문제

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.

도움이 되었습니까?

해결책

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top