java.lang.Object
de.grogra.pf.ui.autocomplete.impl.AbstractCompletion
de.grogra.pf.ui.autocomplete.impl.BasicCompletion
de.grogra.pf.ui.autocomplete.impl.VariableCompletion
- All Implemented Interfaces:
Completion
,Comparable<Completion>
- Direct Known Subclasses:
FunctionCompletion
A completion for a variable (or constant) in a programming language.
This completion type uses its shortDescription
property as part of
its summary returned by getSummary()
; for this reason, it may be
a little longer (even much longer), if desired, than what is recommended
for BasicCompletion
s (where the shortDescription
is used
in toString()
for ListCellRenderers
).
- Version:
- 1.0
- Author:
- Robert Futrell
-
Constructor Summary
ConstructorDescriptionVariableCompletion
(CompletionProvider provider, String name, String type) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Returns where this variable is defined.Return the definition of this variable completion.getName()
Returns the name of this variable.Returns the description of this auto-complete choice.Returns the tool tip text to display for mouse hovers over this completion.getType()
Returns the type of this variable.protected void
Adds some HTML describing where this variable is defined, if this information is known.protected boolean
Adds the description text as HTML to a buffer, if a description is defined.void
setDefinedIn
(String definedIn) Sets where this variable is defined.toString()
Overridden to return the name of the variable being completed.Methods inherited from class de.grogra.pf.ui.autocomplete.impl.BasicCompletion
getReplacementText, getShortDescription, setShortDescription, setSummary
Methods inherited from class de.grogra.pf.ui.autocomplete.impl.AbstractCompletion
compareTo, getAlreadyEntered, getCompareString, getIcon, getInputText, getProvider, getRelevance, setIcon, setRelevance
-
Constructor Details
-
VariableCompletion
Constructor.- Parameters:
provider
- The parent provider.name
- The name of this variable.type
- The type of this variable (e.g. "int
", "String
", etc.).
-
-
Method Details
-
addDefinitionString
-
getDefinitionString
Return the definition of this variable completion.- Returns:
- The definition string.
-
getDefinedIn
Returns where this variable is defined.- Returns:
- Where this variable is defined.
- See Also:
-
getName
Returns the name of this variable.- Returns:
- The name.
-
getSummary
Description copied from interface:Completion
Returns the description of this auto-complete choice. This can be used in a popup "description window."- Specified by:
getSummary
in interfaceCompletion
- Overrides:
getSummary
in classBasicCompletion
- Returns:
- This item's description. This should be HTML. It may be
null
if there is no description for this completion.
-
getToolTipText
Returns the tool tip text to display for mouse hovers over this completion.Note that for this functionality to be enabled, a
JTextComponent
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(JTextComponent, java.awt.Point)
.- Specified by:
getToolTipText
in interfaceCompletion
- Overrides:
getToolTipText
in classAbstractCompletion
- Returns:
- The tool tip text for this completion, or
null
if none.
-
getType
Returns the type of this variable.- Returns:
- The type.
-
possiblyAddDefinedIn
Adds some HTML describing where this variable is defined, if this information is known.- Parameters:
sb
- The buffer to append to.
-
possiblyAddDescription
Adds the description text as HTML to a buffer, if a description is defined.- Parameters:
sb
- The buffer to append to.- Returns:
- Whether there was a description to add.
-
setDefinedIn
Sets where this variable is defined.- Parameters:
definedIn
- Where this variable is defined.- See Also:
-
toString
Overridden to return the name of the variable being completed.- Overrides:
toString
in classBasicCompletion
- Returns:
- A string representation of this completion.
-