public class LanguageAwareCompletionProvider extends CompletionProviderBase implements ToolTipSupplier
This provider also implements the
org.fife.ui.rtextarea.ToolTipSupplier interface, which allows it
to display tooltips for completion choices. Thus the standard
VariableCompletion and FunctionCompletion completions should
be able to display tooltips with the variable declaration or function
definition (provided the RSyntaxTextArea was registered with the
javax.swing.ToolTipManager).
EMPTY_STRING| 限定符 | 构造器和说明 |
|---|---|
protected |
LanguageAwareCompletionProvider()
Constructor subclasses can use when they don't have their default
provider created at construction time.
|
|
LanguageAwareCompletionProvider(CompletionProvider defaultProvider)
Constructor.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clearParameterizedCompletionParams()
Calling this method will result in an
UnsupportedOperationException being thrown. |
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.
|
CompletionProvider |
getCommentCompletionProvider()
Returns the completion provider to use for comments.
|
java.util.List<Completion> |
getCompletionsAt(javax.swing.text.JTextComponent tc,
java.awt.Point p)
Returns the completions that have been entered at the specified visual
location.
|
protected java.util.List<Completion> |
getCompletionsImpl(javax.swing.text.JTextComponent comp)
Does the dirty work of creating a list of completions.
|
CompletionProvider |
getDefaultCompletionProvider()
Returns the completion provider used when one isn't defined for a
particular token type.
|
CompletionProvider |
getDocCommentCompletionProvider()
Returns the completion provider to use for documentation comments.
|
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 |
getStringCompletionProvider()
Returns the completion provider to use for strings.
|
java.lang.String |
getToolTipText(RTextArea textArea,
java.awt.event.MouseEvent e)
Returns the tool tip to display for a mouse event.
|
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 |
setCommentCompletionProvider(CompletionProvider provider)
Sets the comment completion provider.
|
void |
setDefaultCompletionProvider(CompletionProvider provider)
Sets the default completion provider.
|
void |
setDocCommentCompletionProvider(CompletionProvider provider)
Sets the documentation comment completion provider.
|
void |
setParameterizedCompletionParams(char listStart,
java.lang.String separator,
char listEnd)
Calling this method will result in an
UnsupportedOperationException being thrown. |
void |
setStringCompletionProvider(CompletionProvider provider)
Sets the completion provider to use while in a string.
|
getCompletions, getListCellRenderer, getParameterChoicesProvider, getParent, setAutoActivationRules, setListCellRenderer, setParameterChoicesProvider, setParentprotected LanguageAwareCompletionProvider()
setDefaultCompletionProvider(CompletionProvider) in this
constructor.public LanguageAwareCompletionProvider(CompletionProvider defaultProvider)
defaultProvider - The provider to use when no provider is assigned
to a particular token type. This cannot be null.public void clearParameterizedCompletionParams()
UnsupportedOperationException being thrown. To set the
parameter completion parameters, do so on the provider returned by
getDefaultCompletionProvider().clearParameterizedCompletionParams 在接口中 CompletionProviderclearParameterizedCompletionParams 在类中 CompletionProviderBasejava.lang.UnsupportedOperationException - Always.setParameterizedCompletionParams(char, String, char)public java.lang.String getAlreadyEnteredText(javax.swing.text.JTextComponent comp)
getAlreadyEnteredText 在接口中 CompletionProvidercomp - 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).public CompletionProvider getCommentCompletionProvider()
setCommentCompletionProvider(CompletionProvider)public java.util.List<Completion> getCompletionsAt(javax.swing.text.JTextComponent tc, java.awt.Point p)
getCompletionsAt 在接口中 CompletionProvidertc - The text component.p - The position, usually from a MouseEvent.protected java.util.List<Completion> getCompletionsImpl(javax.swing.text.JTextComponent comp)
getCompletionsImpl 在类中 CompletionProviderBasecomp - The text component to look in.public CompletionProvider getDefaultCompletionProvider()
setDefaultCompletionProvider(CompletionProvider)public CompletionProvider getDocCommentCompletionProvider()
setDocCommentCompletionProvider(CompletionProvider)public java.util.List<ParameterizedCompletion> getParameterizedCompletions(javax.swing.text.JTextComponent tc)
getParameterizedCompletions 在接口中 CompletionProvidertc - The text component.ParameterizedCompletions. If no completions
are available, this may be null.public char getParameterListEnd()
getParameterListEnd 在接口中 CompletionProvidergetParameterListEnd 在类中 CompletionProviderBase)'.CompletionProvider.getParameterListStart(),
CompletionProvider.getParameterListSeparator(),
CompletionProvider.setParameterizedCompletionParams(char, String, char)public java.lang.String getParameterListSeparator()
getParameterListSeparator 在接口中 CompletionProvidergetParameterListSeparator 在类中 CompletionProviderBase, ".CompletionProvider.getParameterListStart(),
CompletionProvider.getParameterListEnd(),
CompletionProvider.setParameterizedCompletionParams(char, String, char)public char getParameterListStart()
getParameterListStart 在接口中 CompletionProvidergetParameterListStart 在类中 CompletionProviderBase(".CompletionProvider.getParameterListEnd(),
CompletionProvider.getParameterListSeparator(),
CompletionProvider.setParameterizedCompletionParams(char, String, char)public CompletionProvider getStringCompletionProvider()
setStringCompletionProvider(CompletionProvider)public 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 '.'.isAutoActivateOkay 在接口中 CompletionProviderisAutoActivateOkay 在类中 CompletionProviderBasetc - The text component.public void setCommentCompletionProvider(CompletionProvider provider)
provider - The provider to use in comments.getCommentCompletionProvider()public void setDefaultCompletionProvider(CompletionProvider provider)
provider - The provider to use when no provider is assigned to a
particular token type. This cannot be null.getDefaultCompletionProvider()public void setDocCommentCompletionProvider(CompletionProvider provider)
provider - The provider to use in comments.getDocCommentCompletionProvider()public void setParameterizedCompletionParams(char listStart,
java.lang.String separator,
char listEnd)
UnsupportedOperationException being thrown. To set the
parameter completion parameters, do so on the provider returned by
getDefaultCompletionProvider().setParameterizedCompletionParams 在接口中 CompletionProvidersetParameterizedCompletionParams 在类中 CompletionProviderBaselistStart - 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.UnsupportedOperationException - Always.clearParameterizedCompletionParams()public void setStringCompletionProvider(CompletionProvider provider)
provider - The provider to use.getStringCompletionProvider()public java.lang.String getToolTipText(RTextArea textArea, java.awt.event.MouseEvent e)
For this method to be called, the RSyntaxTextArea must be registered with the javax.swing.ToolTipManager like so:
ToolTipManager.sharedInstance().registerComponent(textArea);
getToolTipText 在接口中 ToolTipSuppliertextArea - The text area.e - The mouse event.null if none.