public interface CompletionProvider
AutoCompletion.Completion providers can have an optional parent. Parents are searched for completions when their children are. This allows for chaining of completion providers.
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clearParameterizedCompletionParams()
Clears the values used to identify and insert "parameterized completions"
(e.g. functions or methods).
|
java.lang.String |
getAlreadyEnteredText(javax.swing.text.JTextComponent comp)
Returns the text just before the current caret position that could be
the start of something auto-completable.
|
java.util.List<Completion> |
getCompletions(javax.swing.text.JTextComponent comp)
Gets the possible completions for the text component at the current
caret position.
|
java.util.List<Completion> |
getCompletionsAt(javax.swing.text.JTextComponent comp,
java.awt.Point p)
Returns the completions that have been entered at the specified visual
location.
|
javax.swing.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.
|
java.util.List<ParameterizedCompletion> |
getParameterizedCompletions(javax.swing.text.JTextComponent tc)
Returns a list of parameterized completions that have been entered
at the current caret position of a text component (and thus can have
their completion choices displayed).
|
char |
getParameterListEnd()
Returns the text that marks the end of a list of parameters to a
function or method.
|
java.lang.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(javax.swing.text.JTextComponent tc)
This method is called if auto-activation is enabled in the parent
AutoCompletion after the user types a single character. |
void |
setListCellRenderer(javax.swing.ListCellRenderer r)
Sets the renderer to use when displaying completion choices.
|
void |
setParameterizedCompletionParams(char listStart,
java.lang.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.
|
void clearParameterizedCompletionParams()
java.lang.String getAlreadyEnteredText(javax.swing.text.JTextComponent comp)
comp - The text component.null means nothing
should be auto-completed; a value of an empty string
("") means auto-completion should still be
considered (i.e., all possible choices are valid).java.util.List<Completion> getCompletions(javax.swing.text.JTextComponent comp)
comp - The text component.Completions. If no completions are
available, this may be null.java.util.List<Completion> getCompletionsAt(javax.swing.text.JTextComponent comp, java.awt.Point p)
comp - The text component.p - The position, usually from a MouseEvent.javax.swing.ListCellRenderer getListCellRenderer()
null if the default should
be used.setListCellRenderer(ListCellRenderer)ParameterChoicesProvider getParameterChoicesProvider()
null if
none is installed.java.util.List<ParameterizedCompletion> getParameterizedCompletions(javax.swing.text.JTextComponent tc)
tc - The text component.ParameterizedCompletions. If no completions
are available, this may be null.char getParameterListEnd()
)'.getParameterListStart(),
getParameterListSeparator(),
setParameterizedCompletionParams(char, String, char)java.lang.String getParameterListSeparator()
, ".getParameterListStart(),
getParameterListEnd(),
setParameterizedCompletionParams(char, String, char)char getParameterListStart()
(".getParameterListEnd(),
getParameterListSeparator(),
setParameterizedCompletionParams(char, String, char)CompletionProvider getParent()
setParent(CompletionProvider)boolean isAutoActivateOkay(javax.swing.text.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 '.'.tc - The text component.void setListCellRenderer(javax.swing.ListCellRenderer r)
r - The renderer to use.getListCellRenderer()void setParameterizedCompletionParams(char listStart,
java.lang.String separator,
char listEnd)
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.java.lang.IllegalArgumentException - If either listStart or
listEnd is not printable ASCII, or if
separator is null or an empty string.clearParameterizedCompletionParams()void setParent(CompletionProvider parent)
parent - The parent provider. null means there will
be no parent provider.getParent()