Class JavaScriptLinkGenerator

  • All Implemented Interfaces:
    org.fife.ui.rsyntaxtextarea.LinkGenerator

    public class JavaScriptLinkGenerator
    extends java.lang.Object
    implements org.fife.ui.rsyntaxtextarea.LinkGenerator
    • Field Detail

      • findLocal

        private boolean findLocal
      • findPreprocessed

        private boolean findPreprocessed
      • findSystem

        private boolean findSystem
    • Method Detail

      • isLinkAtOffset

        public org.fife.ui.rsyntaxtextarea.LinkGeneratorResult isLinkAtOffset​(org.fife.ui.rsyntaxtextarea.RSyntaxTextArea textArea,
                                                                              int offs)
        Specified by:
        isLinkAtOffset in interface org.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