java.lang.Object
de.grogra.pf.ui.autocomplete.impl.CompletionProviderBase
de.grogra.pf.ui.autocomplete.impl.AbstractCompletionProvider
de.grogra.pf.ui.autocomplete.impl.ClassCompletionProvider
- All Implemented Interfaces:
CompletionProvider
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()
-
Nested Class Summary
Nested classes/interfaces inherited from class de.grogra.pf.ui.autocomplete.impl.AbstractCompletionProvider
AbstractCompletionProvider.CaseInsensitiveComparator -
Field Summary
Fields inherited from class de.grogra.pf.ui.autocomplete.impl.AbstractCompletionProvider
comparator, completionsFields inherited from class de.grogra.pf.ui.autocomplete.impl.CompletionProviderBase
EMPTY_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancharContains(char c, char[] array) returns the text used for the completion.protected ClassCompletionreturn a classcompletion that matches the name of the read class from the text.protected StringgetCompletionsAt(AutoCompletableTextArea comp, Point p) Returns the completions that have been entered at the specified visual location.protected List<Completion> Does the dirty work of creating a list of completions.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).booleanisValidChar(char c) Test if a char is valid for this completionMethods inherited from class de.grogra.pf.ui.autocomplete.impl.AbstractCompletionProvider
addCompletion, addCompletions, addWordCompletions, checkProviderAndAdd, clear, getCompletionByInputText, removeCompletionMethods inherited from class de.grogra.pf.ui.autocomplete.impl.CompletionProviderBase
clearParameterizedCompletionParams, getCompletions, getListCellRenderer, getParameterChoicesProvider, getParameterListEnd, getParameterListSeparator, getParameterListStart, getParent, isAutoActivateOkay, setAutoActivationRules, setListCellRenderer, setParameterChoicesProvider, setParameterizedCompletionParams, setParent
-
Constructor Details
-
ClassCompletionProvider
-
-
Method Details
-
getAlreadyEnteredText
returns the text used for the completion.- Parameters:
comp- The text component.- Returns:
- The text. A return value of
nullmeans 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:CompletionProviderTest if a char is valid for this completion -
getCompletionsAt
Description copied from interface:CompletionProviderReturns 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 aMouseEvent.- Returns:
- The completions, or an empty list if there are none.
-
getCompletionsImpl
Description copied from class:CompletionProviderBaseDoes the dirty work of creating a list of completions.- Overrides:
getCompletionsImplin classAbstractCompletionProvider- Parameters:
comp- The text component to look in.- Returns:
- The list of possible completions, or an empty list if there are none.
-
getClassNameFromText
-
charContains
protected boolean charContains(char c, char[] array) -
getClassCompletionFromText
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
Description copied from interface:CompletionProviderReturns 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 benull.
-