Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Defining common figures and edit parts
Defining common figures and edit parts [message #675815] Wed, 01 June 2011 15:34 Go to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
Hello,

After generating gmfgen, gmfmap and gmfgraph I end up with edit parts and figures that define my model elements. Many of the elements are similar but there is nothing that ties them together in generated code (no common figures or edit parts from my customization perspective). I can refactor the code to extract common classes, but is there a way to do this for gmf editors? In gmfgraph I can create custom figure, so I guess it's doable for figures, but what about edit parts? Is this achievable by:

1.Define custom figure in gmfgraph
2.Generate gmfgen and edit parts will be created based on figure definitions in gmfgraph

I was also thinking about creating a common figure gallery and extending from those figures in my default gallery - not sure if this work as such.

My goal is to do as much customization in gmf editors so that my generated code is as much reusable as possible.

Thanks for your help,
Alex

Re: Defining common figures and edit parts [message #676167 is a reply to message #675815] Fri, 03 June 2011 05:12 Go to previous messageGo to next message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
Hi Alex,

you might want to import gmf.codegen plugin as source project into your workspace and have a look at the contents of the "templates" folder. Copy the templates you need for your changes (and keep the folder structure) to the plugin with your gmf models. Then in gmfgen, set "use dynamic templates" to true and set the path of the "template directory". This enables you to modify the generated code. However, GMF's xPand does not create all files itself. Most of that is done in GMF's Generator class (the interesting methods are private and thus not visible or overridable). If you need to customize that class you might:


  • want to check the ObjectTeams project or
  • figure out a way to replace the usage of that class by GMF's generate diagram code wizzard or
  • check out GMFTools from source, modify its call to the GMF Generator class and install it into your IDE afterwards. GMFTools gives you more options to set (and keep!) defaults to gmfgen file when that one is generated. Plus: it gives you a single button to generate gmfgen and diagram code at once.


Hope this helps.

Rob

[Updated on: Fri, 03 June 2011 05:16]

Report message to a moderator

Re: Defining common figures and edit parts [message #676323 is a reply to message #676167] Fri, 03 June 2011 16:54 Go to previous messageGo to next message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
Thanks Robert,

I was looking at GMFTools, but the last commit was back in October 2010 so I was not sure if project is still active.

So if I understand it correctly GMF does not provide a way to define common classes (figures/edit parts) in its editors, so this is where GMFTools come in?

Also, what are your thoughts on Graphiti project and EuGENia?

Thanks,
Alex
Re: Defining common figures and edit parts [message #676389 is a reply to message #676323] Sat, 04 June 2011 04:49 Go to previous message
Robert Wloch is currently offline Robert WlochFriend
Messages: 109
Registered: July 2009
Senior Member
Alex,

comments below...

Alex wrote on Fri, 03 June 2011 12:54
Thanks Robert,

I was looking at GMFTools, but the last commit was back in October 2010 so I was not sure if project is still active.

It's still active. So far it serves our purpose, hence few commits lately.
Quote:
So if I understand it correctly GMF does not provide a way to define common classes (figures/edit parts) in its editors, so this is where GMFTools come in?

GMF does not provide an easy way via modeling. You need to tweek the templates and/or Generator class, but you do not need GMFTools for that. The changes can be done without it.
Quote:

Also, what are your thoughts on Graphiti project and EuGENia?

I haven't used EuGENia yet, but had a look at Graphiti about a year ago. It appeared to be a replacement for GEF. So you don't get the EMF model synch stuff GMF provides but need to code it yourself. This left me concluding that there's going to be some "modeling project" coding a modeling environment ontop of Graphiti taking the role GMF took for GEF. Turns out I was right: The Spray project was started recently.
Quote:

Thanks,
Alex


Rob
Previous Topic:How do I join two diagrams?
Next Topic:Can I change compartment positions
Goto Forum:
  


Current Time: Thu Apr 25 15:52:01 GMT 2024

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

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

Back to the top