Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to get ecore and genmodel?(xtext multiple grammar file)
How to get ecore and genmodel? [message #1059936] Wed, 22 May 2013 04:39 Go to next message
chris yo is currently offline chris yo
Messages: 11
Registered: February 2013
Junior Member
I have 1 project, that contains 2 different xtext files (MyDsl.xtext and Form.xtext).


For MyDsl.xtext, I can generate xtext artifacts with no problem.
But for Form.xtext, the option is not available there. "Run configuration" is shown instead.

I was able to use the rules in Form.xtext without problem. But when I run the MWE2 workflow, I get errors:
805  [main] INFO  ipse.xtext.generator.LanguageConfig  - generating infrastructure for org.xtext.example.mydsl.MyDsl with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, SerializerFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, GeneratorFragment, FormatterFragment, LabelProviderFragment, OutlineTreeProviderFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment, Junit4Fragment, RefactorElementNameFragment, TypesGeneratorFragment, XbaseGeneratorFragment, CodetemplatesGeneratorFragment, CompareFragment
java.lang.RuntimeException: Could not find a GenModel for EPackage 'http://www.xtext.org/example/mydsl/Form'
If the missing GenModel has been generated via EcoreGeneratorFragment make sure to run it first in the workflow.
If you have a *.genmodel-file, make sure to register it via StandaloneSetup.registerGenModelFile(String)


In order for MyDsl.xtext to be able to refer to rules in Form.xtext, I would need to add it in my workflow. But I don't have the .genmodel and .ecore file for Form.xtext.
How can I get the ecore and genmodel files of Form.xtext?

Re: How to get ecore and genmodel? [message #1059982 is a reply to message #1059936] Wed, 22 May 2013 08:47 Go to previous messageGo to next message
Edwin Tuzar is currently offline Edwin Tuzar
Messages: 10
Registered: April 2013
Junior Member
Hi,
I had also this problem. I can tell what I did, maybe it's not the best practice, but for me works.
So I put my both languages in one xtext file and at the top I can choose which language I'll use. (then the emf model will combine the two "languages")
Or I think you can create two different projects.
Hope It helped a little.


Edwin W.T.
Re: How to get ecore and genmodel? [message #1060121 is a reply to message #1059936] Thu, 23 May 2013 03:59 Go to previous messageGo to next message
chris yo is currently offline chris yo
Messages: 11
Registered: February 2013
Junior Member
I would want to sort my grammar into different files. All the grammar has to be in the same project because I only need 1 validator and generator.

I was able to add new grammar file to MyDsl project by simple copy + paste method.

Grammar mixins and import is talking about grammars in different projects. So, I was looking for alternatives.

Re: How to get ecore and genmodel? [message #1060161 is a reply to message #1059936] Thu, 23 May 2013 07:37 Go to previous message
Alexander Nittka is currently offline Alexander Nittka
Messages: 1085
Registered: July 2009
Senior Member
Hi,

you can generate the infrastructure for two languages within the same project. You'll have to adapt the workflow to process not only one (as is the default case) but both.

An example workflow can be found here here.

Note that the generator components contains two language entries.

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
Previous Topic:Getting the root node from a resource
Next Topic:Xtext 2.4 referencing UML
Goto Forum:
  


Current Time: Tue May 28 17:14:06 EDT 2013

Powered by FUDForum. Page generated in 0.02287 seconds