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 15:54 Go to next 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
Re: Contributed adapter not available [message #987984 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 191
Registered: January 2012
Senior Member

Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,

Eclipse Platform committer. Ask me about Eclipse support, training, and consulting.
Re: Contributed adapter not available [message #988014 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #988031 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #988048 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #988066 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #988083 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #988104 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #988123 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #988146 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #988168 is a reply to message #987905] Wed, 28 November 2012 17:38 Go to previous messageGo to next message
Brian de Alwis is currently offline Brian de Alwis
Messages: 242
Registered: July 2009
Senior Member
Check hat your bundle is set to be lazily activated -- see the "Activate bundle on class load" (or something to that effect) on the "Overview" page of the manifest editor,
Re: Contributed adapter not available [message #989867 is a reply to message #988014] Sat, 08 December 2012 19:12 Go to previous message
Steve Biggs is currently offline Steve Biggs
Messages: 5
Registered: November 2012
Junior Member
Thanks for the suggestion. Selecting "Activate this plug-in when one of it's classes is loaded" in the General Information section of the Overview tab of the plug-in's manifest editor fixed the problem.

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


Current Time: Tue Oct 21 18:26:34 GMT 2014

Powered by FUDForum. Page generated in 0.01953 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software