Community
Participate
Working Groups
3.1 RC1 I create a new plug-in without a bundle activator, then added a view that used the Workbench's content and label providers. The applications model elements extend PlatformObject thus inherits the getAdapter() method that looks via the IAdapterManager for adapters. I added a couple of IWorkbenchAdapters to the runtime.adapters extension point. When the application is run and getAdapter() is called on the model elements the IAdapterManager returns that there are no adapters registered. I looked into this and found that the following line was causing the trouble: AdapterFactoryProxy::loadFactory String bundleId = element.getNamespace(); if (!force && Platform.getBundle(bundleId).getState() != Bundle.ACTIVE) return null; This means that the adapter factory won't be visible until the plug-in that defines it is loaded. This is probably the only place in the Platform were a plug-in with an extension is not loaded when it's extension is needed. The reason this isn't a problem for most is that if you define a bundle activator PDE adds the EclipseAutoStart directory to the manifest, thus ensuring that the plug-in is started. I'm not sure what the solution should be but here are some general observations: 1. PlatformObject calls IAdapterManager.getAdapter() which won't lazily load. A Workaround is to not extend PlatformObject and instead implement my own getAdapter() using IAdapterManager.loadAdapter() instead. This forces plug-in activation. 2. But this begs the question, shouldn't PlatformObject just call loadAdapter() and force the callers to decide if they don't want to load plug-ins? I get that in most cases you *want* to load the adapter factory, and the only cases where you don't (e.g. in the Workbench contribution code) it is calling IAdapterManager.getAdapter() explicitly anyway.
*** This bug has been marked as a duplicate of 82973 ***