|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fife.ui.autocomplete.CompletionProviderBase
org.fife.ui.autocomplete.AbstractCompletionProvider
org.fife.ui.autocomplete.DefaultCompletionProvider
public class DefaultCompletionProvider
A basic completion provider implementation. This provider has no understanding of language semantics. It simply checks the text entered up to the caret position for a match against known completions. This is all that is needed in the majority of cases.
| Field Summary | |
|---|---|
protected Segment |
seg
|
| Fields inherited from class org.fife.ui.autocomplete.AbstractCompletionProvider |
|---|
comparator, completions |
| Fields inherited from class org.fife.ui.autocomplete.CompletionProviderBase |
|---|
EMPTY_STRING |
| Constructor Summary | |
|---|---|
DefaultCompletionProvider()
Constructor. |
|
DefaultCompletionProvider(String[] words)
Creates a completion provider that provides completion for a simple list of words. |
|
| Method Summary | |
|---|---|
String |
getAlreadyEnteredText(JTextComponent comp)
Returns the text just before the current caret position that could be the start of something auto-completable. |
List |
getCompletionsAt(JTextComponent tc,
Point p)
Returns the completions that have been entered at the specified visual location. |
List |
getParameterizedCompletions(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). |
protected void |
init()
Initializes this completion provider. |
protected boolean |
isValidChar(char ch)
Returns whether the specified character is valid in an auto-completion. |
void |
loadFromXML(File file)
Loads completions from an XML file. |
void |
loadFromXML(InputStream in)
Loads completions from an XML input stream. |
void |
loadFromXML(InputStream in,
ClassLoader cl)
Loads completions from an XML input stream. |
void |
loadFromXML(String resource)
Loads completions from an XML file. |
| Methods inherited from class org.fife.ui.autocomplete.AbstractCompletionProvider |
|---|
addCompletion, addCompletions, addWordCompletions, checkProviderAndAdd, clear, getCompletionByInputText, getCompletionsImpl, removeCompletion |
| Methods inherited from class org.fife.ui.autocomplete.CompletionProviderBase |
|---|
clearParameterizedCompletionParams, getCompletions, getListCellRenderer, getParameterChoicesProvider, getParameterListEnd, getParameterListSeparator, getParameterListStart, getParent, isAutoActivateOkay, setAutoActivationRules, setListCellRenderer, setParameterChoicesProvider, setParameterizedCompletionParams, setParent |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Segment seg
| Constructor Detail |
|---|
public DefaultCompletionProvider()
AbstractCompletionProvider.addCompletion(Completion)public DefaultCompletionProvider(String[] words)
words - The words to offer as completion suggestions. If this is
null, no completions will be known.BasicCompletion| Method Detail |
|---|
public String getAlreadyEnteredText(JTextComponent comp)
This method returns all characters before the caret that are matched
by isValidChar(char).
Returns the text just before the current caret position that could be
the start of something auto-completable.
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 List getCompletionsAt(JTextComponent tc,
Point p)
tc - The text component.p - The position, usually from a MouseEvent.
public List getParameterizedCompletions(JTextComponent tc)
tc - The text component.
ParameterizedCompletions. If no completions
are available, this may be null.protected void init()
protected boolean isValidChar(char ch)
Character.isLetterOrDigit(ch) || ch=='_'". Subclasses
can override this method to change what characters are matched.
ch - The character.
public void loadFromXML(File file)
throws IOException
file - An XML file to load from.
IOException - If an IO error occurs.
public void loadFromXML(InputStream in)
throws IOException
in - The input stream to read from.
IOException - If an IO error occurs.
public void loadFromXML(InputStream in,
ClassLoader cl)
throws IOException
in - The input stream to read from.cl - The class loader to use when loading any extra classes defined
in the XML, such as custom FunctionCompletions. This
may be null if the default is to be used, or if no
custom completions are defined in the XML.
IOException - If an IO error occurs.
public void loadFromXML(String resource)
throws IOException
resource - A resource the current ClassLoader can get to.
IOException - If an IO error occurs.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||