Eclipse Platform Release 3.7

## org.eclipse.jface.wizard
Class ProgressMonitorPart

    java.lang.Object
      org.eclipse.swt.widgets.Widget
          org.eclipse.swt.widgets.Control
              org.eclipse.swt.widgets.Scrollable
                  org.eclipse.swt.widgets.Composite
                      org.eclipse.jface.wizard.ProgressMonitorPart

All Implemented Interfaces:
  IProgressMonitor, IProgressMonitorWithBlocking, Drawable

    public class ProgressMonitorPart

extends Composite
implements IProgressMonitorWithBlocking

A standard implementation of an IProgressMonitor. It consists of a label displaying the task and subtask name, and a progress indicator to show progress. In contrast to `ProgressMonitorDialog` this class only implements `IProgressMonitor`.

Field Summary
`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

Fields inherited from class org.eclipse.swt.widgets.Control
`handle`

Fields inherited from interface org.eclipse.core.runtime.IProgressMonitor
`UNKNOWN`

Constructor Summary
`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.

Method Summary
`void` `attachToCancelComponent(Control cancelComponent)` Attaches the progress monitor part to the given cancel component.
`void` `beginTask(String name, int totalWork)` Implements `IProgressMonitor.beginTask`.
`void` `clearBlocked()` Clears the blocked state of the running operation.
`void` `done()` Implements `IProgressMonitor.done`.
`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)` Implements `IProgressMonitor.internalWorked`.
`boolean` `isCanceled()` Implements `IProgressMonitor.isCanceled`.
`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)` Implements `IProgressMonitor.setCanceled`.
`void` `setFont(Font font)` Sets the progress monitor part's font.
`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)` Implements `IProgressMonitor.worked`.

Methods inherited from class org.eclipse.swt.widgets.Composite
`changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList`

Methods inherited from class org.eclipse.swt.widgets.Scrollable
`computeTrim, getClientArea, getHorizontalBar, getVerticalBar`

Methods inherited from class org.eclipse.swt.widgets.Control

`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, 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, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update`

Methods inherited from class org.eclipse.swt.widgets.Widget
`addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### fLabel

    protected Label fLabel

  the label

### fTaskName

    protected String fTaskName

  the current task name

### fSubTaskName

    protected String fSubTaskName

  the current sub task name

### fProgressIndicator

    protected ProgressIndicator fProgressIndicator

  the progress indicator

### fCancelComponent

    protected Control fCancelComponent

  the cancel component

### fIsCanceled

    protected volatile boolean fIsCanceled

  true if canceled

### blockedStatus

    protected IStatus blockedStatus

  current blocked status

### fCancelListener

    protected Listener fCancelListener

  the cancel lister attached to the cancel component

Constructor Detail

### ProgressMonitorPart

    public ProgressMonitorPart(Composite parent,
                               Layout layout)

  Creates a `ProgressMonitorPart` that does not provide a stop button.

  Parameters:
    `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.

### ProgressMonitorPart

    public ProgressMonitorPart(Composite parent,
                               Layout layout,
                               int progressIndicatorHeight)

  Creates a `ProgressMonitorPart` that does not provide a stop button.

  Parameters:
    `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.

### ProgressMonitorPart

    public ProgressMonitorPart(Composite parent,
                               Layout layout,
                               boolean createStopButton)

  Creates a `ProgressMonitorPart`.

  Parameters:
    `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.
    `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.
  Since:
    3.6

Method Detail

### attachToCancelComponent

    public void attachToCancelComponent(Control cancelComponent)

  Attaches the progress monitor part to the given cancel component.

  Parameters:
    `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.
  See Also:
    `ProgressMonitorPart(Composite, Layout, boolean)`

### beginTask

    public void beginTask(String name,
                          int totalWork)

  Implements `IProgressMonitor.beginTask`.

  Specified by:
    `beginTask` in interface `IProgressMonitor`
  Parameters:
    `name` - the name (or description) of the main task
    `totalWork` - 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.
  See Also:
    `IProgressMonitor.beginTask(java.lang.String, int)`

