Home » Modeling » GMF (Graphical Modeling Framework) » Replacing GEF model with EMF; go GMF? Or just EMF+GEF?
Replacing GEF model with EMF; go GMF? Or just EMF+GEF? [message #145914] |
Thu, 09 August 2007 06:47  |
Eclipse User |
|
|
|
Platform: ubuntu feisty, Intel pentium M
eclipse/gef 3.2.2
Hi!
We have a GEF editor that edits a graph consisting of nodes and
connections. The model being edited predates the GEF editor, and
parsing and saving the model from/to XML files (an ad-hoc XML format
without any schema definition), is done from OSGi bundles added as
plugins to the PDE target platform.
I'm looking into replacing the current model being edited in GEF, with
an EMF model.
What I wonder is: What's simplest? Adding the new EMF model to the
existing GEF editor? Or just ditching the existing GEF editor and
using the GMF framework directly?
How much is involved in fitting the EMF model to the GEF editor? I
have to modify the model-relevant parts of the existing edit parts?
Anything else?
What do I get extra for going GMF? More automatically written
notification stuff? Anything else? Does GMF provide connection
constraints (ie. what types of connections can be put between
different nodes? Connection cardinality?)?
Is using 3.3 a must for using GMF? Or are there workable stuff for
3.2.2? (I haven't been able to get GMF in 3.2.2 working yet...)
Thanx!
- Steinar
|
|
|
Re: Replacing GEF model with EMF; go GMF? Or just EMF+GEF? [message #146438 is a reply to message #145914] |
Mon, 13 August 2007 12:45   |
Eclipse User |
|
|
|
Hi Steinar.
You saying you have an existing GEF editor and you are looking to migrate
your model to EMF.
If your GEF editor is completely functional, the decision to use GMF comes
down to how it will affect your diagram. Your GEF figures will be portable
to GMF, but there may be things on a GMF based diagram that affect how you
have implemented your diagram. Check out
http://www.eclipse.org/articles/Article-Introducing-GMF/arti cle.html for a
small list of the diagram features in the GMF Runtime. Some of the features
may be new diagram functionality that you would get for free by using GMF
(such as export to image and printing).
You will need to worry about how your diagrams features are affected by
standard GMF features. Take connections as an example. If you have simple
line connections between nodes, you could simply use the GMF connections and
you would be ok. If your diagram has extended GEF connections with some
special routing or line styles, then you will need to spend effort merging
your connection extensions to the way GMF does connections, handles routing
and bendpoints.
If you have looked at GMF diagrams and are interested in the diagram
features, go with GMF. Otherwise I would keep your functional GEF diagram
and move your model to EMF.
Cheers...
Anthony
"Steinar Bang" <sb@dod.no> wrote in message news:87r6mdyofc.fsf@dod.no...
> Platform: ubuntu feisty, Intel pentium M
> eclipse/gef 3.2.2
>
> Hi!
>
> We have a GEF editor that edits a graph consisting of nodes and
> connections. The model being edited predates the GEF editor, and
> parsing and saving the model from/to XML files (an ad-hoc XML format
> without any schema definition), is done from OSGi bundles added as
> plugins to the PDE target platform.
>
> I'm looking into replacing the current model being edited in GEF, with
> an EMF model.
>
> What I wonder is: What's simplest? Adding the new EMF model to the
> existing GEF editor? Or just ditching the existing GEF editor and
> using the GMF framework directly?
>
> How much is involved in fitting the EMF model to the GEF editor? I
> have to modify the model-relevant parts of the existing edit parts?
> Anything else?
>
> What do I get extra for going GMF? More automatically written
> notification stuff? Anything else? Does GMF provide connection
> constraints (ie. what types of connections can be put between
> different nodes? Connection cardinality?)?
>
> Is using 3.3 a must for using GMF? Or are there workable stuff for
> 3.2.2? (I haven't been able to get GMF in 3.2.2 working yet...)
>
> Thanx!
>
>
> - Steinar
|
|
|
Re: Replacing GEF model with EMF; go GMF? Or just EMF+GEF? [message #146594 is a reply to message #145914] |
Wed, 15 August 2007 04:28  |
Eclipse User |
|
|
|
Steinar,
I've been through a similar process, myself. I first had an implementation of an
graphical editor completely outside Eclipse (JavaBeans and Swing), which I
ported to EMF+GEF. Then this one was ported to GMF.
Porting the model to EMF, which was easy.Although EMF's notification mechanism
was different, it's role and usage as the model in an MVC architecture remained
the same. Some custom code had to be written to preserve some of the original
API. Introducing GEF was a big job, but since you already use GEF, that's a
no-op for you. In the end, I'm very happy with EMF, since it gives so much for free.
The second port from GEF+EMF to GMF didn't involve that much new code, since I
already had a similar architecture (e.g. separate visual and semantic model).
Defining the GMF models was actually fairly easy, once I understood how GMF used
the semantic model. It did require some changes to the EMF model, so targeting
GMF from the start is best. The basic editor, which support creation and editing
of all essential elements, was fairly easy and quick to make. What took longer
was (understanding how to) migrate the existing GEF logic to GMF. A lot of the
GEF code could be removed, as it was handled by generated code. Since my EMF+GEF
editor was similar enough to GMF in many ways, it was fairly easy to separate
obsolete code from the custom code that had to be inserted into the generated
edit part and figure classes, to preserve features that the GMF models didn't
support. Note that GMF doesn't hide GEF, so you don't have to learn a completely
different runtime machinery, "just" how GMF utilises GEF.
How much custom code is needed depends on many things, like how direct the
mapping from semantic to visual elements is, what kind of interactivity you
need, etc. In my case, most of the constraints and rules could be formulated in
terms of types, i.e. not requiring attribute checks and computations. E.g. I
have two kinds of edges, and the rules for which nodes could be sources and
targets were simply specific types (EClass), and GMF handled this well. In one
case I found it easiest to introduce some extra abstract classes in the semantic
model, to make the rules simpler and more GMF-friendly.
The most time-consuming process was learning how the EditPart, Request,
EditPolicy and Command fit together. E.g. I (re)implemented drag and drop from a
palette to insert a clone of objects from a "template" model. This required one
concrete class of each of these and a lot of head-scratching I knew the
essential logic already from the EMF+GEF editor, but GMF makes it a more
complex. (There really should be some tools for tracing what happens in the
process of converting a Request to a Command, by EditParts and EditPolicies).
Hope this helps.
Hallvard
Steinar Bang wrote:
> Platform: ubuntu feisty, Intel pentium M
> eclipse/gef 3.2.2
>
> Hi!
>
> We have a GEF editor that edits a graph consisting of nodes and
> connections. The model being edited predates the GEF editor, and
> parsing and saving the model from/to XML files (an ad-hoc XML format
> without any schema definition), is done from OSGi bundles added as
> plugins to the PDE target platform.
>
> I'm looking into replacing the current model being edited in GEF, with
> an EMF model.
>
> What I wonder is: What's simplest? Adding the new EMF model to the
> existing GEF editor? Or just ditching the existing GEF editor and
> using the GMF framework directly?
>
> How much is involved in fitting the EMF model to the GEF editor? I
> have to modify the model-relevant parts of the existing edit parts?
> Anything else?
>
> What do I get extra for going GMF? More automatically written
> notification stuff? Anything else? Does GMF provide connection
> constraints (ie. what types of connections can be put between
> different nodes? Connection cardinality?)?
>
> Is using 3.3 a must for using GMF? Or are there workable stuff for
> 3.2.2? (I haven't been able to get GMF in 3.2.2 working yet...)
>
> Thanx!
>
>
> - Steinar
|
|
|
Goto Forum:
Current Time: Thu Sep 18 14:11:44 EDT 2025
Powered by FUDForum. Page generated in 0.05070 seconds
|