Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Generating Elements Automatically
Generating Elements Automatically [message #500834] Sun, 29 November 2009 12:46 Go to next message
sebastian.sprenger is currently offline sebastian.sprengerFriend
Messages: 16
Registered: November 2009
Junior Member
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 13:11 Go to previous messageGo to next message
Alex Shatalin is currently offline Alex ShatalinFriend
Messages: 141
Registered: July 2009
Senior Member
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 13:51 Go to previous message
sebastian.sprenger is currently offline sebastian.sprengerFriend
Messages: 16
Registered: November 2009
Junior Member
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 Apr 19 23:34:08 GMT 2024

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

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

Back to the top