【问题标题】:Can we contribute a new plugin.xml to ExtensionRegistry我们可以为 ExtensionRegistry 贡献一个新的 plugin.xml
【发布时间】:2009-09-23 09:45:57
【问题描述】:

我有一些额外的 xml 文件(包含标准的 eclipse 扩展)位于包之外。有没有办法可以将这些文件中的 extns/extnpoints 贡献给平台的扩展注册表?

我试过了

`Platform.getExtensionRegistry.addContribution(..)`

但是该方法需要一个我无权访问的 masterToken 对象,如果没有它,它会给我一个异常。

【问题讨论】:

    标签: eclipse registry osgi equinox


    【解决方案1】:

    你必须使用一些内部方法。这是我的工作:

        IExtensionRegistry reg = Platform.getExtensionRegistry();
        Object ut = ((ExtensionRegistry)reg).getTemporaryUserToken();
    
        IContributor cont = ContributorFactoryOSGi.createContributor(Platform
                .getBundle(editor.getPluginId()));
    
    
        if (!reg.addContribution(is, cont, false, null, null, ut))
            Util.impossible("Contribution not added due to error"); //$NON-NLS-1$
    

    【讨论】:

    • 谢谢弗朗西斯,我也使用类似的东西。但是这里有两个问题(如果我已经磨损,请纠正我):a)使用临时令牌,贡献不会持续 b)虽然我的系统是 OSGI 系统,但新贡献来自非 osgi-bundle 贡献者.我在没有使用 ContributorFactoryOSGi 的情况下创建了贡献者,但我不确定如何实际混合 osgi-contributors 和非 sogi 贡献者。
    • 我不知道如何回答您的任何问题。我会在 Eclipse Runtime Equinox 新闻组中发帖(在 eclipse.org - 他们也有一个网络论坛界面),你应该可以在那里得到一些很好的帮助。
    • 你能把链接贴在这里,我可以跟进。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2018-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-06-13
    相关资源
    最近更新 更多