Module platform

Class ClassCompletionProvider

All Implemented Interfaces:
CompletionProvider

public class ClassCompletionProvider extends AbstractCompletionProvider
A completion provider that check the text to the carret position, then, depending on the completioncontext it: if the CompletionContext.getContext() == NEWCLASS: it try to match the ClassCompletion.getName() to the entered text and autocomplete it with the ClassCompletion.getConstructors() if the CompletionContext.getContext() == INCLASS: it try to find match the name of the class with getEnteredClass() if it is not null (a.k.a. a CompletionClass matches) it will complete based on the ClassCompletion.getInternals()
  • Constructor Details

  • Method Details

    • getAlreadyEnteredText

      public String getAlreadyEnteredText(AutoCompletableTextArea comp)
      returns the text used for the completion.
      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).
    • isValidChar

      public boolean isValidChar(char c)
      Description copied from interface: CompletionProvider
      Test if a char is valid for this completion
    • getCompletionsAt

      public List<Completion> getCompletionsAt(AutoCompletableTextArea comp, Point p)
      Description copied from interface: CompletionProvider
      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.
    • getCompletionsImpl

      protected List<Completion> getCompletionsImpl(AutoCompletableTextArea comp)
      Description copied from class: CompletionProviderBase
      Does the dirty work of creating a list of completions.
      Overrides:
      getCompletionsImpl in class AbstractCompletionProvider
      Parameters:
      comp - The text component to look in.
      Returns:
      The list of possible completions, or an empty list if there are none.
    • getClassNameFromText

      protected String getClassNameFromText(AutoCompletableTextArea comp)
    • charContains

      protected boolean charContains(char c, char[] array)
    • getClassCompletionFromText

      protected ClassCompletion getClassCompletionFromText(AutoCompletableTextArea comp)
      return a classcompletion that matches the name of the read class from the text. Or null if no such class can be found.
      Returns:
    • getParameterizedCompletions

      public List<ParameterizedCompletion> getParameterizedCompletions(AutoCompletableTextArea tc)
      Description copied from interface: CompletionProvider
      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.