Package org.fife.rsta.ac.js
Class JavaScriptLinkGenerator
- java.lang.Object
-
- org.fife.rsta.ac.js.JavaScriptLinkGenerator
-
- All Implemented Interfaces:
org.fife.ui.rsyntaxtextarea.LinkGenerator
public class JavaScriptLinkGenerator extends java.lang.Object implements org.fife.ui.rsyntaxtextarea.LinkGenerator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classJavaScriptLinkGenerator.IsLinkableCheckResultThe result of checking whether a region of code under the mouse is possibly link-able.
-
Field Summary
Fields Modifier and Type Field Description private booleanfindLocalprivate booleanfindPreprocessedprivate booleanfindSystemprivate JavaScriptLanguageSupportlanguage
-
Constructor Summary
Constructors Constructor Description JavaScriptLinkGenerator(JavaScriptLanguageSupport language)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private JavaScriptLinkGenerator.IsLinkableCheckResultcheckForLinkableToken(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int offs)Checks if the token at the specified offset is possibly a "click-able" region.protected org.fife.ui.rsyntaxtextarea.LinkGeneratorResultcreateSelectedRegionResult(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, org.fife.ui.rsyntaxtextarea.Token t, JavaScriptDeclaration dec)JavaScriptLanguageSupportgetLanguage()private java.lang.StringgetLookupNameForFunction(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int offs, java.lang.String name)Convert the function Token to JavaScript variable resolver lookup name by replacing any parameters with 'p' and stripping any whitespace between the parameters: e.g.org.fife.ui.rsyntaxtextarea.LinkGeneratorResultisLinkAtOffset(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int offs)voidsetFindLocal(boolean find)voidsetFindPreprocessed(boolean find)voidsetFindSystem(boolean find)private org.fife.ui.rsyntaxtextarea.TokenwrapToken(org.fife.ui.rsyntaxtextarea.Token token)Due to the Tokens being reused, this can cause problems when finding the next token associated with a token.
-
-
-
Field Detail
-
language
private JavaScriptLanguageSupport language
-
findLocal
private boolean findLocal
-
findPreprocessed
private boolean findPreprocessed
-
findSystem
private boolean findSystem
-
-
Constructor Detail
-
JavaScriptLinkGenerator
public JavaScriptLinkGenerator(JavaScriptLanguageSupport language)
-
-
Method Detail
-
isLinkAtOffset
public org.fife.ui.rsyntaxtextarea.LinkGeneratorResult isLinkAtOffset(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int offs)- Specified by:
isLinkAtOffsetin interfaceorg.fife.ui.rsyntaxtextarea.LinkGenerator
-
createSelectedRegionResult
protected org.fife.ui.rsyntaxtextarea.LinkGeneratorResult createSelectedRegionResult(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, org.fife.ui.rsyntaxtextarea.Token t, JavaScriptDeclaration dec)- Returns:
- LinkGeneratorResult based on the JavaScriptDeclaration and the position
-
setFindLocal
public void setFindLocal(boolean find)
- Parameters:
find- flag to state whether to look in the RSTA editing script for variable/function completions
-
setFindPreprocessed
public void setFindPreprocessed(boolean find)
- Parameters:
find- flag to state whether to look in the pre-processed scripts for variable/function completions
-
setFindSystem
public void setFindSystem(boolean find)
- Parameters:
find- flag to state whether to look in the system scripts for variable/function completions
-
getLookupNameForFunction
private java.lang.String getLookupNameForFunction(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int offs, java.lang.String name)Convert the function Token to JavaScript variable resolver lookup name by replacing any parameters with 'p' and stripping any whitespace between the parameters: e.g. Token may contain the function: addTwoNumbers(num1, num2);The return result will be: addTwoNumbers(p,p);
- Returns:
- converted function name to variable resolver lookup name
-
checkForLinkableToken
private JavaScriptLinkGenerator.IsLinkableCheckResult checkForLinkableToken(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int offs)
Checks if the token at the specified offset is possibly a "click-able" region.- Parameters:
textArea- The text area.offs- The offset, presumably at the mouse position.- Returns:
- A result object.
-
wrapToken
private org.fife.ui.rsyntaxtextarea.Token wrapToken(org.fife.ui.rsyntaxtextarea.Token token)
Due to the Tokens being reused, this can cause problems when finding the next token associated with a token. Wrap the tokens to stop this problem.- Parameters:
token- to wrap- Returns:
- copy of the original token
-
getLanguage
public JavaScriptLanguageSupport getLanguage()
- Returns:
- JavaScriptLanguage support
-
-