public final class IndentUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
createIndentString(Document doc,
int indent)
Create (or get from cache) indentation string for the given indent.
|
static String |
createIndentString(int indent,
boolean expandTabs,
int tabSize)
Create (or get from cache) indentation string for the given indent while knowing
whether tabs are exapnded and tabSize value.
|
static int |
indentLevelSize(Document doc)
Get number of spaces that form a single indentation level.
|
static boolean |
isExpandTabs(Document doc)
Get whether the indentation strings should contain hard tabs '\t'
or whether they should only contain spaces.
|
static int |
lineIndent(Document doc,
int lineStartOffset)
Get indentation of a line in a document as a number of spaces.
|
static int |
lineStartOffset(Document doc,
int offset)
Get start offset of a line in a document.
|
static int |
tabSize(Document doc)
Get number of spaces that visually substitute '\t' character.
|
public static int indentLevelSize(Document doc)
public static int tabSize(Document doc)
public static boolean isExpandTabs(Document doc)
public static int lineStartOffset(Document doc, int offset) throws BadLocationException
doc
- non-null document.offset
- >= 0 offset anywhere on the line.BadLocationException
- for invalid offsetpublic static int lineIndent(Document doc, int lineStartOffset) throws BadLocationException
doc
- non-null document.lineStartOffset
- >= 0 start offset of a line in the document.BadLocationException
- for invalid offsetpublic static String createIndentString(Document doc, int indent)
doc
- document from which the indentation settings will be retrieved.indent
- >=0 indentation in number of spaces.public static String createIndentString(int indent, boolean expandTabs, int tabSize)
indent
- >=0 indentation in number of spaces.expandTabs
- true if no tab characters '\t' should be used for indentation string
(only spaces will be used).tabSize
- number of spaces equal to each '\t' character used in indentation string.