Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » P2 » Querying for installed features
Querying for installed features [message #1404648] Mon, 04 August 2014 16:37 Go to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 412
Registered: November 2009
Senior Member
Hello,

I want to search for specific features installed in my product. Reading about p2 Query language I did the following:

IQueryable<IInstallableUnit> queryable = ((IProfileRegistry) provisioningSession.getProvisioningAgent().getService(IProfileRegistry.SERVICE_NAME)).getProfile( profileId );
queryable.query(new IQuery<IInstallableUnit>() {

   public IQueryResult<IInstallableUnit> perform(Iterator<IInstallableUnit> iterator) {
					
      while(iterator.hasNext()){
         IInstallableUnit next = iterator.next();
	 System.out.println(next.toString());
      }
      return null;
   }

   public IExpression getExpression() {
      return null;
   }
}, null);


This returns what looks like plugins that are running, what should I use to get features in my product. I am specifically interested in those listed in "Installed Software" section of Installation Details dialog.

Also, when constructing an actual query, how can add regular expression to the query, something like:

QueryUtil.createMatchQuery(select(x | x.id == $0)", "org.eclipse.*");
Re: Querying for installed features [message #1404649 is a reply to message #1404648] Mon, 04 August 2014 16:53 Go to previous messageGo to next message
Pascal Rapicault is currently offline Pascal RapicaultFriend
Messages: 297
Registered: July 2009
Location: Ottawa
Senior Member
Check out the UserVisibleRootQuery class in the org.eclipse.equinox.p2.engine plugin. This will return the list of things that have been installed (whether they are plugins or features).
You can also check out the QueryUtil class for a bunch of helper methods to create "typical" queries.
HTH
Re: Querying for installed features [message #1404668 is a reply to message #1404649] Mon, 04 August 2014 20:19 Go to previous message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 412
Registered: November 2009
Senior Member
Thanks Pascal.
Previous Topic:Installing features into different Eclipse instance
Next Topic:How to prevent local file repo from getting added to repository list
Goto Forum:
  


Current Time: Tue Apr 21 11:42:06 GMT 2015

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

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