Project: Eclipse_Platform_UI
Bug 92601 [Properties] Can't contribute properties page for non IAdaptable
Reported: 2005-04-25 12:00:30 | Status: verified fixed

Contributing a properties page for objects is not nearly as straightforward as the documentation would imply. First of all, the plugin.xml editor provides a nice class browse dialog to select the type of object for which the properties page is to be contributed. However, that dialog seems to have some kind of filter on it that does not allow me to select the desired class/interface (not even IFile, or IResource)! When I just type in the fully qualified class name I try to bring up the Properties dialog by selecting my object in a view (custom view) and then going to File | Properties. Unfortunately the action is disabled (Alt+Enter doesn't work either). I added my own popup menu to the custom view and added the PropertyDialogAction to it, but when I click the action, I get a class cast exception saying that my object is not an IAdaptable. Looking in the code, I saw that the code assumes that the target object is an IAdaptable and so it just casts it. However, I cannot discern why the object needs to be an IAdaptable, because it does not use any of the IAdaptable methods. Further in the stack, where it does finally use the IAdaptable#getAdapter method, it first does an instanceof check. I have my own domain objects that I am trying to keep separate from eclipse code, so that they can be portable without having to lug around eclipse jars just to be useful. I need to be able to bring up a property page for the object when it is in eclipse, but I keep running into road blocks.

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPage.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyDialogAction.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AdaptableForwarder.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IPropertyPageContributor.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyDialog.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageContributorManager.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageNode.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RegistryPageContributor.java