Starting plugin with a non UI contribution [message #1821672] |
Tue, 18 February 2020 13:12 |
vlad tsepesh Messages: 5 Registered: January 2012 |
Junior Member |
|
|
Hi all,
I got two plugin:
the first one contains all the logic of the user experience, i.e. button, text area and so on, and declare an extension point
<plugin>
<extension-point id="any.id" name="Save" schema="any.id.exsd"/>
...
</plugin>
#################
#### any.id.exsd ####
#################
<element name="client">
<complexType>
<attribute name="class" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":my.package.ISave"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
the purpose of this extension is to store some data to a datastore.
the second one contains only the logic of implementing the way to persist the data, it implements the any.id plugin
<plugin>
<extension point="any.id">
<client class="another.package.SaveToDatabase">
</client>
</extension>
....
</plugin>
where, obviusly SaveToDatabase class implement the ISave interface.
Given that there's many way to store the data, a database is only one of those, the second plugin is provided via a p2 repository, it means we don't know at deploy time of the product which plugin is available.
So when I try to invoke the implementors of my extension point via the following code
String saveExtensionPointId = "any.id";
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(saveExtensionPointId);
Arrays.asList(config).forEach(c -> {
try {
ISave s = (ISaveCounter) c.createExecutableExtension("class");
s.save(...);
} catch (Exception e) {
}
});
the config[] is empty, which means the second plugin has not been started, the eclipse rcp framework did not analyze the plugin itself and register the extension point to the given id.
The only way I get everything works fine is
to deploy both the plugin in the same product, in a monolithic way, and declare the autostart for second plugin, but in this way I did not have the advantages of the repo.
or
declare some UI object, such as a menu, which do nothing, only to have the Activator started.
Not elegant at all.
PS: changing the Bundle-ActivationPolicy: makes no effect
Am I missing something?
Or I am doing something wrong?
Hope everything is clear in order to understand what is wrong.
TIA.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03054 seconds