| java.lang.Object org.netbeans.editor.ext.FormatSupport org.netbeans.editor.ext.ExtFormatSupport
ExtFormatSupport | public class ExtFormatSupport extends FormatSupport (Code) | | Extended format-support offers comment-token support,
token-and-text operations and other support.
author: Miloslav Metelka version: 1.00 |
Method Summary | |
public 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.
The index of the item from the array that matched
can be found by calling getIndex() method.
It is suitable mainly for the image-token-ids.
Parameters: startToken - token from which to start. | public FormatTokenPosition | findImportant(FormatTokenPosition startPosition, FormatTokenPosition limitPosition, boolean stopOnEOL, boolean backward) Get the first position that is not whitespace and that is not comment.
Parameters: startPosition - position from which the search starts.For the backward search the character right at startPositionis not considered as part of the search. Parameters: limitPosition - position where the search will be brokenreporting that nothing was found. | public TokenItem | findImportantToken(TokenItem startToken, TokenItem limitToken, boolean backward) Find the first non-whitespace and non-comment token in the given
direction. | public int | findLineDistance(FormatTokenPosition fromPosition, FormatTokenPosition toPosition) Find how many EOLs is between two token-position.
Parameters: fromPosition - the position from which to start counting.If it's EOL, it's counted. Parameters: toPosition - the ending position. | public 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. | public FormatTokenPosition | findLineFirstImportant(FormatTokenPosition pos) Get the first non-whitespace and non-comment token or null. | public TokenItem | findMatchingToken(TokenItem startToken, TokenItem limitToken, TokenID matchTokenID, String matchTokenImage, boolean backward) This method can be used to find a matching brace token. | public TokenItem | findMatchingToken(TokenItem startToken, TokenItem limitToken, ImageTokenID matchTokenID, boolean backward) | public 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.
Parameters: startToken - token from which to start searching. | public char | getChar(FormatTokenPosition pos) Get the character at the given position. | public 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. | public TokenItem | insertImageToken(TokenItem beforeToken, ImageTokenID tokenID, TokenContextPath tokenContextPath) Insert the token that has token-id containing image, so additional
text is not necessary. | public 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. | public boolean | isComment(FormatTokenPosition pos) | public boolean | isImportant(TokenItem token, int offset) Whether the given position is not a whitespace or comment. | public boolean | isImportant(FormatTokenPosition pos) | public boolean | isLineStart(FormatTokenPosition pos) Whether the given position is at the begining of the line. | public boolean | isNewLine(FormatTokenPosition pos) | public FormatTokenPosition | removeLineEndWhitespace(FormatTokenPosition pos) Remove the ending whitespace from the line.
Parameters: pos - position on the line to be checked. |
findAnyToken | public TokenItem findAnyToken(TokenItem startToken, TokenItem limitToken, TokenID[] tokenIDArray, TokenContextPath tokenContextPath, boolean backward)(Code) | | Search for any of the image tokens from the given array
and return if the token matches any item from the array.
The index of the item from the array that matched
can be found by calling getIndex() method.
It is suitable mainly for the image-token-ids.
Parameters: startToken - token from which to start. For backward searchthis token is excluded from the search. Parameters: limitToken - the token where the search will be brokenreporting that nothing was found. It can be null to searchtill 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. Parameters: tokenIDArray - array of the token-ids for which to search. Parameters: tokenContextPath - context path that the found token must have.It can be null. Parameters: backward - true for searching in backward direction or falseto serach in forward direction. |
findImportant | public FormatTokenPosition findImportant(FormatTokenPosition startPosition, FormatTokenPosition limitPosition, boolean stopOnEOL, boolean backward)(Code) | | Get the first position that is not whitespace and that is not comment.
Parameters: startPosition - position from which the search starts.For the backward search the character right at startPositionis not considered as part of the search. Parameters: limitPosition - position where the search will be brokenreporting that nothing was found. It can be null to searchtill the end or begining of the chain (depending on direction). Parameters: stopOnEOL - whether stop and return EOL token or continue search ifEOL token is found. Parameters: backward - whether search in backward direction. first non-whitespace token or EOL or null if all the tokenstill the begining of the chain are whitespaces. |
findImportantToken | public TokenItem findImportantToken(TokenItem startToken, TokenItem limitToken, boolean backward)(Code) | | Find the first non-whitespace and non-comment token in the given
direction. This is similair to findImportant()
but it operates over the tokens.
Parameters: startToken - token from which to start searching. For backwardsearch this token is excluded from the search. Parameters: limitToken - the token where the search will be brokenreporting that nothing was found. It can be null to searchtill 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. Parameters: backward - true for searching in backward direction or falseto serach in forward direction. return the matching token or null if nothing was found |
findLineDistance | public int findLineDistance(FormatTokenPosition fromPosition, FormatTokenPosition toPosition)(Code) | | Find how many EOLs is between two token-position.
Parameters: fromPosition - the position from which to start counting.If it's EOL, it's counted. Parameters: toPosition - the ending position. If it points at EOL,it's ignored from the total count.It is necessary for the second position to followthe first one. |
findLineEndNonImportant | public FormatTokenPosition findLineEndNonImportant(FormatTokenPosition pos)(Code) | | Get the start of the area of line where there is only
whitespace or comment till the end of the line.
Parameters: pos - any position on the line.Return null if there's no such area. |
findMatchingToken | public TokenItem findMatchingToken(TokenItem startToken, TokenItem limitToken, TokenID matchTokenID, String matchTokenImage, boolean backward)(Code) | | This method can be used to find a matching brace token. Both
the token-id and token-text are used for comparison of the starting token.
Parameters: startToken - token from which to start. It cannot be null.For backward search this token is ignored and the previous one is used. Parameters: limitToken - the token where the search will be brokenreporting that nothing was found. It can be null to searchtill 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. Parameters: matchTokenID - matching token-id for the start token. Parameters: matchTokenImage - matching token-text for the start token. Parameters: backward - true for searching in backward direction or falseto serach in forward direction. |
findToken | public TokenItem findToken(TokenItem startToken, TokenItem limitToken, TokenID tokenID, TokenContextPath tokenContextPath, String tokenImage, boolean backward)(Code) | | Find the token either by token-id or token-text or both.
Parameters: startToken - token from which to start searching. For backwardsearch this token is excluded from the search. Parameters: limitToken - the token where the search will be brokenreporting that nothing was found. It can be null to searchtill 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. Parameters: tokenID - token-id to be searched. If null the token-idof the tokens inspected will be ignored. Parameters: tokenImage - text of the token to find. If null the textof the tokens inspected will be ignored. Parameters: backward - true for searching in backward direction or falseto serach in forward direction. return the matching token or null if nothing was found |
getChar | public char getChar(FormatTokenPosition pos)(Code) | | Get the character at the given position. The caller must care
about not to pass the end-of-chain position to this method.
|
getIndex | public int getIndex(TokenItem token, TokenID[] tokenIDArray)(Code) | | Get the index of the token in the given token-id-and-text array or -1
if the token is not in the array.
|
isComment | public boolean isComment(TokenItem token, int offset)(Code) | | Is the given token a comment token? By default it returns
false but it can be redefined in descendants.
|
isImportant | public boolean isImportant(TokenItem token, int offset)(Code) | | Whether the given position is not a whitespace or comment.
|
isLineStart | public boolean isLineStart(FormatTokenPosition pos)(Code) | | Whether the given position is at the begining of the line.
|
removeLineEndWhitespace | public FormatTokenPosition removeLineEndWhitespace(FormatTokenPosition pos)(Code) | | Remove the ending whitespace from the line.
Parameters: pos - position on the line to be checked. position of the EOL on the line or end of chain position |
Methods inherited from org.netbeans.editor.ext.FormatSupport | public boolean canInsertToken(TokenItem beforeToken)(Code)(Java Doc) public boolean canModifyWhitespace(TokenItem inToken)(Code)(Java Doc) public boolean canRemoveToken(TokenItem token)(Code)(Java Doc) public boolean canReplaceToken(TokenItem token)(Code)(Java Doc) public String chainToString(TokenItem token)(Code)(Java Doc) public String chainToString(TokenItem token, int maxDocumentTokens)(Code)(Java Doc) public FormatTokenPosition changeLineIndent(FormatTokenPosition pos, int indent)(Code)(Java Doc) public boolean expandTabs()(Code)(Java Doc) public TokenItem findFirstToken(TokenItem token)(Code)(Java Doc) public FormatTokenPosition findLineEnd(FormatTokenPosition pos)(Code)(Java Doc) public FormatTokenPosition findLineEndWhitespace(FormatTokenPosition pos)(Code)(Java Doc) public FormatTokenPosition findLineFirstNonWhitespace(FormatTokenPosition pos)(Code)(Java Doc) public FormatTokenPosition findLineStart(FormatTokenPosition pos)(Code)(Java Doc) public FormatTokenPosition findNextEOL(FormatTokenPosition pos)(Code)(Java Doc) public TokenItem findNonEmptyToken(TokenItem token, boolean backward)(Code)(Java Doc) public FormatTokenPosition findNonWhitespace(FormatTokenPosition startPosition, FormatTokenPosition limitPosition, boolean stopOnEOL, boolean backward)(Code)(Java Doc) public FormatTokenPosition findPreviousEOL(FormatTokenPosition pos)(Code)(Java Doc) public FormatTokenPosition getFormatStartPosition()(Code)(Java Doc) public FormatWriter getFormatWriter()(Code)(Java Doc) public int getIndentShift()(Code)(Java Doc) public String getIndentString(int indent)(Code)(Java Doc) public FormatTokenPosition getLastPosition()(Code)(Java Doc) public TokenItem getLastToken()(Code)(Java Doc) public int getLineIndent(FormatTokenPosition pos, boolean zeroForWSLine)(Code)(Java Doc) public FormatTokenPosition getNextPosition(TokenItem token, int offset, Position.Bias bias)(Code)(Java Doc) public FormatTokenPosition getNextPosition(FormatTokenPosition pos)(Code)(Java Doc) public FormatTokenPosition getNextPosition(FormatTokenPosition pos, Position.Bias bias)(Code)(Java Doc) public FormatTokenPosition getNextPosition(TokenItem token, int offset)(Code)(Java Doc) public FormatTokenPosition getPosition(TokenItem token, int offset)(Code)(Java Doc) public FormatTokenPosition getPosition(TokenItem token, int offset, Position.Bias bias)(Code)(Java Doc) public FormatTokenPosition getPreviousPosition(TokenItem token, int offset, Position.Bias bias)(Code)(Java Doc) public FormatTokenPosition getPreviousPosition(FormatTokenPosition pos)(Code)(Java Doc) public FormatTokenPosition getPreviousPosition(FormatTokenPosition pos, Position.Bias bias)(Code)(Java Doc) public FormatTokenPosition getPreviousPosition(TokenItem token, int offset)(Code)(Java Doc) public TokenItem getPreviousToken(TokenItem token)(Code)(Java Doc) public boolean getSettingBoolean(String settingName, Boolean defaultValue)(Code)(Java Doc) public boolean getSettingBoolean(String settingName, boolean defaultValue)(Code)(Java Doc) public int getSettingInteger(String settingName, Integer defaultValue)(Code)(Java Doc) public int getSettingInteger(String settingName, int defaultValue)(Code)(Java Doc) public Object getSettingValue(String settingName)(Code)(Java Doc) public Object getSettingValue(String settingName, Object defaultValue)(Code)(Java Doc) public int getShiftWidth()(Code)(Java Doc) public int getSpacesPerTab()(Code)(Java Doc) public int getTabSize()(Code)(Java Doc) public FormatTokenPosition getTextStartPosition()(Code)(Java Doc) public TokenContextPath getValidWhitespaceTokenContextPath()(Code)(Java Doc) public TokenID getValidWhitespaceTokenID()(Code)(Java Doc) public int getVisualColumnOffset(FormatTokenPosition pos)(Code)(Java Doc) public TokenContextPath getWhitespaceTokenContextPath()(Code)(Java Doc) public TokenID getWhitespaceTokenID()(Code)(Java Doc) public void insertSpaces(TokenItem beforeToken, int spaceCount)(Code)(Java Doc) public void insertString(TokenItem token, int offset, String text)(Code)(Java Doc) public void insertString(FormatTokenPosition pos, String text)(Code)(Java Doc) public TokenItem insertToken(TokenItem beforeToken, TokenID tokenID, TokenContextPath tokenContextPath, String tokenImage)(Code)(Java Doc) public boolean isAfter(TokenItem testedToken, TokenItem afterToken)(Code)(Java Doc) public boolean isAfter(FormatTokenPosition testedPosition, FormatTokenPosition afterPosition)(Code)(Java Doc) public boolean isChainStartPosition(FormatTokenPosition pos)(Code)(Java Doc) final public boolean isIndentOnly()(Code)(Java Doc) public boolean isLineEmpty(FormatTokenPosition pos)(Code)(Java Doc) public boolean isLineWhite(FormatTokenPosition pos)(Code)(Java Doc) public boolean isRestartFormat()(Code)(Java Doc) public boolean isWhitespace(TokenItem token, int offset)(Code)(Java Doc) public boolean isWhitespace(FormatTokenPosition pos)(Code)(Java Doc) public void remove(TokenItem token, int offset, int length)(Code)(Java Doc) public void remove(FormatTokenPosition pos, int length)(Code)(Java Doc) public void removeToken(TokenItem token)(Code)(Java Doc) public void removeTokenChain(TokenItem startToken, TokenItem endToken)(Code)(Java Doc) public void replaceToken(TokenItem originalToken, TokenID tokenID, TokenContextPath tokenContextPath, String tokenImage)(Code)(Java Doc) public void setIndentShift(int indentShift)(Code)(Java Doc) public void setRestartFormat(boolean restartFormat)(Code)(Java Doc) public TokenItem splitEnd(TokenItem token, int endLength, TokenID newTokenID, TokenContextPath newTokenContextPath)(Code)(Java Doc) public TokenItem splitStart(TokenItem token, int startLength, TokenID newTokenID, TokenContextPath newTokenContextPath)(Code)(Java Doc) public boolean tokenEquals(TokenItem compareToken, TokenID withTokenID)(Code)(Java Doc) public boolean tokenEquals(TokenItem compareToken, TokenID withTokenID, TokenContextPath withTokenContextPath)(Code)(Java Doc) public boolean tokenEquals(TokenItem compareToken, TokenID withTokenID, TokenContextPath withTokenContextPath, String withTokenImage)(Code)(Java Doc)
|
|
|