Skip to main content



      Home
Home » Eclipse Projects » Equinox » Querying product's plugins under debug
Querying product's plugins under debug [message #1808831] Tue, 02 July 2019 09:53 Go to next message
Eclipse UserFriend
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!
Re: Querying product's plugins under debug [message #1808956 is a reply to message #1808831] Thu, 04 July 2019 23:42 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Logger log level
Next Topic:Add "DynamicImport-Package" at runtime / by API?
Goto Forum:
  


Current Time: Wed May 21 18:04:10 EDT 2025

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

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

Back to the top