Question

Is it possible to read a feature like its possible to read a plugin use the eclipse PDE API? Currently I read plugins using:

        Bundle[] bundles = Platform.getBundles(name, version);
        if (bundles == null) {
          throw new NullPointerException("No bundle found with ID: " + name
              + " and version: " + version);

        } else {
          for (Bundle bundle : bundles) {
            System.out.println(bundle.getSymbolicName());

          }

        }

But if I specify the name of an installed feature I just get null. Is there some other way that features should be read?

And when I have read the feature I would like to iterate all the plugins that it reference.

Was it helpful?

Solution

You can try to use p2 API to query the installed feature. P2 is the manager of eclipse installation.

// IProvisioningAgent is a OSGi service
IProvisioningAgent agent = ...;
IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
IQueryResult rt = profile.query(QueryUtil.createIUPropertyQuery("org.eclipse.equinox.p2.eclipse.type", "feature"), null);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top