Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to choose "Generate an activator..." when creating a new Eclipse plugin project

There are lots of Eclipse RCP tutorials that begin with the obvious first step: "Create a new plugin project..."

It seems that approx. 70% of them specify checking the "Generate an activator, a Java class that controls the plug-in life cycle". The others specifically say don't check that toggle.

alt text http://img179.imageshack.us/img179/6710/newpluginoptions.png

Its not clear to me, what generating an activator class does for you, when you need one, and when you don't.

For being a prominent option you get every time you create a new plugin project (it seems to be set on by default) this option isn't very well explained anywhere that I have found.

Any advice/rules of thumb on choosing this option when creating Eclipse plugin projects?

like image 260
Anon Support 2010 Avatar asked May 18 '10 13:05

Anon Support 2010


People also ask

What is activator in Eclipse plugin?

Activator class is the start point of the plugin. Activator class is loaded initially and if you look into the hierarchy of the Activator class, it extends the AbstractUIPlugin, which tells the Eclipse Run-time that this Plugin is someway related to the Eclipse Platform UI.

What is the purpose of the activator java file?

Correct answer by Activator. java can be used to initialize(start) things.

What is plugin project in Eclipse?

The Plug-in Development Kit (PDK) includes an Eclipse plug-in that you can use in your Eclipse or Rational® Application Developer environment to create and edit some of the configuration files in the plug-ins that are used in your virtual applications. Overview.


1 Answers

One way to find out is to look at the generated class. Turns out that it is a subclass of AbstractUIPlugin. Check out the JavaDoc, it provides services like preference management, image registry and the like. If you need any of this, you may want to use it. It is a subclass of Plugin, which kind of makes sense.

Also, it implements BundleActivator, which has some useful JavaDoc. This provides you with stubs for start() and stop(), which allows you to hook your own code in here. It also generates a static convenience method getDefault(), which gives you the Activator. And that's all there is to it.

like image 87
jastram Avatar answered Oct 01 '22 17:10

jastram