|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.controller.console.CommandCompletor
Command completor utility: allow to complete a String
from a
given list of keywords and from the file sytem.
This code has been inspired by the BeanShell Java Scripting project (http://www.beanshell.org/) by Patrick Niemeyer (pat@pat.net).
Field Summary | |
private java.lang.String[] |
toBeFound
List of keywords to look for. |
Constructor Summary | |
CommandCompletor()
Creates a new CommandCompletor instance with no list of
keywords to look for. |
|
CommandCompletor(java.lang.String[] keywords)
Creates a new CommandCompletor instance with a given list of
keywords to look for. |
Method Summary | |
private void |
addFileNames(java.util.List found,
java.lang.String part)
Adds the eventual file names corresponding to the given part to complete to the given list. |
java.lang.String[] |
complete(java.lang.String part)
Returns an array containing a String element of the maximum
unambiguous command completion or, if there is no common prefix, returns
the list of ambiguous commands. |
private void |
searchFiles(java.util.List found,
java.io.File dir,
java.lang.String part)
Searchs and adds to the given list the file names corresponding to the given part to complete. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private java.lang.String[] toBeFound
Constructor Detail |
public CommandCompletor()
CommandCompletor
instance with no list of
keywords to look for.
public CommandCompletor(java.lang.String[] keywords)
CommandCompletor
instance with a given list of
keywords to look for.
keywords
- the given list of keywords.Method Detail |
public java.lang.String[] complete(java.lang.String part)
CommandCompletorInterface
String
element of the maximum
unambiguous command completion or, if there is no common prefix, returns
the list of ambiguous commands.
complete
in interface CommandCompletorInterface
part
- the String
to complete.
String[]
instance.CommandCompletorInterface.complete(java.lang.String)
private void addFileNames(java.util.List found, java.lang.String part)
found
- the List
.part
- the String
to complete.private void searchFiles(java.util.List found, java.io.File dir, java.lang.String part)
found
- the completion List
.dir
- the directory where to search the files.part
- the String
to complete.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |