Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » GMF Editor should use additional notation model
GMF Editor should use additional notation model [message #202962] Thu, 21 August 2008 19:49 Go to next message
Arne Schipper is currently offline Arne SchipperFriend
Messages: 4
Registered: July 2009
Junior Member
Hi folks.

I'm trying to enhance an existing GMF-Editor. I created a state machine
editor, works fine, Statemachines are beeing saved as *.ssm and
*.ssm_diagram.

No what I want to do, is to put another "layer" over the existing editor
which should be able to edit properties of the editparts, and save them
into another file, e.g. *.ssm_layouthints.

I know there is a post similar to this problem
( news://news.eclipse.org:119/3d7e00c0e937d0562bd95cab0079497f $1@www.eclipse.org),
but in that case everything is stored in the notation model and
therefore the existing editor has to be altered. That is a thing I want
to avoide, because this extra functionality I want to develop is
intended to run with any editor later on. (Not only with the mentioned
state machine editor).

Short explanation what it is going to be:
I want to be able to annotate the editparts, or better the nodes, of a
diagram with special layout hints. E.g. I want to select a bunch of
nodes into a group and annotate this group with the hint "vertical, node
distance 20px". Another group might be annotated with the hint "circle".

All this information will be fed into a layouter which should do the
appropriate rendering according to the hints. As I'm going to develop
this as a plugin which is intended to run with any editor, changes to
the domain and even the notation model should be avoided, as well as to
the editor.

I hope someone can provide me some hints.

Cheers, arne
Re: GMF Editor should use additional notation model [message #203035 is a reply to message #202962] Fri, 22 August 2008 09:00 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Arne,

There is an interface Style in a notation model. Each Node/Edge has a number
of styles attached. You can subclass this interface and create "LayoutHintsStyle".
This style can be created/modified by custom actions (code annotating diagram
elements). As a result you'll not change anything in a notation model, but
you'll be able to annotate any kint of diagrams.

Another option is: create your own "decoration" model decorating either domain
model elements or notation model ones. Then in the action adding "LayoutHints"
for the particular domain model elenet you can load/create additional EMF
resource (e.g. *.ssm_diagram_layout_hints) and store/create corresponding
"decorating" elements there. As a result you'll not modify original model,
but you'll be able to store additional information in a separate resource.
The only place you should care about this resource is action working with
corresponding layout hints..

-----------------
Alex Shatalin
Re: GMF Editor should use additional notation model [message #203119 is a reply to message #203035] Fri, 22 August 2008 12:28 Go to previous messageGo to next message
Arne Schipper is currently offline Arne SchipperFriend
Messages: 4
Registered: July 2009
Junior Member
Hi Alex.

Thanks for your fast answer.
Alex Shatalin wrote:
> Hello Arne,
>
> There is an interface Style in a notation model. Each Node/Edge has a
> number of styles attached. You can subclass this interface and create
> "LayoutHintsStyle". This style can be created/modified by custom actions
> (code annotating diagram elements). As a result you'll not change
> anything in a notation model, but you'll be able to annotate any kint of
> diagrams.
>
I think this is related to the method/post I mentioned in my first post.
To clarify it for me (and maybe others). This does mean that I have to
extent the GMF notation model
(http://www.eclipse.org/gmf/runtime/1.0.1/notation). That means, on the
other hand, that existing GMF editors compiled against that notation
model are not going to work any more? Can you confirm/negate.

Is it maybe possible to use an extension point to add this functionality
into every GMF editor?

> Another option is: create your own "decoration" model decorating either
> domain model elements or notation model ones. Then in the action adding
> "LayoutHints" for the particular domain model elenet you can load/create
> additional EMF resource (e.g. *.ssm_diagram_layout_hints) and
> store/create corresponding "decorating" elements there. As a result
> you'll not modify original model, but you'll be able to store additional
> information in a separate resource. The only place you should care about
> this resource is action working with corresponding layout hints..
I'll have at look at this.

Ciao, ciao, Arne
>
> -----------------
> Alex Shatalin
>
>
Re: GMF Editor should use additional notation model [message #203133 is a reply to message #203119] Fri, 22 August 2008 13:43 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Arne,

> post. To clarify it for me (and maybe others). This does mean that I
> have to extent the GMF notation model (http://www.eclipse.org/gmf/runtime/1.0.1/notation).
That means, on
Yes. You have to create your own model extensing Style class from notation
one.

> the other hand, that existing GMF editors compiled against that
> notation model are not going to work any more? Can you confirm/negate.
No. generated code for your notation model extension will be located in a
separate plugin and will have dependency on notation model (not vice versa).
So, as a result you'll not change anything in the generated diagram code/runtime
plugins used by this diagram. Only additional ections (adding this custom
style) will have a dependency to newly generated notation model extension
plugin.
I suggest you trying that.

> Is it maybe possible to use an extension point to add this
> functionality into every GMF editor?
It's not necessary to add anything to GMF. See org.eclipse.gmf.runtime.notation.View.getStyles()
method. I suggest you to create own sybclass of Style interface and use it
while calling View.getStyles().add(myStyleInstance)

In addition EMF is able to generate MyStyle for you if you'll specify "Style"
as a superclass for "MyStyle" EClass inside extension.ecore model.

-----------------
Alex Shatalin
Previous Topic:DestroyElementRequest
Next Topic:Constraint at creation of nodes
Goto Forum:
  


Current Time: Thu Apr 25 12:03:31 GMT 2024

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

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

Back to the top