Class BatchingProgressMonitor

java.lang.Object
org.eclipse.jgit.lib.BatchingProgressMonitor
All Implemented Interfaces:
ProgressMonitor
Direct Known Subclasses:
SideBandProgressMonitor, TextProgressMonitor

public abstract class BatchingProgressMonitor extends Object implements ProgressMonitor
ProgressMonitor that batches update events.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private long
     
    private TimeUnit
     
     

    Fields inherited from interface org.eclipse.jgit.lib.ProgressMonitor

    UNKNOWN
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    beginTask(String title, int work)
    Begin processing a single task.
    void
    Finish the current task, so the next can begin.
    boolean
    Check for user task cancellation.
    protected abstract void
    onEndTask(String taskName, int workCurr)
    Finish the progress monitor when the total wasn't known in advance.
    protected abstract void
    onEndTask(String taskName, int workCurr, int workTotal, int percentDone)
    Finish the progress monitor when the total is known in advance.
    protected abstract void
    onUpdate(String taskName, int workCurr)
    Update the progress monitor if the total work isn't known,
    protected abstract void
    onUpdate(String taskName, int workCurr, int workTotal, int percentDone)
    Update the progress monitor when the total is known in advance.
    void
    setDelayStart(long time, TimeUnit unit)
    Set an optional delay before the first output.
    void
    start(int totalTasks)
    Advise the monitor of the total number of subtasks.
    void
    update(int completed)
    Denote that some work units have been completed.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • BatchingProgressMonitor

      public BatchingProgressMonitor()
  • Method Details

    • setDelayStart

      public void setDelayStart(long time, TimeUnit unit)
      Set an optional delay before the first output.
      Parameters:
      time - how long to wait before output. If 0 output begins on the first update(int) call.
      unit - time unit of time.
    • start

      public void start(int totalTasks)
      Advise the monitor of the total number of subtasks.

      This should be invoked at most once per progress monitor interface.

      Specified by:
      start in interface ProgressMonitor
      Parameters:
      totalTasks - the total number of tasks the caller will need to complete their processing.
    • beginTask

      public void beginTask(String title, int work)
      Begin processing a single task.
      Specified by:
      beginTask in interface ProgressMonitor
      Parameters:
      title - title to describe the task. Callers should publish these as stable string constants that implementations could match against for translation support.
      work - total number of work units the application will perform; ProgressMonitor.UNKNOWN if it cannot be predicted in advance.
    • update

      public void update(int completed)
      Denote that some work units have been completed.

      This is an incremental update; if invoked once per work unit the correct value for our argument is 1, to indicate a single unit of work has been finished by the caller.

      Specified by:
      update in interface ProgressMonitor
      Parameters:
      completed - the number of work units completed since the last call.
    • endTask

      public void endTask()
      Finish the current task, so the next can begin.
      Specified by:
      endTask in interface ProgressMonitor
    • isCancelled

      public boolean isCancelled()
      Check for user task cancellation.
      Specified by:
      isCancelled in interface ProgressMonitor
      Returns:
      true if the user asked the process to stop working.
    • onUpdate

      protected abstract void onUpdate(String taskName, int workCurr)
      Update the progress monitor if the total work isn't known,
      Parameters:
      taskName - name of the task.
      workCurr - number of units already completed.
    • onEndTask

      protected abstract void onEndTask(String taskName, int workCurr)
      Finish the progress monitor when the total wasn't known in advance.
      Parameters:
      taskName - name of the task.
      workCurr - total number of units processed.
    • onUpdate

      protected abstract void onUpdate(String taskName, int workCurr, int workTotal, int percentDone)
      Update the progress monitor when the total is known in advance.
      Parameters:
      taskName - name of the task.
      workCurr - number of units already completed.
      workTotal - estimated number of units to process.
      percentDone - workCurr * 100 / workTotal.
    • onEndTask

      protected abstract void onEndTask(String taskName, int workCurr, int workTotal, int percentDone)
      Finish the progress monitor when the total is known in advance.
      Parameters:
      taskName - name of the task.
      workCurr - total number of units processed.
      workTotal - estimated number of units to process.
      percentDone - workCurr * 100 / workTotal.