Community
Participate
Working Groups
I20060718-0800 1. open the propertie pages on an JAR entry in the JRE container 2. error dialogs says that a page couldn't be shown java.lang.NullPointerException at org.eclipse.ui.internal.ide.dialogs.ResourceInfoPage.createContents(ResourceInfoPage.java:234) at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:233) at org.eclipse.jface.preference.PreferenceDialog.createPageControl(PreferenceDialog.java:1403) at org.eclipse.jface.preference.PreferenceDialog$12.run(PreferenceDialog.java:1162) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:843) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149) at org.eclipse.jface.preference.PreferenceDialog.showPage(PreferenceDialog.java:1156) at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.showPage(FilteredPreferenceDialog.java:439) at org.eclipse.jface.preference.PreferenceDialog$8.selectionChanged(PreferenceDialog.java:661) at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:839) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37) at org.eclipse.core.runtime.Platform.run(Platform.java:843) at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44) at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:149) at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:837) at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1578) at org.eclipse.jface.preference.PreferenceDialog.selectSavedItem(PreferenceDialog.java:958) at org.eclipse.ui.internal.dialogs.FilteredPreferenceDialog.selectSavedItem(FilteredPreferenceDialog.java:482) at org.eclipse.jface.preference.PreferenceDialog$3.run(PreferenceDialog.java:345) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.preference.PreferenceDialog.createContents(PreferenceDialog.java:341) at org.eclipse.jface.window.Window.create(Window.java:426) at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1124) at org.eclipse.ui.internal.dialogs.PropertyDialog.createDialogOn(PropertyDialog.java:82) at org.eclipse.ui.dialogs.PropertyDialogAction.createDialog(PropertyDialogAction.java:175) at org.eclipse.ui.dialogs.PropertyDialogAction.run(PropertyDialogAction.java:154) at org.eclipse.jface.action.Action.runWithEvent(Action.java:499) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3377) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2997) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
Martin, the Info property page is registered on objects that adapt to IResource. JarPackageFragmentRoot adapts to IResource but returns null for external JARs. We can guard against the NPE, but what do you expect the behaviour to be? An empty Info property page or one with a label telling you information could not be retrieved?
I guess a label on the page would be good enough. But maybe the approach of contributing to everything that adapts to IResource is too coarse. - from the beginning on, adaptation to IResource has been blured as it is used in many contexts (actions, decorators... - now all our element have such a info page but can't show Java specific info
I think the Info page should just show the resource info. Mixing in model info (such as more info from an IJavaElement) would bloat the page -- that information should be shown on a separate page if it's really useful. How about renaming the page to 'Resource' to make clear that this is only resource-related info? After all, all properties pages show some 'info'... Then it would also be OK to hide the page when the element does not adapt to IResource. This would be consistent with all other properties pages which also only show up when they have something to show.
Created attachment 46932 [details] org.eclipse.ui.ide patch comment 3 is right on the money. The Resource property page shows up only on objects that adapt to IResource and displays resource-specific attributes only. So if null is returned as in the case here, we display a label indicating so. I also agree that the title 'Info' is not distinctive enough and has now been changed to 'Resource'.
Boris, please review/release patch. Thanks.
Or 'Resource Info'?
I hate the word 'info' as it's too informal. 'Resource Information'?
Patch looks good, released (with just "Resource") to HEAD >20060728. I don't think we need Info or Information since all property pages contain information. I have filed bug 152147, requesting additional API in IAdapterManager which in this case would allow us to hide the resource property page altogether.
Thanks Boris. Setting milestone.
Thanks Wassim!