Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to invoke mwe2 workflow run within plugin
How to invoke mwe2 workflow run within plugin [message #1771705] Tue, 29 August 2017 16:46
Hung Nguyen is currently offline Hung NguyenFriend
Messages: 1
Registered: August 2017
Junior Member
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.
Previous Topic:Alert messaging
Next Topic:How to Activate a Plugin when leaving the "New Project" Wizard
Goto Forum:
  


Current Time: Mon Sep 24 01:56:35 GMT 2018

Powered by FUDForum. Page generated in 0.01307 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top