Bug 331335 [Wizards] Bad implementation of IWizard's dispose() method can prevent the dialog from closing
If there is bad client code in an IWizard's dispose() method, the dialog get into a state where it cannot be closed. ------------ Run this code and try to close the wizard dialog, you will not be able to. Display display = new Display(); Wizard wizard = new Wizard() { public boolean performFinish() { return true; } public void dispose() { throw new RuntimeException(); } }; WizardDialog dialog = new WizardDialog(null, wizard); dialog.open(); display.dispose(); ------------ java.lang.RuntimeException at Main$5.dispose(Main.java:142) at org.eclipse.jface.wizard.WizardDialog.hardClose(WizardDialog.java:859) at org.eclipse.jface.wizard.WizardDialog.close(WizardDialog.java:484) at org.eclipse.jface.window.Window.handleShellCloseEvent(Window.java:741) at org.eclipse.jface.window.Window$3.shellClosed(Window.java:687) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:98)
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java
private void saveEnableStateAndSet(Control w, Map h, String key,
			boolean enabled) {
		if (w != null) {
			h.put(key, w.getEnabled() ? Boolean.TRUE : Boolean.FALSE);
			w.setEnabled(enabled);
		}
	}
	/**
	 * Captures and returns the enabled/disabled state of the wizard dialog's
	 * buttons and the tree of controls for the currently showing page. All
	 * these controls are disabled in the process, with the possible exception
	 * of the Cancel button.
	 * 
	 * @param keepCancelEnabled
	 *            <code>true</code> if the Cancel button should remain
	 *            enabled, and <code>false</code> if it should be disabled
	 * @return a map containing the saved state suitable for restoring later
	 *         with <code>restoreUIState</code>
	 * @see #restoreUIState
	 */
	private Map saveUIState(boolean keepCancelEnabled) {
		Map savedState = new HashMap(10);
		saveEnableStateAndSet(backButton, savedState, "back", false); 
		saveEnableStateAndSet(nextButton, savedState, "next", false); 
		saveEnableStateAndSet(finishButton, savedState, "finish", false); 
		saveEnableStateAndSet(cancelButton, savedState,	"cancel", keepCancelEnabled); 
		saveEnableStateAndSet(helpButton, savedState, "help", false); 
		if (currentPage != null) {
			savedState
					.put(