Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » LWC2011 document, "Using the manually maintained Ecore model"
LWC2011 document, "Using the manually maintained Ecore model" [message #701256] Sun, 24 July 2011 18:06 Go to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 4
Registered: August 2010
Junior Member
Dear list,

I am trying to teach myself Xtext with the LWC2011 document.

In section:
7.5.4 Using the manually maintained Ecore model,
On page 71,
"Select the root node from the Genmodel again and select Generate Model Code from the context"

1)
Could someone please clarify if this means that one needs to right click on one of the nodes of "Instances.genmodel" and select the "Generate Model" from the context menu ?

I could not find such a menu entry.

2)
Also, I would greatly appreciate an explanation on the purpose of the instance language versus the domain model language.
Why not write the grammar of the "instance DSL" directly ?


I am using the itemis indigo eclipse distribution.
Sincerely.
Arye.


Re: LWC2011 document, "Using the manually maintained Ecore model" [message #701293 is a reply to message #701256] Sun, 24 July 2011 19:15 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik Lindberg
Messages: 2493
Registered: July 2009
Senior Member
When you open a (correctly constructed) genmodel it opens with the
genmodel tree collapsed and you see a single node. In the contect menu
for that node, there is a "Generate Model Code". This is the action you
want to execute.

The benefit of using an imported model is that you have more control
over it than if you generate it from the grammar. Some things are also
not possible to achieve unless you have a separate model. A
recommendation is to start with a model that is generated from the
grammar since it is much more convenient when exploring possibilities in
a new grammar. Later, you don't want this flexibility as it will hide
problems in the grammar and you may have an unwanted structure. When you
reach this point, simply copy the generated model to a separate project
and maintain it manually.

Don't understand your "instance language" vs. "DSL language" question,
but maybe the explanation about generating the model from the grammar
vs. using an "external" model answers this...

Regards
- henrik


On 7/25/11 12:06 AM, howaryoo wrote:
> Dear list,
>
> I am trying to teach myself Xtext with the LWC2011 document.
>
> In section:
> 7.5.4 Using the manually maintained Ecore model,
> On page 71, "Select the root node from the Genmodel again and select
> Generate Model Code from the context"
>
> 1)
> Could someone please clarify if this means that one needs to right click
> on one of the nodes of "Instances.genmodel" and select the "Generate
> Model" from the context menu ?
>
> I could not find such a menu entry.
>
> 2)
> Also, I would greatly appreciate an explanation on the purpose of the
> instance language versus the domain model language.
> Why not write the grammar of the "instance DSL" directly ?
>
>
> I am using the itemis indigo eclipse distribution.
> Sincerely.
> Arye.
>
>
>
Re: LWC2011 document, "Using the manually maintained Ecore model" [message #701530 is a reply to message #701293] Mon, 25 July 2011 04:20 Go to previous message
Missing name Missing name is currently offline Missing name Missing name
Messages: 4
Registered: August 2010
Junior Member
Hello,
your attention and quick reply is appreciated !

1) Genmodel question, indeed my genmodel is probably badly constructed since I have quite a few root nodes and not just one. I tried to follow the instructions carefully but I must have missed something.

2) "Instance DSL" vs "Domainmodel DSL"
I was referring to the 2 example DSLs mentionned in the LWC2011 xtext submission.
I understand now after reading a little further (14.3.2 InstancesGenerator.xtend) one purpose of the instance language is to allow creating instances more easily. This way, the code for creating the instances can be generated by xtend.



Thank you again.
Regards,
Arye.
Previous Topic:Restricting the scope / code suggestion
Next Topic:Issue with generator
Goto Forum:
  


Current Time: Wed Apr 23 19:48:56 EDT 2014

Powered by FUDForum. Page generated in 0.01629 seconds