Skip to main content


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 08:39 Go to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior 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 12:47 Go to previous messageGo to next message
Edwin Tuzar is currently offline Edwin TuzarFriend
Messages: 33
Registered: April 2013
Location: Kaiserslautern
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 07:59 Go to previous messageGo to next message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior 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 11:37 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
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
Re: How to get ecore and genmodel? [message #1062611 is a reply to message #1060161] Mon, 10 June 2013 03:15 Go to previous message
chris yo is currently offline chris yoFriend
Messages: 146
Registered: February 2013
Senior Member
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: Fri Apr 26 00:45:49 GMT 2024

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

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

Back to the top