Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-ui-dev] Problem with JFace PreferenceDialog class

I see you've posted this to both platform-swt-dev and platform-ui-dev. Neither is the right place. Please address questions like this to the eclipse.platform newsgroup. When you do, it wouldn't hurt to specify whether or not you have a standalone application or are writing an Eclipse plugin.

Bob Foster

Thilo Brandt wrote:
Hi together,

I am pretty new to JFace development and I have some trouble with it ;-)
When calling the following coding twice in my application:

Display display = new Display();

// create a PreferenceManager
PreferenceManager mgr = new PreferenceManager();

// assign nodes to PreferenceManager
IPreferenceNode n = new PreferenceNode("page1", new SamplePreferencePage());
mgr.addToRoot(n);

// create a PreferenceDialog
PreferenceDialog dlg = new PreferenceDialog(new Shell(display), mgr);
dlg.setPreferenceStore(new PreferenceStore());

dlg.open();
display.dispose();

... I got the following exception:

java.lang.NullPointerException
	at
org.eclipse.jface.preference.PreferenceDialog.createTitleArea(PreferenceDial
og.java:421)
	at
org.eclipse.jface.preference.PreferenceDialog.createDialogArea(PreferenceDia
log.java:378)
	at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:632)
	at
org.eclipse.jface.preference.PreferenceDialog.access$3(PreferenceDialog.java
:1)
	at
org.eclipse.jface.preference.PreferenceDialog$3.run(PreferenceDialog.java:30
7)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at
org.eclipse.jface.preference.PreferenceDialog.createContents(PreferenceDialo
g.java:305)
	at org.eclipse.jface.window.Window.create(Window.java:348)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:925)
	at org.eclipse.jface.window.Window.open(Window.java:637)
	at
de.powerisdnmonitor.ui.jface.configuration.ConfigurationCommand.execute(Conf
igurationCommand.java:47)


Is this a bug or do I have to change/add something in my code? I used the
libraries (jar files) from the Eclispe 3.0.1 build.
Any hints are appreciated.

BTW, is there a good source with code snippets/examples for JFace developers
like for
SWT?

Best regards,
Thilo



Back to the top