Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Generating Elements Automatically
Generating Elements Automatically [message #500834] Sun, 29 November 2009 07:46 Go to next message
Eclipse UserFriend
Hi everyone, im new to GMF. I have got the following problem. I created an Editor, which allows me to generate a node on the canvas. Always when I create a node, i wanted to create a child element automatically (but it should not be drawn on the canvas). I managed this via the mapping file by adding "Feature Seq Initializer", "Reference New Element Spec", another "Feature Seq Initializer", a "Feature Value Spec" and a "Value Expression". That worked so far, the XML-File generated by the Editor contains the element. But, I wasn`t able to set an attribute value of the element. I thought this works with the Body of the "Value Expression", but I wasn`t able to manage it.
So my questions are, is the mentioned way the right way to create elements automatically and how can I set Attribute-Values of the Elements automatically.
Somebody help please.
Re: Generating Elements Automatically [message #500840 is a reply to message #500834] Sun, 29 November 2009 08:11 Go to previous messageGo to next message
Eclipse UserFriend
Hello sebastian.sprenger@online.de,

Yes, this is a right way to initialize domain model elements created via
diagram editor.
You can set any attribute/references values by using OCL. On case some domain
model elements are not available from OCL you can set language of the corresponding
ValueExpression to "java", generate code and implement corresponding initializer
using java in the generated method stub.

-----------------
Alex Shatalin
Re: Generating Elements Automatically [message #500842 is a reply to message #500840] Sun, 29 November 2009 08:51 Go to previous message
Eclipse UserFriend
Thank you for the reply. The element wich should be added to my domain model has got one attribute "name:String". In the value expression I used java as language and tried the following expressions for the "body"-part: name="test", this.name="test", "test", new String("test") ... but nothing worked. Could you give me an example of how to set the value or a link to a documentation site? It would also help me to know, where I can find the relevant parts of the generated diagram code, because until now I only used the GMF tree-editor.
Previous Topic:Synchronizing different diagrams to show parts of the same model
Next Topic:Realising global elements in ecore?
Goto Forum:
  


Current Time: Fri Jul 04 22:59:31 EDT 2025

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

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

Back to the top