Package org.eclipse.core.runtime.jobs
Class ProgressProvider
java.lang.Object
org.eclipse.core.runtime.jobs.ProgressProvider
The progress provider supplies the job manager with progress monitors for
running jobs. There can only be one progress provider at any given time.
This class is intended for use by the currently executing Eclipse application. Plug-ins outside the currently running application should not reference or subclass this class.
- Since:
- 3.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract IProgressMonitor
createMonitor
(Job job) Provides a new progress monitor instance to be used by the given job.createMonitor
(Job job, IProgressMonitor group, int ticks) Returns a progress monitor that can be used by a running job to report progress in the context of a progress group.Returns a progress monitor that can be used to provide aggregated progress feedback on a set of running jobs.Returns a progress monitor to use when none has been provided by the client running the job.monitorFor
(IProgressMonitor monitor) Returns a (possibly wrapped) progress monitor to use when running in a job.
-
Constructor Details
-
ProgressProvider
public ProgressProvider()
-
-
Method Details
-
createMonitor
Provides a new progress monitor instance to be used by the given job. This method is called prior to running any job that does not belong to a progress group. The returned monitor will be supplied to the job'srun
method.- Parameters:
job
- the job to create a progress monitor for- Returns:
- a progress monitor, or
null
if no progress monitoring is needed. - See Also:
-
createProgressGroup
Returns a progress monitor that can be used to provide aggregated progress feedback on a set of running jobs. This method implementsIJobManager.createProgressGroup
, and must obey all rules specified in that contract.This default implementation returns a new
NullProgressMonitor
. Subclasses may override.- Returns:
- a progress monitor
- See Also:
-
createMonitor
Returns a progress monitor that can be used by a running job to report progress in the context of a progress group. One of the twocreateMonitor
methods will be invoked prior to each execution of a job, depending on whether a progress group was specified for the job.The provided monitor must be a monitor returned by the method
createProgressGroup
. This method is responsible for asserting this and throwing an appropriate runtime exception if an invalid monitor is provided.This default implementation returns a new
SubMonitor
. Subclasses may override.- Parameters:
job
- the job to create a progress monitor forgroup
- the progress monitor group that this job belongs toticks
- the number of ticks of work for the progress monitor- Returns:
- a progress monitor, or
null
if no progress monitoring is needed. - See Also:
-
getDefaultMonitor
Returns a progress monitor to use when none has been provided by the client running the job.This default implementation returns a new
NullProgressMonitor
Subclasses may override.- Returns:
- a progress monitor
-
monitorFor
Returns a (possibly wrapped) progress monitor to use when running in a job.The default implementation does the following:
- if
monitor
is null or an instance ofNullProgressMonitor
returns the value from a call to ProgressProvider#getDefaultMonitor() - in all other cases return the the
monitor
passed to this method.
- Parameters:
monitor
- the monitor to wrap, might be null- Returns:
- a progress monitor for the given
monitor
but nevernull
- Since:
- 3.13
- if
-