Project: Eclipse_Platform_UI
Bug 244354 [CommonNavigator] ProjectExplorer property page incorrectly given in the non-resource use of CN
Reported: 2008-08-15 20:27:53 | Status: resolved fixed

The Common Navigator is automatically adaptable to an IPropertySheetPage via the TabbedPropertySheetAdapterFactory class. This is a problem. If a creator wants to have a view that provides *no* properties sheet page at all, there is currently no way to do that. If I use the "CommonNavigator" class itself, the call to getAdapter(IPropertySheetPage.class) returns the object directly, which is fine I suppose though I feel it shouldn't do this automatically. However, if I have a subclass of CommonNavigator, and specifically overwrite the getAdapter(Class) as follows: public Object getAdapter(Class clazz) { if( clazz == IPropertySheetPage.class ) return null; return super.getAdapter(clazz); } in order to specifically have NO property page, the execution goes as follows: if (sourceObject instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) sourceObject; // THIS is where it asks the view Object result = adaptable.getAdapter(adapter); if (result != null) { // Sanity-check Assert.isTrue(adapter.isInstance(result)); return result; } } // And HERE it goes and asks the platform anyway! if (!(sourceObject instanceof PlatformObject)) { Object result; if (activatePlugins) { result = Platform.getAdapterManager().loadAdapter(sourceObject, adapter.getName()); } else { result = Platform.getAdapterManager().getAdapter(sourceObject, adapter); } This leads to an error later on in, specifically a very very cryptic error in the TabbedPropertyRegistry class complaining that I did not provide any categories. The exact error is "Contributor org.jboss.ide.eclipse.archives.ui.ProjectArchivesView cannot be created. An exception stack trace is not available." This took a decently long time to debug, actually. I suggest that this automatic adaptability be removed from the framework and instead be embedded in the CommonNavigator.getAdapter(Class clazz) code instead. This would allow subclassers the ability to *not* have a property page if they so choose and thus avoid this pretty ridiculous error. This problem can be seen in any CommonNavigator based view that does not contribute any property page data... The Data Source Explorer is one of them, and our product has two such views where this problem is seen. A patch will be attached shortly.

Files changed in fix:
bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetAdapterFactory.java