private void writeObject(ObjectOutputStream out) throws IOException { // old serialization version out.writeObject(support.findDataObject()); out.writeObject(support.cesEnv()); }
/** This component should be discarded if the associated environment * is not valid. */ private boolean discard() { return (support == null) || !support.cesEnv().isValid(); }
/** Test whether the document is modified. * @return <code>true</code> if the document is in memory and is modified; * otherwise <code>false</code> */ public boolean isModified() { CloneableEditorSupport redirect = CloneableEditorSupportRedirector.findRedirect(this); if (redirect != null) { return redirect.isModified(); } return cesEnv().isModified(); }
InputStream is = new BufferedInputStream(cesEnv().inputStream());
/** Creates editor kit for this source. * @return editor kit */ protected EditorKit createEditorKit() { if (kit != null) { return kit; } if (mimeType != null) { kit = getEditorKit(mimeType); } else { String defaultMIMEType = cesEnv().getMimeType(); kit = getEditorKit(defaultMIMEType); } return kit; }
out.writeObject((support != null) ? support.cesEnv() : null);
/** Method that can be overriden by children to create empty * styled document or attach additional document properties to it. * * @param kit the kit to use * @return styled document to use */ protected StyledDocument createStyledDocument(EditorKit kit) { StyledDocument sd = createNetBeansDocument(kit.createDefaultDocument()); sd.putProperty("mimeType", (mimeType != null) ? mimeType : cesEnv().getMimeType()); // NOI18N return sd; }
return cesEnv().inputStream();
if (cesEnv().isModified()) {
/** Initialization of the document. */ public void run() { // synchronized (getLock ()) { /* Remove existing listener before running the loading task * This should prevent firing of insertUpdate() during load (or reload) * which can prevent dedloks that sometimes occured during file reload. */ addRemoveDocListener(getDoc(), false); try { loadExc = null; LOCAL_LOAD_TASK.set(true); loadDocument(kit,getDoc()); } catch (IOException e) { loadExc = e; throw new DelegateIOExc(e); } finally { LOCAL_LOAD_TASK.set(null); } // opening the document, inform position manager getPositionManager().documentOpened(doc); // create new description of lines updateLineSet(true); setLastSaveTime(cesEnv().getTime().getTime()); // Start listening on changes in document addRemoveDocListener(getDoc(), true); }
if (!cesEnv().isModified()) { if (log) { ERR.fine(documentID() + " No save performed because cesEnv().isModified() == false"); // NOI18N final long externalMod = cesEnv().getTime().getTime(); if (externalMod > prevLST) { if (log) { try { setLastSaveTime(-1); os = cesEnv().outputStream(); memoryOutputStream[0].writeTo(os); setLastSaveTime(cesEnv().getTime().getTime()); } finally { if (lastSaveTime == -1) { // restore for unsuccessful save
/** Is called under getLock () to close the document. */ private boolean doCloseDocument() { boolean fireEvent = false; // notifies the support that cesEnv().removePropertyChangeListener(getListener()); try { LOCAL_CLOSE_DOCUMENT.set(Boolean.TRUE); callNotifyUnmodified(); } finally { LOCAL_CLOSE_DOCUMENT.set(Boolean.FALSE); } StyledDocument d = getDoc(); if (d != null) { d.removeUndoableEditListener(getUndoRedo()); addRemoveDocListener(d, false); } if (positionManager != null) { positionManager.documentClosed(); } documentStatus = DOCUMENT_NO; fireEvent = true; setDoc(null, false); kit = null; getUndoRedo().discardAllEdits(); updateLineSet(true); return fireEvent; }