Skip to main content



      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 09:13 Go to next message
Eclipse UserFriend
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 09:42 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to run the code generator from another eclipse instance [message #685898 is a reply to message #685877] Mon, 20 June 2011 11:09 Go to previous messageGo to next message
Eclipse UserFriend
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 11:11 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Mon, 20 June 2011 11:31] by Moderator

Re: How to run the code generator from another eclipse instance [message #685901 is a reply to message #685900] Mon, 20 June 2011 11:15 Go to previous messageGo to next message
Eclipse UserFriend
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 08:01 Go to previous messageGo to next message
Eclipse UserFriend
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 08:01] by Moderator

Re: How to run the code generator from another eclipse instance [message #690927 is a reply to message #690904] Thu, 30 June 2011 08:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

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

~Christian

[Updated on: Thu, 30 June 2011 08:47] by Moderator

Re: How to run the code generator from another eclipse instance [message #690946 is a reply to message #690927] Thu, 30 June 2011 09:02 Go to previous messageGo to next message
Eclipse UserFriend
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 09:54 Go to previous messageGo to next message
Eclipse UserFriend
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 09:59] by Moderator

Re: How to run the code generator from another eclipse instance [message #690990 is a reply to message #690984] Thu, 30 June 2011 10:06 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to run the code generator from another eclipse instance [message #691000 is a reply to message #690990] Thu, 30 June 2011 10:24 Go to previous messageGo to next message
Eclipse UserFriend
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 10:29 Go to previous messageGo to next message
Eclipse UserFriend
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

[Updated on: Thu, 30 June 2011 10:31] by Moderator

Re: How to run the code generator from another eclipse instance [message #691007 is a reply to message #691004] Thu, 30 June 2011 10:36 Go to previous messageGo to next message
Eclipse UserFriend
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 14:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

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

~Christian
Re: How to run the code generator from another eclipse instance [message #691402 is a reply to message #691121] Fri, 01 July 2011 07:46 Go to previous messageGo to next message
Eclipse UserFriend
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 09:10 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to run the code generator from another eclipse instance [message #692327 is a reply to message #691121] Mon, 04 July 2011 04:12 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: How to run the code generator from another eclipse instance [message #692328 is a reply to message #692327] Mon, 04 July 2011 04:19 Go to previous message
Eclipse UserFriend
As i said before, there is a bug regarding running mwe2 workflows
within an osgi environment. Regards Christian
Previous Topic:Leak in OutlineWithEditorLinker?
Next Topic:Using some Xtext features in a SWT Widget
Goto Forum:
  


Current Time: Wed Jul 23 15:45:00 EDT 2025

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

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

Back to the top