Package org.fife.ui.autocomplete
Class FunctionCompletion
- java.lang.Object
-
- org.fife.ui.autocomplete.AbstractCompletion
-
- org.fife.ui.autocomplete.BasicCompletion
-
- org.fife.ui.autocomplete.VariableCompletion
-
- org.fife.ui.autocomplete.FunctionCompletion
-
- All Implemented Interfaces:
Comparable<Completion>,Completion,ParameterizedCompletion
public class FunctionCompletion extends VariableCompletion implements ParameterizedCompletion
A completion choice representing a function.- Version:
- 1.0
- Author:
- Robert Futrell
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.fife.ui.autocomplete.ParameterizedCompletion
ParameterizedCompletion.Parameter
-
-
Constructor Summary
Constructors Constructor Description FunctionCompletion(CompletionProvider provider, String name, String returnType)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDefinitionString(StringBuilder sb)protected voidaddParameters(StringBuilder sb)Adds HTML describing the parameters to this function to a buffer.StringgetDefinitionString()Returns the "definition string" for this function completion.org.fife.ui.autocomplete.ParameterizedCompletionInsertionInfogetInsertionInfo(JTextComponent tc, boolean replaceTabsWithSpaces)ParameterizedCompletion.ParametergetParam(int index)Returns the specifiedParameterizedCompletion.Parameter.intgetParamCount()Returns the number of parameters to this function.StringgetReturnValueDescription()Returns the description of the return value of this function.booleangetShowParameterToolTip()Returns whether a tool tip displaying assistance for each parameter while it is being edited is appropriate for this completion.StringgetSummary()Returns the description of this auto-complete choice.StringgetToolTipText()Returns the tool tip text to display for mouse hovers over this completion.voidsetParams(List<ParameterizedCompletion.Parameter> params)Sets the parameters to this function.voidsetReturnValueDescription(String desc)Sets the description of the return value of this function.-
Methods inherited from class org.fife.ui.autocomplete.VariableCompletion
getDefinedIn, getName, getType, possiblyAddDefinedIn, possiblyAddDescription, setDefinedIn, toString
-
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.fife.ui.autocomplete.Completion
compareTo, getAlreadyEntered, getIcon, getInputText, getProvider, getRelevance, getReplacementText
-
-
-
-
Constructor Detail
-
FunctionCompletion
public FunctionCompletion(CompletionProvider provider, String name, String returnType)
Constructor.- Parameters:
provider- The parent provider.name- The name of this function.returnType- The return type of this function.
-
-
Method Detail
-
addDefinitionString
protected void addDefinitionString(StringBuilder sb)
- Overrides:
addDefinitionStringin classVariableCompletion
-
addParameters
protected void addParameters(StringBuilder sb)
Adds HTML describing the parameters to this function to a buffer.- Parameters:
sb- The buffer to append to.
-
getDefinitionString
public String getDefinitionString()
Returns the "definition string" for this function completion. For example, for the C "printf" function, this would return "int printf(const char *, ...)".- Specified by:
getDefinitionStringin interfaceParameterizedCompletion- Overrides:
getDefinitionStringin classVariableCompletion- Returns:
- The definition string.
-
getInsertionInfo
public org.fife.ui.autocomplete.ParameterizedCompletionInsertionInfo getInsertionInfo(JTextComponent tc, boolean replaceTabsWithSpaces)
- Specified by:
getInsertionInfoin interfaceParameterizedCompletion
-
getParam
public ParameterizedCompletion.Parameter getParam(int index)
Returns the specifiedParameterizedCompletion.Parameter.- Specified by:
getParamin interfaceParameterizedCompletion- Parameters:
index- The index of the parameter to retrieve.- Returns:
- The parameter.
- See Also:
ParameterizedCompletion.getParamCount()
-
getParamCount
public int getParamCount()
Returns the number of parameters to this function.- Specified by:
getParamCountin interfaceParameterizedCompletion- Returns:
- The number of parameters to this function.
- See Also:
getParam(int)
-
getShowParameterToolTip
public boolean getShowParameterToolTip()
Returns whether a tool tip displaying assistance for each parameter while it is being edited is appropriate for this completion.- Specified by:
getShowParameterToolTipin interfaceParameterizedCompletion- Returns:
- Whether the tool tip is appropriate to display.
-
getReturnValueDescription
public String getReturnValueDescription()
Returns the description of the return value of this function.- Returns:
- The description, or
nullif there is none. - See Also:
setReturnValueDescription(String)
-
getSummary
public String getSummary()
Returns the description of this auto-complete choice. This can be used in a popup "description window."- Specified by:
getSummaryin interfaceCompletion- Overrides:
getSummaryin classVariableCompletion- Returns:
- This item's description. This should be HTML. It may be
nullif there is no description for this completion.
-
getToolTipText
public String 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 the ToolTipManager, and the text component must know to search for this value. In the case of an RSyntaxTextArea, this can be done with a org.fife.ui.rtextarea.ToolTipSupplier that calls into
CompletionProvider.getCompletionsAt(JTextComponent, java.awt.Point).- Specified by:
getToolTipTextin interfaceCompletion- Overrides:
getToolTipTextin classVariableCompletion- Returns:
- The tool tip text for this completion, or
nullif none.
-
setParams
public void setParams(List<ParameterizedCompletion.Parameter> params)
Sets the parameters to this function.- Parameters:
params- The parameters. This should be a list ofParameterizedCompletion.Parameters.- See Also:
getParam(int),getParamCount()
-
setReturnValueDescription
public void setReturnValueDescription(String desc)
Sets the description of the return value of this function.- Parameters:
desc- The description.- See Also:
getReturnValueDescription()
-
-