public final class Reformat extends Object
reformat.lock(); try { doc.atomicLock(); try { reformat.reformat(...); } finally { doc.atomicUnlock(); } } finally { reformat.unlock(); }
Modifier and Type | Method and Description |
---|---|
static Reformat |
get(Document doc)
Get the reformatting for the given document.
|
void |
lock()
Clients should call this method before acquiring of document's write lock.
|
void |
reformat(int startOffset,
int endOffset)
Reformat a given range of code in the given document.
|
void |
unlock()
Clients should call this method after releasing of document's write lock.
|
public static Reformat get(Document doc)
doc
- non-null document.public void lock()
reformat.lock(); try { doc.atomicLock(); try { reformat.reformat(...); } finally { doc.atomicUnlock(); } } finally { reformat.unlock(); }
public void unlock()
reformat.lock(); try { doc.atomicLock(); try { reformat.reformat(...); } finally { doc.atomicUnlock(); } } finally { reformat.unlock(); }
public void reformat(int startOffset, int endOffset) throws BadLocationException
If the reformatter implementation is not available the reindentation will be performed (i.e. just the line indentation will be fixed) as a closest match.
startOffset
- start offset of the area to be reformatted.endOffset
- end offset of the area to be reformatted.BadLocationException