Eclipse插件绑定卡在启动状态 [英] Eclipse plugin bundle stuck in Starting state

查看:196
本文介绍了Eclipse插件绑定卡在启动状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse创建一个新的插件项目,为我创建一个默认的 Activator 。当调试(作为Eclipse应用程序运行)时,我注意到这个激活器的 start() stop()



以下有关您在捆绑在Eclipse中不可见我偶然发现以下结果。




  • 使用 ss 命令,我可以看到我的捆绑列表。

  • 我的捆绑包的状态是'开始'




该包正在启动过程中。当开始方法处于活动状态时,捆绑包在 STARTING
状态中。当捆绑包的 BundleActivator.start(BundleContext)被调用时,捆绑包必须处于此状态
。如果
,$ code> BundleActivator.start 方法无一例外地完成,那么
包已经成功启动,必须​​移动到 ACTIVE state。


放置在开始的第一行的断点方法没有被击中。控制台中也不会显示 System.out.println 。什么可能导致开始方法不被调用,因此状态被卡在启动

解决方案

以下内容并未解决OSGi控制台报告插件为 STARTING ,但是在Eclipse开始之后,我有一个方法让我的插件开始。



As Chris Gerken在评论中指出,启动代码仅在您尝试使用其中一个插件扩展时运行。



使用 org.eclipse.ui.startup 扩展名,您可以注册一个想要的插件在启动时被激活。可以使用清单编辑器进行设置。


  1. 添加 org.eclipse.ui 作为依赖关系选项卡中的依赖项。

  2. 在扩展名选项卡中添加启动扩展( org.eclipse.ui.startup )。

  3. 在扩展元素详细信息下面提供一个实现 org.eclipse.ui.IStartup



TaskManager.java

  public class TaskManager实现IStartup 
{
@Override
public void earlyStartup()
{
//当Eclipse启动时,这将被调用,
//在GUI已经初始化。
}
}


I used Eclipse to create a new plug-in project which created a default Activator for me. When debugging (running as Eclipse Application) I noticed the start() and stop() methods of this activator weren't called.

Following the guide on what to do when your bundle isn't visible in Eclipse I stumbled upon the following results.

  • Using the ss command, I can see my bundle listed.
  • The status of my bundle is 'Starting'

The bundle is in the process of starting. A bundle is in the STARTING state when its start method is active. A bundle must be in this state when the bundle's BundleActivator.start(BundleContext) is called. If the BundleActivator.start method completes without exception, then the bundle has successfully started and must move to the ACTIVE state.

A breakpoint placed on the first line in the start method doesn't get hit. Neither does System.out.println show up in the console. What could cause the start method not getting called, and thus the state being stuck in STARTING?

解决方案

The following doesn't address the fact that the OSGi console reports the plugin to be STARTING, but it is an approach by which I got my plugin to start right after Eclipse started up.

As Chris Gerken points out in a comment, the startup code is only run when you try to use one of the plugin extensions.

Using the org.eclipse.ui.startup extension you can register a plugin that wants to be activated on startup. It is possible to set this up by using the manifest editor.

  1. Add org.eclipse.ui as a dependency in the "Dependencies" tab.
  2. In the "Extensions" tab add the Startup extension (org.eclipse.ui.startup).
  3. Underneath "Extension Element Details" provide a class which implements org.eclipse.ui.IStartup.

TaskManager.java

public class TaskManager implements IStartup
{
    @Override
    public void earlyStartup()
    {
        // This will get called when Eclipse is started,
        // after the GUI has been initialized.
    }
}

这篇关于Eclipse插件绑定卡在启动状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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