Eclipse插件绑定卡在启动状态 [英] Eclipse plugin bundle stuck in Starting state
问题描述
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
扩展名,您可以注册一个想要的插件在启动时被激活。可以使用清单编辑器进行设置。
- 添加
org.eclipse.ui
作为依赖关系选项卡中的依赖项。 - 在扩展名选项卡中添加启动扩展(
org.eclipse.ui.startup
)。 - 在扩展元素详细信息下面提供一个实现
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 itsstart
method is active. A bundle must be in this state when the bundle'sBundleActivator.start(BundleContext)
is called. If theBundleActivator.start
method completes without exception, then the bundle has successfully started and must move to theACTIVE
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.
- Add
org.eclipse.ui
as a dependency in the "Dependencies" tab. - In the "Extensions" tab add the Startup extension (
org.eclipse.ui.startup
). - 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屋!