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

StackOverflow https://stackoverflow.com/questions/18766334

  •  28-06-2022
  •  | 
  •  

Question

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?

Was it helpful?

Solution

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

Make MWE2 work in OSGi

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top