|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openide.windows.CloneableOpenSupport org.openide.loaders.OpenSupport org.openide.text.EditorSupport
Support for associating an editor and a Swing 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.
Nested Class Summary | |
static class |
EditorSupport.Editor
Deprecated. Cloneable top component to hold the editor kit. |
Nested classes inherited from class org.openide.loaders.OpenSupport |
OpenSupport.Env |
Nested classes inherited from class org.openide.cookies.EditorCookie |
EditorCookie.Observable |
Field Summary | |
static String |
EDITOR_MODE
Deprecated. Use CloneableEditorSupport.EDITOR_MODE instead. |
protected String |
modifiedAppendix
Deprecated. no longer used |
Fields inherited from class org.openide.loaders.OpenSupport |
entry |
Fields inherited from class org.openide.windows.CloneableOpenSupport |
allEditors, env |
Fields inherited from interface org.openide.cookies.EditorCookie.Observable |
PROP_DOCUMENT, PROP_MODIFIED, PROP_OPENED_PANES |
Constructor Summary | |
EditorSupport(MultiDataObject.Entry entry)
Deprecated. Support an existing loader entry. |
Method Summary | |
void |
addChangeListener(ChangeListener l)
Deprecated. Adds a listener for status changes. |
void |
addPropertyChangeListener(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 CloneableTopComponent |
createCloneableTopComponent()
Deprecated. |
protected EditorKit |
createEditorKit()
Deprecated. Creates editor kit for this source. |
PositionRef |
createPositionRef(int offset,
Position.Bias bias)
Deprecated. Create a position reference for the given offset. |
protected UndoRedo.Manager |
createUndoRedoManager()
Deprecated. Create an undo/redo manager. |
protected MultiDataObject |
findDataObject()
Deprecated. Finds data object the entry belongs to. |
StyledDocument |
getDocument()
Deprecated. Get the document. |
Line.Set |
getLineSet()
Deprecated. Get the line set for all paragraphs in the document. |
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(StyledDocument doc,
InputStream stream,
EditorKit kit)
Deprecated. Actually read file data into an editor kit's document from an input stream. |
protected String |
messageName()
Deprecated. Constructs message that should be used to name the editor component. |
protected String |
messageOpened()
Deprecated. Message to display when an object has been opened. |
protected String |
messageOpening()
Deprecated. Message to display when an object is being opened. |
protected String |
messageSave()
Deprecated. Constructs message that should be displayed when the data object is modified and is being closed. |
protected 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(PositionRef pos)
Deprecated. Forcibly create one editor component. |
StyledDocument |
openDocument()
Deprecated. Get the document associated with this cookie. |
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 Task |
reloadDocumentTask()
Deprecated. Starts reloading of document. |
void |
removeChangeListener(ChangeListener l)
Deprecated. Removes a listener for status changes. |
void |
removePropertyChangeListener(PropertyChangeListener l)
Deprecated. |
void |
saveDocument()
Deprecated. Save the document in this thread. |
protected void |
saveFromKitToStream(StyledDocument doc,
EditorKit kit,
OutputStream stream)
Deprecated. Actually write file data to an output stream from an editor kit's document. |
void |
setActions(SystemAction[] actions)
Deprecated. has no effect |
void |
setMIMEType(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. |
Methods inherited from class org.openide.windows.CloneableOpenSupport |
edit, openCloneableTopComponent, view |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String EDITOR_MODE
CloneableEditorSupport.EDITOR_MODE
instead.
protected String modifiedAppendix
Constructor Detail |
public EditorSupport(MultiDataObject.Entry entry)
entry
- entry to create instance fromMethod Detail |
protected String messageOpening()
messageOpening
in class OpenSupport
protected String messageOpened()
messageOpened
in class OpenSupport
protected String messageSave()
protected String messageName()
protected String messageToolTip()
protected void updateTitles()
protected CloneableTopComponent createCloneableTopComponent()
protected UndoRedo.Manager createUndoRedoManager()
The default implementation simply uses UndoRedo.Manager
.
public void open()
open
in interface EditorCookie
public boolean close()
close
in interface EditorCookie
false
if the operation is cancelledprotected boolean close(boolean ask)
ask
- true if we should ask the user
public Task prepareDocument()
prepareDocument
in interface EditorCookie
public StyledDocument openDocument() throws 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 EditorCookie
IOException
- if the document could not be loadedpublic StyledDocument getDocument()
prepareTask
)
has been completed, in such a case the document must not be modified.
getDocument
in interface EditorCookie
null
if it is not yet loadedpublic boolean isDocumentLoaded()
true
if document is loadedpublic void saveDocument() throws IOException
saveDocument
in interface EditorCookie
IOException
- on I/O errorprotected void saveFromKitToStream(StyledDocument doc, EditorKit kit, OutputStream stream) throws IOException, 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 to
IOException
- if there was a problem writing the file
BadLocationException
- should not normally be thrownloadFromStreamToKit(javax.swing.text.StyledDocument, java.io.InputStream, javax.swing.text.EditorKit)
public boolean isModified()
isModified
in interface EditorCookie
true
if the document is in memory and is modified;
otherwise false
protected MultiDataObject findDataObject()
public final PositionRef createPositionRef(int offset, Position.Bias bias)
offset
- the offset to create position atbias
- the Position.Bias for new creating position.
public Line.Set getLineSet()
getLineSet
in interface LineCookie
public void setMIMEType(String s)
s
- the new MIME typepublic void setActions(SystemAction[] actions)
protected 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(ChangeListener l)
l
- new listenerpublic void removeChangeListener(ChangeListener l)
l
- listener to removepublic final void addPropertyChangeListener(PropertyChangeListener l)
addPropertyChangeListener
in interface EditorCookie.Observable
public final void removePropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener
in interface EditorCookie.Observable
public void print()
print
in interface PrintCookie
protected void loadFromStreamToKit(StyledDocument doc, InputStream stream, EditorKit kit) throws IOException, 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 kit
IOException
- if there was a problem reading the file
BadLocationException
- should not normally be thrownsaveFromKitToStream(javax.swing.text.StyledDocument, javax.swing.text.EditorKit, java.io.OutputStream)
protected void reloadDocument()
reloadDocumentTask()
protected Task reloadDocumentTask()
protected EditorSupport.Editor openAt(PositionRef pos)
pos
- where to place the caret
null
editorprotected boolean canClose()
true
if everything can be closedpublic JEditorPane[] getOpenedPanes()
getOpenedPanes
in interface EditorCookie
protected void notifyUnmodified()
protected boolean notifyModified()
protected void notifyClosed()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |