/** * Resolves deserialized object. Overrides superclass method. Adds checking * for object validity. In case this object is invalid * throws {@link java.io.InvalidObjectException InvalidObjectException}. * @throws ObjecStreamException When problem during serialization occures. * @throws InvalidObjectException When deserialized <code>CloneableEditor</code> * is invalid and shouldn't be used. */ protected Object readResolve() throws ObjectStreamException { if (discard()) { throw new java.io.InvalidObjectException("Deserialized component is invalid: " + this); // NOI18N } else { initializeBySupport(); return this; } }
/** * Replaces serializing object. Overrides superclass method. Adds checking * for object validity. In case this object is invalid * throws {@link java.io.NotSerializableException NotSerializableException}. * @throws ObjectStreamException When problem during serialization occures. * @throws NotSerializableException When this <code>CloneableEditor</code> * is invalid and doesn't want to be serialized. */ @Override protected Object writeReplace() throws ObjectStreamException { if (discard()) { throw new NotSerializableException("Serializing component is invalid: " + this); // NOI18N } return super.writeReplace(); }
/** * Replaces serializing object. Overrides superclass method. Adds checking * for object validity. In case this object is invalid * throws {@link java.io.NotSerializableException NotSerializableException}. * @throws ObjectStreamException When problem during serialization occures. * @throws NotSerializableException When this <code>CloneableEditor</code> * is invalid and doesn't want to be serialized. */ protected Object writeReplace() throws ObjectStreamException { if(discard()) { throw new NotSerializableException( "Serializing component is invalid: " + this); // NOI18N } return super.writeReplace(); }
/** * Replaces serializing object. Overrides superclass method. Adds checking * for object validity. In case this object is invalid * throws {@link java.io.NotSerializableException NotSerializableException}. * @throws ObjectStreamException When problem during serialization occures. * @throws NotSerializableException When this <code>CloneableEditor</code> * is invalid and doesn't want to be serialized. */ protected Object writeReplace() throws ObjectStreamException { if(discard()) { throw new NotSerializableException( "Serializing component is invalid: " + this); // NOI18N } return super.writeReplace(); }
/** * Resolves deserialized object. Overrides superclass method. Adds checking * for object validity. In case this object is invalid * throws {@link java.io.InvalidObjectException InvalidObjectException}. * @throws ObjecStreamException When problem during serialization occures. * @throws InvalidObjectException When deserialized <code>CloneableEditor</code> * is invalid and shouldn't be used. */ protected Object readResolve() throws ObjectStreamException { if (discard ()) { throw new java.io.InvalidObjectException( "Deserialized component is invalid: " + this); // NOI18N } else { support.initializeCloneableEditor (this); return this; } }
/** * Resolves deserialized object. Overrides superclass method. Adds checking * for object validity. In case this object is invalid * throws {@link java.io.InvalidObjectException InvalidObjectException}. * @throws ObjecStreamException When problem during serialization occures. * @throws InvalidObjectException When deserialized <code>CloneableEditor</code> * is invalid and shouldn't be used. */ protected Object readResolve() throws ObjectStreamException { if (discard ()) { throw new java.io.InvalidObjectException( "Deserialized component is invalid: " + this); // NOI18N } else { support.initializeCloneableEditor (this); return this; } }
if (!discard ()) { cursorPosition = offset;
if (!discard ()) { cursorPosition = offset;
@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()); } } }
/** Performs needed initialization */ private void initialize() { if (initialized || discard()) { return; } final QuietEditorPane tmp = new QuietEditorPane(); tmp.getAccessibleContext().setAccessibleName( NbBundle.getMessage(CloneableEditor.class, "ACS_CloneableEditor_QuietEditorPane", this.getName()) ); tmp.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage( CloneableEditor.class, "ACSD_CloneableEditor_QuietEditorPane", this.getAccessibleContext().getAccessibleDescription() ) ); tmp.putClientProperty("usedByCloneableEditor", true); this.pane = tmp; this.initialized = true; this.isComponentOpened = true; this.doInitialize = new DoInitialize(tmp); }
/** Overrides superclass version. Opens top component only if * it is in valid state. * (Editor top component may become invalid after deserialization).<br> * Also tries to open all other top components which are docked * in editor mode on given workspace, but not visible.<br> */ public void open(Workspace workspace) { if(discard()) { ErrorManager.getDefault().log(ErrorManager.WARNING, "Can not open " + this + " component," // NOI18N + " its support environment is not valid" // NOI18N + " [support=" + support + ", env=" // NOI18N + (support == null ? null : support.env()) + "]"); // NOI18N } else { Workspace realWorkspace = (workspace == null) ? WindowManager.getDefault().getCurrentWorkspace() : workspace; dockIfNeeded(realWorkspace); super.open(workspace); } }
/** Overrides superclass version. Opens top component only if * it is in valid state. * (Editor top component may become invalid after deserialization).<br> * Also tries to open all other top components which are docked * in editor mode on given workspace, but not visible.<br> */ public void open(Workspace workspace) { if(discard()) { ErrorManager.getDefault().log(ErrorManager.WARNING, "Can not open " + this + " component," // NOI18N + " its support environment is not valid" // NOI18N + " [support=" + support + ", env=" // NOI18N + (support == null ? null : support.env()) + "]"); // NOI18N } else { Workspace realWorkspace = (workspace == null) ? WindowManager.getDefault().getCurrentWorkspace() : workspace; dockIfNeeded(realWorkspace); super.open(workspace); } }
if(initialized || discard()) { return;
if(initialized || discard()) { return;