public abstract class CompletionProviderBase extends Object implements CompletionProvider
AbstractCompletionProvider
Modifier and Type | Field and Description |
---|---|
protected static String |
EMPTY_STRING |
Constructor and Description |
---|
CompletionProviderBase() |
Modifier and Type | Method and Description |
---|---|
void |
clearParameterizedCompletionParams()
Clears the values used to identify and insert "parameterized completions"
(e.g. functions or methods).
|
List<Completion> |
getCompletions(JTextComponent comp)
Gets the possible completions for the text component at the current
caret position.
|
protected abstract List<Completion> |
getCompletionsImpl(JTextComponent comp)
Does the dirty work of creating a list of completions.
|
ListCellRenderer |
getListCellRenderer()
Returns the cell renderer for completions returned from this provider.
|
ParameterChoicesProvider |
getParameterChoicesProvider()
Returns an object that can return a list of completion choices for
parameters.
|
char |
getParameterListEnd()
Returns the text that marks the end of a list of parameters to a
function or method.
|
String |
getParameterListSeparator()
Returns the text that separates parameters to a function or method.
|
char |
getParameterListStart()
Returns the text that marks the start of a list of parameters to a
function or method.
|
CompletionProvider |
getParent()
Returns the parent completion provider.
|
boolean |
isAutoActivateOkay(JTextComponent tc)
This method is called if auto-activation is enabled in the parent
AutoCompletion after the user types a single character. |
void |
setAutoActivationRules(boolean letters,
String others)
Sets the characters that auto-activation should occur after.
|
void |
setListCellRenderer(ListCellRenderer r)
Sets the renderer to use when displaying completion choices.
|
void |
setParameterChoicesProvider(ParameterChoicesProvider pcp)
Sets the param choices provider.
|
void |
setParameterizedCompletionParams(char listStart,
String separator,
char listEnd)
Sets the values used to identify and insert "parameterized completions"
(e.g. functions or methods).
|
void |
setParent(CompletionProvider parent)
Sets the parent completion provider.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAlreadyEnteredText, getCompletionsAt, getParameterizedCompletions
protected static final String EMPTY_STRING
public void clearParameterizedCompletionParams()
clearParameterizedCompletionParams
in interface CompletionProvider
CompletionProvider.setParameterizedCompletionParams(char, String, char)
public List<Completion> getCompletions(JTextComponent comp)
getCompletions
in interface CompletionProvider
comp
- The text component.Completion
s. If no completions are
available, this may be null
.protected abstract List<Completion> getCompletionsImpl(JTextComponent comp)
comp
- The text component to look in.public ListCellRenderer getListCellRenderer()
getListCellRenderer
in interface CompletionProvider
null
if the default should
be used.CompletionProvider.setListCellRenderer(ListCellRenderer)
public ParameterChoicesProvider getParameterChoicesProvider()
getParameterChoicesProvider
in interface CompletionProvider
null
if
none is installed.public char getParameterListEnd()
getParameterListEnd
in interface CompletionProvider
)
'.CompletionProvider.getParameterListStart()
,
CompletionProvider.getParameterListSeparator()
,
CompletionProvider.setParameterizedCompletionParams(char, String, char)
public String getParameterListSeparator()
getParameterListSeparator
in interface CompletionProvider
,
".CompletionProvider.getParameterListStart()
,
CompletionProvider.getParameterListEnd()
,
CompletionProvider.setParameterizedCompletionParams(char, String, char)
public char getParameterListStart()
getParameterListStart
in interface CompletionProvider
(
".CompletionProvider.getParameterListEnd()
,
CompletionProvider.getParameterListSeparator()
,
CompletionProvider.setParameterizedCompletionParams(char, String, char)
public CompletionProvider getParent()
getParent
in interface CompletionProvider
CompletionProvider.setParent(CompletionProvider)
public boolean isAutoActivateOkay(JTextComponent tc)
AutoCompletion
after the user types a single character. This
provider should check the text at the current caret position of the
text component, and decide whether auto-activation would be appropriate
here. For example, a CompletionProvider
for Java might
want to return true
for this method only if the last
character typed was a '.
'.isAutoActivateOkay
in interface CompletionProvider
tc
- The text component.public void setAutoActivationRules(boolean letters, String others)
others
to ".
", to allow auto-activation for members of an object.letters
- Whether auto-activation should occur after any letter.others
- A string of (non-letter) chars that auto-activation should
occur after. This may be null
.public void setParameterChoicesProvider(ParameterChoicesProvider pcp)
pcp
- The parameter choices provider, or null
for
none.getParameterChoicesProvider()
public void setListCellRenderer(ListCellRenderer r)
setListCellRenderer
in interface CompletionProvider
r
- The renderer to use.CompletionProvider.getListCellRenderer()
public void setParameterizedCompletionParams(char listStart, String separator, char listEnd)
setParameterizedCompletionParams
in interface CompletionProvider
listStart
- The character that marks the beginning of a list of
parameters, such as '(' in C or Java.separator
- Text that should separate parameters in a parameter
list when one is inserted. For example, ", ".listEnd
- The character that marks the end of a list of parameters,
such as ')' in C or Java.CompletionProvider.clearParameterizedCompletionParams()
public void setParent(CompletionProvider parent)
setParent
in interface CompletionProvider
parent
- The parent provider. null
means there will
be no parent provider.CompletionProvider.getParent()