Class JavaScriptLinkGenerator
java.lang.Object
org.fife.rsta.ac.js.JavaScriptLinkGenerator
- All Implemented Interfaces:
org.fife.ui.rsyntaxtextarea.LinkGenerator
public class JavaScriptLinkGenerator
extends Object
implements org.fife.ui.rsyntaxtextarea.LinkGenerator
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classThe result of checking whether a region of code under the mouse is possibly link-able. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate booleanprivate booleanprivate JavaScriptLanguageSupport -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckForLinkableToken(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) private StringgetLookupNameForFunction(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int offs, 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 Details
-
language
-
findLocal
private boolean findLocal -
findPreprocessed
private boolean findPreprocessed -
findSystem
private boolean findSystem
-
-
Constructor Details
-
JavaScriptLinkGenerator
-
-
Method Details
-
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 String getLookupNameForFunction(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea, int offs, 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
- Returns:
- JavaScriptLanguage support
-