|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.editor.ext.FormatSupport
org.netbeans.editor.ext.ExtFormatSupport
public class ExtFormatSupport
Extended format-support offers comment-token support, token-and-text operations and other support.
Constructor Summary | |
---|---|
ExtFormatSupport(FormatWriter formatWriter)
|
Method Summary | |
---|---|
TokenItem |
findAnyToken(TokenItem startToken,
TokenItem limitToken,
TokenID[] tokenIDArray,
TokenContextPath tokenContextPath,
boolean backward)
Search for any of the image tokens from the given array and return if the token matches any item from the array. |
FormatTokenPosition |
findImportant(FormatTokenPosition startPosition,
FormatTokenPosition limitPosition,
boolean stopOnEOL,
boolean backward)
Get the first position that is not whitespace and that is not comment. |
TokenItem |
findImportantToken(TokenItem startToken,
TokenItem limitToken,
boolean backward)
Find the first non-whitespace and non-comment token in the given direction. |
int |
findLineDistance(FormatTokenPosition fromPosition,
FormatTokenPosition toPosition)
Find how many EOLs is between two token-position. |
FormatTokenPosition |
findLineEndNonImportant(FormatTokenPosition pos)
Get the start of the area of line where there is only whitespace or comment till the end of the line. |
FormatTokenPosition |
findLineFirstImportant(FormatTokenPosition pos)
Get the first non-whitespace and non-comment token or null. |
TokenItem |
findMatchingToken(TokenItem startToken,
TokenItem limitToken,
ImageTokenID matchTokenID,
boolean backward)
|
TokenItem |
findMatchingToken(TokenItem startToken,
TokenItem limitToken,
TokenID matchTokenID,
String matchTokenImage,
boolean backward)
This method can be used to find a matching brace token. |
TokenItem |
findToken(TokenItem startToken,
TokenItem limitToken,
TokenID tokenID,
TokenContextPath tokenContextPath,
String tokenImage,
boolean backward)
Find the token either by token-id or token-text or both. |
char |
getChar(FormatTokenPosition pos)
Get the character at the given position. |
int |
getIndex(TokenItem token,
TokenID[] tokenIDArray)
Get the index of the token in the given token-id-and-text array or -1 if the token is not in the array. |
TokenItem |
insertImageToken(TokenItem beforeToken,
ImageTokenID tokenID,
TokenContextPath tokenContextPath)
Insert the token that has token-id containing image, so additional text is not necessary. |
boolean |
isComment(FormatTokenPosition pos)
|
boolean |
isComment(TokenItem token,
int offset)
Is the given token a comment token? By default it returns false but it can be redefined in descendants. |
boolean |
isImportant(FormatTokenPosition pos)
|
boolean |
isImportant(TokenItem token,
int offset)
Whether the given position is not a whitespace or comment. |
boolean |
isLineStart(FormatTokenPosition pos)
Whether the given position is at the begining of the line. |
boolean |
isNewLine(FormatTokenPosition pos)
|
FormatTokenPosition |
removeLineEndWhitespace(FormatTokenPosition pos)
Remove the ending whitespace from the line. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExtFormatSupport(FormatWriter formatWriter)
Method Detail |
---|
public int findLineDistance(FormatTokenPosition fromPosition, FormatTokenPosition toPosition)
fromPosition
- the position from which to start counting.
If it's EOL, it's counted.toPosition
- the ending position. If it points at EOL,
it's ignored from the total count.
It is necessary for the second position to follow
the first one.public boolean isComment(TokenItem token, int offset)
public boolean isComment(FormatTokenPosition pos)
public boolean isImportant(TokenItem token, int offset)
public boolean isImportant(FormatTokenPosition pos)
public FormatTokenPosition findImportant(FormatTokenPosition startPosition, FormatTokenPosition limitPosition, boolean stopOnEOL, boolean backward)
startPosition
- position from which the search starts.
For the backward search the character right at startPosition
is not considered as part of the search.limitPosition
- position where the search will be broken
reporting that nothing was found. It can be null to search
till the end or begining of the chain (depending on direction).stopOnEOL
- whether stop and return EOL token or continue search if
EOL token is found.backward
- whether search in backward direction.
public FormatTokenPosition findLineFirstImportant(FormatTokenPosition pos)
pos
- any position on the line.public FormatTokenPosition findLineEndNonImportant(FormatTokenPosition pos)
pos
- any position on the line.
Return null if there's no such area.public TokenItem insertImageToken(TokenItem beforeToken, ImageTokenID tokenID, TokenContextPath tokenContextPath)
public TokenItem findToken(TokenItem startToken, TokenItem limitToken, TokenID tokenID, TokenContextPath tokenContextPath, String tokenImage, boolean backward)
startToken
- token from which to start searching. For backward
search this token is excluded from the search.limitToken
- the token where the search will be broken
reporting that nothing was found. It can be null to search
till the end or begining of the chain (depending on direction).
For forward search this token is not considered to be part of search,
but for backward search it is.tokenID
- token-id to be searched. If null the token-id
of the tokens inspected will be ignored.tokenImage
- text of the token to find. If null the text
of the tokens inspected will be ignored.backward
- true for searching in backward direction or false
to serach in forward direction.
public TokenItem findImportantToken(TokenItem startToken, TokenItem limitToken, boolean backward)
startToken
- token from which to start searching. For backward
search this token is excluded from the search.limitToken
- the token where the search will be broken
reporting that nothing was found. It can be null to search
till the end or begining of the chain (depending on direction).
For forward search this token is not considered to be part of search,
but for backward search it is.backward
- true for searching in backward direction or false
to serach in forward direction.
public TokenItem findMatchingToken(TokenItem startToken, TokenItem limitToken, TokenID matchTokenID, String matchTokenImage, boolean backward)
startToken
- token from which to start. It cannot be null.
For backward search this token is ignored and the previous one is used.limitToken
- the token where the search will be broken
reporting that nothing was found. It can be null to search
till the end or begining of the chain (depending on direction).
For forward search this token is not considered to be part of search,
but for backward search it is.matchTokenID
- matching token-id for the start token.matchTokenImage
- matching token-text for the start token.backward
- true for searching in backward direction or false
to serach in forward direction.public TokenItem findMatchingToken(TokenItem startToken, TokenItem limitToken, ImageTokenID matchTokenID, boolean backward)
public TokenItem findAnyToken(TokenItem startToken, TokenItem limitToken, TokenID[] tokenIDArray, TokenContextPath tokenContextPath, boolean backward)
startToken
- token from which to start. For backward search
this token is excluded from the search.limitToken
- the token where the search will be broken
reporting that nothing was found. It can be null to search
till the end or begining of the chain (depending on direction).
For forward search this token is not considered to be part of search,
but for backward search it is.tokenIDArray
- array of the token-ids for which to search.tokenContextPath
- context path that the found token must have.
It can be null.backward
- true for searching in backward direction or false
to serach in forward direction.public int getIndex(TokenItem token, TokenID[] tokenIDArray)
public FormatTokenPosition removeLineEndWhitespace(FormatTokenPosition pos)
pos
- position on the line to be checked.
public char getChar(FormatTokenPosition pos)
public boolean isLineStart(FormatTokenPosition pos)
public boolean isNewLine(FormatTokenPosition pos)
|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |