Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to decorate domain model elements in GMF?
How to decorate domain model elements in GMF? [message #1077324] Thu, 01 August 2013 14:37 Go to next message
Niels Brouwers is currently offline Niels BrouwersFriend
Messages: 67
Registered: July 2009
Member
Hi all,

We have already developed a GMF editor for our domain model. Furthermore, we have created several decorator models for this domain model. The goal of the decorator models are to store non-essential data about elements from the domain model in a seperated model, thus preventing the pollution of the domain model.

Now we would like to annotate the graphical representations of the domain model with data from the decorating elements stored in the deocrator models. Ideally, we would like to empower the user interacting with the domain model's GMF editor to dynamically select the annotation models to be visible on top of the domain model.

Example: assume that the domain model contains only one class Node and one reference Link to connect two Nodes. The Node is represented by a rectangle, the Link is represented by a line. Now, we have defined a meta-model for a decorator model, consisting of a LinkDecorator element that has only one attribute data:EInt and a reference to the Link element from the domain model. The data attribute is represented by a rectangular shape containing the value of the data attribute. Now we would like to show the graphical representation of the data atrribute next to the Link representation in the domain model's editor.

Given the above, we are facing two problems for which help is really appreciated:


  1. How to define a GMF editor, where nodes from the diagram are originating (and persisted!) from more than one Ecore model? It is acceptable if only the domain model itself can be edited using the editor, and the decorator models are read-only.
  2. How to group graphical representations from decorator models in layers and let the layer be visible according to the layer selection by the user of the editor?


Thanks in advance.



Kind regards,
Niels Brouwers.
Re: How to decorate domain model elements in GMF? [message #1095033 is a reply to message #1077324] Mon, 26 August 2013 14:27 Go to previous message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
Registered: November 2009
Senior Member
Hi,

if you want to manipulate model elements based on manipulations I would suggest you to extend the generated code for the editpart. The part that is always there is your domain model. Hence, I would define a gmf editor on top of this. Then I would add code to the edit parts which interprets the annotation that you are currently loading. You could also add this outside of the edit part in something like a decorator service. However, in both situations, you need to manipulate the draw2d figure of the edit parts. This should not be too hard. In case you want to edit edit part logic or other generated code you should look at custom templates or GMF Runtime extension mechanisms. The annotation models could be shown in a view next to the editor. Maybe you should take a look at the MDPE tool of Mathias Fritzsche (e.g. http://ceur-ws.org/Vol-489/paper11.pdf, http://link.springer.com/chapter/10.1007%2F978-3-642-03848-8_8#page-2).

Ralph

[Updated on: Mon, 26 August 2013 14:33]

Report message to a moderator

Previous Topic:How can i change view of element when element attribute changed?
Next Topic:WorkspaceSynchronizer getFile
Goto Forum:
  


Current Time: Sat Nov 29 10:18:59 GMT 2014

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

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