Bug 60227 [Progress] support for clients implementing IRunnableContext
Clients which implement IRunnableContext directly need some support so that they can also show the BlockedJobsDialog. These clients currently typically run an operation as follows (for example SearchDialog): ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay ()); One idea is to provide them with a helper that creates a progress monitor that handles setBlocked by showing the BlockedJobsDialog. For example, IProgressService.getProgressMonitorFor(IProgressMonitor); The wrapper could be implemented as shown below. It could probably reuse some of the WorkbenchWizardBlockedHandler. Once this support is in place the WorkbenchWindow should leverage this support. public class BlockedJobsAwareProgressMonitor extends ProgressMonitorWrapper { private BlockedJobsDialog blockedDialog; private Shell shell; private String currentTask; protected BlockedJobsAwareProgressMonitor(Shell shell, IProgressMonitor monitor) { super(monitor); this.shell = shell; } public void clearBlocked() { if (blockedDialog == null) return; blockedDialog.close(); blockedDialog = null; } public void setBlocked(IStatus reason) { showBlocked(shell, this, reason, currentTask); } public void showBlocked(Shell parentShell, IProgressMonitor blockingMonitor, IStatus blockingStatus, String blockedName) { if (blockedName == null) blockedName = parentShell.getText(); blockedDialog = new BlockedJobsDialog(parentShell, blockingMonitor, blockingStatus); blockedDialog.setBlockedTaskName(blockedName); blockedDialog.open(); } public void beginTask(String name, int totalWork) { super.beginTask(name, totalWork); currentTask = name; } }
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java
* <p>
 * In typical usage, the client instantiates this class with 
 * a particular wizard. The dialog serves as the wizard container
 * and orchestrates the presentation of its pages.
 * <p>
 * The standard layout is roughly as follows: 
 * it has an area at the top containing both the
 * wizard's title, description, and image; the actual wizard page
 * appears in the middle; below that is a progress indicator
 * (which is made visible if needed); and at the bottom
 * of the page is message line and a button bar containing 
 * Help, Next, Back, Finish, and Cancel buttons (or some subset).
 * </p>
 * <p>
 * Clients may subclass <code>WizardDialog</code>, although this
 * is rarely required.
 * </p>
 */
public class WizardDialog extends TitleAreaDialog implements IWizardContainer2 {
	/**
	 * Image registry key for error message image (value <code>"dialog_title_error_image"</code>).
	 */
	public static final String WIZ_IMG_ERROR = "dialog_title_error_image"; 
	
	
	private static IWizardBlockedHandler blockedHandler =
		new IWizardBlockedHandler(){
		/* (non-Javadoc)
		 * @see org.eclipse.jface.wizard.IWizardBlockedHandler#clearBlocked()
		 */