0

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

我试过

`Platform.getExtensionRegistry.addContribution(..)`

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

4

1 回答 1

0

您必须使用一些内部方法。这是我所做的:

    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$
于 2009-09-28T12:37:06.617 回答