org.netbeans.api.actions.Closable, org.netbeans.api.actions.Openable, org.netbeans.api.actions.Printable, org.openide.cookies.CloseCookie, org.openide.cookies.EditorCookie, org.openide.cookies.EditorCookie.Observable, org.openide.cookies.LineCookie, org.openide.cookies.OpenCookie, org.openide.cookies.PrintCookie, org.openide.nodes.Node.CookieDataEditorSupport instead@Deprecated public class EditorSupport extends OpenSupport implements org.openide.cookies.EditorCookie.Observable, org.openide.cookies.OpenCookie, org.openide.cookies.CloseCookie, org.openide.cookies.PrintCookie
Document to a data object.
Can be assigned as a cookie to any editable data object.
Then this data object will be capable of being opened in an editor, and there will be ways of retrieving and acting upon the Swing document which is editing it.| Modifier and Type | Class | Description |
|---|---|---|
static class |
EditorSupport.Editor |
Deprecated.
Cloneable top component to hold the editor kit.
|
org.openide.cookies.EditorCookie.ObservableOpenSupport.Env| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
EDITOR_MODE |
Deprecated.
Use
CloneableEditorSupport.EDITOR_MODE instead. |
protected java.lang.String |
modifiedAppendix |
Deprecated.
no longer used
|
PROP_DOCUMENT, PROP_MODIFIED, PROP_OPENED_PANESentry| Constructor | Description |
|---|---|
EditorSupport(MultiDataObject.Entry entry) |
Deprecated.
Support an existing loader entry.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l) |
Deprecated.
Adds a listener for status changes.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l) |
Deprecated.
|
protected boolean |
canClose() |
Deprecated.
Should test whether all data is saved, and if not, prompt the user
to save.
|
boolean |
close() |
Deprecated.
Closes all opened editors (if the user agrees) and
flushes content of the document to the file.
|
protected boolean |
close(boolean ask) |
Deprecated.
Closes the editor, asks if necessary.
|
protected org.openide.windows.CloneableTopComponent |
createCloneableTopComponent() |
Deprecated.
|
protected javax.swing.text.EditorKit |
createEditorKit() |
Deprecated.
Creates editor kit for this source.
|
org.openide.text.PositionRef |
createPositionRef(int offset,
javax.swing.text.Position.Bias bias) |
Deprecated.
Create a position reference for the given offset.
|
protected org.openide.awt.UndoRedo.Manager |
createUndoRedoManager() |
Deprecated.
Create an undo/redo manager.
|
protected MultiDataObject |
findDataObject() |
Deprecated.
Finds data object the entry belongs to.
|
javax.swing.text.StyledDocument |
getDocument() |
Deprecated.
Get the document.
|
org.openide.text.Line.Set |
getLineSet() |
Deprecated.
Get the line set for all paragraphs in the document.
|
javax.swing.JEditorPane[] |
getOpenedPanes() |
Deprecated.
|
boolean |
isDocumentLoaded() |
Deprecated.
Test whether the document is in memory, or whether loading is still in progress.
|
boolean |
isModified() |
Deprecated.
Test whether the document is modified.
|
protected void |
loadFromStreamToKit(javax.swing.text.StyledDocument doc,
java.io.InputStream stream,
javax.swing.text.EditorKit kit) |
Deprecated.
Actually read file data into an editor kit's document from an input stream.
|
protected java.lang.String |
messageName() |
Deprecated.
Constructs message that should be used to name the editor component.
|
protected java.lang.String |
messageOpened() |
Deprecated.
Message to display when an object has been opened.
|
protected java.lang.String |
messageOpening() |
Deprecated.
Message to display when an object is being opened.
|
protected java.lang.String |
messageSave() |
Deprecated.
Constructs message that should be displayed when the data object
is modified and is being closed.
|
protected java.lang.String |
messageToolTip() |
Deprecated.
Text to use as tooltip for component.
|
protected void |
notifyClosed() |
Deprecated.
Called when the document is closed and released from memory.
|
protected boolean |
notifyModified() |
Deprecated.
Overrides the super method to add a save cookie if the
document has been marked modified.
|
protected void |
notifyUnmodified() |
Deprecated.
Notification method called when the document become unmodified.
|
void |
open() |
Deprecated.
Passes the actual opening to internal delegate support.
|
protected EditorSupport.Editor |
openAt(org.openide.text.PositionRef pos) |
Deprecated.
Forcibly create one editor component.
|
javax.swing.text.StyledDocument |
openDocument() |
Deprecated.
Get the document associated with this cookie.
|
org.openide.util.Task |
prepareDocument() |
Deprecated.
Load the document into memory.
|
void |
print() |
Deprecated.
The implementation of @see org.openide.cookies.PrintCookie#print() method.
|
protected void |
reloadDocument() |
Deprecated.
Reload the document in response to external modification.
|
protected org.openide.util.Task |
reloadDocumentTask() |
Deprecated.
Starts reloading of document.
|
void |
removeChangeListener(javax.swing.event.ChangeListener l) |
Deprecated.
Removes a listener for status changes.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l) |
Deprecated.
|
void |
saveDocument() |
Deprecated.
Save the document in this thread.
|
protected void |
saveFromKitToStream(javax.swing.text.StyledDocument doc,
javax.swing.text.EditorKit kit,
java.io.OutputStream stream) |
Deprecated.
Actually write file data to an output stream from an editor kit's document.
|
void |
setActions(org.openide.util.actions.SystemAction[] actions) |
Deprecated.
has no effect
|
void |
setMIMEType(java.lang.String s) |
Deprecated.
Set the MIME type for the document.
|
void |
setModificationListening(boolean listenToModifs) |
Deprecated.
Utility method which enables or disables listening to modifications
on asociated document.
|
protected void |
updateTitles() |
Deprecated.
Updates titles of all editors.
|
@Deprecated public static final java.lang.String EDITOR_MODE
CloneableEditorSupport.EDITOR_MODE instead.@Deprecated protected java.lang.String modifiedAppendix
public EditorSupport(MultiDataObject.Entry entry)
entry - entry to create instance fromprotected java.lang.String messageOpening()
messageOpening in class OpenSupportprotected java.lang.String messageOpened()
messageOpened in class OpenSupportprotected java.lang.String messageSave()
protected java.lang.String messageName()
protected java.lang.String messageToolTip()
protected void updateTitles()
protected org.openide.windows.CloneableTopComponent createCloneableTopComponent()
createCloneableTopComponent in class org.openide.windows.CloneableOpenSupportprotected org.openide.awt.UndoRedo.Manager createUndoRedoManager()
The default implementation simply uses UndoRedo.Manager.
public void open()
open in interface org.openide.cookies.EditorCookieopen in interface org.netbeans.api.actions.Openableopen in class org.openide.windows.CloneableOpenSupportpublic boolean close()
close in interface org.netbeans.api.actions.Closableclose in interface org.openide.cookies.EditorCookieclose in class org.openide.windows.CloneableOpenSupportfalse if the operation is cancelledprotected boolean close(boolean ask)
close in class org.openide.windows.CloneableOpenSupportask - true if we should ask the userpublic org.openide.util.Task prepareDocument()
prepareDocument in interface org.openide.cookies.EditorCookiepublic javax.swing.text.StyledDocument openDocument()
throws java.io.IOException
StyledDocument but it should
also understand the NetBeans NbDocument.GUARDED to
prevent certain lines from being edited by the user.
If the document is not loaded the method blocks until it is.
openDocument in interface org.openide.cookies.EditorCookiejava.io.IOException - if the document could not be loadedpublic javax.swing.text.StyledDocument getDocument()
prepareTask)
has been completed, in such a case the document must not be modified.getDocument in interface org.openide.cookies.EditorCookienull if it is not yet loadedpublic boolean isDocumentLoaded()
true if document is loadedpublic void saveDocument()
throws java.io.IOException
saveDocument in interface org.openide.cookies.EditorCookiejava.io.IOException - on I/O errorprotected void saveFromKitToStream(javax.swing.text.StyledDocument doc,
javax.swing.text.EditorKit kit,
java.io.OutputStream stream)
throws java.io.IOException,
javax.swing.text.BadLocationException
saveDocument().
The default implementation just calls EditorKit.write(...).
Subclasses could override this to provide support for persistent guard blocks, for example.
doc - the document to write fromkit - the associated editor kitstream - the open stream to write tojava.io.IOException - if there was a problem writing the filejavax.swing.text.BadLocationException - should not normally be thrownloadFromStreamToKit(javax.swing.text.StyledDocument, java.io.InputStream, javax.swing.text.EditorKit)public boolean isModified()
isModified in interface org.openide.cookies.EditorCookietrue if the document is in memory and is modified;
otherwise falseprotected MultiDataObject findDataObject()
public final org.openide.text.PositionRef createPositionRef(int offset,
javax.swing.text.Position.Bias bias)
offset - the offset to create position atbias - the Position.Bias for new creating position.public org.openide.text.Line.Set getLineSet()
getLineSet in interface org.openide.cookies.LineCookiepublic void setMIMEType(java.lang.String s)
s - the new MIME type@Deprecated public void setActions(org.openide.util.actions.SystemAction[] actions)
protected javax.swing.text.EditorKit createEditorKit()
public void setModificationListening(boolean listenToModifs)
Could be useful if we have to modify document, but do not want the Save and Save All actions to be enabled/disabled automatically. Initially modifications are listened to.
listenToModifs - whether to listen to modificationspublic void addChangeListener(javax.swing.event.ChangeListener l)
l - new listenerpublic void removeChangeListener(javax.swing.event.ChangeListener l)
l - listener to removepublic final void addPropertyChangeListener(java.beans.PropertyChangeListener l)
addPropertyChangeListener in interface org.openide.cookies.EditorCookie.Observablepublic final void removePropertyChangeListener(java.beans.PropertyChangeListener l)
removePropertyChangeListener in interface org.openide.cookies.EditorCookie.Observablepublic void print()
print in interface org.netbeans.api.actions.Printableprotected void loadFromStreamToKit(javax.swing.text.StyledDocument doc,
java.io.InputStream stream,
javax.swing.text.EditorKit kit)
throws java.io.IOException,
javax.swing.text.BadLocationException
prepareDocument().
The default implementation just calls EditorKit.read(...).
Subclasses could override this to provide support for persistent guard blocks, for example.
doc - the document to read intostream - the open stream to read fromkit - the associated editor kitjava.io.IOException - if there was a problem reading the filejavax.swing.text.BadLocationException - should not normally be thrownsaveFromKitToStream(javax.swing.text.StyledDocument, javax.swing.text.EditorKit, java.io.OutputStream)protected void reloadDocument()
reloadDocumentTask()protected org.openide.util.Task reloadDocumentTask()
protected EditorSupport.Editor openAt(org.openide.text.PositionRef pos)
pos - where to place the caretnull editorprotected boolean canClose()
canClose in class org.openide.windows.CloneableOpenSupporttrue if everything can be closedpublic javax.swing.JEditorPane[] getOpenedPanes()
getOpenedPanes in interface org.openide.cookies.EditorCookieprotected void notifyUnmodified()
protected boolean notifyModified()
protected void notifyClosed()
Built on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.