|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Cookie defining standard operations with a text document and
an editor that can display it.
The cookie extends LineCookie
because all implementations of editors should support access
by lines.
The cookie provides interfaces for opening the file, closing the editor, background loading, saving of the document, and notification of modification.
Warning: it is not guaranteed that the document
returned from this cookie will persist for the full lifetime of the
cookie. That is, if the editor window is closed and then reopened,
it is possible for the document to change.
The
allows listening to
changes of the state of the document. You should do this
if you are listening to changes in the document itself, as otherwise
you would get no notifications from a reopened document.
EditorCookie.Observable
Nested Class Summary | |
static interface |
EditorCookie.Observable
The interface extends EditorCookie and allows observing changes in state of the text document. |
Method Summary | |
boolean |
close()
Closes all opened editors (if the user agrees) and flushes content of the document to file. |
StyledDocument |
getDocument()
Get the document (but do not block). |
JEditorPane[] |
getOpenedPanes()
Get a list of all editor panes opened on this object. |
boolean |
isModified()
Test whether the document is modified. |
void |
open()
Instructs an editor to be opened. |
StyledDocument |
openDocument()
Get the document (and wait). |
Task |
prepareDocument()
Should load the document into memory. |
void |
saveDocument()
Save the document. |
Methods inherited from interface org.openide.cookies.LineCookie |
getLineSet |
Method Detail |
public void open()
public boolean close()
false
if the operation has been cancelledpublic Task prepareDocument()
Note that this does not involve opening the actual Editor window.
For that, use open()
.
public StyledDocument openDocument() throws IOException
Editor API
for details on how this document should behave.
If the document is not yet loaded the method blocks until it is.
Note that this does not involve opening the actual Editor window.
For that, use open()
.
IOException
- if the document could not be loadedpublic StyledDocument getDocument()
Note that this does not involve opening the actual Editor window.
For that, use open()
.
null
if it has not yet been loadedpublic void saveDocument() throws IOException
IOException
- on I/O errorpublic boolean isModified()
true
if the document is in memory and is modified; false
otherwisepublic JEditorPane[] getOpenedPanes()
The resulting panes are useful for a range of tasks;
most commonly, getting the current cursor position or text selection,
including the Caret
object.
This method may also be used to test whether an object is already open in an editor, without actually opening it.
null
if no pane is open from this file.
In no case is an empty array returned.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |