org.eclipse.emf.common.util
Class BasicMonitor

java.lang.Object
  extended by org.eclipse.emf.common.util.BasicMonitor
All Implemented Interfaces:
Monitor
Direct Known Subclasses:
BasicMonitor.Printing

public class BasicMonitor
extends java.lang.Object
implements Monitor

The most basic implementation of a task monitor.


Nested Class Summary
static class BasicMonitor.Delegating
          A simple monitor that delegates to another monitor.
static class BasicMonitor.EclipseSubProgress
          An Eclipse subprogress monitor that directly implements the monitor API.
static class BasicMonitor.Printing
          A simple monitor that prints progress to a print stream.
 
Field Summary
 
Fields inherited from interface org.eclipse.emf.common.util.Monitor
UNKNOWN
 
Constructor Summary
BasicMonitor()
           
 
Method Summary
 void beginTask(java.lang.String name, int totalWork)
          Called once per instance to indicate the name of the task and its expected duration.
 void clearBlocked()
          Clears the reason for the activity being blocked.
 void done()
          Called to indicate the task is complete.
 Diagnostic getBlockedReason()
          Returns the current reason for task being blocked, or null.
 void internalWorked(double work)
          Called by subprogress monitors to do fractional work.
 boolean isCanceled()
          Returns whether the activity has been canceled.
 void setBlocked(Diagnostic reason)
          Sets the reason for the activity being blocked.
 void setCanceled(boolean isCanceled)
          Sets whether the active should be canceled.
 void setTaskName(java.lang.String name)
          Update the task name.
 void subTask(java.lang.String name)
          Sets the current subtask of the overall task.
static IProgressMonitor toIProgressMonitor(Monitor monitor)
          Creates a delegating wrapper that allows the monitor to be used in a context requiring an instance implementing the Eclipse API.
static IProgressMonitorWithBlocking toIProgressMonitorWithBlocking(Monitor monitor)
          Creates a delegating wrapper that allows the monitor to be used in a context requiring an instance implementing the Eclipse API.
static Monitor toMonitor(IProgressMonitor progressMonitor)
          Creates a delegating wrapper that allows the Eclipse progress monitor to be used in a context requiring an instance implementing the monitor API.
static Monitor toMonitor(IProgressMonitorWithBlocking progressMonitor)
          Creates a delegating wrapper that allows the Eclipse progress monitor to be used in a context requiring an instance implementing the monitor API.
 void worked(int work)
          Called to indicate the amount or progress on the task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicMonitor

public BasicMonitor()
Method Detail

isCanceled

public boolean isCanceled()
Description copied from interface: Monitor
Returns whether the activity has been canceled.

Specified by:
isCanceled in interface Monitor

setCanceled

public void setCanceled(boolean isCanceled)
Description copied from interface: Monitor
Sets whether the active should be canceled.

Specified by:
setCanceled in interface Monitor

getBlockedReason

public Diagnostic getBlockedReason()
Returns the current reason for task being blocked, or null.


setBlocked

public void setBlocked(Diagnostic reason)
Description copied from interface: Monitor
Sets the reason for the activity being blocked.

Specified by:
setBlocked in interface Monitor

clearBlocked

public void clearBlocked()
Description copied from interface: Monitor
Clears the reason for the activity being blocked.

Specified by:
clearBlocked in interface Monitor

beginTask

public void beginTask(java.lang.String name,
                      int totalWork)
Description copied from interface: Monitor
Called once per instance to indicate the name of the task and its expected duration.

Specified by:
beginTask in interface Monitor

setTaskName

public void setTaskName(java.lang.String name)
Description copied from interface: Monitor
Update the task name.

Specified by:
setTaskName in interface Monitor

subTask

public void subTask(java.lang.String name)
Description copied from interface: Monitor
Sets the current subtask of the overall task.

Specified by:
subTask in interface Monitor

worked

public void worked(int work)
Description copied from interface: Monitor
Called to indicate the amount or progress on the task.

Specified by:
worked in interface Monitor

internalWorked

public void internalWorked(double work)
Description copied from interface: Monitor
Called by subprogress monitors to do fractional work.

Specified by:
internalWorked in interface Monitor

done

public void done()
Description copied from interface: Monitor
Called to indicate the task is complete.

Specified by:
done in interface Monitor

toIProgressMonitor

public static IProgressMonitor toIProgressMonitor(Monitor monitor)
Creates a delegating wrapper that allows the monitor to be used in a context requiring an instance implementing the Eclipse API.


toIProgressMonitorWithBlocking

public static IProgressMonitorWithBlocking toIProgressMonitorWithBlocking(Monitor monitor)
Creates a delegating wrapper that allows the monitor to be used in a context requiring an instance implementing the Eclipse API.


toMonitor

public static Monitor toMonitor(IProgressMonitorWithBlocking progressMonitor)
Creates a delegating wrapper that allows the Eclipse progress monitor to be used in a context requiring an instance implementing the monitor API.


toMonitor

public static Monitor toMonitor(IProgressMonitor progressMonitor)
Creates a delegating wrapper that allows the Eclipse progress monitor to be used in a context requiring an instance implementing the monitor API.


Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.