/** * Attaches the progress monitor part to the given cancel component. * * @param cancelComponent the control whose selection will trigger a cancel. This parameter will * be ignored and hence can be <code>null</code> if a stop button was requested upon * construction and instead the stop button will enabled and serve as the cancel component. * @see #ProgressMonitorPart(Composite, Layout, boolean) */ public void attachToCancelComponent(Control cancelComponent) { if (fHasStopButton) setCancelEnabled(true); else { fCancelComponent = cancelComponent; fCancelComponent.addListener(SWT.Selection, fCancelListener); } }
/** * Detach the progress monitor part from the given cancel component. * * @param cancelComponent the control that was previously used as a cancel component. This * parameter will be ignored and hence can be <code>null</code> if a stop button was requested * upon construction and instead the stop button will be disabled. * @see #ProgressMonitorPart(Composite, Layout, boolean) */ public void removeFromCancelComponent(Control cancelComponent) { if (fHasStopButton) { setCancelEnabled(false); } else { Assert.isTrue(fCancelComponent == cancelComponent && fCancelComponent != null); fCancelComponent.removeListener(SWT.Selection, fCancelListener); fCancelComponent = null; } }