Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349247

Summary: [wizard] invoking the new team wizard from the PDE editor throws NPE
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTDTAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P2    
Version: 2.0   
Target Milestone: 2.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
trivial fix none

Description Stephan Herrmann CLA 2011-06-13 17:46:50 EDT
This is a regression introduced by bug 346799:

When the new team wizard is invoked without a current selection
it throws the following NPE:

java.lang.NullPointerException
        at org.eclipse.objectteams.otdt.internal.ui.wizards.NewTypeWizardPage.getInitialJavaElement(NewTypeWizardPage.java:789)
        at org.eclipse.objectteams.otdt.internal.ui.wizards.NewTypeWizardPage.init(NewTypeWizardPage.java:781)
        at org.eclipse.objectteams.otdt.internal.pde.ui.ExtensionEditorAdaptor$__OT__JavaAttributeWizard.addNewTeamWizardPage(ExtensionEditorAdaptor.java:199)
        at org.eclipse.objectteams.otdt.internal.pde.ui.ExtensionEditorAdaptor._OT$JavaAttributeWizard$addNewTeamWizardPage$addPages(ExtensionEditorAdaptor.java:189)
        at org.eclipse.pde.internal.ui.editor.plugin.JavaAttributeWizard._OT$addPages$chain(JavaAttributeWizard.java)
        at org.eclipse.pde.internal.ui.editor.plugin.JavaAttributeWizard.addPages(JavaAttributeWizard.java)
        at org.eclipse.jface.wizard.WizardDialog.createContents(WizardDialog.java:605)

This makes it impossible to use the link in the PDE editor for creating
a team that has been referenced in an aspectBinding but doesn't exist.
Comment 1 Stephan Herrmann CLA 2011-06-13 17:54:40 EDT
For reproducing note that the workspace must have > 1 projects,
otherwise the single project will be picked as the current selection.
Comment 2 Stephan Herrmann CLA 2011-06-13 18:01:04 EDT
Created attachment 197932 [details]
trivial fix

Just checking for null fixes this issue indeed.
Comment 3 Stephan Herrmann CLA 2011-06-13 18:39:44 EDT
.
Comment 4 Stephan Herrmann CLA 2011-06-14 18:24:47 EDT
Patch has been committed, build was contributed for RC5.
Comment 5 Stephan Herrmann CLA 2012-01-29 17:26:29 EST
Verified using build 201201281118.