de.cau.cs.kieler.core.ui
Class KielerProgressMonitor

java.lang.Object
  extended by de.cau.cs.kieler.core.alg.BasicProgressMonitor
      extended by de.cau.cs.kieler.core.ui.KielerProgressMonitor
All Implemented Interfaces:
IKielerProgressMonitor

public class KielerProgressMonitor
extends BasicProgressMonitor

Wrapper class for Eclipse progress monitors.

Rating proposed yellow
(2009-12-11) msp

Field Summary
 
Fields inherited from interface de.cau.cs.kieler.core.alg.IKielerProgressMonitor
UNKNOWN_WORK
 
Constructor Summary
KielerProgressMonitor(IProgressMonitor theprogressMonitor)
          Creates a progress monitor wrapper for a given Eclipse progress monitor.
KielerProgressMonitor(IProgressMonitor theprogressMonitor, int maxLevels)
          Creates a progress monitor wrapper with given maximal number of hierarchy levels.
 
Method Summary
protected  void doBegin(String name, float totalWork, boolean topInstance, int maxHierarchyLevels)
          Reports to the integrated Eclipse progress monitor that the current task begins.
protected  void doDone(boolean topInstance, int maxHierarchyLevels)
          Reports to the integrated Eclipse progress monitor that the main task is done, if this is the top instance.
 BasicProgressMonitor doSubTask(float work, int maxHierarchyLevels)
          Creates a new instance of KielerProgressMonitor.
protected  void doWorked(float work, float completedWork, boolean topInstance)
          Reports to the integrated Eclipse progress monitor that some work was done, if this is the top instance.
 boolean isCanceled()
          Returns true if the integrated Eclipse progress monitor reports cancellation.
 
Methods inherited from class de.cau.cs.kieler.core.alg.BasicProgressMonitor
begin, done, getExecutionTime, getParentMonitor, getSubMonitors, getTaskName, subTask, worked
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KielerProgressMonitor

public KielerProgressMonitor(IProgressMonitor theprogressMonitor)
Creates a progress monitor wrapper for a given Eclipse progress monitor. The number of hierarchy levels for which progress is reported to the Eclipse monitor is infinite.

Parameters:
theprogressMonitor - the progress monitor

KielerProgressMonitor

public KielerProgressMonitor(IProgressMonitor theprogressMonitor,
                             int maxLevels)
Creates a progress monitor wrapper with given maximal number of hierarchy levels. Progress is reported to parent monitors only up to the specified hierarchy level.

Parameters:
theprogressMonitor - the progress monitor
maxLevels - maximal number of hierarchy levels for which progress is reported
Method Detail

doBegin

protected void doBegin(String name,
                       float totalWork,
                       boolean topInstance,
                       int maxHierarchyLevels)
Reports to the integrated Eclipse progress monitor that the current task begins.

Overrides:
doBegin in class BasicProgressMonitor
Parameters:
name - task name
totalWork - total amount of work for the new task
topInstance - if true, this progress monitor is the top instance
maxHierarchyLevels - maximal number of reported hierarchy levels

doDone

protected void doDone(boolean topInstance,
                      int maxHierarchyLevels)
Reports to the integrated Eclipse progress monitor that the main task is done, if this is the top instance.

Overrides:
doDone in class BasicProgressMonitor
Parameters:
topInstance - if true, this progress monitor is the top instance
maxHierarchyLevels - maximal number of reported hierarchy levels

isCanceled

public boolean isCanceled()
Returns true if the integrated Eclipse progress monitor reports cancellation.

Specified by:
isCanceled in interface IKielerProgressMonitor
Overrides:
isCanceled in class BasicProgressMonitor
Returns:
true if the user has requested to cancel the operation

doSubTask

public BasicProgressMonitor doSubTask(float work,
                                      int maxHierarchyLevels)
Creates a new instance of KielerProgressMonitor.

Overrides:
doSubTask in class BasicProgressMonitor
Parameters:
work - amount of work that is completed in the current monitor instance when the sub-task ends
maxHierarchyLevels - the maximal number of hierarchy levels for the parent progress monitor
Returns:
a new progress monitor instance

doWorked

protected void doWorked(float work,
                        float completedWork,
                        boolean topInstance)
Reports to the integrated Eclipse progress monitor that some work was done, if this is the top instance.

Overrides:
doWorked in class BasicProgressMonitor
Parameters:
work - amount of work that has just been done
completedWork - total number of work that is done for this task
topInstance - if true, this progress monitor is the top instance