Package com.iizix
Class PropProgressMonitor
java.lang.Object
com.iizix.PropProgressMonitor
- All Implemented Interfaces:
- IPropProgressMonitor
The progress monitor implementation.
- Author:
- Christopher Mindus
- Field Summary- Fields inherited from interface com.iizix.IPropProgressMonitor- NULL
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- voidNotifies that the main task is beginning.- void- cancel()Cancels the progress monitor.- void- done()Notifies that the work is done; that is, either the main task is completed or the user canceled it.- doubleGets the current percentage done.Gets the verbose progress from the main and all subtasks in %.Gets the org.eclipse.core.runtime.IProgressMonitor instance.Gets the submonitors that have been created for this progress monitor.Gets the task name being performed.- booleanReturns whether cancellation of current operation has been requested.- newSubMonitor- (int work) Creates a new sub progress monitor taking up a number of work.- void- setListener- (Runnable listener) Sets the cancel listener.- void- setProgressListener- (Runnable listener) Sets the progress listener.- void- setTaskName- (String name) Sets the task name to the given value.- void- setWorked- (int worked) Set worked value.- void- setWorkRemaining- (int workRemaining) Set worked remaining.- void- worked- (int work) Notifies that a given number of work unit of the main task has been completed.
- Constructor Details- PropProgressMonitorpublic PropProgressMonitor()Constructor.
 
- Method Details- setProgressListenerSets the progress listener.- Parameters:
- listener- Listener for changes in the progress monitor, null for none.
 
- setListenerSets the cancel listener.- Parameters:
- listener- Listener for changes in the progress monitor, null for none.
 
- beginTaskNotifies that the main task is beginning. This must only be called once on a given progress monitor instance.- Specified by:
- beginTaskin interface- IPropProgressMonitor
- 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. The value must be greater than zero.
- Throws:
- IllegalArgumentException- If totalWork is zero or less.
- NullPointerException- If name is null.
 
- setTaskNameSets 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:
- setTaskNamein interface- IPropProgressMonitor
- Parameters:
- name- the name (or description) of the main task.
- See Also:
 
- getProgresspublic double getProgress()Gets the current percentage done.- Returns:
- A value between 0 and 1, where 1 indicates completed.
 
- getProgressDescriptionGets the verbose progress from the main and all subtasks in %.- Returns:
- A string formatted as "task (xx%), subtask (yy%)".
 
- getTaskNameGets the task name being performed.- Returns:
- The task name.
 
- getSubProgressMonitorsGets the submonitors that have been created for this progress monitor.- Returns:
- An array, never null, of progress monitors.
 
- workedpublic void worked- (int work) 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:
- workedin interface- IPropProgressMonitor
- Parameters:
- work- A non-negative number of work units just completed.
- Throws:
- IllegalArgumentException- If work is less than zero.
 
- setWorkedpublic void setWorked- (int worked) Set worked value.- Specified by:
- setWorkedin interface- IPropProgressMonitor
- Parameters:
- worked- The work value.
 
- setWorkRemainingpublic void setWorkRemaining- (int workRemaining) Set worked remaining.- Specified by:
- setWorkRemainingin interface- IPropProgressMonitor
- Parameters:
- workRemaining- The remaining work value, must be between zero and totalWork.
 
- donepublic void done()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:
- donein interface- IPropProgressMonitor
 
- isCanceledpublic boolean isCanceled()Returns whether cancellation of current operation has been requested. Long-running operations should poll to see if cancellation has been requested.- Specified by:
- isCanceledin interface- IPropProgressMonitor
- Returns:
- trueif cancellation has been requested, and- falseotherwise.
 
- cancelpublic void cancel()Cancels the progress monitor.- Specified by:
- cancelin interface- IPropProgressMonitor
 
- getProgressMonitorGets the org.eclipse.core.runtime.IProgressMonitor instance.- Specified by:
- getProgressMonitorin interface- IPropProgressMonitor
- Returns:
- Always null.
 
- newSubMonitorCreates a new sub progress monitor taking up a number of work.- Specified by:
- newSubMonitorin interface- IPropProgressMonitor
- Parameters:
- work- A non-negative number of work units that the new sub progress monitor will tick off.
- Returns:
- A new submonitor.