如何读取已安装的功能(eclipse PDE)?

发布于 2024-10-01 14:34:04 字数 521 浏览 0 评论 0原文

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

          }

        }

但是如果我指定已安装功能的名称,我只会得到 null。是否还有其他方式可以读取功能?

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

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离旧人 2024-10-08 14:34:04

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

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文