How to activate plugin providing an IAdapterFactory? [message #1277962] |
Wed, 26 March 2014 18:10 |
Jan Reimann Messages: 140 Registered: July 2009 |
Senior Member |
|
|
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 };
}
}
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05278 seconds