/** Closes all components. * @return <code>true</code> if every component is successfully closed or <code>false</code> if the user cancelled the request * @see org.openide.cookies.CloseCookie#close */ public boolean close () { return close (true); }
/** Focuses existing component to view, or if none exists creates new. * The default implementation simply calls {@link #open}. * @see org.openide.cookies.ViewCookie#view */ public void view () { open (); }
public void run () { CloneableTopComponent editor = openCloneableTopComponent(); editor.requestActive(); } });
/** Simply open for an editor. */ protected final CloneableTopComponent openCloneableTopComponent() { //synchronized (allEditors) { synchronized (getLock()) { CloneableTopComponent ret = allEditors.getArbitraryComponent (); if(ret != null) { ret.open(); return ret; } else { // no opened editor String msg = messageOpening (); if (msg != null) { StatusDisplayer.getDefault().setStatusText(msg); } CloneableTopComponent editor = createCloneableTopComponent (); editor.setReference (allEditors); editor.open(); msg = messageOpened (); if (msg == null) { msg = ""; // NOI18N } StatusDisplayer.getDefault().setStatusText(msg); return editor; } } }
public Object run () { //synchronized (allEditors) { synchronized (getLock()) { // user canceled the action if (ask && !canClose ()) { return Boolean.FALSE; } java.util.Enumeration en = allEditors.getComponents (); while (en.hasMoreElements ()) { TopComponent c = (TopComponent)en.nextElement (); if (!c.close ()) { return Boolean.FALSE; } } } return Boolean.TRUE; } });
/** Simply open for an editor. */ protected final CloneableTopComponent openCloneableTopComponent() { //synchronized (allEditors) { synchronized (getLock()) { CloneableTopComponent ret = allEditors.getArbitraryComponent (); if(ret != null) { ret.open(); return ret; } else { // no opened editor String msg = messageOpening (); if (msg != null) { StatusDisplayer.getDefault().setStatusText(msg); } CloneableTopComponent editor = createCloneableTopComponent (); editor.setReference (allEditors); editor.open(); msg = messageOpened (); if (msg == null) { msg = ""; // NOI18N } StatusDisplayer.getDefault().setStatusText(msg); return editor; } } }
public Object run () { //synchronized (allEditors) { synchronized (getLock()) { // user canceled the action if (ask && !canClose ()) { return Boolean.FALSE; } java.util.Enumeration en = allEditors.getComponents (); while (en.hasMoreElements ()) { TopComponent c = (TopComponent)en.nextElement (); if (!c.close ()) { return Boolean.FALSE; } } } return Boolean.TRUE; } });
/** Focuses existing component to view, or if none exists creates new. * The default implementation simply calls {@link #open}. * @see org.openide.cookies.EditCookie#edit */ public void edit () { open (); }
/** Closes all components. * @return <code>true</code> if every component is successfully closed or <code>false</code> if the user cancelled the request * @see org.openide.cookies.CloseCookie#close */ public boolean close () { return close (true); }
/** Forbids setValid (false) on data object when there is an * opened editor. * * @param ev PropertyChangeEvent */ public void vetoableChange (PropertyChangeEvent ev) throws PropertyVetoException { if (Env.PROP_VALID.equals (ev.getPropertyName ())) { // do not check it if old value is not true if (Boolean.FALSE.equals (ev.getOldValue ())) return; if (env.isModified ()) { // if the object is modified CloneableOpenSupport os = support (); if (os != null && !os.canClose ()) { // is modified and has not been sucessfully closed throw new PropertyVetoException ( // [PENDING] this is not a very good detail message! "", ev // NOI18N ); } } } }
public void run () { CloneableTopComponent editor = openCloneableTopComponent(); editor.requestActive(); } });
/** Focuses existing component to view, or if none exists creates new. * The default implementation simply calls {@link #open}. * @see org.openide.cookies.EditCookie#edit */ public void edit () { open (); }
/** Closes all opened editors (if the user agrees) and * flushes content of the document to the file. * * @param ask ask whether to save the document or not? * @return <code>false</code> if the operation is cancelled */ protected boolean close (boolean ask) { if (!super.close (ask)) { // if not all editors has been closed return false; } notifyClosed (); return true; }
/** Forbids setValid (false) on data object when there is an * opened editor. * * @param ev PropertyChangeEvent */ public void vetoableChange (PropertyChangeEvent ev) throws PropertyVetoException { if (Env.PROP_VALID.equals (ev.getPropertyName ())) { // do not check it if old value is not true if (Boolean.FALSE.equals (ev.getOldValue ())) return; if (env.isModified ()) { // if the object is modified CloneableOpenSupport os = support (); if (os != null && !os.canClose ()) { // is modified and has not been sucessfully closed throw new PropertyVetoException ( // [PENDING] this is not a very good detail message! "", ev // NOI18N ); } } } }
/** Focuses existing component to view, or if none exists creates new. * The default implementation simply calls {@link #open}. * @see org.openide.cookies.ViewCookie#view */ public void view () { open (); }
/** Closes all opened editors (if the user agrees) and * flushes content of the document to the file. * * @param ask ask whether to save the document or not? * @return <code>false</code> if the operation is cancelled */ protected boolean close (boolean ask) { if (!super.close (ask)) { // if not all editors has been closed return false; } notifyClosed (); return true; }
/** Closes the support in AWT thread. */ public void run () { // loosing validity CloneableOpenSupport os = support (); if (os != null) { // mark the object as not being modified, so nobody // will ask for save env.unmarkModified (); os.close (false); } }
/** Overrides superclass method, first processes document preparation. * @see #prepareDocument */ public void open() { try { if (getListener ().loadExc instanceof UserQuestionException) { getListener ().loadExc = null; prepareTask = null; documentStatus = DOCUMENT_NO; } openDocument(); super.open(); } catch (final UserQuestionException e) { if (SwingUtilities.isEventDispatchThread ()) { askUserAndDoOpen (e); } else { SwingUtilities.invokeLater (new Runnable () { public void run () { askUserAndDoOpen (e); } }); } } catch (IOException e) { ErrorManager.getDefault().notify( ErrorManager.INFORMATIONAL, e); } }
/** Closes the support in AWT thread. */ public void run () { // loosing validity CloneableOpenSupport os = support (); if (os != null) { // mark the object as not being modified, so nobody // will ask for save env.unmarkModified (); os.close (false); } }