### done

    public void done()

  Implements `IProgressMonitor.done`.

  Specified by:
    `done` in interface `IProgressMonitor`
  See Also:
    `IProgressMonitor.done()`

### escapeMetaCharacters

    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.

  Parameters:
    `in` - the original String
  Returns:
    The converted String

### initialize

    protected void initialize(Layout layout,
                              int progressIndicatorHeight)

  Creates the progress monitor's UI parts and layouts them according to the given layout. If the layout is `null` the part's default layout is used.

  Parameters:
    `layout` - The layout for the receiver.
    `progressIndicatorHeight` - The suggested height of the indicator

### internalWorked

    public void internalWorked(double work)

  Implements `IProgressMonitor.internalWorked`.

  Specified by:
    `internalWorked` in interface `IProgressMonitor`
  Parameters:
    `work` - the amount of work done
  See Also:
    `IProgressMonitor.internalWorked(double)`

### isCanceled

    public boolean isCanceled()

  Implements `IProgressMonitor.isCanceled`.

  Specified by:
    `isCanceled` in interface `IProgressMonitor`
  Returns:
    `true` if cancellation has been requested, and `false` otherwise
  See Also:
    `IProgressMonitor.isCanceled()`

### removeFromCancelComponent

    public void removeFromCancelComponent(Control cancelComponent)

  Detach the progress monitor part from the given cancel component.

  Parameters:
    `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.
  See Also:
    `ProgressMonitorPart(Composite, Layout, boolean)`

### setCanceled

    public void setCanceled(boolean b)

  Implements `IProgressMonitor.setCanceled`.

  Specified by:
    `setCanceled` in interface `IProgressMonitor`
  Parameters:
    `b` - `true` indicates that cancelation has been requested (but not necessarily acknowledged); `false` clears this flag
  See Also:
    `IProgressMonitor.setCanceled(boolean)`

### setFont

    public void setFont(Font font)

  Sets the progress monitor part's font.

  Overrides:
    `setFont` in class `Control`
  Parameters:
    `font` - the new font (or null)

### setTaskName

    public void setTaskName(String name)

  Description copied from interface: `IProgressMonitor`
  Sets the task name to the given value. This method is used to restore the task label after a nested operation was executed. Normally there is no need for clients to call this method.

  Specified by:
    `setTaskName` in interface `IProgressMonitor`
  Parameters:
    `name` - the name (or description) of the main task
  See Also:
    `IProgressMonitor.beginTask(java.lang.String, int)`

### subTask

    public void subTask(String name)

  Description copied from interface: `IProgressMonitor`
  Notifies that a subtask of the main task is beginning. Subtasks are optional; the main task might not have subtasks.

  Specified by:
    `subTask` in interface `IProgressMonitor`
  Parameters:
    `name` - the name (or description) of the subtask

### updateLabel

    protected void updateLabel()

  Updates the label with the current task and subtask names.

### worked

    public void worked(int work)

  Implements `IProgressMonitor.worked`.

  Specified by:
    `worked` in interface `IProgressMonitor`
  Parameters:
    `work` - a non-negative number of work units just completed
  See Also:
    `IProgressMonitor.worked(int)`

### clearBlocked

    public void clearBlocked()

  Description copied from interface: `IProgressMonitorWithBlocking`
  Clears the blocked state of the running operation. If a running operation ever calls `setBlocked`, it must eventually call `clearBlocked` before the operation completes.

  Specified by:
    `clearBlocked` in interface `IProgressMonitorWithBlocking`
  See Also:
    `IProgressMonitorWithBlocking.setBlocked(IStatus)`

### setBlocked

    public void setBlocked(IStatus reason)

  Description copied from interface: `IProgressMonitorWithBlocking`
  Indicates that this operation is blocked by some background activity. If a running operation ever calls `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.

  Specified by:
    `setBlocked` in interface `IProgressMonitorWithBlocking`
  Parameters:
    `reason` - an optional status object whose message describes the reason why this operation is blocked, or `null` if this information is not available.
  See Also:
    `IProgressMonitorWithBlocking.clearBlocked()`

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.