public class SubProgressMonitor extends ProgressMonitorWrapper
try { pm.beginTask("Main Task", 100); doSomeWork(pm, 30); SubProgressMonitor subMonitor= SubProgressMonitor.create(pm, 40); try { subMonitor.beginTask("", 300); doSomeWork(subMonitor, 300); } finally { subMonitor.done(); } doSomeWork(pm, 30); } finally { pm.done(); }
This class may be instantiated or subclassed by clients.
This class has been more or less directly taken over from the Eclipse Core API.
Modifier and Type | Field and Description |
---|---|
static int |
PREPEND_MAIN_LABEL_TO_SUBTASK
Style constant indicating that the main task label
should be prepended to the subtask label.
|
static int |
SUPPRESS_SUBTASK_LABEL
Style constant indicating that calls to
subTask
should not have any effect. |
NULL, UNKNOWN
Constructor and Description |
---|
SubProgressMonitor(ProgressMonitor monitor,
int ticks)
Creates a new sub-progress monitor for the given monitor.
|
SubProgressMonitor(ProgressMonitor monitor,
int ticks,
int style)
Creates a new sub-progress monitor for the given monitor.
|
Modifier and Type | Method and Description |
---|---|
void |
beginTask(String taskName,
int totalWork)
This implementation of a
ProgressMonitor
method forwards to the wrapped progress monitor. |
static ProgressMonitor |
create(ProgressMonitor monitor,
int ticks)
Creates a progress monitor based on the passed in parent monitor.
|
static ProgressMonitor |
createSynchronized(ProgressMonitor monitor,
int ticks)
Creates a progress monitor based on the passed in parent monitor.If the parent monitor is
ProgressMonitor.NULL ,
monitor is returned, otherwise a new SubProgressMonitor is created. |
void |
done()
This implementation of a
ProgressMonitor
method forwards to the wrapped progress monitor. |
void |
internalWorked(double work)
This implementation of a
ProgressMonitor
method forwards to the wrapped progress monitor. |
void |
setSubTaskName(String subTaskName)
This implementation of a
ProgressMonitor
method forwards to the wrapped progress monitor. |
void |
worked(int work)
This implementation of a
ProgressMonitor
method forwards to the wrapped progress monitor. |
getWrappedProgressMonitor, isCanceled, setCanceled, setTaskName
public static final int SUPPRESS_SUBTASK_LABEL
subTask
should not have any effect.public static final int PREPEND_MAIN_LABEL_TO_SUBTASK
public SubProgressMonitor(ProgressMonitor monitor, int ticks)
monitor
- the parent progress monitorticks
- the number of work ticks allocated from the
parent monitorpublic SubProgressMonitor(ProgressMonitor monitor, int ticks, int style)
monitor
- the parent progress monitorticks
- the number of work ticks allocated from the
parent monitorstyle
- one of
SUPPRESS_SUBTASK_LABEL
PREPEND_MAIN_LABEL_TO_SUBTASK
SUPPRESS_SUBTASK_LABEL
,
PREPEND_MAIN_LABEL_TO_SUBTASK
public static ProgressMonitor create(ProgressMonitor monitor, int ticks)
ProgressMonitor.NULL
,
monitor
is returned, otherwise a new SubProgressMonitor
is created.monitor
- the parent progress monitorticks
- the number of work ticks allocated from the
parent monitorpublic static ProgressMonitor createSynchronized(ProgressMonitor monitor, int ticks)
ProgressMonitor.NULL
,
monitor
is returned, otherwise a new SubProgressMonitor
is created.
In contrast to the monitor returned by create(ProgressMonitor, int)
this one can be considered to be thread-safe.monitor
- the parent progress monitorticks
- the number of work ticks allocated from the
parent monitorpublic void beginTask(String taskName, int totalWork)
ProgressMonitorWrapper
ProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.beginTask
in interface ProgressMonitor
beginTask
in class ProgressMonitorWrapper
taskName
- the name (or description) of the main tasktotalWork
- 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.ProgressMonitor.beginTask(String, int)
public void done()
ProgressMonitorWrapper
ProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.done
in interface ProgressMonitor
done
in class ProgressMonitorWrapper
ProgressMonitor.done()
public void internalWorked(double work)
ProgressMonitorWrapper
ProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.internalWorked
in interface ProgressMonitor
internalWorked
in class ProgressMonitorWrapper
work
- the amount of work doneProgressMonitor.internalWorked(double)
public void setSubTaskName(String subTaskName)
ProgressMonitorWrapper
ProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.setSubTaskName
in interface ProgressMonitor
setSubTaskName
in class ProgressMonitorWrapper
subTaskName
- the name (or description) of the subtaskProgressMonitor.setSubTaskName(String)
public void worked(int work)
ProgressMonitorWrapper
ProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.worked
in interface ProgressMonitor
worked
in class ProgressMonitorWrapper
work
- the number of work units just completedProgressMonitor.worked(int)
Copyright © 2014–2022 European Space Agency (ESA). All rights reserved.