Project: Eclipse_Platform_UI
Bug 129156 [Wizards] NPE in IDESelectionConversionService.convertToResources
Reported: 2006-02-23 09:18:38 | Status: closed fixed

I get NPE when I try to open a TPTP wizard with a selection that doesn't have an associated ResourceMapping, the following lines (64,65) returns null when currentElement is one of our EMF model object (works fine if the selection is on a project/folder in our Profiling Monitor navigator - TPTP project): ResourceMapping mapping = (ResourceMapping) adapterManager .getAdapter(currentElement, ResourceMapping.class); I use 3.2 M5 driver (org.eclipse.ui.ide_3.2.0.I20060216-1200.jar). Here is the exception: java.lang.NullPointerException at org.eclipse.ui.internal.ide.IDESelectionConversionService.convertToResources(IDESelectionConversionService.java) at org.eclipse.ui.internal.dialogs.WorkbenchWizardElement.convertToResources(WorkbenchWizardElement.java:210) at org.eclipse.ui.internal.dialogs.WorkbenchWizardElement.adaptedSelection(WorkbenchWizardElement.java:99) at org.eclipse.ui.internal.dialogs.WorkbenchWizardNode.getWizard(WorkbenchWizardNode.java:168) at org.eclipse.jface.wizard.WizardSelectionPage.getNextPage(WizardSelectionPage.java:101) at org.eclipse.ui.internal.dialogs.WorkbenchWizardSelectionPage.getNextPage(WorkbenchWizardSelectionPage.java:99) at org.eclipse.ui.internal.dialogs.ImportExportPage.getNextPage(ImportExportPage.java:420) at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:737) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:345) at org.eclipse.jface.dialogs.Dialog$3.widgetSelected(Dialog.java:645) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3287) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2907) at org.eclipse.jface.window.Window.runEventLoop(Window.java:811) at org.eclipse.jface.window.Window.open(Window.java:789) at org.eclipse.ui.actions.ImportResourcesAction.run(ImportResourcesAction.java:158) at org.eclipse.ui.actions.BaseSelectionListenerAction.runWithEvent(BaseSelectionListenerAction.java:167) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:530) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:480) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:392) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:925) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3287) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2907) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1899) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1863) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:417) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:99) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:374) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952)

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardElement.java