java.lang.Object
de.grogra.pf.ui.autocomplete.impl.CompletionProviderBase
- All Implemented Interfaces:
CompletionProvider
- Direct Known Subclasses:
AbstractCompletionProvider,XLContextCompletionProvider
A base class for all standard completion providers. This class implements
functionality that should be sharable across all
CompletionProvider
implementations.- Version:
- 1.0
- Author:
- Robert Futrell
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the values used to identify and insert "parameterized completions" (e.g. functions or methods).Gets the possible completions for the text component at the current caret position.protected abstract List<Completion> Does the dirty work of creating a list of completions.Returns the cell renderer for completions returned from this provider.Returns an object that can return a list of completion choices for parameters.charReturns the text that marks the end of a list of parameters to a function or method.Returns the text that separates parameters to a function or method.charReturns the text that marks the start of a list of parameters to a function or method.Returns the parent completion provider.booleanThis method is called if auto-activation is enabled in the parentafter the user types a single character.invalid reference
AutoCompletionvoidsetAutoActivationRules(boolean letters, String others) Sets the characters that auto-activation should occur after.voidSets the renderer to use when displaying completion choices.voidSets the param choices provider.voidsetParameterizedCompletionParams(char listStart, String separator, char listEnd) Sets the values used to identify and insert "parameterized completions" (e.g. functions or methods).voidsetParent(CompletionProvider parent) Sets the parent completion provider.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.grogra.pf.ui.autocomplete.impl.CompletionProvider
getAlreadyEnteredText, getCompletionsAt, getParameterizedCompletions, isValidChar
-
Field Details
-
EMPTY_STRING
- See Also:
-
-
Constructor Details
-
CompletionProviderBase
public CompletionProviderBase()
-
-
Method Details
-
clearParameterizedCompletionParams
public void clearParameterizedCompletionParams()Description copied from interface:CompletionProviderClears 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.- Specified by:
clearParameterizedCompletionParamsin interfaceCompletionProvider- See Also:
-
getCompletions
Description copied from interface:CompletionProviderGets the possible completions for the text component at the current caret position.- Specified by:
getCompletionsin interfaceCompletionProvider- Parameters:
comp- The text component.- Returns:
- The list of
Completions. If no completions are available, this method should return an empty list.
-
getCompletionsImpl
Does the dirty work of creating a list of completions.- Parameters:
comp- The text component to look in.- Returns:
- The list of possible completions, or an empty list if there are none.
-
getListCellRenderer
Description copied from interface:CompletionProviderReturns the cell renderer for completions returned from this provider.- Specified by:
getListCellRendererin interfaceCompletionProvider- Returns:
- The cell renderer, or
nullif the default should be used. - See Also:
-
getParameterChoicesProvider
Description copied from interface:CompletionProviderReturns 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.- Specified by:
getParameterChoicesProviderin interfaceCompletionProvider- Returns:
- The parameter choices provider, or
nullif none is installed.
-
getParameterListEnd
public char getParameterListEnd()Description copied from interface:CompletionProviderReturns the text that marks the end of a list of parameters to a function or method.- Specified by:
getParameterListEndin interfaceCompletionProvider- Returns:
- The text for a parameter list end, for example,
'
)', or0if none. - See Also:
-
getParameterListSeparator
Description copied from interface:CompletionProviderReturns the text that separates parameters to a function or method.- Specified by:
getParameterListSeparatorin interfaceCompletionProvider- Returns:
- The text that separates parameters, for example,
"
,". - See Also:
-
getParameterListStart
public char getParameterListStart()Description copied from interface:CompletionProviderReturns the text that marks the start of a list of parameters to a function or method.- Specified by:
getParameterListStartin interfaceCompletionProvider- Returns:
- The text for a parameter list start, for example,
"
(". - See Also:
-
getParent
Description copied from interface:CompletionProviderReturns the parent completion provider.- Specified by:
getParentin interfaceCompletionProvider- Returns:
- The parent completion provider.
- See Also:
-
isAutoActivateOkay
Description copied from interface:CompletionProviderThis method is called if auto-activation is enabled in the parentafter 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, ainvalid reference
AutoCompletionCompletionProviderfor Java might want to returntruefor this method only if the last character typed was a '.'.- Specified by:
isAutoActivateOkayin interfaceCompletionProvider- Parameters:
tc- The text component.- Returns:
- Whether auto-activation would be appropriate.
-
setAutoActivationRules
Sets the characters that auto-activation should occur after. A Java completion provider, for example, might want to setothersto ".", to allow auto-activation for members of an object.- Parameters:
letters- Whether auto-activation should occur after any letter.others- A string of (non-letter) chars that auto-activation should occur after. This may benull.
-
setParameterChoicesProvider
Sets the param choices provider. 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.- Parameters:
pcp- The parameter choices provider, ornullfor none.- See Also:
-
setListCellRenderer
Description copied from interface:CompletionProviderSets the renderer to use when displaying completion choices.- Specified by:
setListCellRendererin interfaceCompletionProvider- Parameters:
r- The renderer to use.- See Also:
-
setParameterizedCompletionParams
Description copied from interface:CompletionProviderSets 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.- Specified by:
setParameterizedCompletionParamsin interfaceCompletionProvider- 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.- See Also:
-
setParent
Description copied from interface:CompletionProviderSets the parent completion provider.- Specified by:
setParentin interfaceCompletionProvider- Parameters:
parent- The parent provider.nullmeans there will be no parent provider.- See Also:
-