public class SimpleProcess
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
SimpleProcess()
Constructor.
|
SimpleProcess(SimpleProcess process)
Copy constructor.
|
SimpleProcess(java.lang.String[] cmd)
Creates an instance that can be used to start a subprocess.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Creates a clone instance of the process configuration.
|
protected java.lang.Object |
copyTo(java.lang.Object o) |
java.io.PipedInputStream |
duplicateErrorStream()
Returns a PipedInputStream which duplicates the error (System.err)
from the subprocess.
|
java.io.PipedInputStream |
duplicateOutputStream()
Returns a PipedInputStream which duplicates the output (System.out)
from the subprocess.
|
void |
exec()
Executes a separate subprocess.
|
int |
execAndWait()
Executes a separate subprocess and waits for the subprocess to
finish.
|
java.lang.Exception |
getExecException()
Gets the exception that occurred when starting the process.
|
RunProcess |
getRunProcess()
Gets the
RunProcess instance used by this process
configuration. |
void |
setAddToProcessesFolder(boolean addToProcessesFolder)
Specifies whether to add the subprocess to the processes folder
of the run manager.
|
void |
setAddToTerminateMenu(boolean addToTerminateMenu)
Specifies whether to list the subprocess in the Terminate submenu
of the Run menu.
|
void |
setAllowInput(boolean allowInput)
Sets whether the subprocess will allow input, which will be read
through some UI in the log window.
|
void |
setCommand(java.lang.String[] cmd)
Sets the command for the subprocess.
|
void |
setCommandStringForLog(java.lang.String commandStringForLog)
Specifies the command string that should be logged.
|
void |
setDoUILater()
Specifies that the simple process code should call
SwingUtilities.invokeLater instead of calling
SwingUtilities.invokeAndWait when/if it needs to do UI.
|
void |
setEnvironmentParams(java.lang.String[] environmentParams)
Sets the environment parameters for the subprocess.
|
void |
setIcon(javax.swing.Icon icon)
Sets the icon that will appear with the subprocess in the
processes folder of the run manager.
|
void |
setLabel(java.lang.String label)
Sets the label that will appear with the subprocess in the
processes folder of the run manager.
|
void |
setLogCommandString(boolean logCommandString)
Specifies whether to show the command string itself in the log
window.
|
void |
setLogPage(LogPage logPageOverride)
Sets the log page where the subprocess's output will be displayed.
|
void |
setLogStartDirectory(boolean logStartDirectory)
Specifies whether to show the start directory in the log
window.
|
void |
setRunProcessListener(RunProcessListener runProcessListener)
Specifies that a callback method should be called after the
subprocess has finished executing and all of the subprocess's
output has been sent to the log page.
|
void |
setShowStartStatus(boolean showStartStatus)
Specifies whether to show the start message in the status
bar.
|
void |
setSuppressDirectoryDefault()
Specifies that the simple process code should suppress defaulting of the
run process directory to the context project directory.
|
void |
setUseLogPage(boolean useLogPage)
Sets whether a log page will be used to print process information.
|
void |
setUseLogPageQuietly(boolean quiet)
Sets whether a log page will be used to print as silently as possible,
the log window will not be displayed if it is hidden and tab will not
be highlighted.
|
void |
setWorkingDirectory(java.io.File dir)
Sets the working directory for the subprocess.
|
public SimpleProcess()
public SimpleProcess(SimpleProcess process)
public SimpleProcess(java.lang.String[] cmd)
The subprocess inherits the working directory of the current
process, unless overridden by the
setWorkingDirectory(java.io.File)
method.
The label that will appear with the subprocess in the processes
folder of the run manager will be the zero-th argument of the
command array passed to the exec()
or execAndWait()
method, unless overridden by the setLabel(java.lang.String)
method.
The Swing default icon will appear with the subprocess in the
processes folder of the run manager, unless overridden by the
setIcon(javax.swing.Icon)
method.
A new log page will be created to display the subprocess's output,
unless overridden by the setLogPage(oracle.ide.log.LogPage)
method.
The start directory will be logged, unless overridden by the
setLogStartDirectory(boolean)
method.
The command string itself will be logged, unless overridden by the
setLogCommandString(boolean)
method.
To adjust or manipulate the command string that is logged,
use the setCommandStringForLog(java.lang.String)
method.
A start message will be shown in the status bar, unless overridden by the
setShowStartStatus(boolean)
method.
The subprocess will be added to the processes folder of the run
manager, unless overridden by the setAddToProcessesFolder(boolean)
method.
The subprocess will be listed in the Terminate submenu of the Run
menu, unless overridden by the setAddToTerminateMenu(boolean)
method.
cmd
- array containing the command to call and its arguments.protected java.lang.Object copyTo(java.lang.Object o)
public RunProcess getRunProcess()
RunProcess
instance used by this process
configuration.RunProcess
.public void setCommand(java.lang.String[] cmd)
cmd
- the command array.public void setEnvironmentParams(java.lang.String[] environmentParams)
environmentParams
- an array of strings, each element of which has
environment variable settings in format name=value, or null
if the subprocess should inherit the environment settings of the current
process.public void setUseLogPage(boolean useLogPage)
useLogPage
- if true, a log page will be used.public void setUseLogPageQuietly(boolean quiet)
quiet
- if true, a log page will be used quietly.public void setAllowInput(boolean allowInput)
allowInput
- if true, input will be read, otherwise, input
will not be read. Default value is false.public void setWorkingDirectory(java.io.File dir)
dir
- the working directory of the subprocess, or null if the
subprocess should inherit the working directory of the current
process.public void setLabel(java.lang.String label)
setLogPage(oracle.ide.log.LogPage)
method.label
- the labelpublic void setIcon(javax.swing.Icon icon)
setLogPage(oracle.ide.log.LogPage)
method.icon
- the iconpublic void setLogPage(LogPage logPageOverride)
logPage
- the log pagepublic void setLogStartDirectory(boolean logStartDirectory)
public void setLogCommandString(boolean logCommandString)
public void setCommandStringForLog(java.lang.String commandStringForLog)
public void setShowStartStatus(boolean showStartStatus)
public void setAddToProcessesFolder(boolean addToProcessesFolder)
public void setAddToTerminateMenu(boolean addToTerminateMenu)
public void setRunProcessListener(RunProcessListener runProcessListener)
runProcessListener
- the run process listenerpublic void setDoUILater()
public void setSuppressDirectoryDefault()
public java.io.PipedInputStream duplicateOutputStream()
public java.io.PipedInputStream duplicateErrorStream()
public void exec()
The standard output and error output streams are redirected to a page in the log window.
public int execAndWait()
The standard output and error output streams are redirected to a page in the log window.
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.Exception getExecException()
null
if no exception was thrown.