|
org.openide.text 6.9.32 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface NbDocument.WriteLockable
Specialized version of document that knows how to lock the document for complex modifications.
Field Summary |
---|
Fields inherited from interface javax.swing.text.Document |
---|
StreamDescriptionProperty, TitleProperty |
Method Summary | |
---|---|
void |
runAtomic(Runnable r)
Executes given runnable in lock mode of the document. |
void |
runAtomicAsUser(Runnable r)
Executes given runnable in "user mode" does not allowing any modifications to parts of text marked as guarded. |
Methods inherited from interface javax.swing.text.Document |
---|
addDocumentListener, addUndoableEditListener, createPosition, getDefaultRootElement, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeDocumentListener, removeUndoableEditListener, render |
Method Detail |
---|
void runAtomic(Runnable r)
By definition there should be only one locker at a time. Sample implementation, if you are extending AbstractDocument
:
writeLock();
try {
r.run();
} finally {
writeUnlock();
}
r
- runnable to run while lockedNbDocument.runAtomic(javax.swing.text.StyledDocument, java.lang.Runnable)
void runAtomicAsUser(Runnable r) throws BadLocationException
r
- runnable to run in user mode that will have exclusive access to modify the document
BadLocationException
- if a modification of guarded text occured
and that is why no changes to the document has been done.
|
org.openide.text 6.9.32 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |