user1016179
user1016179

Reputation: 629

Activator.start method never called

I have implemented some code in the start method in Activator class in purpose to open a wizard right after eclipse will be opened. I'm trying to debug it but the start method is never being called. Any idea what can solve it? Here is Activator code:

public class Activator extends AbstractUIPlugin {

    /**
     * The constructor
     */
    public Activator() {
    }

    public void start(BundleContext context) throws Exception {
        super.start(context);

        // Call function to open a wizard
        openWizard();
    }

    private void openWizard() {

        NewProjectWizard wiz;
        final WizardDialog wd;
        wiz = new NewProjectWizard();
        wd = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
        Display.getDefault().asyncExec(new Runnable() {
            @Override
            public void run() {
                wd.open();
            }
        });
    }        
}

Upvotes: 3

Views: 1767

Answers (1)

greg-449
greg-449

Reputation: 111142

You need to configure the Activator on the Overview tab of the plugin.xml editor.

There is also the Activate this plug-in when one of it classes is loaded option, if you specify this then the activator will not be run unless other code references it. If you don't specify this option then your activator will only be started if the run configuration says it should be started. If it is started it may start before the UI code is fully initialized.

All the above means is that the activator is the wrong place to put UI code.

Upvotes: 5

Related Questions