Reputation: 1869
I have an objects of class T that belongs to plugin P. It is possible to retrieve the Plugin ID, trough class T?
I don't have access to plugin object but I have access to a objects that is an inner class of plugin P, I have access to PluginClassDescriptor. I have access to:
P.T object; // I need P.pluginID
Thanks
Upvotes: 0
Views: 215
Reputation: 111141
You can get the Bundle
for any plug-in class using:
Bundle bundle = FrameworkUtil.getBundle(anyobject.getClass());
where `anyobject' is an instance of some class belonging to the plug-in.
The plug-in id is known as the 'symbolic name' in the bundle:
String pluginid = bundle.getSymbolicName();
FrameworkUtil
is org.osgi.framework.FrameworkUtil
in the org.eclipse.osgi
plug-in.
Upvotes: 1