Skip to main content



      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
Eclipse UserFriend
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
Eclipse UserFriend
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.
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
Eclipse UserFriend
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 messageGo to next message
Eclipse UserFriend
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
Re: How to get ecore and genmodel? [message #1062611 is a reply to message #1060161] Sun, 09 June 2013 23:15 Go to previous message
Eclipse UserFriend
Thank you for the reply Alexander. I tried to follow what you did on your project. I added a new language entry in the component Generator.

But I am getting a java runtime error:
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)


So, in the StandaloneSetup, I added these 2 lines:
registerGeneratedEPackage = "org.xtext.example.mydsl.form.FormPackage"
      registerGenModelFile = "classpath:/org/xtext/example/mydsl/Form.genmodel"


But, still I am getting a runtime error from mwe2launcher.

I placed the Form.xtext in the same directory location with MyDsl.xtext, so there should not be a problem. What else do I need to add in the workflow?
Previous Topic:How to validate import URI in Maven project managed by Eclipse m2e?
Next Topic:Fillter predicate
Goto Forum:
  


Current Time: Tue Jul 08 21:17:38 EDT 2025

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

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

Back to the top