Class SubProgressMonitor

  • All Implemented Interfaces:
    IProgressMonitor, IProgressMonitorWithBlocking

    @Deprecated
    public class SubProgressMonitor
    extends ProgressMonitorWrapper
    Deprecated.
    use SubMonitor instead
    A progress monitor that uses a given amount of work ticks from a parent monitor. Code that currently uses this utility should be rewritten to use SubMonitor instead. Consider the following example:
         void someMethod(IProgressMonitor pm) {
            pm.beginTask("Main Task", 100);
            SubProgressMonitor subMonitor1= new SubProgressMonitor(pm, 60);
            try {
               doSomeWork(subMonitor1);
            } finally {
               subMonitor1.done();
            }
            SubProgressMonitor subMonitor2= new SubProgressMonitor(pm, 40);
            try {
               doSomeMoreWork(subMonitor2);
            } finally {
               subMonitor2.done();
            }
         }
     

    The above code should be refactored to this:

         void someMethod(IProgressMonitor pm) {
            SubMonitor subMonitor = SubMonitor.convert(pm, "Main Task", 100);
            doSomeWork(subMonitor.split(60));
            doSomeMoreWork(subMonitor.split(40));
         }
     

    The process for converting code which used SubProgressMonitor into SubMonitor is:

    Please see the SubMonitor documentation for further examples.

    This class can be used without OSGi running.

    This class may be instantiated or subclassed by clients.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int PREPEND_MAIN_LABEL_TO_SUBTASK
      Deprecated.
      Style constant indicating that the main task label should be prepended to the subtask label.
      static int SUPPRESS_SUBTASK_LABEL
      Deprecated.
      Style constant indicating that calls to subTask should not have any effect.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void beginTask​(java.lang.String name, int totalWork)
      Deprecated.
      Starts a new main task.
      void done()
      Deprecated.
      This implementation of a IProgressMonitor method forwards to the wrapped progress monitor.
      void internalWorked​(double work)
      Deprecated.
      This implementation of a IProgressMonitor method forwards to the wrapped progress monitor.
      void subTask​(java.lang.String name)
      Deprecated.
      This implementation of a IProgressMonitor method forwards to the wrapped progress monitor.
      void worked​(int work)
      Deprecated.
      This implementation of a IProgressMonitor method forwards to the wrapped progress monitor.
      • Methods inherited from class java.lang.Object

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

      • SubProgressMonitor

        public SubProgressMonitor​(IProgressMonitor monitor,
                                  int ticks)
        Deprecated.
        Creates a new sub-progress monitor for the given monitor. The sub progress monitor uses the given number of work ticks from its parent monitor.
        Parameters:
        monitor - the parent progress monitor
        ticks - the number of work ticks allocated from the parent monitor
      • SubProgressMonitor

        public SubProgressMonitor​(IProgressMonitor monitor,
                                  int ticks,
                                  int style)
        Deprecated.
        Creates a new sub-progress monitor for the given monitor. The sub progress monitor uses the given number of work ticks from its parent monitor.
        Parameters:
        monitor - the parent progress monitor
        ticks - the number of work ticks allocated from the parent monitor
        style - one of
        • SUPPRESS_SUBTASK_LABEL
        • PREPEND_MAIN_LABEL_TO_SUBTASK
        See Also:
        SUPPRESS_SUBTASK_LABEL, PREPEND_MAIN_LABEL_TO_SUBTASK
    • Method Detail

      • beginTask

        public void beginTask​(java.lang.String name,
                              int totalWork)
        Deprecated.
        Starts a new main task. Since this progress monitor is a sub progress monitor, the given name will NOT be used to update the progress bar's main task label. That means the given string will be ignored. If style PREPEND_MAIN_LABEL_TO_SUBTASK is specified, then the given string will be prepended to every string passed to subTask(String).
        Specified by:
        beginTask in interface IProgressMonitor
        Overrides:
        beginTask in class ProgressMonitorWrapper
        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. If the value is UNKNOWN the implementation is free to indicate progress in a way which doesn't require the total number of work units in advance.
        See Also:
        IProgressMonitor.beginTask(String, int)