6

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?

4

1 に答える 1

3

以下は、OSGi コンソールがプラグSTARTINGインを .

Chris Gerken がコメントで指摘しているように、スタートアップ コードは、プラグイン拡張機能の 1 つを使用しようとしたときにのみ実行されます。

拡張機能を使用するorg.eclipse.ui.startupと、起動時に有効にするプラグインを登録できます。これは、マニフェスト エディターを使用して設定できます。

  1. org.eclipse.ui「依存関係」タブで依存関係として追加します。
  2. [拡張機能] タブで、スタートアップ拡張機能 ( org.eclipse.ui.startup) を追加します。
  3. 「拡張要素の詳細」の下に、 を実装するクラスを提供します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.
    }
}
于 2012-12-10T16:02:00.093 に答える