|
org.netbeans.modules.editor.indent/2 1.28 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.netbeans.modules.editor.indent.spi.Context
public final class Context
Context information for both indentation and reformatting.
A common class allows to conveniently share code between indentation and reformatting.
isIndent() allows to check whether the actual processing
is indentation or reformatting.
| Nested Class Summary | |
|---|---|
static class |
Context.Region
Description of the region where the indentation/reformatting should operate. |
| Method Summary | |
|---|---|
int |
caretOffset()
Return offset of the caret passed to the indentation infrastructure. |
Document |
document()
Document for which the reformatting or indenting is being done. |
int |
endOffset()
Starting offset of the area to be reformatted or reindented. |
Lookup |
getLookup()
Returns lookup which is merge of lookups provided by individual formatters involved in formatting given document. |
List<Context.Region> |
indentRegions()
Get list of regions for the given mime-path where the indent or reformat task should operate. |
boolean |
isIndent()
|
int |
lineIndent(int lineStartOffset)
Determine indent on the given line as a number of spaces. |
int |
lineStartOffset(int offset)
Determine start of the line for the given offset. |
String |
mimePath()
Get mimePath of this context as string. |
void |
modifyIndent(int lineStartOffset,
int newIndent)
Modify indent of the line at the offset passed as the parameter. |
void |
setCaretOffset(int offset)
Override the offset at which the caret should be placed after the indentation is finished. |
int |
startOffset()
Starting offset of the area to be reformatted or reindented. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public Lookup getLookup()
IndentTask.reindent() or ReformatTask.reformat().
public Document document()
public String mimePath()
public int startOffset()
public int endOffset()
public int lineStartOffset(int offset)
throws BadLocationException
offset - offset in a document being formatted.
BadLocationException - if the given offset is not within
corresponding document's bounds.
public int lineIndent(int lineStartOffset)
throws BadLocationException
lineStartOffset - start offset of a line where the indent is being determined.
BadLocationException - if the given lineStartOffset is not within
corresponding document's bounds.
public void modifyIndent(int lineStartOffset,
int newIndent)
throws BadLocationException
lineStartOffset - start offset of a line where the indent is being modified.newIndent - new indent as a number of spaces. The method will possibly use tabs
according to the indentation settings for the given document.
BadLocationException - if the given lineStartOffset is not within
corresponding document's bounds.public int caretOffset()
setCaretOffset(int).
public void setCaretOffset(int offset)
throws BadLocationException
offset - new offset where the caret should be placed.
BadLocationException - if the given offset is outside
of underlying document bounds.caretOffset()public List<Context.Region> indentRegions()
public boolean isIndent()
|
org.netbeans.modules.editor.indent/2 1.28 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||