public class DocumentUtils
extends java.lang.Object
IDocument
related isues.Constructor and Description |
---|
DocumentUtils() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getDocumentation(IDocument doc,
int offset,
boolean includeSpezification,
java.lang.Character endToken)
Gets the documentation prior to the given offset within the document.
|
static java.lang.String |
getIndent(IDocument doc,
int offset) |
static int |
getIndexOfNextNonCommentAndWhitespaceCharacter(IDocument doc,
int offset)
Returns the index of next character beeing not commented or a whitespace.
|
static int |
getIndexOfPrevNonCommentAndWhitespaceCharacter(IDocument doc,
int offset)
Returns the index of prvious character beeing not commented or a whitespace.
Note: the End.of-line comment style ( // ) is not supported,
just the / * ... |
static int |
getNextCharacterOccurrence(IDocument doc,
int offset,
char c)
Finds the very next character occurrence within the document, begining at
offset . |
static TokenData |
getNextNonCommentToken(IDocument doc,
int offset)
Returns the next non-comment token.
|
static char |
getNextNonWhitespaceCharacter(IDocument doc,
int offset)
Gets the next non-whitespace character from the document.
|
static int |
getPrevCharacterOccurrence(IDocument doc,
int offset,
char c) |
static TokenData |
getPrevNonCommentToken(IDocument doc,
int offset)
Returns the previous non-comment token.
|
static boolean |
isNextNonWhitespaceChar(IDocument doc,
int offset,
char c)
Is the next non-whitespace character in the document one of these?
This method is used when a MACRO_USE is detected and we want to know if there are parameters to the macro |
static boolean |
isNextTokenClosingBracket(IDocument doc,
int offset) |
static boolean |
isPrevTokenOpeningBracket(IDocument doc,
int offset) |
public static java.lang.String getDocumentation(IDocument doc, int offset, boolean includeSpezification, java.lang.Character endToken)
doc
- The IDocument
to processoffset
- The offset within the document to start with. The processing
is done reverse, thus nothing AFTER the offset will be found!includeSpezification
- If true
everything from the
offset until the very first occurence of the endToken
is
added to the return.endToken
- Only used if includeSpezification
is
true
, see above.public static TokenData getNextNonCommentToken(IDocument doc, int offset)
doc
- The document to work onoffset
- The offset to start withnull
.public static TokenData getPrevNonCommentToken(IDocument doc, int offset)
doc
- The document to work onoffset
- The offset to start withnull
.public static boolean isNextTokenClosingBracket(IDocument doc, int offset)
public static boolean isPrevTokenOpeningBracket(IDocument doc, int offset)
public static int getIndexOfNextNonCommentAndWhitespaceCharacter(IDocument doc, int offset)
doc
- The document to processoffset
- The offset to start withpublic static int getIndexOfPrevNonCommentAndWhitespaceCharacter(IDocument doc, int offset)
//
) is not supported,
just the / * ... * /
style is recognized!doc
- The document to processoffset
- The offset to start withpublic static int getNextCharacterOccurrence(IDocument doc, int offset, char c)
offset
.doc
- The document to be preocessedoffset
- The offset to start processing withc
- The character to be foundc
or
-1
if no character could be found til the end of the document.public static int getPrevCharacterOccurrence(IDocument doc, int offset, char c)
public static boolean isNextNonWhitespaceChar(IDocument doc, int offset, char c)
doc
- The IDocument to checkoffset
- The current offset into the IDocument to start checking atc
- The character to check for.public static char getNextNonWhitespaceCharacter(IDocument doc, int offset) throws BadLocationException
doc
- The document to operate on.offset
- The offset to start withBadLocationException
- If no non-whitespace character could be found.public static java.lang.String getIndent(IDocument doc, int offset)