Class DebugMonitor
java.lang.Object
org.eclipse.emf.mwe.internal.core.debug.processing.DebugMonitor
- All Implemented Interfaces:
ProgressMonitor
The heart of the debug process on the runtime side. It has callback methods that are called by the syntax element
implementations before and after a process step.
It works closely together with handlers and adapters that must be registered at startup.
It works closely together with handlers and adapters that must be registered at startup.
-
Field Summary
Fields inherited from interface org.eclipse.emf.mwe.core.monitor.ProgressMonitor
UNKNOWN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAdapter
(ElementAdapter adapter) void
addEventHandler
(EventHandler handler) void
addProcessHandler
(ProcessHandler handler) void
Notifies that the main task is beginning.void
void
done()
Notifies that the work is done; that is, either the main task is completed or the user canceled it.void
fire the finish events to the registered event handlersgetAdapter
(Object element) void
init
(int port) void
open the connection to a debug server framework (e.g.void
internalWorked
(double work) Internal method to handle scaling correctly.boolean
Returns whether cancelation of current operation has been requested.void
inform the handlers about the finalization of a process step.
In case the process may suspend at the end of a syntax element it does so if requested.void
the main method to manipulate the runtime process for debugging.
In case a suspension is requested it stops the process and waits for the next user command.void
setBlocked
(org.eclipse.emf.common.util.Diagnostic reason) void
setCanceled
(boolean value) Sets the cancel state to the given value.void
setCommandListener
(CommandListener commandListener) void
setTaskName
(String name) Sets the task name to the given value.void
fire the STARTED event to the registered event handlersvoid
Notifies that a subtask of the main task is beginning.void
uninit()
Closes the connection.void
worked
(int work) Notifies that a given number of work unit of the main task has been completed.
-
Constructor Details
-
DebugMonitor
public DebugMonitor()
-
-
Method Details
-
init
open the connection to a debug server framework (e.g. eclipse) and instantiate and start the RuntimeHandlerManager listener.- Parameters:
args
- arg[1] must be the port to be connected with- Throws:
IOException
-
init
- Throws:
IOException
-
uninit
public void uninit()Closes the connection. This releases the threads used for debugging and execution and releases memory. -
setCommandListener
-
addProcessHandler
-
addEventHandler
-
addAdapter
-
getAdapter
-
started
fire the STARTED event to the registered event handlers- Specified by:
started
in interfaceProgressMonitor
- Parameters:
element
- The element that fired that notificationcontext
- the context of execution- See Also:
-
preTask
the main method to manipulate the runtime process for debugging.
In case a suspension is requested it stops the process and waits for the next user command.- Specified by:
preTask
in interfaceProgressMonitor
- Parameters:
element
- The element that fired that notificationcontext
- the context of execution- See Also:
-
postTask
inform the handlers about the finalization of a process step.
In case the process may suspend at the end of a syntax element it does so if requested.- Specified by:
postTask
in interfaceProgressMonitor
- Parameters:
element
- The element that fired that notificationcontext
- the context of execution- See Also:
-
finished
fire the finish events to the registered event handlers- Specified by:
finished
in interfaceProgressMonitor
- Parameters:
element
- The element that fired that notificationcontext
- the context of execution- See Also:
-
beginTask
Description copied from interface:ProgressMonitor
Notifies that the main task is beginning. This must only be called once on a given progress monitor instance.- Specified by:
beginTask
in interfaceProgressMonitor
- Parameters:
name
- the name (or description) of the main tasktotalWork
- the total number of work units into which the main task is been subdivided. If the value isUNKNOWN
the implemenation is free to indicate progress in a way which doesn't require the total number of work units in advance.
-
done
public void done()Description copied from interface:ProgressMonitor
Notifies that the work is done; that is, either the main task is completed or the user canceled it. This method may be called more than once (implementations should be prepared to handle this case).- Specified by:
done
in interfaceProgressMonitor
-
internalWorked
public void internalWorked(double work) Description copied from interface:ProgressMonitor
Internal method to handle scaling correctly. This method must not be called by a client. Clients should always use the methodworked(int)
.- Specified by:
internalWorked
in interfaceProgressMonitor
- Parameters:
work
- the amount of work done
-
isCanceled
public boolean isCanceled()Description copied from interface:ProgressMonitor
Returns whether cancelation of current operation has been requested. Long-running operations should poll to see if cancelation has been requested.- Specified by:
isCanceled
in interfaceProgressMonitor
- Returns:
true
if cancellation has been requested, andfalse
otherwise- See Also:
-
setCanceled
public void setCanceled(boolean value) Description copied from interface:ProgressMonitor
Sets the cancel state to the given value.- Specified by:
setCanceled
in interfaceProgressMonitor
- Parameters:
value
-true
indicates that cancelation has been requested (but not necessarily acknowledged);false
clears this flag- See Also:
-
setTaskName
Description copied from interface:ProgressMonitor
Sets the task name to the given value. This method is used to restore the task label after a nested operation was executed. Normally there is no need for clients to call this method.- Specified by:
setTaskName
in interfaceProgressMonitor
- Parameters:
name
- the name (or description) of the main task- See Also:
-
subTask
Description copied from interface:ProgressMonitor
Notifies that a subtask of the main task is beginning. Subtasks are optional; the main task might not have subtasks.- Specified by:
subTask
in interfaceProgressMonitor
- Parameters:
name
- the name (or description) of the subtask
-
worked
public void worked(int work) Description copied from interface:ProgressMonitor
Notifies that a given number of work unit of the main task has been completed. Note that this amount represents an installment, as opposed to a cumulative amount of work done to date.- Specified by:
worked
in interfaceProgressMonitor
- Parameters:
work
- the number of work units just completed
-
clearBlocked
public void clearBlocked() -
setBlocked
public void setBlocked(org.eclipse.emf.common.util.Diagnostic reason)
-