Class CommandRuntimeHandler
java.lang.Object
org.eclipse.emf.mwe.internal.core.debug.processing.handlers.CommandRuntimeHandler
- All Implemented Interfaces:
Runnable
,EventHandler
,CommandListener
,ProcessHandler
,RuntimeHandler
public class CommandRuntimeHandler
extends Object
implements RuntimeHandler, CommandListener, ProcessHandler, EventHandler, Runnable
This class handles the communication of debug commands on the runtime side.
It listens in an extra thread for commands and sets state values accordingly.
The
The
The
It listens in an extra thread for commands and sets state values accordingly.
The
DebugMonitor
uses this class to react according to the
process state settings when it needs to.The
ICommandListener
and IProcessHandler
methods
are the active ones that communicate with the debug server.The
IEventHandler
methods react only internally on events.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from interface org.eclipse.emf.mwe.core.debug.processing.EventHandler
END_FRAME, NORMAL_FRAME
Fields inherited from interface org.eclipse.emf.mwe.internal.core.debug.processing.ProcessHandler
INTERRUPT, POP, PUSH, SHALL_HANDLE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
init
(DebugMonitor monitor, Connection connection) initiate the instantiated handler.boolean
the CommandRuntimeHandler shall have the last callvoid
listen for the next regular process command.void
decrement the iteration levelvoid
increment the iteration levelvoid
resumed()
no contribution herevoid
run()
boolean
shallHandle
(boolean lastState, Object element, int flag) ask the suitable element adapter if the element shall be handled.boolean
shallInterrupt
(boolean lastState) return true in case of a user's terminate event or if the socket connection is no longer openboolean
shallSuspend
(boolean lastState, Object element, int flag) return true in case of a user's suspend request or dependend on the current iteration level.void
started()
no contribution herevoid
start the listening process in an extra thread, if requiredvoid
reset a potential forceSuspend requestvoid
no contribution here
-
Field Details
-
STEP_INTO
public static final int STEP_INTO- See Also:
-
STEP_OVER
public static final int STEP_OVER- See Also:
-
STEP_RETURN
public static final int STEP_RETURN- See Also:
-
RESUME
public static final int RESUME- See Also:
-
SUSPEND
public static final int SUSPEND- See Also:
-
TERMINATE
public static final int TERMINATE- See Also:
-
-
Constructor Details
-
CommandRuntimeHandler
public CommandRuntimeHandler()
-
-
Method Details
-
init
Description copied from interface:RuntimeHandler
initiate the instantiated handler. It gets theDebugMonitor
andConnection
instances that may be needed for the handler to do it's work
the handler may be registered at theDebugMonitor
dependent on the type of handler.- Specified by:
init
in interfaceRuntimeHandler
- Parameters:
monitor
- the DebugMonitorconnection
- the connection to the debugger framework- See Also:
-
startListener
public void startListener()Description copied from interface:RuntimeHandler
start the listening process in an extra thread, if required- Specified by:
startListener
in interfaceRuntimeHandler
- See Also:
-
run
public void run() -
isLastCall
public boolean isLastCall()the CommandRuntimeHandler shall have the last call- Specified by:
isLastCall
in interfaceProcessHandler
- Returns:
- whether or not
- See Also:
-
shallHandle
ask the suitable element adapter if the element shall be handled. Remember that information for the pop call.- Specified by:
shallHandle
in interfaceProcessHandler
- Parameters:
lastState
- the consolidated decisions of previously asked listenerselement
- the element that is questionedflag
- one of the valuesIProcessHandler.PUSH
orIProcessHandler.POP
- Returns:
- true if element shall be handled
- See Also:
-
shallSuspend
return true in case of a user's suspend request or dependend on the current iteration level.- Specified by:
shallSuspend
in interfaceProcessHandler
- Parameters:
lastState
- the consolidated decisions of previously asked listenerselement
- the element that is questionedflag
- one of the valuesIEventHandler.NORMAL_FRAME
orIEventHandler.END_FRAME
- Returns:
- if the process shall suspend based on the last state and the evaluation of the current element
- See Also:
-
shallInterrupt
public boolean shallInterrupt(boolean lastState) return true in case of a user's terminate event or if the socket connection is no longer open- Specified by:
shallInterrupt
in interfaceProcessHandler
- Parameters:
lastState
- the consolidated decisions of previously asked listeners- Returns:
- if the process shall be interrupted based on the last state and the evaluation of the current element
- See Also:
-
started
public void started()no contribution here- Specified by:
started
in interfaceEventHandler
- See Also:
-
preTask
increment the iteration level- Specified by:
preTask
in interfaceEventHandler
- See Also:
-
postTask
decrement the iteration level- Specified by:
postTask
in interfaceEventHandler
- See Also:
-
suspended
public void suspended()reset a potential forceSuspend request- Specified by:
suspended
in interfaceEventHandler
- See Also:
-
resumed
public void resumed()no contribution here- Specified by:
resumed
in interfaceEventHandler
- See Also:
-
terminated
public void terminated()no contribution here- Specified by:
terminated
in interfaceEventHandler
- See Also:
-
listenCommand
public void listenCommand()Description copied from interface:CommandListener
listen for the next regular process command. This method could be a long running one that waits until the user starts the next debug action.- Specified by:
listenCommand
in interfaceCommandListener
-