Reputation: 19100
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.
ss
command, I can see my bundle listed.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
?
Upvotes: 6
Views: 2464
Reputation: 19100
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.
org.eclipse.ui
as a dependency in the "Dependencies" tab.org.eclipse.ui.startup
).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.
}
}
Upvotes: 3