public class ProgressMonitorPart extends Composite implements IProgressMonitorWithBlocking
ProgressMonitorDialog
this class only implements
IProgressMonitor
.Modifier and Type | Field and Description |
---|---|
protected IStatus |
blockedStatus
current blocked status
|
protected Control |
fCancelComponent
the cancel component
|
protected Listener |
fCancelListener
the cancel lister attached to the cancel component
|
protected boolean |
fIsCanceled
true if canceled
|
protected Label |
fLabel
the label
|
protected ProgressIndicator |
fProgressIndicator
the progress indicator
|
protected String |
fSubTaskName
the current sub task name
|
protected String |
fTaskName
the current task name
|
UNKNOWN
Constructor and Description |
---|
ProgressMonitorPart(Composite parent,
Layout layout)
Creates a
ProgressMonitorPart that does not provide a stop button. |
ProgressMonitorPart(Composite parent,
Layout layout,
boolean createStopButton)
Creates a
ProgressMonitorPart . |
ProgressMonitorPart(Composite parent,
Layout layout,
int progressIndicatorHeight)
Creates a
ProgressMonitorPart that does not provide a stop button. |
Modifier and Type | Method and Description |
---|---|
void |
attachToCancelComponent(Control cancelComponent)
Attaches the progress monitor part to the given cancel component.
|
void |
beginTask(String name,
int totalWork)
Notifies that the main task is beginning.
|
void |
clearBlocked()
Clears the blocked state of the running operation.
|
void |
done()
Notifies that the work is done; that is, either the main task is completed
or the user canceled it.
|
protected static String |
escapeMetaCharacters(String in)
Escapes any occurrence of '&' in the given String so that
it is not considered as a mnemonic
character in SWT ToolItems, MenuItems, Button and Labels.
|
protected void |
initialize(Layout layout,
int progressIndicatorHeight)
Creates the progress monitor's UI parts and layouts them
according to the given layout.
|
void |
internalWorked(double work)
Internal method to handle scaling correctly.
|
boolean |
isCanceled()
Returns whether cancelation of current operation has been requested.
|
void |
removeFromCancelComponent(Control cancelComponent)
Detach the progress monitor part from the given cancel component.
|
void |
setBlocked(IStatus reason)
Indicates that this operation is blocked by some background activity.
|
void |
setCanceled(boolean b)
Sets the cancel state to the given value.
|
void |
setFont(Font font)
Sets the font that the receiver will use to paint textual information
to the font specified by the argument, or to the default font for that
kind of control if the argument is null.
|
void |
setTaskName(String name)
Sets the task name to the given value.
|
void |
subTask(String name)
Notifies that a subtask of the main task is beginning.
|
protected void |
updateLabel()
Updates the label with the current task and subtask names.
|
void |
worked(int work)
Notifies that a given number of work unit of the main task
has been completed.
|
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
protected Label fLabel
protected String fTaskName
protected String fSubTaskName
protected ProgressIndicator fProgressIndicator
protected Control fCancelComponent
protected volatile boolean fIsCanceled
protected IStatus blockedStatus
protected Listener fCancelListener
public ProgressMonitorPart(Composite parent, Layout layout)
ProgressMonitorPart
that does not provide a stop button.parent
- The SWT parent of the part.layout
- The SWT grid layout used by the part. A client can supply the layout to control
how the progress monitor part is laid out. If null
is passed the part
uses its default layout.public ProgressMonitorPart(Composite parent, Layout layout, int progressIndicatorHeight)
ProgressMonitorPart
that does not provide a stop button.parent
- The SWT parent of the part.layout
- The SWT grid layout used by the part. A client can supply the layout to control
how the progress monitor part is laid out. If null
is passed the part
uses its default layout.progressIndicatorHeight
- The height of the progress indicator in pixels. This value may
be SWT.DEFAULT in order to get the default height as calculated by the widget and
its layout.public ProgressMonitorPart(Composite parent, Layout layout, boolean createStopButton)
ProgressMonitorPart
.parent
- the SWT parent of the partlayout
- the SWT grid layout used by the part. A client can supply the layout to control
how the progress monitor part is laid out. If null
is passed the part
uses its default layout.createStopButton
- true
if the progress indicator should include a stop
button that can be used to cancel any currently running task, and
false
if no such stop button should be created.public void attachToCancelComponent(Control cancelComponent)
cancelComponent
- the control whose selection will trigger a cancel. This parameter will
be ignored and hence can be null
if a stop button was requested upon
construction and instead the stop button will enabled and serve as the cancel
component.ProgressMonitorPart(Composite, Layout, boolean)
public void beginTask(String name, int totalWork)
IProgressMonitor
beginTask
in interface IProgressMonitor
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.public void done()
IProgressMonitor
done
in interface IProgressMonitor
protected static String escapeMetaCharacters(String in)
in
- the original Stringprotected void initialize(Layout layout, int progressIndicatorHeight)
null
the part's default layout is used.layout
- The layout for the receiver.progressIndicatorHeight
- The suggested height of the indicatorpublic void internalWorked(double work)
IProgressMonitor
internalWorked
in interface IProgressMonitor
work
- the amount of work donepublic boolean isCanceled()
IProgressMonitor
isCanceled
in interface IProgressMonitor
true
if cancellation has been requested,
and false
otherwiseIProgressMonitor.setCanceled(boolean)
public void removeFromCancelComponent(Control cancelComponent)
cancelComponent
- the control that was previously used as a cancel component. This
parameter will be ignored and hence can be null
if a stop button was
requested upon construction and instead the stop button will be disabled.ProgressMonitorPart(Composite, Layout, boolean)
public void setCanceled(boolean b)
IProgressMonitor
setCanceled
in interface IProgressMonitor
b
- true
indicates that cancelation has
been requested (but not necessarily acknowledged);
false
clears this flagIProgressMonitor.isCanceled()
public void setFont(Font font)
Control
public void setTaskName(String name)
IProgressMonitor
setTaskName
in interface IProgressMonitor
name
- the name (or description) of the main taskIProgressMonitor.beginTask(java.lang.String, int)
public void subTask(String name)
IProgressMonitor
subTask
in interface IProgressMonitor
name
- the name (or description) of the subtaskprotected void updateLabel()
public void worked(int work)
IProgressMonitor
worked
in interface IProgressMonitor
work
- a non-negative number of work units just completedpublic void clearBlocked()
IProgressMonitorWithBlocking
setBlocked
, it must eventually call
clearBlocked
before the operation completes.clearBlocked
in interface IProgressMonitorWithBlocking
IProgressMonitorWithBlocking.setBlocked(IStatus)
public void setBlocked(IStatus reason)
IProgressMonitorWithBlocking
setBlocked
, it must
eventually call clearBlocked
before the operation
completes.
If the caller is blocked by a currently executing job, this method will return
an IJobStatus
indicating the job that is currently blocking
the caller. If this blocking job is not known, this method will return a plain
informational IStatus
object.
setBlocked
in interface IProgressMonitorWithBlocking
reason
- an optional status object whose message describes the
reason why this operation is blocked, or null
if this
information is not available.IProgressMonitorWithBlocking.clearBlocked()
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.