| Class diagram Editor with GMF [message #651508] |
Mon, 31 January 2011 08:37  |
Thomas Buchmann Messages: 51 Registered: November 2010 |
Member |
|
|
Hi,
i want to build a class diagram editor on top of the UML2 Metamodel provided by Eclipse. I chose GMF for this task. However, i'm running in some problems now:
1. i want to display attributes in the following form: "attribute name : attribute type". My idea was to use only one label to display both attributes. But it seems the problem is, that only attributes of the corresponding domain element can be chosen from the dialog. In the UML2 Metamodel, the type of a Property is realized by a EReference to the corresponding Element. So my question is: Is there a way to display both attributes using GMF only? Or do i need manual "customization" of the generated code to achieve this?
2. In the UML2 Metamodel, an association has 2 properties that define the ends of the association (memberEnds, navigableEnds). In the concrete Syntax, an association is drawn between to Classes. How can i model this in GMF?
Thanks for an answer.
Regards,
Thomas
|
|
|
| Re: Class diagram Editor with GMF [message #651704 is a reply to message #651508] |
Tue, 01 February 2011 06:11   |
Ralph Gerbig Messages: 550 Registered: November 2009 |
Senior Member |
|
|
Hi,
| Quote: | 1. i want to display attributes in the following form: "attribute name : attribute type". My idea was to use only one label to display both attributes. But it seems the problem is, that only attributes of the corresponding domain element can be chosen from the dialog. In the UML2 Metamodel, the type of a Property is realized by a EReference to the corresponding Element. So my question is: Is there a way to display both attributes using GMF only? Or do i need manual "customization" of the generated code to achieve this?
|
use a Expression Label mapping instead of a feature label mapping. Add a value expression like self.attribute.Name.concat(self.datatype.name). For the correct expression refer to the OCL Language Reference and to your meta model.
| Quote: | 2. In the UML2 Metamodel, an association has 2 properties that define the ends of the association (memberEnds, navigableEnds). In the concrete Syntax, an association is drawn between to Classes. How can i model this in GMF?
|
I have no idea how to solve 2) as I am not familar with the meta model you are using. But I think you can react in your editParts handleNotificationEvent method on the changes in navigableEnds and change the figures decorator. This might help you: http://wiki.eclipse.org/GMF/Tips#Making_figures_sensitive_to _attributes_of_semantic_elements
Ralph
[Updated on: Tue, 01 February 2011 06:11] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01691 seconds