console
Class SystemShell

java.lang.Object
  extended by console.Shell
      extended by console.SystemShell

public class SystemShell
extends Shell

A SystemShell is shared across all instances of Console. It has own environment (variables), and executes system statements in a shell which resembles in terms of user interface, something that is a cross between the Windows "cmd.exe" and the Linux bash shell, so it should be easy to use for both. It manages a mapping of Console to ConsoleState objects, where the ConsoleState manages the actual ConsoleProcess and the state of that shell. When SystemShell executes something, the process itself is started indirectly by ProcessRunner.exec().

Author:
1999, 2005 Slava Pestov, 2006, 2007 Alan Ezust

Nested Class Summary
 
Nested classes/interfaces inherited from class console.Shell
Shell.CompletionInfo, Shell.ShellAction, Shell.SwitchAction, Shell.ToggleAction
 
Field Summary
 
Fields inherited from class console.Shell
SERVICE
 
Constructor Summary
SystemShell()
           
 
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 input, Output output, Output error, java.lang.String command)
          Executes a command.
 void executeBuiltIn(Console console, Output output, Output error, java.lang.String command, java.util.Vector args)
           
 java.util.Hashtable<java.lang.String,java.lang.String> getAliases()
           
 Shell.CompletionInfo getCompletions(Console console, java.lang.String command)
          Returns possible completions for the specified command.
 java.lang.String getVariableValue(org.gjt.sp.jedit.View view, java.lang.String varName)
           
 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.
 void stop(Console console)
          Stops the currently executing command, if any.
 boolean waitFor(Console console)
          Waits for currently running Console processes to finish execution.
 
Methods inherited from class console.Shell
execute, getName, getShell, getShellNames, registerShell, toString, unregisterShell, waitUntilDone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SystemShell

public SystemShell()
Method Detail

openConsole

public void openConsole(Console console)
Called when a Console dockable first selects this shell.

Overrides:
openConsole in class Shell
Since:
Console 4.0.2

closeConsole

public void closeConsole(Console console)
Called when a Console dockable is closed.

Overrides:
closeConsole in class Shell
Since:
Console 4.0.2

printInfoMessage

public void printInfoMessage(Output output)
Description copied from class: Shell
Prints a 'info' message to the specified console.

Overrides:
printInfoMessage in class Shell
Parameters:
output - The output

printPrompt

public void printPrompt(Console console,
                        Output output)
Prints a prompt to the specified console.

Overrides:
printPrompt in class Shell
Parameters:
output - The output
console - The console instance

executeBuiltIn

public void executeBuiltIn(Console console,
                           Output output,
                           Output error,
                           java.lang.String command,
                           java.util.Vector args)

execute

public void execute(Console console,
                    java.lang.String input,
                    Output output,
                    Output error,
                    java.lang.String command)
Description copied from class: Shell
Executes a command. Override this abstract method in custom derived classes.

Specified by:
execute in class Shell
Parameters:
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 input
output - Standard output - the destination to send output
error - Standard error - the destionation to send error messages
command - The command

stop

public void stop(Console console)
Description copied from class: Shell
Stops the currently executing command, if any. When the user clicks the "stop" button on the console, this method is called.

Overrides:
stop in class Shell
Parameters:
console - the same Console instance that was passed to execute()

waitFor

public boolean waitFor(Console console)
Waits for currently running Console processes to finish execution.

Overrides:
waitFor in class Shell
Parameters:
console - the same Console instance that was passed to execute()
Returns:
true if all was successful (i.e. the error status code was 0)

endOfFile

public void endOfFile(Console console)
Sends an end of file.

Overrides:
endOfFile in class Shell
Parameters:
console - The console

detach

public void detach(Console console)
Detaches the currently running process.

Overrides:
detach in class Shell
Parameters:
console - The console

getCompletions

public Shell.CompletionInfo getCompletions(Console console,
                                           java.lang.String command)
Returns possible completions for the specified command.

Overrides:
getCompletions in class Shell
Parameters:
console - The console instance
command - The command
Since:
Console 3.6

getVariableValue

public java.lang.String getVariableValue(org.gjt.sp.jedit.View view,
                                         java.lang.String varName)

getAliases

public java.util.Hashtable<java.lang.String,java.lang.String> getAliases()