public class ExtSyntaxSupport extends SyntaxSupport
Modifier and Type | Class and Description |
---|---|
class |
ExtSyntaxSupport.BracketFinder
Finder for the matching bracket.
|
static interface |
ExtSyntaxSupport.DeclarationTokenProcessor
Token processor extended to get declaration position
of the given variable.
|
static interface |
ExtSyntaxSupport.VariableMapTokenProcessor |
Modifier and Type | Field and Description |
---|---|
static int |
COMPLETION_CANCEL
Cancel request without changing completion visibility.
|
static int |
COMPLETION_HIDE
Hide completion.
|
static int |
COMPLETION_POPUP
Schedule content update making completion visible.
|
static int |
COMPLETION_POST_REFRESH
Schedule content update if it's currently visible.
|
static int |
COMPLETION_REFRESH
Update content immediatelly if it's currently visible.
|
tokenNumericIDsValid
Constructor and Description |
---|
ExtSyntaxSupport(BaseDocument doc) |
Modifier and Type | Method and Description |
---|---|
protected Map |
buildGlobalVariableMap(int offset) |
protected Map |
buildLocalVariableMap(int offset) |
int |
checkCompletion(JTextComponent target,
String typedText,
boolean visible)
Check and possibly popup, hide or refresh the completion
|
protected ExtSyntaxSupport.DeclarationTokenProcessor |
createDeclarationTokenProcessor(String varName,
int startPos,
int endPos) |
protected ExtSyntaxSupport.VariableMapTokenProcessor |
createVariableMapTokenProcessor(int startPos,
int endPos) |
protected void |
documentModified(DocumentEvent evt)
Called when the document was modified by either the insert or removal.
|
int |
findDeclarationPosition(String varName,
int varPos)
Find either the local or global declaration position.
|
int |
findGlobalDeclarationPosition(String varName,
int varPos)
Get the position of the global declaration of a given variable.
|
int |
findLocalDeclarationPosition(String varName,
int varPos) |
int[] |
findMatchingBlock(int offset,
boolean simpleSearch)
Find matching bracket or more generally block
that matches with the current position.
|
Object |
findType(String varName,
int varPos)
Find the type of the variable.
|
protected TokenID[] |
getBracketSkipTokens()
Get the array of token IDs that should be skipped when
searching for matching bracket.
|
int[] |
getCommentBlocks(int startPos,
int endPos)
Get the blocks consisting of comments in a specified document area.
|
TokenID[] |
getCommentTokens()
Get the array of token IDs that denote the comments.
|
int[] |
getFunctionBlock(int offset) |
int[] |
getFunctionBlock(int[] identifierBlock)
Is the identifier at the position a function call?
It first checks whether there is a identifier under
the cursor and then it searches for the function call
character - usually '('.
|
Map |
getGlobalVariableMap(int offset) |
Map |
getLocalVariableMap(int offset) |
protected ExtSyntaxSupport.BracketFinder |
getMatchingBracketFinder(char bracketChar)
Get the bracket finder that will search for the matching bracket
or null if the bracket character doesn't belong to bracket
characters.
|
protected int |
getMethodStartPosition(int offset)
Get the start position of the method or the area
where the declaration can start.
|
int |
getRowLastValidChar(int offset)
Gets the last non-blank and non-comment character on the given line.
|
TokenItem |
getTokenChain(int startOffset,
int endOffset)
Get the chain of the tokens for the given block of text.
|
TokenID |
getTokenID(int offset)
Gets the token-id of the token at the given position.
|
boolean |
isCommentOrWhitespace(int startPos,
int endPos) |
boolean |
isRowValid(int offset)
Does the line contain some valid code besides of possible white space
and comments?
|
boolean |
isWhitespaceToken(TokenID tokenID,
char[] buffer,
int offset,
int tokenLength) |
createSyntaxSupport, findInsideBlocks, findOutsideBlocks, get, getDocument, getTokenBlocks, getTokenChain, initSyntax, isAbbrevDisabled, isIdentifier, tokenizeText, tokenizeText
public static final int COMPLETION_POPUP
public static final int COMPLETION_CANCEL
public static final int COMPLETION_REFRESH
public static final int COMPLETION_POST_REFRESH
public static final int COMPLETION_HIDE
public ExtSyntaxSupport(BaseDocument doc)
public TokenItem getTokenChain(int startOffset, int endOffset) throws BadLocationException
startOffset
- starting position of the blockendOffset
- ending position of the blockBadLocationException
protected void documentModified(DocumentEvent evt)
evt
- event received with the modification notification. getType()
can be used to obtain the type of the event.protected ExtSyntaxSupport.BracketFinder getMatchingBracketFinder(char bracketChar)
public int[] findMatchingBlock(int offset, boolean simpleSearch) throws BadLocationException
offset
- position of the starting bracketsimpleSearch
- whether the search should skip comment and possibly other areas.
This can be useful when the speed is critical, because the simple
search is faster.BadLocationException
protected TokenID[] getBracketSkipTokens()
public TokenID getTokenID(int offset) throws BadLocationException
offset
- position at which the token should be returnedBadLocationException
public int[] getFunctionBlock(int[] identifierBlock) throws BadLocationException
identifierBlock
- int[2] block delimiting the identifierBadLocationException
public int[] getFunctionBlock(int offset) throws BadLocationException
BadLocationException
public boolean isWhitespaceToken(TokenID tokenID, char[] buffer, int offset, int tokenLength)
public boolean isCommentOrWhitespace(int startPos, int endPos) throws BadLocationException
BadLocationException
public int getRowLastValidChar(int offset) throws BadLocationException
BadLocationException
public boolean isRowValid(int offset) throws BadLocationException
BadLocationException
public TokenID[] getCommentTokens()
public int[] getCommentBlocks(int startPos, int endPos) throws BadLocationException
startPos
- starting position of the searched document areaendPos
- ending position of the searched document areaBadLocationException
public Object findType(String varName, int varPos)
public Map getLocalVariableMap(int offset)
protected Map buildLocalVariableMap(int offset)
public Map getGlobalVariableMap(int offset)
protected Map buildGlobalVariableMap(int offset)
protected int getMethodStartPosition(int offset)
public int findDeclarationPosition(String varName, int varPos)
public int findLocalDeclarationPosition(String varName, int varPos)
public int findGlobalDeclarationPosition(String varName, int varPos)
protected ExtSyntaxSupport.DeclarationTokenProcessor createDeclarationTokenProcessor(String varName, int startPos, int endPos)
protected ExtSyntaxSupport.VariableMapTokenProcessor createVariableMapTokenProcessor(int startPos, int endPos)
public int checkCompletion(JTextComponent target, String typedText, boolean visible)