Class RSyntaxTextAreaEditorKit.DumbCompleteWordAction

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
    Enclosing class:
    RSyntaxTextAreaEditorKit

    public static class RSyntaxTextAreaEditorKit.DumbCompleteWordAction
    extends RTextAreaEditorKit.DumbCompleteWordAction
    Overridden to use the programming language RSTA is displaying when computing words to complete.
    See Also:
    Serialized Form
    • Constructor Detail

      • DumbCompleteWordAction

        public DumbCompleteWordAction()
    • Method Detail

      • getPreviousWordStartInLine

        private int getPreviousWordStartInLine​(RSyntaxDocument doc,
                                               javax.swing.text.Element elem,
                                               int offs)
                                        throws javax.swing.text.BadLocationException
        Throws:
        javax.swing.text.BadLocationException
      • getWordStartImpl

        private static int getWordStartImpl​(RSyntaxDocument doc,
                                            javax.swing.text.Element elem,
                                            int offs)
                                     throws javax.swing.text.BadLocationException
        Throws:
        javax.swing.text.BadLocationException
      • isAcceptablePrefix

        protected boolean isAcceptablePrefix​(java.lang.String prefix)
        Overridden to not suggest word completions if the text right before the caret contains non-word characters, such as '/' or '%'.
        Overrides:
        isAcceptablePrefix in class RTextAreaEditorKit.DumbCompleteWordAction
        Parameters:
        prefix - The prefix characters before the caret.
        Returns:
        Whether the prefix could be part of a "word" in the context of the text area's current content.
      • isIdentifierChar

        private static boolean isIdentifierChar​(char ch)
        Returns whether the specified character should be considered part of an identifier.
        Parameters:
        ch - The character.
        Returns:
        Whether the character is part of an identifier.