Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to show the addChildren function in generated code
How to show the addChildren function in generated code [message #124256] Sat, 05 May 2007 01:44 Go to next message
Eclipse UserFriend
Originally posted by: biju_gopinathan.rediffmail.com

Hi friends

I need to set the reference of the parent to child when they are added
to the parent. But as the generated code does not show the addChildren
function by default, how can I set this reference.

Is there any way to show the addChildren function of the parent in
generated code.

Thanks and Regards biju
Re: How to show the addChildren function in generated code [message #124360 is a reply to message #124256] Mon, 07 May 2007 05:44 Go to previous message
Eclipse UserFriend
Hello biju,

If you have the following Meta-Model:

Parent
- children (containmentReference) : Child
Child

then you can create (in .gmfgen model) Child reference with specified "Containment
Feature" property pointing to the "children" reference in the Meta-Model
- generated code will put created Child instance into the corresponding EList
in EMF.

If you have more complex situation:

Parent
- children (containmentReference) : Child
- selectedChildren (non-containmentReference) : Child
Child

And you would like to add all the newly created diagram elements into "selectedChildren"
reference. Then you can create Child reference using step.1 and then add
one more property: "Children Feature" pointing to the "selectedChildren"
reference. As a result generated code will create new instance of Child element
and add it into both Elists: "children" and "selectedChildren".

If you have another situation - please describe it in more details.


-----------------
Alex Shatalin
Previous Topic:how to customize creation tool?
Next Topic:GMF Book?
Goto Forum:
  


Current Time: Thu May 08 18:34:14 EDT 2025

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

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

Back to the top