Skip to main content

About Activator Classes

An Activator class is a Java class that controls the life cycle of a plug-in. This class triggers the actions on startup and shutdown, which makes an Activator the best place to allocate and release the resources that a plug-in uses.

You are required to use an Activator class when you need to do the following:

  • Control the life cycle of a plug-in

  • Trigger an action or event that is based on the startup or shutdown of a plug-in, such as authenticating to the communications bus

  • Access globally registered services, for example, Logger Service, ConfigService, and communications services

The Activator class accesses the service registry in the OSGi framework. The service registry enables the Activator to register the OSGi service when the plug-in is started, and to unregister the service when the plug-in is stopped.

The code that Eclipse generates for an Activator class depends on whether the plug-in makes contributions to the UI.

  • If the plug-in contributes to the UI, the Activator class extends the org.eclipse.ui.plugin.AbstractUIPlugin class.

  • If you want to use Logger Service or ConfigService, extend the AbstractEdgeBasePlugin class. This class is an extension of AbstractUIPlugin.

  • If the plug-in is targeted for an OSGi framework, an Activator class implements the org.osgi.framework.BundleActivator interface. This interface customizes the starting and stopping of a bundle. If your plug-in does not contribute to the UI, use either this interface or the Plugin class.

To develop general purpose Red Apps, the implementation of BundleActivator is not recommended. However, implementation of BundleActivator is recommended for specific cases, such as when access to the UI is not required, or when you want to use your own services.

Dependencies and Classes for an Activator

Some functionality requires that you add an Activator class to your plug-in. Both Eclipse and Sabre Red 360 have defined the dependencies and classes that are required for an Activator class. These requirements are listed below.

Minimal Required Dependencies

  • com.sabre.edge.platform.core.common. This Sabre Red 360 dependency includes the Activator.class file. This dependency is required only if you are extending AbstractEdgeBasePlugin.

  • org.eclipse.ui. The org.eclipse.ui dependency is required for the following cases:

    • The plug-in contributes to the UI.

    • The plug-in extends AbstractEdgeBasePlugin.

Failure to add this dependency for these cases will result in the display of confusing errors to developers.

Activator Classes

  • com.sabre.edge.platform.core.common.AbstractEdgeBasePlugin

        The easiest way to work with an Activator class for Red Apps is to extend AbstractEdgeBasePlugin. The AbstractEdgeBasePlugin class provides easy access to all publicly available core services.

        AbstractEdgeBasePlugin contains all methods from AbstractUiPlugin and it implements BundleActivator.

  • org.eclipse.ui.plugin.AbstractUIPlugin

        When developing plug-ins that contribute to the UI, the default approach is to extend class AbstractUiPlugin.

  • org.osgi.framework.BundleActivator

        If the plug-in is targeted for an OSGi framework, the Activator implements the org.osgi.framework.BundleActivator interface.