- All Superinterfaces:
Comparable<Completion>
- All Known Subinterfaces:
ParameterizedCompletion
- All Known Implementing Classes:
AbstractCompletion
,BasicCompletion
,ClassCompletion
,FunctionCompletion
,MarkupTagCompletion
,PackageCompletion
,ShorthandCompletion
,TemplateCompletion
,VariableCompletion
Represents a completion choice. A
CompletionProvider
returns lists
of objects implementing this interface. A Completion
contains the
following information:
- The text the user must (begin to) input for this to be a completion choice.
- The text that will be filled in if the user chooses this completion. Note that often, this is the same as the text the user must (begin to) enter, but this doesn't have to be the case.
- Summary HTML that describes this completion. This is information that
can be displayed in a helper "tooltip"-style window beside the
completion list. This may be
null
. It may also be lazily generated to cut down on memory usage. - The
CompletionProvider
that returned this completion. - Tool tip text that can be displayed when a mouse hovers over this completion in a text component.
- Version:
- 1.0
- Author:
- Robert Futrell
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(Completion other) Compares this completion to another one lexicographically, ignoring case.Returns the portion of this completion that has already been entered into the text component.Return the String used for comparing this Completion to othersgetIcon()
Returns the icon to use for this completion.Returns the text that the user has to (start) typing for this completion to be offered.Returns the provider that returned this completion.int
Returns the "relevance" of this completion.Returns the text to insert as the result of this auto-completion.Returns the description of this auto-complete choice.Returns the tool tip text to display for mouse hovers over this completion.
-
Method Details
-
compareTo
Compares this completion to another one lexicographically, ignoring case.- Specified by:
compareTo
in interfaceComparable<Completion>
- Parameters:
other
- Another completion instance.- Returns:
- How this completion compares to the other one.
-
getAlreadyEntered
Returns the portion of this completion that has already been entered into the text component. The match is case-insensitive.This is a convenience method for:
getProvider().getAlreadyEnteredText(comp)
.- Parameters:
comp
- The text component.- Returns:
- The already-entered portion of this completion.
-
getIcon
Icon getIcon()Returns the icon to use for this completion.- Returns:
- The icon, or
null
for none.
-
getInputText
String getInputText()Returns the text that the user has to (start) typing for this completion to be offered. Note that this will usually be the same value asgetReplacementText()
, but not always (a completion could be a way to implement shorthand, for example, "sysout
" mapping to "System.out.println(
").- Returns:
- The text the user has to (start) typing for this completion to be offered.
- See Also:
-
getProvider
CompletionProvider getProvider()Returns the provider that returned this completion.- Returns:
- The provider.
-
getRelevance
int getRelevance()Returns the "relevance" of this completion. This is used when sorting completions by their relevance. It is an abstract concept that may mean different things to different languages, and may depend on the context of the completion.By default, all completions have a relevance of
0
. The higher the value returned by this method, the higher up in the list this completion will be; the lower the value returned, the lower it will be.Completion
s with equal relevance values will be sorted alphabetically.- Returns:
- The relevance of this completion.
-
getReplacementText
String getReplacementText()Returns the text to insert as the result of this auto-completion. This is the "complete" text, including any text that replaces what the user has already typed.- Returns:
- The replacement text.
- See Also:
-
getSummary
String getSummary()Returns the description of this auto-complete choice. This can be used in a popup "description window."- Returns:
- This item's description. This should be HTML. It may be
null
if there is no description for this completion.
-
getToolTipText
String getToolTipText()Returns the tool tip text to display for mouse hovers over this completion.Note that for this functionality to be enabled, a
AutoCompletableTextArea
must be registered with theToolTipManager
, and the text component must know to search for this value. In the case of an RSyntaxTextArea, this can be done with aorg.fife.ui.rtextarea.ToolTipSupplier
that calls intoCompletionProvider.getCompletionsAt(AutoCompletableTextArea, java.awt.Point)
.- Returns:
- The tool tip text for this completion, or
null
if none.
-
getCompareString
String getCompareString()Return the String used for comparing this Completion to others- Returns:
-