|
org.openide.text 6.9.32 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EditorCookie
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 |
---|
void open()
boolean close()
false
if the operation has been cancelledTask prepareDocument()
Note that this does not involve opening the actual Editor window.
For that, use open()
.
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 loadedStyledDocument getDocument()
Note that this does not involve opening the actual Editor window.
For that, use open()
.
null
if it has not yet been loadedvoid saveDocument() throws IOException
IOException
- on I/O errorboolean isModified()
true
if the document is in memory and is modified; false
otherwiseJEditorPane[] 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.
|
org.openide.text 6.9.32 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |