安装Eclipse后,如何停止Eclipse Feature启动 [英] How do I stop an Eclipse Feature from starting after it's been installed

查看:322
本文介绍了安装Eclipse后,如何停止Eclipse Feature启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发几个Eclipse功能(组成可安装单元的Eclipse插件组),并且我已经被要求每个功能必须具有被禁用的功能,或者换句话说就是不能启动Eclipse启动时。



我有一个对UI(透视图,向导,菜单项等)做出贡献的插件,我试图拦截对起始方法的调用的插件如此...



请注意,PluginVerification类正在另一个插件中运行,该插件将随安装的Feature一起提供,其中包含插件想停止换句话说,我的功能包括插件A,B和C.插件维护生活在C中,我想使用它来控制插件A和B的启动。



这里是插件A和B的Activator类的启动方法

  / * 
*非Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
* /
public void start(BundleContext context)throws Exception {
if(PluginVerification.verify(this)){
super.start(context);
plugin = this;
}
}

如果调用PluginVerification.verify(this)返回假,那么我不启动插件。这样做的一半,因为插件真的没有启动,但是由这个插件贡献的UI工件仍然显示。例如,这个插件贡献的向导仍然可以通过UI访问。但是,当您尝试使用其中之一时,NullPointerExceptions将被抛出,因为该插件从未启动。



我希望有人可以帮助我找到更好的地方来真正阻止插件开始,它不会贡献它的UI工件在所有。我打算提醒用户他的产品没有被验证,因此无法启动。我希望用户感觉好像Feature已经从Eclipse环境中消失了。



感谢您的考虑,
跟踪

$ b

/org.eclipse.platform.doc.isv/guide/p2_director.htmlrel =nofollow noreferrer> p2 director 。至于为什么有些工件可用,可能是因为您的插件已安装(您可以使用osgi控制台检查),但尚未启动。

I'm developing several Eclipse Features (groups of Eclipse plugins that form an Installable Unit), and I've been given the requirement that each Feature must have the ability to be deactivated, or in other words, made to not start when Eclipse is started.

I have a plugin that makes contributions to the UI (Perspective, Wizards, Menu items, etc), and I've tried to just intercept the call to the start method of the plugin like so...

Please note that the class PluginVerification is running in another plugin that will be delivered with the installation of the Feature that contains the plugins that I want to stop. In other words, my Feature consists of Plugins A, B, and C. PluginVerification lives in C, and I want to use it to control the starting of Plugins A and B.

Here's Plugin A and B's Activator class's start method

/*
 * (non-Javadoc)
 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
 */
public void start(BundleContext context) throws Exception {
    if(PluginVerification.verify(this)) {
        super.start(context);
        plugin = this;
    }
}

If the call to PluginVerification.verify(this) returns false, then I don't start the plugin. This works half way, because the plugin truly does not start, but there are UI artifacts that were contributed by this plugin that still show up. For example, the wizards that this plugin contributes are still accessible via the UI. But when you try to use one of them, NullPointerExceptions are thrown because the plugin never started.

I was hoping someone could help me find better place to truly stop a plugin from starting so that it won't contribute it's UI artifacts at all. I'm planning to alert the user that his product isn't verified, and therefore could not be started. I want the user to feel as if the Feature has simply disappeared from his Eclipse environment.

Thank you for your consideration, Trace

解决方案

I think you will have better luck with p2 director. As to why some artifacts are available, probably because your plugins are installed (you can check with osgi console) but are not started..

这篇关于安装Eclipse后,如何停止Eclipse Feature启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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