CloneableOpenSupport os = env.findCloneableOpenSupport ();
env.markModified(); } catch (final UserQuestionException ex) { synchronized (this) { ERR.log(Level.FINE, "notifyModified returns true; env.isModified()=" + env.isModified());
/** Notification method called when the document become unmodified. * Called after save or after reload of document. * <P> * This implementation simply marks the associated * environement unmodified and updates titles of all components. */ protected void notifyUnmodified() { env.unmarkModified(); if (!Boolean.TRUE.equals(LOCAL_CLOSE_DOCUMENT.get())) { updateTitles(); } }
env.removePropertyChangeListener(getListener()); env.addPropertyChangeListener(getListener());
env.removePropertyChangeListener(getListener()); env.addPropertyChangeListener(getListener());
env.removePropertyChangeListener(getListener()); env.addPropertyChangeListener(getListener());
boolean locked = true; try { env.markModified (); } catch (final UserQuestionException ex) { synchronized (this) {
boolean locked = true; try { env.markModified (); } catch (final UserQuestionException ex) { synchronized (this) {
CloneableOpenSupport os = env.findCloneableOpenSupport ();
return null; CloneableOpenSupport cos = env.findCloneableOpenSupport(); COSRedirectorImpl.Storage storage = getCachedStorage(dobj); if (storage != null) {
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); int offset; Object firstObject = in.readObject(); // New deserialization that uses Env environment, // and which could be null(!) see writeExternal. if (firstObject instanceof CloneableOpenSupport.Env) { CloneableOpenSupport.Env env = (CloneableOpenSupport.Env) firstObject; CloneableOpenSupport os = env.findCloneableOpenSupport(); support = (CloneableEditorSupport) os; } // load cursor position offset = ((Integer) in.readObject()).intValue(); if (!discard()) { cursorPosition = offset; } updateName(); isComponentOpened = true; if (in.available() > 0) { boolean associate = in.readBoolean(); if (associate && support != null) { associateLookup(support.getLookup()); } } }
/** 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 ); } } } }
/** 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 ); } } } }
/** New support for a given environment. * @param env environment to take all date from/to */ public CloneableOpenSupport(Env env) { this.env = env; Listener l = new Listener (env); this.allEditors = l; // attach property change listener to be informed about loosing validity env.addPropertyChangeListener (org.openide.util.WeakListeners.propertyChange ( l, env )); // attach vetoable change listener to be cancel loosing validity when modified env.addVetoableChangeListener (org.openide.util.WeakListeners.vetoableChange ( l, env )); }
/** New support for a given environment. * @param env environment to take all date from/to */ public CloneableOpenSupport(Env env) { this.env = env; Listener l = new Listener (env); this.allEditors = l; // attach property change listener to be informed about loosing validity env.addPropertyChangeListener (org.openide.util.WeakListeners.propertyChange ( l, env )); // attach vetoable change listener to be cancel loosing validity when modified env.addVetoableChangeListener (org.openide.util.WeakListeners.vetoableChange ( l, env )); }
/** 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); } }
/** Getter for the associated CloneableOpenSupport * @return the support or null if none was found */ private CloneableOpenSupport support () { return env.findCloneableOpenSupport (); }
/** Getter for the associated CloneableOpenSupport * @return the support or null if none was found */ private CloneableOpenSupport support () { return env.findCloneableOpenSupport (); }
/** Notification method called when the document become unmodified. * Called after save or after reload of document. * <P> * This implementation simply marks the associated * environement unmodified and updates titles of all components. */ protected void notifyUnmodified () { env.unmarkModified (); updateTitles (); alreadyModified = false; }
/** 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); } }