Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Class diagram Editor with GMF(on top of org.eclipse.uml2 metamodel)
Class diagram Editor with GMF [message #651508] Mon, 31 January 2011 13:37 Go to next message
Thomas Buchmann is currently offline Thomas BuchmannFriend
Messages: 53
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 11:11 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 697
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 11:11]

Report message to a moderator

Re: Class diagram Editor with GMF [message #652002 is a reply to message #651508] Wed, 02 February 2011 12:02 Go to previous messageGo to next message
Thomas Buchmann is currently offline Thomas BuchmannFriend
Messages: 53
Registered: November 2010
Member
Thanks Ralph,

using an Expression Label did the trick.

Will have a look on your second suggestion.

Regards,
Thomas
Re: Class diagram Editor with GMF [message #669703 is a reply to message #652002] Wed, 11 May 2011 08:30 Go to previous message
Cindy  is currently offline Cindy Friend
Messages: 59
Registered: May 2011
Member
Hey could you tell me how to use expression lable in detail~~ i still cannot work it out~~ confused...
thank you very much if you could give me some tips:-)
Previous Topic:classDiagram.gmfmap
Next Topic:Displaying several features in element
Goto Forum:
  


Current Time: Sun Nov 23 19:01:38 GMT 2014

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

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