/** * Overrides the super method to add a save cookie if the document has been marked modified. * * @return true if the environment accepted being marked as modified or false if it refused it and * the document should still be unmodified */ protected boolean notifyModified() { if (del.superNotifyModified()) { EditorSupport.this.modifySaveCookie(true); return true; } else { return false; } }
/** Updates titles of all editors. */ protected void updateTitles() { del.superUpdateTitles(); }
/** Called when the document is closed and released from memory. */ protected void notifyClosed() { del.superNotifyClosed(); }
/** * Notification method called when the document become unmodified. Called after save or after * reload of document. */ protected void notifyUnmodified() { EditorSupport.this.modifySaveCookie(false); del.superNotifyUnmodified(); }
/** * Should test whether all data is saved, and if not, prompt the user to save. * * @return <code>true</code> if everything can be closed */ protected boolean canClose() { return del.superCanClose(); }
/** * Starts reloading of document. Could not be named reloadDocument, because of backward * compatibility. * * @return task one can listen on when reloading the document */ protected Task reloadDocumentTask() { return del.superReloadDocument(); }
/** The implementation of @see org.openide.cookies.PrintCookie#print() method. */ public void print() { del.print(); }
public final void addPropertyChangeListener(java.beans.PropertyChangeListener l) { del.addPropertyChangeListener(l); }
/** * Test whether the document is in memory, or whether loading is still in progress. * * @return <code>true</code> if document is loaded */ public boolean isDocumentLoaded() { return del.isDocumentLoaded(); }
/** * Get the document. This method may be called before the document initialization (<code> * prepareTask</code>) has been completed, in such a case the document must not be modified. * * @return document or <code>null</code> if it is not yet loaded */ public StyledDocument getDocument() { return del.getDocument(); }
/** * Get the document associated with this cookie. It is an instance of Swing's {@link * StyledDocument} but it should also understand the NetBeans {@link NbDocument#GUARDED} to * prevent certain lines from being edited by the user. * * <p>If the document is not loaded the method blocks until it is. * * @return the styled document for this cookie that understands the guarded attribute * @exception IOException if the document could not be loaded */ public StyledDocument openDocument() throws IOException { return del.openDocument(); }
/** * Load the document into memory. This is done in different thread. A task for the thread is * returned so anyone may test whether the loading has been finished or is still in process. * * @return task for control over loading */ public synchronized Task prepareDocument() { return del.prepareDocument(); }
/** * Closes the editor, asks if necessary. * * @param ask true if we should ask the user * @return true if succesfully closed */ protected boolean close(boolean ask) { return del.superClose(ask); }
/** * Closes all opened editors (if the user agrees) and flushes content of the document to the file. * * @return <code>false</code> if the operation is cancelled */ public boolean close() { return del.close(); }
/** Passes the actual opening to internal delegate support. Overrides superclass method. */ public void open() { del.open(); }
/** * Adds a listener for status changes. An event is fired when the document is moved or removed * from memory. * * @param l new listener */ public void addChangeListener(ChangeListener l) { del.addChangeListener(l); }
/** * Removes a listener for status changes. * * @param l listener to remove */ public void removeChangeListener(ChangeListener l) { del.removeChangeListener(l); }
/** * Save the document in this thread. Create 'orig' document for the case that the save would fail. * * @exception IOException on I/O error */ public void saveDocument() throws IOException { del.superSaveDocument(); }
public final void removePropertyChangeListener(java.beans.PropertyChangeListener l) { del.removePropertyChangeListener(l); }
/** * Actually write file data to an output stream from an editor kit's document. Called during a * file save by {@link #saveDocument}. * * <p>The default implementation just calls {@link EditorKit#write(OutputStream, Document, int, * int) EditorKit.write(...)}. Subclasses could override this to provide support for persistent * guard blocks, for example. * * @param doc the document to write from * @param kit the associated editor kit * @param stream the open stream to write to * @throws IOException if there was a problem writing the file * @throws BadLocationException should not normally be thrown * @see #loadFromStreamToKit */ protected void saveFromKitToStream(StyledDocument doc, EditorKit kit, OutputStream stream) throws IOException, BadLocationException { del.superSaveFromKitToStream(doc, kit, stream); }
/** * Actually read file data into an editor kit's document from an input stream. Called during a * file load by {@link #prepareDocument}. * * <p>The default implementation just calls {@link EditorKit#read(InputStream, Document, int) * EditorKit.read(...)}. Subclasses could override this to provide support for persistent guard * blocks, for example. * * @param doc the document to read into * @param stream the open stream to read from * @param kit the associated editor kit * @throws IOException if there was a problem reading the file * @throws BadLocationException should not normally be thrown * @see #saveFromKitToStream */ protected void loadFromStreamToKit(StyledDocument doc, InputStream stream, EditorKit kit) throws IOException, BadLocationException { del.superLoadFromStreamToKit(doc, stream, kit); }
/** * 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() { return del.isModified(); }
/** * Forcibly create one editor component. Then set the caret to the given position. * * @param pos where to place the caret * @return always non-<code>null</code> editor */ protected Editor openAt(PositionRef pos) { return (Editor) del.openAt(pos, -1); }
/** * Create a position reference for the given offset. The position moves as the document is * modified and reacts to closing and opening of the document. * * @param offset the offset to create position at * @param bias the Position.Bias for new creating position. * @return position reference for that offset */ public final PositionRef createPositionRef(int offset, Position.Bias bias) { return del.createPositionRef(offset, bias); }
/* List of all JEditorPane's opened by this editor support. * The first item in the array should represent the component * that is currently selected or has been selected lastly. * * @return array of panes or null if no pane is opened. * In no case empty array is returned. */ public JEditorPane[] getOpenedPanes() { return del.getOpenedPanes(); }
/** * Get the line set for all paragraphs in the document. * * @return positions of all paragraphs on last save */ public Line.Set getLineSet() { return del.getLineSet(); }
/** * Set the MIME type for the document. * * @param s the new MIME type */ public void setMIMEType(String s) { del.setMIMEType(s); }
/** * Creates editor kit for this source. * * @return editor kit */ protected EditorKit createEditorKit() { return del.superCreateEditorKit(); }
/** * Message to display when an object has been opened. * * @return the message or null if nothing should be displayed */ protected String messageOpened() { return del.superMessageOpened(); }
/** * Text to use as tooltip for component. * * @return text to show to the user */ protected String messageToolTip() { return del.superMessageToolTip(); }