| java.lang.Object org.netbeans.editor.ext.FormatSupport org.netbeans.editor.ext.ExtFormatSupport
All known Subclasses: org.netbeans.editor.ext.java.JavaFormatSupport,
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. | 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. | 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. | 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.
Parameters: pos - any position on 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 search this token isexcluded from the search. Parameters: limitToken - the token where the search will be broken reporting thatnothing was found. It can be null to search till the end orbegining of the chain (depending on direction). For forwardsearch this token is not considered to be part of search, butfor 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 false to serach inforward 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 searchthe character right at startPosition is not considered as partof the search. Parameters: limitPosition - position where the search will be broken reporting thatnothing was found. It can be null to search till the end orbegining of the chain (depending on direction). Parameters: stopOnEOL - whether stop and return EOL token or continue search if EOLtoken is found. Parameters: backward - whether search in backward direction. first non-whitespace token or EOL or null if all the tokens tillthe 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 backward search thistoken is excluded from the search. Parameters: limitToken - the token where the search will be broken reporting thatnothing was found. It can be null to search till the end orbegining of the chain (depending on direction). For forwardsearch this token is not considered to be part of search, butfor backward search it is. Parameters: backward - true for searching in backward direction or false to serach inforward 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'scounted. Parameters: toPosition - the ending position. If it points at EOL, it's ignored fromthe total count. It is necessary for the second position tofollow the 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 backwardsearch this token is ignored and the previous one is used. Parameters: limitToken - the token where the search will be broken reporting thatnothing was found. It can be null to search till the end orbegining of the chain (depending on direction). For forwardsearch this token is not considered to be part of search, butfor 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 false to serach inforward 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 backward search thistoken is excluded from the search. Parameters: limitToken - the token where the search will be broken reporting thatnothing was found. It can be null to search till the end orbegining of the chain (depending on direction). For forwardsearch this token is not considered to be part of search, butfor backward search it is. Parameters: tokenID - token-id to be searched. If null the token-id of the tokensinspected will be ignored. Parameters: tokenImage - text of the token to find. If null the text of the tokensinspected will be ignored. Parameters: backward - true for searching in backward direction or false to serach inforward 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)
|
|
|