Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

OTEquinox/Howto Create OTEquinox App From OTApp

Important.png
Change of namespace
In versions upto 1.4.0 (served from www.objectteams.org) the IDs of OT/Equionx bundles start with org.objectteams.
During the project move to Eclipse.org these are being renamed to org.eclipse.objectteams....


Convert the OT application into an eclipse plugin

Migrate the project

  • "Configure > Add Object Teams Support" (from the project's context menu)
This includes the following adjustments
  • Adding the required project nature
  • Adding required plug-in dependencies
  • Adjusting compiler preferences if necessary

Configure the plug-in

  • Declare extensions ("Extensions" tab)
    • Extension point: org.objectteams.otequinox.aspectBindings
      • basePlugin: self
      • teams: adapting teams
  • Export packages ("Runtime" tab)
    • all packages, which should be used in the Application project (see 2. below)

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

    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 dependency.
    TODOs:
    • TransformerPlugin.isWaitingForTeams()
    • Listener
    • Class.forName(...)) (don't!)

Back to the top