|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectconsole.Shell
public abstract class Shell
Console has a single dockable window, which can contain multiple Shells. Each Shell is named, and executes commands in a different language, and can be selected via a JComboBox in the upper left corner of the Console.
By default, each Console has two shells: A SystemShell and a BeanShell. Each of these shells was defined in services.xml, which looks like this:
<SERVICES> <SERVICE CLASS="console.Shell" NAME="System"> new console.SystemShell(); </SERVICE> <SERVICE CLASS="console.Shell" NAME="BeanShell"> new console.ConsoleBeanShell(); </SERVICE> </SERVICES>
To define a new Shell for your own plugin extend from this class, and return an instance of it from the beanshell code in services.xml.
Because it is a service, it is a singleton instance, shared by all for all Views and Console instances, and created only once while the plugin is loaded.
Nested Class Summary | |
---|---|
static class |
Shell.CompletionInfo
|
static class |
Shell.ShellAction
All ShellActions select a named Shell. |
static class |
Shell.SwitchAction
A SwitchAction selects a shell and makes Console visible. |
static class |
Shell.ToggleAction
A ToggleAction is a ShellAction which also toggles the visibility of the Console. |
Field Summary | |
---|---|
static java.lang.String |
SERVICE
|
Constructor Summary | |
---|---|
Shell(java.lang.String name)
|
Method Summary | |
---|---|
void |
closeConsole(Console console)
Called when a Console dockable is closed. |
void |
detach(Console console)
Detaches the currently running process. |
void |
endOfFile(Console console)
Sends an end of file. |
void |
execute(Console console,
java.lang.String command,
Output output)
A convenience function - you do not override this method. |
abstract void |
execute(Console console,
java.lang.String input,
Output output,
Output error,
java.lang.String command)
Executes a command. |
Shell.CompletionInfo |
getCompletions(Console console,
java.lang.String command)
Returns possible completions for the specified command. |
java.lang.String |
getName()
Returns the name of the shell. |
static Shell |
getShell(java.lang.String name)
Returns the shell with the specified name |
static java.lang.String[] |
getShellNames()
Returns an array of all registered shells. |
void |
openConsole(Console console)
Called when a Console dockable first selects this shell. |
void |
printInfoMessage(Output output)
Prints a 'info' message to the specified console. |
void |
printPrompt(Console console,
Output output)
Prints a prompt to the specified console. |
static void |
registerShell(Shell shell)
Deprecated. Write a services.xml file instead. |
void |
stop(Console console)
Stops the currently executing command, if any. |
java.lang.String |
toString()
Returns the name of the shell. |
static void |
unregisterShell(Shell shell)
Deprecated. Write a services.xml file instead. |
boolean |
waitFor(Console console)
Waits until any currently executing commands finish. |
void |
waitUntilDone()
Deprecated. - see waitFor(Console) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SERVICE
Constructor Detail |
---|
public Shell(java.lang.String name)
Method Detail |
---|
public static void registerShell(Shell shell)
services.xml
file instead.
public static void unregisterShell(Shell shell)
services.xml
file instead.
public static java.lang.String[] getShellNames()
public static Shell getShell(java.lang.String name)
name
- The shell name. Common values are:
"System", "BeanShell", "Factor", "Ant", "Python", etc....public void openConsole(Console console)
public void closeConsole(Console console)
public void printInfoMessage(Output output)
output
- The outputpublic void printPrompt(Console console, Output output)
console
- The console instanceoutput
- The outputpublic abstract void execute(Console console, java.lang.String input, Output output, Output error, java.lang.String command)
console
- The Console instance, to distinguish it from others when there are
multiple View or Console instances.input
- optional string to feed into the command's Standard inputoutput
- Standard output - the destination to send outputerror
- Standard error - the destionation to send error messagescommand
- The commandpublic final void execute(Console console, java.lang.String command, Output output)
public void waitUntilDone()
public void stop(Console console)
console
- the same Console instance that was passed to execute()public boolean waitFor(Console console)
console
- the same Console instance that was passed to execute()
public void endOfFile(Console console)
console
- the same Console instance that was passed to execute()public void detach(Console console)
console
- the same Console instance that was passed to execute()public Shell.CompletionInfo getCompletions(Console console, java.lang.String command)
console
- The console instancecommand
- The commandpublic java.lang.String getName()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |