Eclipse 3.8到4.6 Migration Platform.getPlugin()返回null [英] Eclipse 3.8 to 4.6 Migration Platform.getPlugin() returns null

查看:40
本文介绍了Eclipse 3.8到4.6 Migration Platform.getPlugin()返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须从Eclipse 3.8迁移到4.6.我的问题是,在4.6(或更早版本)中,Platform.getPlugin()已弃用,并将始终返回null.使用Bundles代替插件并不能帮助我,因为在这种情况下,我们将不得不破坏我们的公共API.您知道捆绑包中是否有办法获取插件?

I have to migrate from Eclipse 3.8 to 4.6. My problem is that in 4.6 (or earlier) Platform.getPlugin() got deprecated and will always return null. Using the Bundles in place of plugins doesn't help me beacuse in that case we will have to break our public API. Do you know if there is a way from the bundle to get the plugin ?

/**
 * As the org.eclipse.core.runtime.compatibility plug-in has been removed in
 * Eclipse 4.6 this method is not supported anymore.
 *
 */
@Deprecated
public static Plugin getPlugin(String id) {
    return null;
}

推荐答案

我要问的问题是您将其用于什么,然后指出 Platform#getPlugin(字符串)已弃用, Plugin 本身.如果您的 Bundle-Activator 类扩展了 Plugin ,只需将其引用保存在其构造函数ala

The question I have to ask is what were you using it for, and then point out that while Platform#getPlugin(String) is deprecated, Plugin itself is not. If your Bundle-Activator class extends Plugin, just have it save a reference to itself in its constructor, ala http://git.eclipse.org/c/sourceediting/webtools.sourceediting.git/tree/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/JSPCorePlugin.java#n54 . Then it's just a matter of accessing it when you need it.

这篇关于Eclipse 3.8到4.6 Migration Platform.getPlugin()返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