|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.fife.ui.autocomplete.CompletionProviderBase org.fife.ui.autocomplete.LanguageAwareCompletionProvider
public class LanguageAwareCompletionProvider
A completion provider for the C programming language (and other languages with similar syntax). This provider simply delegates to another provider, depending on whether the caret is in:
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).
Field Summary |
---|
Fields inherited from class org.fife.ui.autocomplete.CompletionProviderBase |
---|
EMPTY_STRING |
Constructor Summary | |
---|---|
protected |
LanguageAwareCompletionProvider()
Constructor subclasses can use when they don't have their default provider created at construction time. |
|
LanguageAwareCompletionProvider(CompletionProvider defaultProvider)
Constructor. |
Method Summary | |
---|---|
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. 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 '. '. |
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. |
Methods inherited from class org.fife.ui.autocomplete.CompletionProviderBase |
---|
getCompletions, getListCellRenderer, getParameterChoicesProvider, getParent, setAutoActivationRules, setListCellRenderer, setParameterChoicesProvider, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected 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
.Method Detail |
---|
public void clearParameterizedCompletionParams()
UnsupportedOperationException
being thrown. To set the
parameter completion parameters, do so on the provider returned by
getDefaultCompletionProvider()
.
clearParameterizedCompletionParams
in interface CompletionProvider
clearParameterizedCompletionParams
in class CompletionProviderBase
java.lang.UnsupportedOperationException
- Always.setParameterizedCompletionParams(char, String, char)
public java.lang.String getAlreadyEnteredText(javax.swing.text.JTextComponent comp)
getAlreadyEnteredText
in interface CompletionProvider
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).public CompletionProvider getCommentCompletionProvider()
setCommentCompletionProvider(CompletionProvider)
public java.util.List<Completion> getCompletionsAt(javax.swing.text.JTextComponent tc, java.awt.Point p)
getCompletionsAt
in interface CompletionProvider
tc
- The text component.p
- The position, usually from a MouseEvent.
protected java.util.List<Completion> getCompletionsImpl(javax.swing.text.JTextComponent comp)
getCompletionsImpl
in class CompletionProviderBase
comp
- 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
in interface CompletionProvider
tc
- The text component.
ParameterizedCompletion
s. If no completions
are available, this may be null
.public char getParameterListEnd()
getParameterListEnd
in interface CompletionProvider
getParameterListEnd
in class CompletionProviderBase
)
'.CompletionProvider.getParameterListStart()
,
CompletionProvider.getParameterListSeparator()
,
CompletionProvider.setParameterizedCompletionParams(char, String, char)
public java.lang.String getParameterListSeparator()
getParameterListSeparator
in interface CompletionProvider
getParameterListSeparator
in class CompletionProviderBase
,
".CompletionProvider.getParameterListStart()
,
CompletionProvider.getParameterListEnd()
,
CompletionProvider.setParameterizedCompletionParams(char, String, char)
public char getParameterListStart()
getParameterListStart
in interface CompletionProvider
getParameterListStart
in class 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
in interface CompletionProvider
isAutoActivateOkay
in class CompletionProviderBase
tc
- 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
in interface CompletionProvider
setParameterizedCompletionParams
in class CompletionProviderBase
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.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
in interface ToolTipSupplier
textArea
- The text area.e
- The mouse event.
null
if none.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |