Class EclipseProgressObserver
- java.lang.Object
-
- net.ssehub.easy.basics.progress.ProgressObserver
-
- net.ssehub.easy.producer.eclipse.observer.EclipseProgressObserver
-
public class EclipseProgressObserver extends ProgressObserver
Observes the progress of a longer lasting task for the eclipse ui.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classEclipseProgressObserver.TaskRerpesentation of a task, which will be observed by theEclipseProgressObserver.-
Nested classes/interfaces inherited from class net.ssehub.easy.basics.progress.ProgressObserver
ProgressObserver.ISubtask, ProgressObserver.ITask
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.core.runtime.IProgressMonitormonitorprivate EclipseProgressObserver.Taskparentprivate java.util.List<EclipseProgressObserver.Task>subtasks-
Fields inherited from class net.ssehub.easy.basics.progress.ProgressObserver
NO_OBSERVER, NO_SUBTASK
-
-
Constructor Summary
Constructors Constructor Description EclipseProgressObserver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidnotifyEnd(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask)Notifies about ending a (sub)task.voidnotifyProgress(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int step, int max)Notifies about processing a task or a subtask.voidnotifyStart(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int max)Notifies about starting a (sub)task.voidregister(org.eclipse.core.runtime.IProgressMonitor monitor)Sets the monitor to this progress observer.ProgressObserver.ISubtaskregisterSubtask(java.lang.String subtask)Registers a subtask to notify about processing progress.ProgressObserver.ITaskregisterTask(java.lang.String task)Registers a task for notify about processing progress.voidunregister(org.eclipse.core.runtime.IProgressMonitor monitor)Sets this monitor to null if the current monitor is the same as the specified monitor.-
Methods inherited from class net.ssehub.easy.basics.progress.ProgressObserver
notifyEnd, notifyProgress, notifyProgress, notifyProgress, notifyStart
-
-
-
-
Field Detail
-
monitor
private org.eclipse.core.runtime.IProgressMonitor monitor
-
parent
private EclipseProgressObserver.Task parent
-
subtasks
private java.util.List<EclipseProgressObserver.Task> subtasks
-
-
Method Detail
-
register
public void register(org.eclipse.core.runtime.IProgressMonitor monitor)
Sets the monitor to this progress observer.
Overwrites already set monitors.- Parameters:
monitor- The monitor which should be added to this observer.
-
unregister
public void unregister(org.eclipse.core.runtime.IProgressMonitor monitor)
Sets this monitor to null if the current monitor is the same as the specified monitor.- Parameters:
monitor- If the given monitor is the same monitor as the monitor of this observer instance the monitor of this observer will be set to null otherwise will nothing happen.
-
registerTask
public ProgressObserver.ITask registerTask(java.lang.String task)
Description copied from class:ProgressObserverRegisters a task for notify about processing progress.- Specified by:
registerTaskin classProgressObserver- Parameters:
task- the name of the task- Returns:
- the task identification
-
registerSubtask
public ProgressObserver.ISubtask registerSubtask(java.lang.String subtask)
Description copied from class:ProgressObserverRegisters a subtask to notify about processing progress.- Specified by:
registerSubtaskin classProgressObserver- Parameters:
subtask- the name of the sub task- Returns:
- the task identification
-
notifyStart
public void notifyStart(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int max)
Description copied from class:ProgressObserverNotifies about starting a (sub)task. Subtask notifications shall occur after task notifications, i.e. nested.- Specified by:
notifyStartin classProgressObserver- Parameters:
task- the identification of task to notify about (initially useProgressObserver.registerTask(String)for registering a task)subtask- the subtask (may beProgressObserver.NO_SUBTASK) (initially useProgressObserver.registerSubtask(String)for registering a sub task)max- the intended maximum steps of the subtask
-
notifyProgress
public void notifyProgress(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask, int step, int max)
Description copied from class:ProgressObserverNotifies about processing a task or a subtask.- Specified by:
notifyProgressin classProgressObserver- Parameters:
task- the identification of the task to notify about (initially useProgressObserver.registerTask(String)for registering a task)subtask- the identification of the subtask (may beProgressObserver.NO_SUBTASK, initially useProgressObserver.registerSubtask(String)for registering a sub task)step- the current step in 0<=step<=maxmax- the maximum number of steps, ignored if negative and value from start notification is used instead
-
notifyEnd
public void notifyEnd(ProgressObserver.ITask task, ProgressObserver.ISubtask subtask)
Description copied from class:ProgressObserverNotifies about ending a (sub)task. Subtask notifications shall occur before task notifications, i.e. correctly nested. Use the identifications returned byProgressObserver.registerTask(String)andProgressObserver.registerSubtask(String). This method shall implicitly unregister the given task and/or subtask.- Specified by:
notifyEndin classProgressObserver- Parameters:
task- the identification of the task which ends (initially useProgressObserver.registerTask(String)for registering a task)subtask- the identification of the subtask withtask(may be <ProgressObserver.NO_SUBTASK, if given, only the subtask is supposed to end, initially useProgressObserver.registerSubtask(String)for registering a sub task)
-
-