Breadcrumb
- Sabre Red 360 Software Development Kit Help
- Desktop Red Apps
- Activator Classes
- Adding an Activator Class to a Plugin
Adding an Activator Class to a Plugin
Before you begin, you need a plug-in that requires an Activator class.
This procedure shows how to implement an Activator class using the AbstractEdgeBasePlugin and AbstractUiPlugin classes. The procedure excludes the use of the BundleActivator class.
-
Open the plug-in project to which you will add an Activator.
-
On the Dependencies tab in the manifest editor, add com.sabre.edge.platform.core.common.
-
Open the Overview tab.

-
Select This plug-in is a singleton.
If your plug-in already has an Activator class, this class is displayed in the Activator field.
-
If your plug-in does not have an Activator class, click the Activator link in the General Information group.
On the New Java Class dialog, you will extend the Activator class.

-
In the Package field, type the name of your package.
-
In the Name field, type the name of your class. The recommended name is Activator.
-
For Superclass, type one of the following values for the implementation that you want:
Does your plug-in contribute to the UI? |
Extend this superclass in the Superclass field. |
The superclass is located as follows. |
No |
AbstractEdgeBasePlugin |
com.sabre.edge.platform.core.common.plugin.base + AbstractEdgeBasePlugin |
Yes |
AbstractUiPlugin |
org.eclipse.ui.plugin.AbstractUIPlugin |
-
Select the following check boxes:
-
Constructor from superclass
-
Inherit abstract methods
-
-
Click Finish.
-
Save MANIFEST.MF.
-
In a Java editor, do the following:
-
Override the start() and stop() methods.
-
Implement the static method getDefault() .
-
Substitute the name of your plug-in for plugin. The name should match the plug-in in the manifest.
-
Extending AbstractEdgeBasePlugin forces the plug-in to use org.eclipse.ui .
Call getDefault() at runtime to return the plugin instance.
The code sample below shows an Activator.
import org.osgi.framework.BundleContext;
import com.sabre.edge.platform.core.common.plugin.base.AbstractEdgeBasePlugin;
public class Activator extends AbstractEdgeBasePlugin {
private static Activator plugin;
public Activator() {
}
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
public static Activator getDefault() {
return plugin;
}
}
-
Save the changes to your Java code.
-
Open MANIFEST.MF. On the Overview tab, select Activate This Plug-in When One of Its Classes Is Loaded.

-
Save MANIFEST.MF.
Using Activator with a Website
-
If your plug-in integrates a website that is based on HTML, you must add the PLUGIN_NAME constant to your Activator. You can either hard code this constant, or you can use internationalization methods.
public static final String PLUGIN_NAME = "Example Browser";
-
If you want to translate or internationalize a plug-in that is based on a browser, you can add the following code to define
PLUGIN_NAME
. You will also add the keys toMessages.java
and addmessages.properties
for the languages that you want.
public static final String PLUGIN_NAME = Messages.PLUGIN_NAME;