Package com.iizix

Class PropProgressMonitor

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidbeginTask​(java.lang.String name, int totalWork)
      Notifies that the main task is beginning.
      voidcancel()
      Cancels the progress monitor.
      voiddone()
      Notifies that the work is done; that is, either the main task is completed or the user canceled it.
      doublegetProgress()
      Gets the current percentage done.
      java.lang.StringgetProgressDescription()
      Gets the verbose progress from the main and all subtasks in %.
      java.lang.ObjectgetProgressMonitor()
      Gets the org.eclipse.core.runtime.IProgressMonitor instance.
      PropProgressMonitor[]getSubProgressMonitors()
      Gets the submonitors that have been created for this progress monitor.
      java.lang.StringgetTaskName()
      Gets the task name being performed.
      booleanisCanceled()
      Returns whether cancellation of current operation has been requested.
      PropProgressMonitornewSubMonitor​(int work)
      Creates a new sub progress monitor taking up a number of work.
      voidsetListener​(java.lang.Runnable listener)
      Sets the cancel listener.
      voidsetProgressListener​(java.lang.Runnable listener)
      Sets the progress listener.
      voidsetTaskName​(java.lang.String name)
      Sets the task name to the given value.
      voidsetWorked​(int worked)
      Set worked value.
      voidsetWorkRemaining​(int workRemaining)
      Set worked remaining.
      voidworked​(int work)
      Notifies that a given number of work unit of the main task has been completed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PropProgressMonitor

        public PropProgressMonitor()
        Constructor.
    • Method Detail

      • setProgressListener

        public void setProgressListener​(java.lang.Runnable listener)
        Sets the progress listener.
        Parameters:
        listener - Listener for changes in the progress monitor, null for none.
      • setListener

        public void setListener​(java.lang.Runnable listener)
        Sets the cancel listener.
        Parameters:
        listener - Listener for changes in the progress monitor, null for none.
      • beginTask

        public void beginTask​(java.lang.String name,
                              int totalWork)
        Notifies that the main task is beginning. This must only be called once on a given progress monitor instance.
        Specified by:
        beginTask in 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:
        java.lang.IllegalArgumentException - If totalWork is zero or less.
        java.lang.NullPointerException - If name is null.
      • setTaskName

        public void setTaskName​(java.lang.String name)
        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 interface IPropProgressMonitor
        Parameters:
        name - the name (or description) of the main task.
        See Also:
        beginTask(java.lang.String, int)
      • getProgress

        public double getProgress()
        Gets the current percentage done.
        Returns:
        A value between 0 and 1, where 1 indicates completed.
      • getProgressDescription

        public java.lang.String getProgressDescription()
        Gets the verbose progress from the main and all subtasks in %.
        Returns:
        A string formatted as "task (xx%), subtask (yy%)".
      • getTaskName

        public java.lang.String getTaskName()
        Gets the task name being performed.
        Returns:
        The task name.
      • getSubProgressMonitors

        public PropProgressMonitor[] getSubProgressMonitors()
        Gets the submonitors that have been created for this progress monitor.
        Returns:
        An array, never null, of progress monitors.
      • worked

        public 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:
        worked in interface IPropProgressMonitor
        Parameters:
        work - A non-negative number of work units just completed.
        Throws:
        java.lang.IllegalArgumentException - If work is less than zero.
      • setWorked

        public void setWorked​(int worked)
        Set worked value.
        Specified by:
        setWorked in interface IPropProgressMonitor
        Parameters:
        worked - The work value.
      • setWorkRemaining

        public void setWorkRemaining​(int workRemaining)
        Set worked remaining.
        Specified by:
        setWorkRemaining in interface IPropProgressMonitor
        Parameters:
        workRemaining - The remaining work value, must be between zero and totalWork.
      • done

        public 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:
        done in interface IPropProgressMonitor
      • isCanceled

        public 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:
        isCanceled in interface IPropProgressMonitor
        Returns:
        true if cancellation has been requested, and false otherwise.
      • getProgressMonitor

        public java.lang.Object getProgressMonitor()
        Gets the org.eclipse.core.runtime.IProgressMonitor instance.
        Specified by:
        getProgressMonitor in interface IPropProgressMonitor
        Returns:
        Always null.
      • newSubMonitor

        public PropProgressMonitor newSubMonitor​(int work)
        Creates a new sub progress monitor taking up a number of work.
        Specified by:
        newSubMonitor in interface IPropProgressMonitor
        Parameters:
        work - A non-negative number of work units that the new sub progress monitor will tick off.
        Returns:
        A new submonitor.