Interface CompletionProvider

    • Method Detail

      • clearParameterizedCompletionParams

        void clearParameterizedCompletionParams()
        Clears the values used to identify and insert "parameterized completions" (e.g. functions or methods). After this method is called, functions and methods will not have their parameters auto-completed.
        See Also:
        setParameterizedCompletionParams(char, String, char)
      • getAlreadyEnteredText

        String getAlreadyEnteredText​(JTextComponent comp)
        Returns the text just before the current caret position that could be the start of something auto-completable.
        Parameters:
        comp - The text component.
        Returns:
        The text. A return value of null means nothing should be auto-completed; a value of an empty string ("") means auto-completion should still be considered (i.e., all possible choices are valid).
      • getCompletions

        List<Completion> getCompletions​(JTextComponent comp)
        Gets the possible completions for the text component at the current caret position.
        Parameters:
        comp - The text component.
        Returns:
        The list of Completions. If no completions are available, this method should return an empty list.
      • getCompletionsAt

        List<Completion> getCompletionsAt​(JTextComponent comp,
                                          Point p)
        Returns the completions that have been entered at the specified visual location. This can be used for tool tips when the user hovers the mouse over completed text.
        Parameters:
        comp - The text component.
        p - The position, usually from a MouseEvent.
        Returns:
        The completions, or an empty list if there are none.
      • getParameterChoicesProvider

        ParameterChoicesProvider getParameterChoicesProvider()
        Returns an object that can return a list of completion choices for parameters. This is used when a user code-completes a parameterized completion, such as a function or method. For any parameter to the function/method, this object can return possible completions.
        Returns:
        The parameter choices provider, or null if none is installed.
      • getParameterizedCompletions

        List<ParameterizedCompletion> getParameterizedCompletions​(JTextComponent tc)
        Returns a list of parameterized completions that have been entered at the current caret position of a text component (and thus can have their completion choices displayed).
        Parameters:
        tc - The text component.
        Returns:
        The list of ParameterizedCompletions. If no completions are available, this may be null.
      • isAutoActivateOkay

        boolean isAutoActivateOkay​(JTextComponent tc)
        This method is called if auto-activation is enabled in the parent AutoCompletion after the user types a single character. This provider should check the text at the current caret position of the text component, and decide whether auto-activation would be appropriate here. For example, a CompletionProvider for Java might want to return true for this method only if the last character typed was a '.'.
        Parameters:
        tc - The text component.
        Returns:
        Whether auto-activation would be appropriate.
      • setListCellRenderer

        void setListCellRenderer​(ListCellRenderer r)
        Sets the renderer to use when displaying completion choices.
        Parameters:
        r - The renderer to use.
        See Also:
        getListCellRenderer()
      • setParameterizedCompletionParams

        void setParameterizedCompletionParams​(char listStart,
                                              String separator,
                                              char listEnd)
        Sets the values used to identify and insert "parameterized completions" (e.g. functions or methods). If this method isn't called, functions and methods will not have their parameters auto-completed.
        Parameters:
        listStart - The character that marks the beginning of a list of parameters, such as '(' in C or Java.
        separator - Text that should separate parameters in a parameter list when one is inserted. For example, ", ".
        listEnd - The character that marks the end of a list of parameters, such as ')' in C or Java.
        Throws:
        IllegalArgumentException - If either listStart or listEnd is not printable ASCII, or if separator is null or an empty string.
        See Also:
        clearParameterizedCompletionParams()
      • setParent

        void setParent​(CompletionProvider parent)
        Sets the parent completion provider.
        Parameters:
        parent - The parent provider. null means there will be no parent provider.
        See Also:
        getParent()