org.fife.ui.autocomplete
Interface Completion

All Known Subinterfaces:
ParameterizedCompletion
All Known Implementing Classes:
AbstractCompletion, FunctionCompletion

public interface Completion

Represents a completion choice. A CompletionProvider returns lists of objects implementing this interface. A Completion contains the following information:

Version:
1.0
Author:
Robert Futrell
See Also:
AbstractCompletion

Method Summary
 java.lang.String getAlreadyEntered(javax.swing.text.JTextComponent comp)
          Returns the portion of this completion that has already been entered into the text component.
 java.lang.String getInputText()
          Returns the text that the user has to (start) typing for this completion to be offered.
 CompletionProvider getProvider()
          Returns the provider that returned this completion.
 java.lang.String getReplacementText()
          Returns the text to insert as the result of this auto-completion.
 java.lang.String getSummary()
          Returns the description of this auto-complete choice.
 java.lang.String getToolTipText()
          Returns the tool tip text to display for mouse hovers over this completion.
 

Method Detail

getAlreadyEntered

public java.lang.String getAlreadyEntered(javax.swing.text.JTextComponent comp)
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.

getInputText

public java.lang.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 as getReplacementText(), 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:
getReplacementText()

getProvider

public CompletionProvider getProvider()
Returns the provider that returned this completion.

Returns:
The provider.

getReplacementText

public java.lang.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:
getInputText()

getSummary

public java.lang.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

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 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).

Returns:
The tool tip text for this completion, or null if none.