是否可以阅读使用Eclipse PDE API的读取插件之类的功能?目前,我使用以下方式阅读插件:

        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());

          }

        }

但是,如果我指定已安装功能的名称,我就会获得无效。是否应该阅读其他功能的其他方式?

而且,当我阅读该功能时,我想迭代其引用的所有插件。

有帮助吗?

解决方案

您可以尝试使用P2 API查询已安装的功能。 P2是Eclipse安装的经理。

// 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