Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem running xtext workflow in Plugin Environment(Running user-specified xtext workflow files.)
Problem running xtext workflow in Plugin Environment [message #1004590] Wed, 23 January 2013 14:05 Go to next message
Bhanu Pratap is currently offline Bhanu PratapFriend
Messages: 13
Registered: April 2010
Junior Member
Problem Description:
=======================================================
In Eclipse Plugin Environment, Mwe2StandaloneSetup fails to run xtext workflow.
We need to run xtext workflow using some user-specified, external workflow(.mwe2) and grammar(.xtext) files. This is achieved by creating an eclipse plugin and running a workflow from a new "Context Menu". The location of .mwe2 and .xtext files is specified by the user.

In the attachment, the sample plugin is used to re-create this problem.

PS: To demonstrate the problem, location of .mwe2 and .xtext files is hard-coded to be User's Home directory("user.home") in NewAction.java


Steps to reproduce
========================================================

1. Import this zip file in eclipse as an existing project:
File -> Import -> Existing Projects into workspace

2. Copy "grammar.xtext" and "GenerateGrammar.mwe2" into your "Home" directory(directory path returned by System.getProperty("user.home")) and Edit the following in "GenerateGrammar.mwe2" file to specify this directory :
var grammarURI = "file:///<your-home-directory>/grammar.xtext"

3. Launch this plugin as an eclipse application

4. In the new workbench, Right click on any file and choose "New SubMenu -> New Action"

Step 3 should run the workflow successfully, but it fails with the following exception even when all the dependencies are satisfied:
"org.eclipse.core.internal.resources.ResourceException:
Resource '/org.eclipse.xtext.xbase/model/Xbase.genmodel' does not exist"

=================code snippet===============
		Injector inj = new Mwe2StandaloneSetup().createInjectorAndDoEMFRegistration();
		Mwe2Runner runner3 = inj.getInstance(Mwe2Runner.class);
		String wfFile3str = System.getProperty("user.home")+File.separator+"GenerateGrammar.mwe2";//"GenerateTutorial";
		File wfFile3 = new File(wfFile3str);
		org.eclipse.emf.common.util.URI wfuri = org.eclipse.emf.common.util.URI.createFileURI(wfFile3.getAbsolutePath());
				// Class path of the xtext generator
		runner3.run(wfuri, new HashMap<String, String>());

==========================================================================

Any pointers to solve such problem would be highly appreciated..

Thanks in advance..

[Updated on: Wed, 23 January 2013 14:17]

Report message to a moderator

Re: Problem running xtext workflow programmatically in Plugin Environment [message #1004603 is a reply to message #1004590] Wed, 23 January 2013 14:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6544
Registered: July 2009
Senior Member
Never ever call a stanalonesetup from an eclipse context

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Problem running xtext workflow programmatically in Plugin Environment [message #1004695 is a reply to message #1004603] Wed, 23 January 2013 17:26 Go to previous messageGo to next message
Bhanu Pratap is currently offline Bhanu PratapFriend
Messages: 13
Registered: April 2010
Junior Member
Hi Christian

Thank you for your response. Could you please point me out then how could I realize such case i.e. invoking xtext workflow for some user-specified workflow and grammar files from within the eclipse plugin environment.

Thanks again.

[Updated on: Wed, 23 January 2013 17:27]

Report message to a moderator

Re: Problem running xtext workflow programmatically in Plugin Environment [message #1004705 is a reply to message #1004695] Wed, 23 January 2013 17:44 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6544
Registered: July 2009
Senior Member
Hi you may have a look what workflow runner/launcher do

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Previous Topic:Null pointer through customizing outline view
Next Topic:createReferenceUpdate failed in rename/refactor
Goto Forum:
  


Current Time: Fri Dec 19 01:33:56 GMT 2014

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

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