public final class EditorDocumentUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
runExclusive(Document doc,
Runnable r)
Execute a non mutating runnable under an exclusive document lock over the document
(no other read locks or write locks are taking place).
|
public static void runExclusive(Document doc, Runnable r)
runExclusive(Document, Runnable) are allowed.
The given runnable may also call Document.render(Runnable).
Document.insertString(int, String, javax.swing.text.AttributeSet)
or Document.remove(int, int) are prohibited.
runExclusive(Document, Runnable) within an atomic section
are allowed (but no document mutations may be done during runExclusive() call).
Document.render(java.lang.Runnable) within
runExclusive(Document, Runnable) are allowed.
runExclusive(Document, Runnable) within
Document.render(java.lang.Runnable) are prohibited and may lead to starvation.doc - document being exclusively locked. For non-editor document implementations
(currently org.netbeans.editor.BaseDocument) the implementation
synchronizes over the document and does not check for mutations within runExclusive().r - runnable to be performed. It is not allowed to mutate the document by any insertions or removals.IllegalStateException - in case the given runnable wants to mutate the document.Built on May 21 2013. | Portions Copyright 1997-2013 Oracle. All rights reserved.