up: OtEquinox

How to create an OT/Equinox application from an existing OT application

1. Convert the OT application into an eclipse plugin

Create a new project

  • new -> OT Plug-in Project

Configure the plugin

in MANIFEST.MF:

  • Add required Plug-ins ("Dependencies" tab: Required Plug-ins -> Add)
    • org.objectteams.otequinox
    • org.eclipse.core.runtime
  • Declare extensions ("Extensions" tab)
    • Extension point: org.objectteams.otequinox.aspectBindings
      • base Plugin: self
      • teams: adapting teams
  • Export packages ("Runtime" tab)
    • all packages, which should be used in the Application project (see 2. below)

2. Create an Equinox-Application Project

Create a new Project:

  • new -> Plug-in Project
  • Choose: Target Platform: OSGI framework: Equinox
  • do not generate an activator

Implement IApplication

  • implement Object start(IApplicationContext context) - not returning before exit
class Application implements IApplication {
  ...
  public Object start(IApplicationContext context) throws Exception {
    new myOTApplicationPlugin.Main().startWindow();
    Platform.endSplash();
    while(win.isVisible()) {
      Thread.sleep(500); 
    } // don't return before the window is closed.
    return IApplication.EXIT_OK; // the end.
  }
} 
package myOTApplicationPlugin;
// this is the original main class of the ot application
class Main {
  ...
  public Window startWindow() {
    // call the original main method: 
    main(null);
    // return the main window of the application (has to be set somewhere): 
    return mainWindow;
  } 
}  

Note: The type IApplication will not be known until dependece to the corresponding plugin has been declared (see next).

Configure the plugin

in MANIFEST.MF:

  • Add required plug-ins ("Dependencies" tab: Required Plug-ins -> Add)
    • org.eclipse.core.runtime
    • OT application plugin (see 1.) to run
  • Declare extensions ("Extensions" tab)
    • Extension point: org.eclipse.core.runtime.applications
      • new run... ...Application (run)
  • Set singleton (MANIFEST.MF):
    • Bundle-SymbolicName: <my_name>;singleton:=true

3. Launch as Object Teams Eclipse Application and select the Application to run

Notes

Eclipse extensions:

  • Extensions can be declared to extend extension points of existing eclipse plugins.
  • If the "Extensions" tab is not shown, it can be enabled by clicking at "Extensions" in the "Overview" tab.
  • Before an extension can be declared, the plugin providing the extension point has to be declared as dependend.

Loading order: (TODO)

  • TransformerPlugin.isWaitingForTeams()
  • Listener
  • Class.forName(...))