Package org.fife.ui.autocomplete
Class VariableCompletion
- java.lang.Object
-
- org.fife.ui.autocomplete.AbstractCompletion
-
- org.fife.ui.autocomplete.BasicCompletion
-
- org.fife.ui.autocomplete.VariableCompletion
-
- All Implemented Interfaces:
java.lang.Comparable<Completion>,Completion
- Direct Known Subclasses:
FunctionCompletion
public class VariableCompletion extends BasicCompletion
A completion for a variable (or constant) in a programming language.This completion type uses its
shortDescriptionproperty as part of its summary returned bygetSummary(); for this reason, it may be a little longer (even much longer), if desired, than what is recommended forBasicCompletions (where theshortDescriptionis used intoString()forListCellRenderers).- Version:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description VariableCompletion(CompletionProvider provider, java.lang.String name, java.lang.String type)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDefinitionString(java.lang.StringBuilder sb)java.lang.StringgetDefinedIn()Returns where this variable is defined.java.lang.StringgetDefinitionString()Return the definition of this variable completion.java.lang.StringgetName()Returns the name of this variable.java.lang.StringgetSummary()Returns the description of this auto-complete choice.java.lang.StringgetToolTipText()Returns the tool tip text to display for mouse hovers over this completion.java.lang.StringgetType()Returns the type of this variable.protected voidpossiblyAddDefinedIn(java.lang.StringBuilder sb)Adds some HTML describing where this variable is defined, if this information is known.protected booleanpossiblyAddDescription(java.lang.StringBuilder sb)Adds the description text as HTML to a buffer, if a description is defined.voidsetDefinedIn(java.lang.String definedIn)Sets where this variable is defined.java.lang.StringtoString()Overridden to return the name of the variable being completed.-
Methods inherited from class org.fife.ui.autocomplete.BasicCompletion
getReplacementText, getShortDescription, setShortDescription, setSummary
-
Methods inherited from class org.fife.ui.autocomplete.AbstractCompletion
compareTo, getAlreadyEntered, getIcon, getInputText, getProvider, getRelevance, setIcon, setRelevance
-
-
-
-
Constructor Detail
-
VariableCompletion
public VariableCompletion(CompletionProvider provider, java.lang.String name, java.lang.String type)
Constructor.- Parameters:
provider- The parent provider.name- The name of this variable.type- The type of this variable (e.g. "int", "String", etc.).
-
-
Method Detail
-
addDefinitionString
protected void addDefinitionString(java.lang.StringBuilder sb)
-
getDefinitionString
public java.lang.String getDefinitionString()
Return the definition of this variable completion.- Returns:
- The definition string.
-
getDefinedIn
public java.lang.String getDefinedIn()
Returns where this variable is defined.- Returns:
- Where this variable is defined.
- See Also:
setDefinedIn(String)
-
getName
public java.lang.String getName()
Returns the name of this variable.- Returns:
- The name.
-
getSummary
public java.lang.String getSummary()
Description copied from interface:CompletionReturns the description of this auto-complete choice. This can be used in a popup "description window."- Specified by:
getSummaryin interfaceCompletion- Overrides:
getSummaryin classBasicCompletion- Returns:
- This item's description. This should be HTML. It may be
nullif there is no description for this completion.
-
getToolTipText
public java.lang.String getToolTipText()
Returns the tool tip text to display for mouse hovers over this completion.Note that for this functionality to be enabled, a
JTextComponentmust 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.ToolTipSupplierthat calls intoCompletionProvider.getCompletionsAt(JTextComponent, java.awt.Point).- Specified by:
getToolTipTextin interfaceCompletion- Overrides:
getToolTipTextin classAbstractCompletion- Returns:
- The tool tip text for this completion, or
nullif none.
-
getType
public java.lang.String getType()
Returns the type of this variable.- Returns:
- The type.
-
possiblyAddDefinedIn
protected void possiblyAddDefinedIn(java.lang.StringBuilder sb)
Adds some HTML describing where this variable is defined, if this information is known.- Parameters:
sb- The buffer to append to.
-
possiblyAddDescription
protected boolean possiblyAddDescription(java.lang.StringBuilder sb)
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
public void setDefinedIn(java.lang.String definedIn)
Sets where this variable is defined.- Parameters:
definedIn- Where this variable is defined.- See Also:
getDefinedIn()
-
toString
public java.lang.String toString()
Overridden to return the name of the variable being completed.- Overrides:
toStringin classBasicCompletion- Returns:
- A string representation of this completion.
-
-