I have created a plugin. In my plugin, I need to invoke a mwe2 workflow to run.
But I cannot make mwe2 workflow work as in Java Application.
Here is sample code that works in Java Application:
Main.java
Injector injector = new Mwe2StandaloneSetup().createInjectorAndDoEMFRegistration();
Mwe2Runner runner = injector.getInstance(Mwe2Runner.class);
runner.run("MyWorkflow", paramsHashMap);
Here is code in Plugin:
Activator.java
public Injector getInjector() {
return injector;
}
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
injector = new Mwe2StandaloneSetup().createInjectorAndDoEMFRegistration();
injector.injectMembers(this);
}
PluginHandler.java // plugin command handler
Injector injector = Activator.getDefault().getInjector();
Mwe2Runner runner = injector.getInstance(Mwe2Runner.class);
Bundle bundle = Platform.getBundle("com.hiosdroid.plugin");
URL fileURL = bundle.getEntry("com/hiosdroid/plugin/workflow/MyWorkflow.mwe2");
URI createFileURI = URI.createURI(fileURL.toString());
runner.run(createFileURI, paramsHashMap);
but there's error:
XtextLinkingDiagnostic: null:27 Couldn't resolve reference to JvmIdentifiableElement 'bean'.,
XtextLinkingDiagnostic: null:27 Couldn't resolve reference to JvmType 'StandaloneSetup'.,
XtextLinkingDiagnostic: null:28 Couldn't resolve reference to JvmIdentifiableElement 'scanClassPath'.,
XtextLinkingDiagnostic: null:29 Couldn't resolve reference to JvmIdentifiableElement 'platformUri'.,
XtextLinkingDiagnostic: null:30 Couldn't resolve reference to JvmIdentifiableElement 'registerGeneratedEPackage'.,
....
Please help guide me how to invoke mwe2 workflow run in plugin environment.