Querying product's plugins under debug [message #1808831] |
Tue, 02 July 2019 13:53 |
Tim Sibirsky Messages: 9 Registered: October 2018 |
Junior Member |
|
|
Hello!
In my Eclipse-based product, I need to obtain some information about included plugins and their locations (paths to .jar-files).
When I am running my product as a standalone application built with Maven Tycho, I can use following code that uses P2 API:
BundleContext bundleContext = FrameworkUtil.getBundle(MyObject.class).getBundleContext();
ServiceReference<IProvisioningAgent> serviceReference = bundleContext.getServiceReference(IProvisioningAgent.class);
IProvisioningAgent agent = bundleContext.getService(serviceReference);
IProfileRegistry registry = (IProfileRegistry)agent.getService(IProfileRegistry.SERVICE_NAME);
profile = registry.getProfile(IProfileRegistry.SELF);
And then make a query and check if product contains specific plugin:
IQueryResult<IInstallableUnit> plugins = profile.query(QueryUtil.createIUQuery(pluginName), null);
Then, using obtained plugin name and version find its .jar in product's plugins directory.
But when I am running my product in IDE, during the development process, the mentioned above code returning null for the profile, so I can not make any P2 queries to obtain plugins. Are there any ways to fix it? And another question, if I managed to obtain this installable unit object and obtain name and version of the plugin, how can I find the location of its .jar file for the product that is run from IDE?
Just in case, my IDE uses P2 bundle pool.
Thanks for answers!
|
|
|
|
Powered by
FUDForum. Page generated in 0.03223 seconds