Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Get list of installed IU
Get list of installed IU [message #1698331] Sun, 14 June 2015 07:09 Go to next message
ALex W is currently offline ALex WFriend
Messages: 56
Registered: July 2012
Member
Hello,

Can anyone explain how to retrieve the locally installed IUs ? From Java code I mean.
I'm working on a e4 app, with self-update and installable software (just like in Eclipse), and I cannot re-use p2 UIs (compat layer required).

I retrieve the distant installable units with :
		IMetadataRepositoryManager manager = (IMetadataRepositoryManager) getProvisioningAgent().getService(IMetadataRepositoryManager.SERVICE_NAME);
		
		try {
			manager.loadRepository(new URI("http://mysite.url.com/"), monitor);
		} catch (ProvisionException | OperationCanceledException| URISyntaxException e) {
			throw new GkTechnicalException(e);
		}				
		// Query "groups"
		IQuery<IInstallableUnit> query =QueryUtil.createLatestQuery(QueryUtil.createMatchQuery("properties[$0] == $1 && properties[$2] != null", "org.eclipse.equinox.p2.type.group", "true", "org.eclipse.equinox.p2.type.category"));
		Collection<IInstallableUnit> lstInstallableUnit = manager.query(query, monitor).toUnmodifiableSet();


But can't figure out how to retrieve already installed units.

Thanks
Re: Get list of installed IU [message #1698342 is a reply to message #1698331] Sun, 14 June 2015 15:11 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 333
Registered: July 2009
Location: Ottawa
Senior Member
Take a look at OperationFactory#listInstalledElements in the org.eclipse.equinox.p2.operations bundle.

Also, if the only thing that prevent you from using p2 UI is the usage of the compat layer, I think it may be a better investment of your time to fix p2, than to develop a new UI altogether. To enter a bug https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Equinox
Re: Get list of installed IU [message #1698344 is a reply to message #1698342] Sun, 14 June 2015 16:10 Go to previous message
ALex W is currently offline ALex WFriend
Messages: 56
Registered: July 2012
Member
Hello Pascal,

Thanks for the answer.
I simply want to provide an easy way to install new feature. Quite specific.
I'd like to fix p2, but I'm not sure I'm familiar enough with it.
I don't even know where to find the sources Smile

Previous Topic:Eclipse install fails on conflicting equinox p2 dependency
Next Topic:ProvisioningJob and Invalid thread access
Goto Forum:
  


Current Time: Wed Apr 24 22:33:06 GMT 2024

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

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

Back to the top