Exemple #1
0
 /**
  * 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;
   }
 }
Exemple #2
0
 /** Updates titles of all editors. */
 protected void updateTitles() {
   del.superUpdateTitles();
 }
Exemple #3
0
 /** Called when the document is closed and released from memory. */
 protected void notifyClosed() {
   del.superNotifyClosed();
 }
Exemple #4
0
 /**
  * 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();
 }
Exemple #5
0
 /**
  * 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();
 }
Exemple #6
0
 /**
  * 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();
 }
Exemple #7
0
 /** The implementation of @see org.openide.cookies.PrintCookie#print() method. */
 public void print() {
   del.print();
 }
Exemple #8
0
 public final void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
   del.addPropertyChangeListener(l);
 }
Exemple #9
0
 /**
  * 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();
 }
Exemple #10
0
 /**
  * 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();
 }
Exemple #11
0
 /**
  * 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();
 }
Exemple #12
0
 /**
  * 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();
 }
Exemple #13
0
 /**
  * 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);
 }
Exemple #14
0
 /**
  * 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();
 }
Exemple #15
0
 /** Passes the actual opening to internal delegate support. Overrides superclass method. */
 public void open() {
   del.open();
 }
Exemple #16
0
 /**
  * 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);
 }
Exemple #17
0
 /**
  * Removes a listener for status changes.
  *
  * @param l listener to remove
  */
 public void removeChangeListener(ChangeListener l) {
   del.removeChangeListener(l);
 }
Exemple #18
0
 /**
  * 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();
 }
Exemple #19
0
 public final void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
   del.removePropertyChangeListener(l);
 }
Exemple #20
0
 /**
  * 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);
 }
Exemple #21
0
 /**
  * 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);
 }
Exemple #22
0
 /**
  * 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();
 }
Exemple #23
0
 /**
  * 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);
 }
Exemple #24
0
 /**
  * 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);
 }
Exemple #25
0
 /* 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();
 }
Exemple #26
0
 /**
  * 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();
 }
Exemple #27
0
 /**
  * Set the MIME type for the document.
  *
  * @param s the new MIME type
  */
 public void setMIMEType(String s) {
   del.setMIMEType(s);
 }
Exemple #28
0
 /**
  * Creates editor kit for this source.
  *
  * @return editor kit
  */
 protected EditorKit createEditorKit() {
   return del.superCreateEditorKit();
 }
Exemple #29
0
 /**
  * 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();
 }
Exemple #30
0
 /**
  * Text to use as tooltip for component.
  *
  * @return text to show to the user
  */
 protected String messageToolTip() {
   return del.superMessageToolTip();
 }