e(fx)clipse 1.2.0 – RRobot learned to generate declarative services


In my last blog post I described that the way you define themes has changed – pre 1.2.0 you used extension points, now with 1.2.0 you are supposed to use OSGi-Services (preferably through the use of declarative services).

I guess most people don’t know that but when they are using one for the project wizards we provide the code responsible to do setup is not handcrafted Java code but we are using a DSL named RRobot who holds the setup description in files named .rtask. RRobot has not dependencies to other e(fx)clipse stuff so it can be used by your eclipse plug-in as well to automate the creation of projects.

All the wizard does at the end does is:

public class NewProjectStructureWizard extends Wizard implements INewWizard {
  // ....

  @Override
  public boolean performFinish() {
    Bundle b = FrameworkUtil.getBundle(getClass());
    BundleContext ctx = b.getBundleContext();
    ServiceReference<RRobot> ref = ctx.getServiceReference(RRobot.class);
    RRobot r = ctx.getService(ref);

    FileLoader loader = FileLoader.createLoader();
    RobotTask task = loader.loadTask(
      URI.createPlatformPluginURI("/org.eclipse.fx.ide.pde.ui.e4/generator-tasks/e4App.rtask", true));
    Map<String,Object> additionalData = new HashMap<>();

    try {
      getContainer().run(true, true,
        (monitor) -> r.executeTask(monitor, task, additionalData));
    } catch (Throwable e) {
       // Handle it ....
    }
    return true;
}

The following is the part of rtask-File used when you use the e4 Application wizard for JavaFX in 1.1.0:

screen_ext

With the change to the runtime we had to extend the feature set of rrobot to allow setting up DS-Components so the setup has change to this in 1.2.0:
screen_ds

Advertisements
This entry was posted in e(fx)clipse and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s