Class AbstractApplicationActivator

java.lang.Object
com.amalgamasimulation.desktop.appelements.application.AbstractApplicationActivator
All Implemented Interfaces:
org.osgi.framework.BundleActivator

public abstract class AbstractApplicationActivator extends Object implements org.osgi.framework.BundleActivator
Base activator for the application bundle. On bundle start it creates RedrawRestrictionManager, IAppInfo and ICommandFactory and registers them as OSGi services, so parts and handlers get them through injection.

The platform registers these services because its own classes use them: AbstractTreePart injects RedrawRestrictionManager, BottomStatusBar injects IAppInfo and AbstractPagesPart injects ICommandFactory.

How to use

Set the subclass as Bundle-Activator in MANIFEST.MF and implement createAppInfo(). To replace the command factory, override createCommandFactory(). Register the application services in registerServices().

By default IAppInfo is registered only under the IAppInfo name. If the application extends IAppInfo with its own methods, its classes inject their own type, for example MyAppInfo, to call those methods. In that case override getAppInfoKeys() and return both names: e4 looks up a service by the name of the injected type, so without the MyAppInfo name such an injection does not find the service.

  • Constructor Details

    • AbstractApplicationActivator

      public AbstractApplicationActivator()
  • Method Details

    • start

      public void start(org.osgi.framework.BundleContext context) throws Exception
      Specified by:
      start in interface org.osgi.framework.BundleActivator
      Throws:
      Exception
    • stop

      public void stop(org.osgi.framework.BundleContext context) throws Exception
      Specified by:
      stop in interface org.osgi.framework.BundleActivator
      Throws:
      Exception
    • createAppInfo

      protected abstract com.amalgamasimulation.desktop.utils.IAppInfo createAppInfo()
    • createCommandFactory

      protected ICommandFactory createCommandFactory()
    • getAppInfoKeys

      protected String[] getAppInfoKeys()
    • registerServices

      protected void registerServices(org.osgi.framework.BundleContext context) throws Exception
      Throws:
      Exception
    • getRedrawRestrictionManager

      protected RedrawRestrictionManager getRedrawRestrictionManager()
    • getAppInfo

      protected com.amalgamasimulation.desktop.utils.IAppInfo getAppInfo()
    • getCommandFactory

      protected ICommandFactory getCommandFactory()