java.lang.Object
org.eclipse.emf.mwe.internal.core.debug.processing.DebugMonitor
All Implemented Interfaces:
ProgressMonitor

public class DebugMonitor extends Object implements 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.
  • Constructor Details

    • DebugMonitor

      public DebugMonitor()
  • Method Details

    • init

      public void init(String[] args) throws IOException
      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

      public void init(int port) throws IOException
      Throws:
      IOException
    • uninit

      public void uninit()
      Closes the connection. This releases the threads used for debugging and execution and releases memory.
    • setCommandListener

      public void setCommandListener(CommandListener commandListener)
    • addProcessHandler

      public void addProcessHandler(ProcessHandler handler)
    • addEventHandler

      public void addEventHandler(EventHandler handler)
    • addAdapter

      public void addAdapter(ElementAdapter adapter)
    • getAdapter

      public ElementAdapter getAdapter(Object element)
    • started

      public void started(Object element, Object context)
      fire the STARTED event to the registered event handlers
      Specified by:
      started in interface ProgressMonitor
      Parameters:
      element - The element that fired that notification
      context - the context of execution
      See Also:
    • preTask

      public void preTask(Object element, Object context)
      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 interface ProgressMonitor
      Parameters:
      element - The element that fired that notification
      context - the context of execution
      See Also:
    • postTask

      public void postTask(Object element, Object context)
      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 interface ProgressMonitor
      Parameters:
      element - The element that fired that notification
      context - the context of execution
      See Also:
    • finished

      public void finished(Object element, Object context)
      fire the finish events to the registered event handlers
      Specified by:
      finished in interface ProgressMonitor
      Parameters:
      element - The element that fired that notification
      context - the context of execution
      See Also:
    • beginTask

      public void beginTask(String name, int totalWork)
      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 interface ProgressMonitor
      Parameters:
      name - the name (or description) of the main task
      totalWork - the total number of work units into which the main task is been subdivided. If the value is UNKNOWN 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 interface ProgressMonitor
    • 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 method worked(int).
      Specified by:
      internalWorked in interface ProgressMonitor
      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 interface ProgressMonitor
      Returns:
      true if cancellation has been requested, and false 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 interface ProgressMonitor
      Parameters:
      value - true indicates that cancelation has been requested (but not necessarily acknowledged); false clears this flag
      See Also:
    • setTaskName

      public void setTaskName(String name)
      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 interface ProgressMonitor
      Parameters:
      name - the name (or description) of the main task
      See Also:
    • subTask

      public void subTask(String name)
      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 interface ProgressMonitor
      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 interface ProgressMonitor
      Parameters:
      work - the number of work units just completed
    • clearBlocked

      public void clearBlocked()
    • setBlocked

      public void setBlocked(org.eclipse.emf.common.util.Diagnostic reason)