Skip to main content



      Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to activate plugin providing an IAdapterFactory?
How to activate plugin providing an IAdapterFactory? [message #1277962] Wed, 26 March 2014 14:10 Go to next message
Eclipse UserFriend
Hi,
I have a plugin which just is intended to provide an IAdapterFactory. So
I registered the factory. But when requesting the desired adapter always
null is returned. While debugging I found out that, on the one hand
side, the AdapterManager (in the getFactories method) correctly finds
the adapter type. But, on the other hand side, an AdapterFactoryProxy is
used. And the AdapterFactoryProxy checks if the plugin containing my
AdapterFactory is loaded. Unfortunately, my plugin is resolved and not
active and, thus, my AdapterFactory is not used und null is returned.
How can I achieve to get my AdapterFactory be loaded and used? Attached
you can find my manifest, my plugin.xml and my AdapterFactory.

cheers,
Jan

MANIFEST.MF
===========
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Test
Bundle-SymbolicName: my.plugin.test;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui.workbench.texteditor,
org.eclipse.ui.workbench,
org.eclipse.emf.ecore,
org.eclipse.jface,
org.eclipse.emf.transaction,
org.eclipse.jface.text

plugin.xml
==========
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension
point="org.eclipse.core.runtime.adapters">
<factory
adaptableType="org.eclipse.ui.texteditor.ITextEditor"
class="my.plugin.test.MyAdapterFactory">
<adapter type="my.otherplugin.AdapterTarget"/>
</factory>
</extension>
</plugin>

MyAdapterFactory.java
=====================
public class MyAdapterFactory implements IAdapterFactory {
@Override
public Object getAdapter(Object adaptableObject,
@SuppressWarnings("rawtypes") Class adapterType) {
if(adapterType.equals(AdapterTarget.class) && adaptableObject
instanceof ITextEditor){
return new AdapterTarget();
}
}
return null;
}
@SuppressWarnings("rawtypes")
@Override
public Class[] getAdapterList() {
return new Class[] { AdapterTarget.class };
}
}
Re: How to activate plugin providing an IAdapterFactory? [message #1278373 is a reply to message #1277962] Thu, 27 March 2014 04:39 Go to previous messageGo to next message
Eclipse UserFriend
Any suggestions?
Re: How to activate plugin providing an IAdapterFactory? [message #1289353 is a reply to message #1278373] Wed, 09 April 2014 04:42 Go to previous message
Eclipse UserFriend
Hi,

To force the load of a class, you can use the "org.eclipse.ui.startup" extension point.

Hussein
Previous Topic:JSP Compilation Issue for Simple Web Application
Next Topic:Plugin Development :Get fully qualified class name in my plugin
Goto Forum:
  


Current Time: Thu Jul 03 13:33:37 EDT 2025

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

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

Back to the top