Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Contributed adapter not available (An adapter contributed via org.eclipse.core.runtime.adapters is not available because plugin is RESOLVED and not ACTIVE)
Contributed adapter not available [message #987905] Wed, 28 November 2012 10:54 Go to previous message
Steve Biggs is currently offline Steve Biggs
Messages: 5
Registered: November 2012
Junior Member
I'm contributing two adapters to a plugin I'm writing via the org.eclipse.core.runtime.adapters extension point, but the adapters are not accessible when I start the plugin. The adapters are used to convert my model objects to IWorkbenchAdapter for display in a TreeViewer.

The source of the problem occurs in BaseWorkbenchContentProvider.getChildren() where the call the getAdapter(element) returns null instead of the expected adapter. I've traced this call down to method AdapterFactoryProxy.loadFactory(). This returns null because the call to org.eclipse.core.internal.registry.osgi.EquinoxUtils.isActive() returns false and loadFactory() has been called with the force argument set to false. The isActive() method is returning false because the bundle getState() method is returning Bundle.RESOLVED instead of Bundle.ACTIVE.

Any idea why the bundle state is resolved and not ACTIVE, and how do I access contributed adapters if the contributing bundle state is not Bundle.ACTIVE? Since the contributing bundle is the main plugin associated with the application, it's not clear to me why the state isn't Bundle.ACTIVE, since presumably it would have to be ACTIVE to be executing.

I know the adapters work because if I register them manually using Platform.getAdapterManager().registerAdapters() everything works fine.

Extract from plugin.xml where I declare adapters:
<extension
         point="org.eclipse.core.runtime.adapters">
      <factory
            adaptableType="com.ibm.ccoet.model.managers.ProjectsManager"
            class="com.ibm.ccoet.ui.adapters.ApplicationAdapterFactory">
         <adapter
               type="org.eclipse.ui.model.IWorkbenchAdapter">
         </adapter>
      </factory>
      <factory
            adaptableType="com.ibm.ccoet.ui.adapters.ApplicationAdapterFactory$ObjectWrapper"
            class="com.ibm.ccoet.ui.adapters.ApplicationAdapterFactory">
         <adapter
               type="org.eclipse.ui.model.IWorkbenchAdapter">
         </adapter>
      </factory>
   </extension>


createPartControl() method from the View that displays the TreeViewer
@Override
   public void createPartControl(Composite parent) {
      // Create a TreeViewer to display the managed projects
      treeViewer = new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
		
      // Configure the TreeViewer to be the selection provider for the view
      getSite().setSelectionProvider(treeViewer);
		
      // Hook up the ProjectsManager to the TreeViewer
      DecoratingLabelProvider decorator=new DecoratingLabelProvider(new WorkbenchLabelProvider(),new ArtifactsDecorator());
      treeViewer.setLabelProvider(decorator);
      treeViewer.setContentProvider(new BaseWorkbenchContentProvider());
      treeViewer.setInput(pm);
		
      // Setup drag and drop for artifacts
      initDragAndDrop(treeViewer);
		
      // Listen for artifact editors to open and close
      getSite().getWorkbenchWindow().getPartService().addPartListener(partListener);
		
      // Link to context sensitive help
      PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getControl(),"com.ibm.CCoET.help.project_explorer");
		
      // Perform the rest of the view setup
      createActions();
      initializeToolBar();
      initializeMenu();
}


Thanks.




Steve Biggs
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Create TreeViewer using Workspace Content
Next Topic:Eclipse 4 RCP build tabs immediately
Goto Forum:
  


Current Time: Sat May 18 22:59:27 EDT 2013

Powered by FUDForum. Page generated in 0.01641 seconds