Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to run the code generator from another eclipse instance
How to run the code generator from another eclipse instance [message #685871] Mon, 20 June 2011 13:13 Go to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
Hi,

I was able to follow a great tutorial for building out an Xtext grammar, as well
as defining code generation templates. I was able to test this all out and it worked
perfect.

Now in Eclipse, when I right click on my grammar project and select 'Run As' -> 'Eclipse Application', another instance of eclipse starts. From there I can create an instance of my grammar and I can see the syntax hightlight, outline etc.. No problems here. However, I was wondering how I could get the code generator workflow to run from this spawned Eclipse instance? All of the code generation material is back in the other eclipse instance, where the grammar was defined.

Does my question make sense?
Thank you
Re: How to run the code generator from another eclipse instance [message #685877 is a reply to message #685871] Mon, 20 June 2011 13:42 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

have you tried enablling the SimpleProjectWizard fragment in the workflow that generates the language infrastructure (make sure to merge the plugin.xml_gen into the plugin.xml)? You then get a project wizard that creates a project with a generator workflow delegating to the generator plugin.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: How to run the code generator from another eclipse instance [message #685898 is a reply to message #685877] Mon, 20 June 2011 15:09 Go to previous messageGo to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
Hey, thanks for the reply.

No I haven't tried that. Are there instructions somewhere on how to do this?

Thank you!
Re: How to run the code generator from another eclipse instance [message #685900 is a reply to message #685898] Mon, 20 June 2011 15:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Hi,

Alex already said what to do

(1) enable the SimpleProjectWizard in the workflow of the dsl
(2) run the workflow
(3) merge/copy plugin-xml_gen to plugin.xml
(4) start runtime
(5) create the a dsl project specific for your dsl

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 20 June 2011 15:31]

Report message to a moderator

Re: How to run the code generator from another eclipse instance [message #685901 is a reply to message #685900] Mon, 20 June 2011 15:15 Go to previous messageGo to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
I'll give this a go and report back if I have any problems.
Thanks
JD
Re: How to run the code generator from another eclipse instance [message #690904 is a reply to message #685901] Thu, 30 June 2011 12:01 Go to previous messageGo to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
Hi there. I found some documentation about including the 'SimpleProjectWizardFragment' (http://www.eclipse.org/Xtext/documentation/latest/xtext.html#projectwizard) in my generator workflow located in my .generator project, under src/workflow. I include the following code snippet:

	
// project wizard fragment
fragment = projectWizard.SimpleProjectWizardFragment {
  generatorProjectName = "${projectName}.generator"
  modelFileExtension = file.extensions
}	


Unfortunately, it won't work for me. I just gives me errors with each line stating:

- Couldn't resolve reference to JvmType 'projectWizard.SimpleProjectWizardFragment'.
- Couldn't resolve reference to JvmFeature 'fragment'.
- Couldn't resolve reference to Referrable 'projectName'.
- Couldn't resolve reference to JvmFeature 'generatorProjectName'.
- Couldn't resolve reference to Referrable 'file.extensions'.
- Couldn't resolve reference to JvmFeature 'modelFileExtension'.


I have included the import 'import org.eclipse.xtext.ui.generator.* '

any ideas what I'm missing here?
Thanks

[Updated on: Thu, 30 June 2011 12:01]

Report message to a moderator

Re: How to run the code generator from another eclipse instance [message #690927 is a reply to message #690904] Thu, 30 June 2011 12:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Hi,

you should add this your dsls workflow and not the one of the generator

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 30 June 2011 12:47]

Report message to a moderator

Re: How to run the code generator from another eclipse instance [message #690946 is a reply to message #690927] Thu, 30 June 2011 13:02 Go to previous messageGo to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
Ah I see it there. I was looking at the wrong project - damn it.

Thanks for the help
Re: How to run the code generator from another eclipse instance [message #690984 is a reply to message #685900] Thu, 30 June 2011 13:54 Go to previous messageGo to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
Christian Dietrich wrote on Mon, 20 June 2011 11:11
Hi,

Alex already said what to do

(1) enable the SimpleProjectWizard in the workflow of the dsl
(2) run the workflow
(3) merge/copy plugin-xml_gen to plugin.xml
(4) start runtime
(5) create the a dsl project specific for your dsl

~Christian


Hi there Chrisitan.

I have completed the steps as per the documentation. I have followed the steps of merging the plugin-xml_gen with my dsl project's ui plugin.xml. I have tested it out by running a new eclipse instance and creating a new project that pertains to my DSL (called 'criteria'). Now, what does this mean for me? I have this Xtext project and does this mean that I can edit the template and run it to generate code? Sorry if these questions seem a little trivial but this is all new territory for me and I appreciate the help. Thanks

[Updated on: Thu, 30 June 2011 13:59]

Report message to a moderator

Re: How to run the code generator from another eclipse instance [message #690990 is a reply to message #690984] Thu, 30 June 2011 14:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Hi,

within the project you can create with the wizard in the runtime application you get a Workflow (src/Generator.mwe2).
If you call this the generator worflow of yourdsls.generator project will be called (/org.xtext.example.mydsl.generator/src/workflow/MyDslGenerator.mwe2)
This Workflow calls the generator with the Templates in this Project.
this is what you originally wanted to do.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to run the code generator from another eclipse instance [message #691000 is a reply to message #690990] Thu, 30 June 2011 14:24 Go to previous messageGo to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
I understand. Is it possible to call this generator programmatically? Thanks again for the help.
Re: How to run the code generator from another eclipse instance [message #691004 is a reply to message #691000] Thu, 30 June 2011 14:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Yes and No,

you'd rather use XpandFacade oder an IBuilderParticipant like it is done in the DomainModel Example.
calling the Mwe2 from an OSGi Envirionment has as far as i remember a bug in Xtext 1.0.x
so it won't work if you use Mwe2Runner to call it
https://bugs.eclipse.org/bugs/show_bug.cgi?id=318721

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 30 June 2011 14:31]

Report message to a moderator

Re: How to run the code generator from another eclipse instance [message #691007 is a reply to message #691004] Thu, 30 June 2011 14:36 Go to previous messageGo to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
Ok so, I'll refer to the documentation for this. Thanks once again. I hope this thread is useful for other 'newbies' like me Wink

JD
Re: How to run the code generator from another eclipse instance [message #691121 is a reply to message #691007] Thu, 30 June 2011 18:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Hi,

and if you convert the mwe2 workflow to a good old mwe(1) one you can programatically call it using workflowrunner

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to run the code generator from another eclipse instance [message #691402 is a reply to message #691121] Fri, 01 July 2011 11:46 Go to previous messageGo to next message
john doe is currently offline john doeFriend
Messages: 74
Registered: June 2011
Member
Thanks Christian. Do you perhaps know where I can find examples of what you mention? I looked through the documentation but could not find anything related to XpandFacade nor workflowrunner.

Thanks indeed
Re: How to run the code generator from another eclipse instance [message #691443 is a reply to message #691402] Fri, 01 July 2011 13:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Hi, have a look at the Xpand and Mwe docs and consult Google. There
might be some blogs or forum entries on this. Regards, Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to run the code generator from another eclipse instance [message #692327 is a reply to message #691121] Mon, 04 July 2011 08:12 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
What's wrong with the Mwe2Launcher / Mwe2Runner?


Am 30.06.11 20:54, schrieb Christian Dietrich:
> Hi,
>
> and if you convert the mwe2 workflow to a good old mwe(1) one you can
> programatically call it using workflowrunner
>
> ~Christian


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: How to run the code generator from another eclipse instance [message #692328 is a reply to message #692327] Mon, 04 July 2011 08:19 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
As i said before, there is a bug regarding running mwe2 workflows
within an osgi environment. Regards Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Leak in OutlineWithEditorLinker?
Next Topic:Using some Xtext features in a SWT Widget
Goto Forum:
  


Current Time: Sun Oct 25 15:20:37 GMT 2020

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

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

Back to the top