Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Querying product's plugins under debug
Querying product's plugins under debug [message #1808831] Tue, 02 July 2019 13:53 Go to next message
Tim Sibirsky is currently offline Tim SibirskyFriend
Messages: 9
Registered: October 2018
Junior Member

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!
Re: Querying product's plugins under debug [message #1808956 is a reply to message #1808831] Fri, 05 July 2019 03:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 32563
Registered: July 2009
Senior Member
In the launch configuration you must, on the Configuration tab, enable "Support software installation in the launched application" to ensure that a self profile is available.

Ed Merks
Professional Support:
Previous Topic:Logger log level
Next Topic:Add "DynamicImport-Package" at runtime / by API?
Goto Forum:

Current Time: Wed Nov 30 04:19:52 GMT 2022

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

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

Back to the top