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
gd.horizontalSpan = 2;
		separator.setLayoutData(gd);
		return composite;
	}
	/**
	 * Creates the inner page container.
	 */
	private Composite createPageContainer(Composite parent) {
		Composite result = new Composite(parent, SWT.NULL);
		result.setLayout(new PageLayout());
		return result;
	}
	/**
	 * Creates the wizard's title area.
	 *
	 * @param parent the SWT parent for the title area composite
	 * @return the created title area composite
	 */
	private Composite createTitleArea(Composite parent) {
		
		
		titleArea = new Composite(parent, SWT.NONE);
		GridLayout layout = new GridLayout();
		layout.marginHeight = 2;
		layout.marginWidth = 2;
		layout.verticalSpacing = 0;
		layout.horizontalSpacing = 0;
		layout.numColumns = 2;
		
		Display display = parent.getDisplay();