|
org.netbeans.modules.editor.indent/2 1.15.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.modules.editor.indent.api.Indent
public final class Indent
Reindentation of a single or multiple lines in the document
means fixing of the line's indent only but does not do any other
code beautification.
The following pattern should be used:
indent.lock();
try {
doc.atomicLock();
try {
indent.reindent(...);
} finally {
doc.atomicUnlock();
}
} finally {
indent.unlock();
}
| Method Summary | |
|---|---|
static Indent |
get(Document doc)
Get the indentation for the given document. |
void |
lock()
Clients should call this method before acquiring of document's write lock. |
void |
reindent(int offset)
Correct indentation on a single line determined by the given offset. |
void |
reindent(int startOffset,
int endOffset)
Correct indentation of all lines in the given offset range. |
void |
unlock()
Clients should call this method after releasing of document's write lock. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static Indent get(Document doc)
doc - non-null document.
public void lock()
indent.lock();
try {
doc.atomicLock();
try {
indent.reindent(...);
} finally {
doc.atomicUnlock();
}
} finally {
indent.unlock();
}
public void unlock()
indent.lock();
try {
doc.atomicLock();
try {
indent.reindent(...);
} finally {
doc.atomicUnlock();
}
} finally {
indent.unlock();
}
public void reindent(int offset)
throws BadLocationException
offset - >=0 any offset on the line to be reformatted.
BadLocationException - in case the indenter attempted to insert/remove
at an invalid offset or e.g. into a guarded section.
public void reindent(int startOffset,
int endOffset)
throws BadLocationException
startOffset - >=0 any offset on a first line to be reformatted.endOffset - >=startOffset any offset (including end offset)
on a last line to be reformatted.
BadLocationException - in case the indenter attempted to insert/remove
at an invalid offset or e.g. into a guarded section.
|
org.netbeans.modules.editor.indent/2 1.15.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||