【问题标题】:How to read an installed feature (eclipse PDE)?如何读取已安装的功能(eclipse PDE)?
【发布时间】:2010-11-09 00:12:09
【问题描述】:

是否可以像使用 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());

          }

        }

但是,如果我指定已安装功能的名称,我只会得到空值。还有其他读取特征的方式吗?

当我阅读了该功能后,我想迭代它引用的所有插件。

【问题讨论】:

  • 捆绑包是指插件,而不是功能。功能是用于安装的逻辑单元。

标签: eclipse pde


【解决方案1】:

您可以尝试使用 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);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-11-15
    • 1970-01-01
    • 1970-01-01
    • 2020-11-11
    • 2012-10-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多