Bug 29107 [Preferences] Error thrown in PreferencePage.performOk/Apply/Cancel locks Eclipse
An error thrown inside the overriden methods performOk and performCancel (and performApply) in a PreferencesPage will cause Eclipse to run into a deadlock as soon as the user displays that page. Imagine a new plugin developed using the latest version of the eclipse libraries using methods that did not exist in previous versions. Running it on an older version can lead to NoSuchMethodErrors (that's what happened to me). Imagine those errors in performOk and performCancel on a PreferencesPage. The Error will not be caught and there is no way for the user to exit the preferences or eclipse without killing it. Reproduction: 1. create a new plugin project containing a preferences page. 2. Override methods as follows: public boolean performOk() { throw new NoSuchMethodError("No way out!"); } public boolean performCancel() { throw new NoSuchMethodError("No way out!"); } 3. Run the plugin and go to the preferences page. 4. Try to exit the preferences pages or eclipse Possible solution: Catch any throwable when calling those methods from the environment and report an error message to the user when the method throws any. Exit the preferences anyway (or let the user decide what to do). This problem has been reproduced on 2.1M3 and 2.1M4.
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
item.setData(node);
		item.setText(node.getLabelText());
		Image image = node.getLabelImage();
		if (image != null) {
			item.setImage(image);
		}
		IPreferenceNode[] subnodes = node.getSubNodes();
		for (int i = 0; i < subnodes.length; i++) {
			createTreeItemFor(item, subnodes[i]);
		}
	}
	/**
	 * Returns the preference mananger used by this preference dialog.
	 *
	 * @return the preference mananger
	 */
	public PreferenceManager getPreferenceManager() {
		return preferenceManager;
	}
	/* (non-Javadoc)
	 * Method declared on IPreferencePageDialog.
	 */
	public IPreferenceStore getPreferenceStore() {
		return preferenceStore;
	}
	/**
	 * Save the values specified in the pages.
	 * <p>
	 * The default implementation of this framework method saves all
	 * pages of type <code>PreferencePage</code> (if their store needs saving