Package org.eclipse.debug.core.model
Class RuntimeProcess
java.lang.Object
org.eclipse.core.runtime.PlatformObject
org.eclipse.debug.core.model.RuntimeProcess
- All Implemented Interfaces:
IAdaptable,IProcess,ITerminate
Standard implementation of an
IProcess that wrappers a system
process (java.lang.Process).
Clients may subclass this class. Clients that need to replace the implementation
of a streams proxy associated with an IProcess should subclass this
class. Generally clients should not instantiate this class directly, but should
instead call DebugPlugin.newProcess(...), which can delegate to an
IProcessFactory if one is referenced by the associated launch configuration.
- Since:
- 3.0
- See Also:
-
Field Summary
Fields inherited from interface org.eclipse.debug.core.model.IProcess
ATTR_CMDLINE, ATTR_PROCESS_ID, ATTR_PROCESS_LABEL, ATTR_PROCESS_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns whether this element can be terminated.protected IStreamsProxyCreates and returns the streams proxy associated with this process.protected voidFires a change event.protected voidFires a creation event.protected voidfireEvent(DebugEvent event) Fires the given debug event.protected voidFires a terminate event.<T> TgetAdapter(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.getAttribute(String key) Returns the value of a client defined attribute.intReturns the exit value of this process.getLabel()Returns a human-readable label for this process.Returns the launch this element originated from.Returns a proxy to the standard input, output, and error streams for this process, ornullif not supported.protected ProcessReturns the underlying system process associated with this process.booleanReturns whether this element is terminated.voidsetAttribute(String key, String value) Sets the value of a client defined attribute.protected voidSets the launch this process is contained inprotected voidCalled after notification that this runtime process is created to start the reading of streams.voidCauses this element to terminate, generating aTERMINATEevent.protected voidNotification that the system process associated with this process has terminated.
-
Constructor Details
-
RuntimeProcess
Constructs a RuntimeProcess on the given system process with the given name, adding this process to the given launch.- Parameters:
launch- the parent launch of this processprocess- underlying system processname- the label used for this processattributes- map of attributes used to initialize the attributes of this process, ornullif none
-
-
Method Details
-
startStreams
protected void startStreams()Called after notification that this runtime process is created to start the reading of streams. Must be overridden if a customIStreamsProxyinstance is provided bycreateStreamsProxy()that do not extendsStreamsProxyand does not start the stream reading in any other mean.- Since:
- 3.23
-
canTerminate
public boolean canTerminate()Description copied from interface:ITerminateReturns whether this element can be terminated.- Specified by:
canTerminatein interfaceITerminate- Returns:
- whether this element can be terminated
- See Also:
-
getLabel
Description copied from interface:IProcessReturns a human-readable label for this process. -
setLaunch
Sets the launch this process is contained in- Parameters:
launch- the launch this process is contained in
-
getLaunch
Description copied from interface:IProcessReturns the launch this element originated from. -
getSystemProcess
Returns the underlying system process associated with this process.- Returns:
- system process
-
isTerminated
public boolean isTerminated()Description copied from interface:ITerminateReturns whether this element is terminated.- Specified by:
isTerminatedin interfaceITerminate- Returns:
- whether this element is terminated
- See Also:
-
terminate
Description copied from interface:ITerminateCauses this element to terminate, generating aTERMINATEevent. Implementations may be blocking or non-blocking.- Specified by:
terminatein interfaceITerminate- Throws:
DebugException- on failure. Reasons include:- TARGET_REQUEST_FAILED - The request failed in the target
- NOT_SUPPORTED - The capability is not supported by the target
- See Also:
-
terminated
protected void terminated()Notification that the system process associated with this process has terminated. -
getStreamsProxy
Description copied from interface:IProcessReturns a proxy to the standard input, output, and error streams for this process, ornullif not supported.- Specified by:
getStreamsProxyin interfaceIProcess- Returns:
- a streams proxy, or
nullif not supported - See Also:
-
createStreamsProxy
Creates and returns the streams proxy associated with this process.- Returns:
- streams proxy
-
fireCreationEvent
protected void fireCreationEvent()Fires a creation event. -
fireEvent
Fires the given debug event.- Parameters:
event- debug event to fire
-
fireTerminateEvent
protected void fireTerminateEvent()Fires a terminate event. -
fireChangeEvent
protected void fireChangeEvent()Fires a change event. -
setAttribute
Description copied from interface:IProcessSets the value of a client defined attribute.- Specified by:
setAttributein interfaceIProcess- Parameters:
key- the attribute keyvalue- the attribute value- See Also:
-
getAttribute
Description copied from interface:IProcessReturns the value of a client defined attribute.- Specified by:
getAttributein interfaceIProcess- Parameters:
key- the attribute key- Returns:
- value the String attribute value, or
nullif undefined - See Also:
-
getAdapter
Description copied from class:PlatformObjectReturns an object which is an instance of the given class associated with this object. Returnsnullif no such object can be found.This implementation of the method declared by
IAdaptablepasses the request along to the platform's adapter manager; roughlyPlatform.getAdapterManager().getAdapter(this, adapter). Subclasses may override this method (however, if they do so, they should invoke the method on their superclass to ensure that the Platform's adapter manager is consulted).- Specified by:
getAdapterin interfaceIAdaptable- Overrides:
getAdapterin classPlatformObject- Type Parameters:
T- the class type- Parameters:
adapter- the class to adapt to- Returns:
- the adapted object or
null - See Also:
-
getExitValue
Description copied from interface:IProcessReturns the exit value of this process. Conventionally, 0 indicates normal termination.- Specified by:
getExitValuein interfaceIProcess- Returns:
- the exit value of this process
- Throws:
DebugException- if this process has not yet terminated- See Also:
-