Can someone point me to an example of executing mwe2 programmatically within Eclipse?

393 views Asked by At

I would like to package a number of mwe2 workflow definitions and to execute these definitions programmatically from within an Eclipse plugin.

I have derived the following incantation, but it fails to find the module.

    public void runMwe2() throws Exception {
    /**
     * Obtain the Eclipse-based activator
     */
    Mwe2Activator mwe2Activator = Mwe2Activator.getInstance();

    assert mwe2Activator != null;

    /**
     * Obtain the injector
     */
    Injector injector = mwe2Activator
            .getInjector("org.eclipse.emf.mwe2.language.Mwe2");

    assert injector != null;

    /**
     * Have the injector inject the runner
     */
    Mwe2Runner mwe2Runner = injector.getInstance(Mwe2Runner.class);

    final String pluginPathToModule = WORKFLOW;
    URI moduleUri = URI.createPlatformPluginURI(pluginPathToModule, false);


    mwe2Runner.run(moduleUri, new HashMap<String, String>(),
            new WorkflowContextImpl());

}

I believe this is caused by the inability of the Runner to use the plugin classpath for lookup. I find that RuntimeResourceSetInitializer exclusively lists resources from the Java classpath. Obviously there is nothing to be found here.

Can somebody please complete the example above or tell me how I should inject to make this run smoothly?

1

There are 1 answers

0
Jörn Guy Süß On BEST ANSWER

At the current time it is impossible. There is a long-standing bug

Make MWE2 work in OSGi