| Summary: | [Wizards] NullPointerException in WizardDialog.updateButtons | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Adriaan Peeters <apeeters> |
| Component: | UI | Assignee: | Platform UI Triaged <platform-ui-triaged> |
| Status: | RESOLVED INVALID | QA Contact: | Prakash Rangaraj <prakash> |
| Severity: | normal | ||
| Priority: | P3 | CC: | remy.suen |
| Version: | 3.6 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Adriaan Peeters
Do you have a stack trace? I was wondering how is updateButtons() get called without the current page set I do not have a concrete stack trace but I encountered this 'bug' in the following scenario. I have a wizard that updates its buttons on changes in the underlying data model (using a listener). This data model might change before the wizard is open, hence triggering the listener which calls updateButtons. In this method currentPage is referenced, which is null. A simplified stack trace follows:
java.lang.NullPointerException
at org.eclipse.jface.wizard.WizardDialog.updateButtons(WizardDialog.java:1326)
...
updateButtons is called somehow during createControl
...
at com.example.WizardPage.createControl(WizardPage.java:32)
at org.eclipse.jface.wizard.Wizard.createPageControls(Wizard.java:170)
at org.eclipse.jface.wizard.WizardDialog.createPageControls(WizardDialog.java:734)
at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:606)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
at org.eclipse.jface.window.Window.open(Window.java:790)
The updateButtons() sets the enablement of the back/next buttons. You cannot do this before the creation of all the wizard pages. So calling the updateButtons() in the wizardPage.createControl() method is not correct. You can probably move the logic to the setVisible() method |