Package org.eclipse.emf.mwe.core.monitor
Class ProgressMonitorAdapter
java.lang.Object
org.eclipse.emf.mwe.core.monitor.ProgressMonitorAdapter
- All Implemented Interfaces:
ProgressMonitor
An adapter between Eclipse's
IProgressMonitor
interface and oAW's ProgressMonitor
interface.
The adapter delegates all calls to the wrapped IProgressMonitor instance.- Since:
- 4.1.2
- Author:
- Karsten Thoms
-
Field Summary
Fields inherited from interface org.eclipse.emf.mwe.core.monitor.ProgressMonitor
UNKNOWN
-
Constructor Summary
ConstructorsConstructorDescriptionProgressMonitorAdapter
(org.eclipse.core.runtime.IProgressMonitor monitor) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Notifies that the main task is beginning.void
done()
Notifies that the work is done; that is, either the main task is completed or the user canceled it.void
Notifies that overall process was finished.void
internalWorked
(double work) Internal method to handle scaling correctly.boolean
Returns whether cancelation of current operation has been requested.void
Notifies that a task was finished.void
Notifies that a task will be started.void
setCanceled
(boolean value) Sets the cancel state to the given value.void
setTaskName
(String name) Sets the task name to the given value.void
Notifies that overall process was started.void
Notifies that a subtask of the main task is beginning.void
worked
(int work) Notifies that a given number of work unit of the main task has been completed.
-
Constructor Details
-
ProgressMonitorAdapter
public ProgressMonitorAdapter(org.eclipse.core.runtime.IProgressMonitor monitor) Constructor.- Parameters:
monitor
- The monitor implementation where all calls are delegated to.
-
-
Method Details
-
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.- See Also:
-
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
- See Also:
-
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- See Also:
-
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:
-
started
Description copied from interface:ProgressMonitor
Notifies that overall process was started.- Specified by:
started
in interfaceProgressMonitor
- Parameters:
element
- The element that fired that notificationcontext
- the context of execution
-
finished
Description copied from interface:ProgressMonitor
Notifies that overall process was finished.- Specified by:
finished
in interfaceProgressMonitor
- Parameters:
element
- The element that fired that notificationcontext
- the context of execution
-
postTask
Description copied from interface:ProgressMonitor
Notifies that a task was finished. Must be paired together with onepreTask()
call.- Specified by:
postTask
in interfaceProgressMonitor
- Parameters:
element
- The element that fired that notificationcontext
- the context of execution- See Also:
-
preTask
Description copied from interface:ProgressMonitor
Notifies that a task will be started. Must be paired together with onepostTask()
call.- Specified by:
preTask
in interfaceProgressMonitor
- Parameters:
element
- The element that fired that notificationcontext
- the context of execution- 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- See Also:
-
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- See Also:
-