GMF Introduction

In the previous posts you would have learnt about the basics needed to start-off learning in-depth about Graphical Modeling Framework (GMF). I would suggest you to read this interview featuring Richard Gronback of GMF Project. It will give you a clear picture as to why and how GMF came into existance.
GMF combines both GEF & EMF for designing powerful graphical editors on fly. GEF as described earlier is used to represent the models created using EMF. The main draw backs are 1. its time consuming, 2. editors do not have extensible features, 3. editor needs to be designed manually from scratch, 4. does not provide extensive support for entire EMF framework.

Keeping these drawbacks in mind and to enhance more on it GMF was born. GMF sits on GEF and utilizes all the features of EMF and also provides its users with an editor with many re-usable components like zoom, save canvas as png file, draw otehr shapes, change fonts, colors, etc. This made GMF to be readily accepted by the community. A very good example where GMF has found its place is the Eclipse UML2Tools project.

GMF basically has two main components:
  • Binds EMF & GEF
  • Provides service layer and significant diagramming capabilities
  • Designed for extensibility
Generation (tooling)
  • Models used to define graphics, tooling, mapping to domain
  • Code generation targets runtime
  • Promotes use of Domain-Specific Languages

Generation Framework:
Generation framework of GMF allows users to define their custom diagram structure. Graphical definition is used to define how exactly the diagrams of their respective models look on canvas, be it like ellipse, circle, rectangle, compartments, link with arrow decorations. Tooling definition lets you define the tools that are to be presented in the palette. Here you can choose custom icons for every tool, group the tools in palette. GMF provides you with a "flyout" palette that can be collapsed or expanded as required. Domain Mapping brings together all 3 graphical definition, tooling definitions and domain model (designed using EMF). After the Mapping is over, GMF provides user with a generator model that allows implementation details to be defined for generation phase. More in detail will be posted in forthcoming chapters.

Runtime Framework:
The production of an editor plug-in based on the generator model will target a final model; that is, the diagram runtime (or "notation") model. The runtime is bridge between the notation and domain model(s) when a user is working with a diagram. It also provides for the persistence and synchronization of both. The runtime not only allows easier integration between EMF and GEF, but provides additional services like: transactions support, extended meta-modeling facilities, notation meta-model, variability points used for runtime extensibility of generated code, etc.


Unknown said...
This comment has been removed by the author.
Unknown said...

Hello Amit,

I didn't read yet about GMF. I am looking for a graphical tool that enables to display EMF models and that lets me highlight some parts of the models (e.g. to indicate that a fragment of the model matches a pattern we were looking for). Do you think that GMF is suitable for this??
The goal of the project I am working on is not visualizing models. However to be able to give a demonstration of what I managed to do in patterns detection It's better to graphically visualize models. So I am looking for some quick solution.
Thank you for your help.

Amit S said...

Hi ghizlane,

When it comes to visualizing EMF model, GMF provides you with lots of options.

I think you should go for using GMF.
Since you want to 'highlight some parts of model', it will let you do it at ease. GMF has concept of 'EditParts' that relates every visual thing displayed with model. This will indeed give u easy and better solution.
GEF is time consuming and GMF is based on top of it.

Unknown said...

Hi Amit,

Thanks lot for the answer.
I'll start reading about and exploring GMF. I think that your posts will be helpful for me.
Thanks again.

Amit S said...

Hi again
U r welcome anytime. :)
Blog can give u an headstart. But its still incomplete.

Unknown said...

Hi Amit

I am working on project which require GMF based eclipse plugin developing.please tell me steps to follow for such project with example.


Amit S said...

Hi Asavari,

I fear I may not help you in general examples of GMF. Eclipse by default has few examples/tutorials.
I request you to follow them.
If you have specific doubts. Then I can definitely help you out.

Unknown said...
This comment has been removed by the author.
Amit S said...

I have not tried ER Diagrams. But I am sure they will not be tough to develop.

Develop an ER metamodel using EMF.
Use GMF to generate code for your EMF.


PS: Now I am not sure how you gonna create ER metamodel :)

Anonymous said...

Maybe the most influential blog I have read today!

Amit S said...

Hey. Thanks anonymous !