|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.ide.runner.RunProcess
An abstract class that represents a process that can be run in some way.
Field Summary | |
protected boolean |
addToProcessesFolder
Whether this process should be added to the Run Manager's process folder |
protected boolean |
addToTerminateMenu
Whether a terminate menu for this process should be add to the Run Terminate menu. |
protected boolean |
allowInput
Whether the user wants to allow input to be sent to the process. |
protected Context |
context
The Context that is associated with this process. |
protected boolean |
determineTargetAndStarterAlready
Whether the target Node and Starter have already
been determined. |
protected java.util.List |
errors
The list of errors that occurred when trying to start the process. |
protected java.lang.String |
labelOverride
The label to use instead of the normal label. |
protected boolean |
logCommandString
Whether the command string should be logged. |
protected boolean |
logError
Whether standard error from the process should be logged. |
protected boolean |
logExit
Whether to log a message when the process exits. |
protected boolean |
logOutput
Whether standard output from the process should be logged. |
protected boolean |
logStartDirectory
Whether the start directory should be logged. |
protected RunProcessListener |
runProcessListener
The RunProcessListener for this process. |
protected boolean |
showStartStatus
Whether to show a start status message in the status bar. |
protected Starter |
starter
The starter for this RunProcess. |
protected Node |
target
The target for this RunProcess. |
protected long |
timeCreated
The time this RunProcess was created. |
protected boolean |
useLogPage
Whether a log page should be used to print process information. |
protected boolean |
userCanceled
|
Constructor Summary | |
RunProcess(Context context)
The constructor simply initializes the fields of this RunProcess. |
Method Summary | |
java.lang.String |
canGetStarterForTarget(Node node,
java.lang.Class starterFactorySubClass,
java.util.List errors)
Tests whether the given node is runnable. |
boolean |
canStart()
Tests whether this process can be started. |
boolean |
canTerminate()
Tests whether this RunProcess can be terminated. |
protected boolean |
checkStarter(Starter starter,
java.util.List errors)
Returns whether the given starter can really be used to start a process. |
protected java.lang.Object |
copyTo(java.lang.Object o)
|
protected void |
determineTargetAndStarter()
Determines what should be the target and starter for this process. |
protected void |
determineTargetAndStarter(java.lang.Class starterFactorySubClass)
Determines what should be the target and starter for this process. |
void |
doubleClicked()
This method is called when this process is double clicked in the run manager navigator. |
protected void |
doUI(java.lang.Runnable r)
Uses either SwingUtilities.invokeLater(java.lang.Runnable) or
SwingUtilities.invokeAndWait(java.lang.Runnable) to invoke the
Runnable . |
boolean |
doUILater()
Returns whether SwingUtilities.invokeLater(java.lang.Runnable) should be used to do
UI, instead of SwingUtilities.invokeAndWait(java.lang.Runnable) . |
java.io.PipedInputStream |
duplicateErrorStream()
Returns a PipedInputStream which duplicates the error (System.err) from this process. |
java.io.PipedInputStream |
duplicateOutputStream()
Returns a PipedInputStream which duplicates the output (System.out) from this process. |
void |
finished()
This method will be called by the Starter, when this process finishes. |
protected java.lang.String |
fixCommandStringForLog(java.lang.String[] command)
Returns a the command string for display purposes. |
Attributes |
getAttributes()
Returns a this Element 's Attributes . |
java.util.Iterator |
getChildren()
Gets the children of this RunProcess element. |
Context |
getContext()
Returns the Context that is associated with this RunProcess. |
static Document |
getContextDocumentForRun(Context context)
Returns the Document for the given Context. |
java.lang.Object |
getData()
Gets the data object that implements this interface. |
HelpInfo |
getHelpInfo()
Returns the help info to be used when the user presses F1 in the log page for this run process. |
javax.swing.Icon |
getIcon()
Gets the Icon for this RunProcess element. |
LogPage |
getLogPage()
Returns the LogPage for this process. |
LogPage |
getLogPage(boolean create)
|
java.lang.String |
getLongLabel()
Gets a fully qualified label for display purpose. |
abstract java.lang.String |
getProcessLabelPrefix()
Returns the prefix that will be used in the short and long labels for this RunProcess. |
IdeLayout |
getProcessLayout()
Returns the layout that should be shown when this process is selected in the run manager navigator. |
Project |
getProject()
Returns the Project associated with the RunProcess. |
static Project |
getProject(Context context)
|
RunnableItem[] |
getRunnableItems()
|
protected RunnableItem[] |
getRunnableItemsForTarget(Node node,
java.lang.Class starterFactorySubClass)
|
java.lang.String |
getShortLabel()
Gets a short label for display purpose. |
java.lang.String |
getShortLabelWithPrefix()
Returns a short label containing the process label prefix, for display purposes. |
java.lang.String[] |
getStartCommand()
Returns the command line that will be executed to start the process. |
java.io.File |
getStartDirectory()
Returns the directory that should be used as the working directory of this process, or null if this process should inherit the working directory of the current process. |
java.lang.String[] |
getStartEnvironmentParams()
Returns the environment parameters that are defined for this process. |
Starter |
getStarter()
Returns the Starter that will be used to start this
process. |
protected java.lang.Class |
getStarterFactorySubClass()
|
protected Starter |
getStarterForTarget(Node node,
java.lang.Class starterFactorySubClass)
Tests whether the given node is runnable and returns the starter that can start the process. |
static javax.swing.text.SimpleAttributeSet |
getSystemErrAttributeSet()
|
static javax.swing.text.SimpleAttributeSet |
getSystemOutAttributeSet()
|
Node |
getTarget()
Returns the target. |
long |
getTimeCreated()
Returns the time this RunProcess was created. |
java.lang.String |
getToolTipText()
Gets the tool tip for this RunProcess element |
protected boolean |
getUseLogPage()
Returns whether a log page will be used to print process information. |
Workspace |
getWorkspace()
Returns the Workspace associated with the RunProcess. |
boolean |
hasFinished()
Tests whether this process has finished. |
void |
log(java.lang.Object msg)
Display the specified msg in the log window. |
void |
logCommandString(java.lang.String[] command)
If logCommandString is true , the command
string is displayed in the log window. |
void |
logStartDirectory()
If logStartDirectory is true , the start
directory is displayed in the log window. |
protected void |
logStartErrors()
|
protected LogPage |
makeLogPage(boolean create)
Creates the RunLogPage for this process. |
boolean |
mayHaveChildren()
Tests if this RunProcess element may contain children. |
protected boolean |
mustPrepareToStart()
Calls the Starter.mustPrepareToStart() method. |
protected boolean |
prepareToStart()
Calls the Starter.prepareToStart() method. |
void |
redirectInput(java.io.OutputStream input)
This method will be called by the Starter, if the Starter captured standard input for this process. |
void |
redirectOutput(java.io.InputStream systemOutStream,
java.io.InputStream systemErrStream)
This method will be called by the Starter, if the Starter captured standard output/error for this process. |
protected boolean |
reuseLogPage(RunLogPage runLogPage)
Returns true if the specified RunLogPage should be reused
for this RunProcess. |
void |
selected()
This method is called when this process is selected in the run manager navigator. |
void |
setLabelOverride(java.lang.String labelOverride)
Explicitly sets the string to be shown as the display name of the running process in the run manager. |
boolean |
showStartStatus()
Returns whether a start message should be shown in the status bar. |
void |
start()
Causes this process to begin execution. |
void |
start(Node node,
AbstractStarterFactory abstractStarterFactory,
java.lang.Object cookie)
|
void |
started()
This method will be called by the start method, when this process has been started. |
protected boolean |
startTarget()
Determines the target Node and Starter for this
RunProcess and if successful, calls the Starter.start()
method. |
void |
terminate()
Terminates this process. |
java.lang.String |
toString()
Returns the short label for this RunProcess. |
void |
unselected()
This method is called when this process is unselected in the run manager navigator. |
void |
waitForRedirectOutput()
This call waits until the threads that are redirecting output (System.out and System.err) have processed all output available so far. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected long timeCreated
protected Context context
protected boolean logStartDirectory
protected boolean logCommandString
protected boolean logOutput
protected boolean allowInput
protected boolean logError
protected boolean logExit
protected boolean showStartStatus
protected boolean addToProcessesFolder
protected boolean addToTerminateMenu
protected boolean useLogPage
protected RunProcessListener runProcessListener
RunProcessListener
for this process.
The runProcessListener can be null.
protected boolean userCanceled
protected java.util.List errors
Each StarterFactory
can add errors to the list.
If we are not able to start the process, the errors are displayed
in the log window.
If we are able to start the process, the errors are not displayed.
protected boolean determineTargetAndStarterAlready
Node
and Starter
have already
been determined.
protected java.lang.String labelOverride
protected Node target
protected Starter starter
Constructor Detail |
public RunProcess(Context context)
context
- the context to be associated with this RunProcessMethod Detail |
protected java.lang.Object copyTo(java.lang.Object o)
public java.io.PipedInputStream duplicateOutputStream()
public java.io.PipedInputStream duplicateErrorStream()
protected java.lang.Class getStarterFactorySubClass()
protected void determineTargetAndStarter()
Checks to see if the context document is runnable.
public static Document getContextDocumentForRun(Context context)
protected void determineTargetAndStarter(java.lang.Class starterFactorySubClass)
Checks to see if the context document is runnable.
starterFactorySubClass
- the chosen StarterFactory
must extend this classprotected Starter getStarterForTarget(Node node, java.lang.Class starterFactorySubClass)
If any registered starters claim that they can start this process with the given node as the target, then this method returns the starter.
node
- the targetstarterFactorySubClass
- the chosen StarterFactory
must extend this class
Starter
if the node is runnable, null otherwisepublic RunnableItem[] getRunnableItems()
protected RunnableItem[] getRunnableItemsForTarget(Node node, java.lang.Class starterFactorySubClass)
public java.lang.String canGetStarterForTarget(Node node, java.lang.Class starterFactorySubClass, java.util.List errors)
If any registered starter factory claims that it can start this process with the given node as the target, then this method returns the name of that starter factory.
node
- the targetstarterFactorySubClass
- the chosen StarterFactory
must extend this class
¶m errors the list of errors showing why the node may not be runnable
protected boolean checkStarter(Starter starter, java.util.List errors)
public long getTimeCreated()
public Context getContext()
Context
that is associated with this RunProcess.
public Workspace getWorkspace()
Workspace
associated with the RunProcess.
public Project getProject()
Project
associated with the RunProcess.
public static Project getProject(Context context)
public Node getTarget()
public Starter getStarter()
Starter
that will be used to start this
process.
public boolean canStart()
true
if the process can be startedpublic void start(Node node, AbstractStarterFactory abstractStarterFactory, java.lang.Object cookie)
public void start()
If the process can not be started, error messages will be logged.
protected boolean mustPrepareToStart()
Starter.mustPrepareToStart()
method.
This method is called on the event thread.
protected boolean prepareToStart()
Starter.prepareToStart()
method.
This method is called on a non-event thread.
protected boolean startTarget()
Node
and Starter
for this
RunProcess and if successful, calls the Starter.start()
method.
If the Starter
can not be determined, all errors in the
errors
list are displayed in the log window.
true
if the process was startedprotected void logStartErrors()
public void started()
If the start method was not used to start the process, then this method should be called when the process has been started.
This method adds the process to the processes folder in the run manager navigator and if this process can be terminated, it adds a terminate menu item to the Run Terminate submenu.
public void redirectOutput(java.io.InputStream systemOutStream, java.io.InputStream systemErrStream)
This method will create two LogOutputThread threads to redirect System.out and System.err to the log page.
public static javax.swing.text.SimpleAttributeSet getSystemOutAttributeSet()
public static javax.swing.text.SimpleAttributeSet getSystemErrAttributeSet()
public void redirectInput(java.io.OutputStream input)
input
- the standard inputpublic void waitForRedirectOutput()
If this method is called on the AWT event dispatching thread, it does nothing.
public java.lang.String[] getStartEnvironmentParams()
The default implementation returns null.
public java.io.File getStartDirectory()
The default implementation returns null.
public void logStartDirectory()
logStartDirectory
is true
, the start
directory is displayed in the log window.
public java.lang.String[] getStartCommand()
The default implementation returns null. Subclasses should
either override this method or ensure that the
Starter.getStartCommand()
method is
overridden.
public void logCommandString(java.lang.String[] command)
logCommandString
is true
, the command
string is displayed in the log window.
protected java.lang.String fixCommandStringForLog(java.lang.String[] command)
public boolean showStartStatus()
true
if the message should be shown.protected boolean getUseLogPage()
true
if a log page will be used.public LogPage getLogPage()
Creates the LogPage if necessary.
public LogPage getLogPage(boolean create)
protected LogPage makeLogPage(boolean create)
RunLogPage
for this process.
protected boolean reuseLogPage(RunLogPage runLogPage)
RunLogPage
should be reused
for this RunProcess.
First, the Starter.reuseLogPage(oracle.ide.runner.RunLogPage)
is called,
in case the Starter wants to overide the default behavior.
The default behavior is to reuse the page if the previous process is not still alive, and the name, workspace, project, icon, tooltip, titleName, and helpInfo match.
public void log(java.lang.Object msg)
msg
in the log window.
msg
- the message to display.public boolean doUILater()
SwingUtilities.invokeLater(java.lang.Runnable)
should be used to do
UI, instead of SwingUtilities.invokeAndWait(java.lang.Runnable)
.
protected void doUI(java.lang.Runnable r)
SwingUtilities.invokeLater(java.lang.Runnable)
or
SwingUtilities.invokeAndWait(java.lang.Runnable)
to invoke the
Runnable
.
public abstract java.lang.String getProcessLabelPrefix()
public IdeLayout getProcessLayout()
public void selected()
The implementation of this method should not change layouts. Changing layouts based on what process is selected in the run manager navigator should be accomplished by returning the appropriate layout from the getProcessLayout method.
public void doubleClicked()
public void unselected()
public boolean canTerminate()
true
if this RunProcess can be
terminated.public void terminate()
public boolean hasFinished()
true
if this process has finishedpublic void finished()
If the start method was not used to start the process, then this method should be called when the process finishes.
This method removes the process from the processes folder in the run manager navigator and removes the terminate menu, if a terminate menu item was added to the Run Terminate submenu for this process.
public void setLabelOverride(java.lang.String labelOverride)
public java.lang.String getShortLabelWithPrefix()
public java.lang.String getShortLabel()
getShortLabel
in interface Displayable
public java.lang.String getLongLabel()
getLongLabel
in interface Displayable
public java.lang.Object getData()
getData
in interface Data
public javax.swing.Icon getIcon()
getIcon
in interface Displayable
public java.lang.String getToolTipText()
The default implementation returns the long label.
getToolTipText
in interface Displayable
public boolean mayHaveChildren()
The implementation of this method returns false; a RunProcess may not have children.
mayHaveChildren
in interface Element
public java.util.Iterator getChildren()
The implementation of this method returns null; a RunProcess element may not have children.
getChildren
in interface Element
public Attributes getAttributes()
Element
's Attributes
. This class does not
define any attributes.
getAttributes
in interface Element
public HelpInfo getHelpInfo()
getHelpInfo
in interface Helpable
public java.lang.String toString()
toString
in interface Displayable
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.