public class SubProgressMonitor extends ProgressMonitorWrapper
SubMonitor
.
A progress monitor that uses a given amount of work ticks
from a parent monitor. It can be used as follows:
try { pm.beginTask("Main Task", 100); doSomeWork(pm, 30); SubProgressMonitor subMonitor= new SubProgressMonitor(pm, 40); try { subMonitor.beginTask("", 300); doSomeWork(subMonitor, 300); } finally { subMonitor.done(); } doSomeWork(pm, 30); } finally { pm.done(); }
This class can be used without OSGi running.
This class may be instantiated or subclassed by clients.
SubMonitor
,
Serialized FormModifier 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. |
UNKNOWN
Constructor and Description |
---|
SubProgressMonitor(IProgressMonitor monitor,
int ticks)
Creates a new sub-progress monitor for the given monitor.
|
SubProgressMonitor(IProgressMonitor monitor,
int ticks,
int style)
Creates a new sub-progress monitor for the given monitor.
|
Modifier and Type | Method and Description |
---|---|
void |
beginTask(java.lang.String name,
int totalWork)
This implementation of a
IProgressMonitor
method forwards to the wrapped progress monitor. |
void |
done()
This implementation of a
IProgressMonitor
method forwards to the wrapped progress monitor. |
void |
internalWorked(double work)
This implementation of a
IProgressMonitor
method forwards to the wrapped progress monitor. |
static SubProgressMonitor |
NewStarted(IProgressMonitor monitor,
int parentTicks,
java.lang.String name,
int childTicks) |
void |
subTask(java.lang.String name)
This implementation of a
IProgressMonitor
method forwards to the wrapped progress monitor. |
void |
warning(java.lang.String message)
Notifies about a warning
|
void |
warning(java.lang.String message,
java.lang.Throwable throwable)
Notifies about a warning that was caused by an exception.
|
void |
worked(int work)
This implementation of a
IProgressMonitor
method forwards to the wrapped progress monitor. |
getFeedback, getIsWaitingForFeedback, getOwner, getWrappedProgressMonitor, hasFeedbackWaitTimedOut, interrupt, isCanceled, setCanceled, setFeedback, setOwner, setTaskName, waitForFeedback, waitForFeedback
public static final int SUPPRESS_SUBTASK_LABEL
subTask
should not have any effect.public static final int PREPEND_MAIN_LABEL_TO_SUBTASK
public SubProgressMonitor(IProgressMonitor monitor, int ticks)
monitor
- the parent progress monitorticks
- the number of work ticks allocated from the
parent monitorpublic SubProgressMonitor(IProgressMonitor 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 SubProgressMonitor NewStarted(IProgressMonitor monitor, int parentTicks, java.lang.String name, int childTicks)
public void beginTask(java.lang.String name, int totalWork)
ProgressMonitorWrapper
IProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.beginTask
in interface IProgressMonitor
beginTask
in class ProgressMonitorWrapper
name
- 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.IProgressMonitor.beginTask(String, int)
public void done()
ProgressMonitorWrapper
IProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.done
in interface IProgressMonitor
done
in class ProgressMonitorWrapper
IProgressMonitor.done()
public void internalWorked(double work)
ProgressMonitorWrapper
IProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.interface
documentation for
this method
says the method must not be called by a client.
Clients should always use the method worked(int).internalWorked
in interface IProgressMonitor
internalWorked
in class ProgressMonitorWrapper
work
- the amount of work doneIProgressMonitor.internalWorked(double)
public void subTask(java.lang.String name)
ProgressMonitorWrapper
IProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.subTask
in interface IProgressMonitor
subTask
in class ProgressMonitorWrapper
name
- the name (or description) of the subtaskIProgressMonitor.subTask(String)
public void worked(int work)
ProgressMonitorWrapper
IProgressMonitor
method forwards to the wrapped progress monitor.
Clients may override this method to do additional
processing.worked
in interface IProgressMonitor
worked
in class ProgressMonitorWrapper
work
- a non-negative number of work units just completedIProgressMonitor.worked(int)
public void warning(java.lang.String message)
IProgressMonitor
public void warning(java.lang.String message, java.lang.Throwable throwable)
IProgressMonitor
Copyright © 2007-2020 EDIT. All Rights Reserved.