knownasilya
knownasilya

Reputation: 6143

Implementing IWorkbenchPreferencePage gives NPE when viewing preference page

I have a Eclipse RCP (3.6) plugin that needs some preference pages. At the moment I can't even get one working. I've googled for tutorials, but they all use a different version of IWorkbenchPreferencePage (it seems).

This is the stack trace: http://codepad.org/tu2WTwAA , which has the following first exception:

java.lang.NullPointerException at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1282)

The following is my plugin.xml entry, which shouldn't matter since the Node is in the preferences view.

<extension
      point = "org.eclipse.ui.preferencePages">
      <page id="com.test.menuplugin.preferences.general"
           class="com.gdeb.menuplugin.preferences.GeneralPreferences"
           name="Helpers">
      </page>
</extension>

Following this is my GeneralPreferences class: http://dpaste.com/hold/778180/

I went through the API ( IWorkbenchPreferencePage@Eclipse ) and still have no clue. I even tried to look at Vogelles tutorial but that was too different from the interface provided.

What am I doing wrong, should I be implementing some kind of preference objects like PreferenceDialog (seems like that's if you want preferences independent of the global preferences)?

Thank you all!

Upvotes: 0

Views: 271

Answers (1)

Eugene
Eugene

Reputation: 9474

Sorry, that was a wrong answer.

In Eclipse 3.7 NPE on that line might be caused by a null returned from your computeSize function (and it most definitely looks like your class field size may be null at that point). See org.eclipse.jface.preference.PreferencePage.computeSize() for how platform computes the size.

Upvotes: 2

Related Questions