Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » modeling a typed graph with gmf
modeling a typed graph with gmf [message #65949] Thu, 19 October 2006 18:12 Go to next message
Eclipse UserFriend
Hi,


I am trying to create a graphical editor for a graph that contains nodes
and edges between nodes. Edges shall have a user-chosen type.

I uploaded an image of the graph ecore model to my website. When you
look at the model it should be clear what I want to do.

the url is: http://xgag.sourceforge.net/img/Board.jpeg


Modeling such a graph with a gmf created editor should work as follows:

The user creates several nodes, which are basically labeled rectangles.
Drawing a simple polyline connection between two nodes should create an
edge in the domain model. The polyline connection has a nested label,
whose value should be the type of the connection.


I really have troubles creating a suitable mapping model: I create a
link mapping that maps the connection to an Edge element, which works
fine. Furthermore the connections label should map to Direction element.
Trying to create a nested label-mapping does not seem powerful enough,
since i can only map the label´s value to Attributes of Edge.

I am aware of that adding multiple edges with the same type will involve
to check whether a matching Direction already exists. If this is so,
only the reference has to be set to this Direction. If not I have to
create a new Direction AND set the reference. Further when deleting a
Connection I should check whether there are still connections that share
the same type, etc. After a few desperate hours of try´n error I would
however just be happy if the Direction element would be created at least.

Does anyone understand what I want to do, and could give a hint on how
to achieve it?


Thanks for any help.
Felix
Re: modeling a typed graph with gmf [message #66203 is a reply to message #65949] Fri, 20 October 2006 07:10 Go to previous messageGo to next message
Eclipse UserFriend
Hello Felix,

You can patch generated code to cover your use-case. Take a look on FieldItemSemanticEditPolicy.getCompleteIncomingEdgeXXXComman d()
method - this method return new instance of CreateIncomingEdgeXXXCommand.
This command should be executed to create semantic instance of new Edge.
So, you can modify doDefaultElementCreation method of this command to handle
creation of Direction instances in this method. (Do not forget to specify
“@generated NOT” in java doc for the modified method) Generated EdgeItemSemanticEditPolicy
should be responsible for deleting Edge instance, so you can return subclass
of DestroyElementCommand from this place and remove Direction instance from
this command if necessary.

Concerning the label based on another domain model element – seems like you’ll
be able to create LabelMapping (without any connections to the domain model
element) and manually supply parser implementation to cover your use-case
on closing following request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=161380.

-----------------
Alex Shatalin
Re: modeling a typed graph with gmf [message #66291 is a reply to message #65949] Fri, 20 October 2006 07:38 Go to previous message
Eclipse UserFriend
> Trying to create a nested label-mapping does not seem powerful enough,
> since i can only map the label?s value to Attributes of Edge.

You can add derived transient attribute to Edge and provide implementation
that delegates to Direction.


Artem

"Felix Dorner" <felix_do@web.de> wrote in message
news:eh8tan$tfo$1@utils.eclipse.org...
> Hi,
>
>
> I am trying to create a graphical editor for a graph that contains nodes
> and edges between nodes. Edges shall have a user-chosen type.
>
> I uploaded an image of the graph ecore model to my website. When you look
> at the model it should be clear what I want to do.
>
> the url is: http://xgag.sourceforge.net/img/Board.jpeg
>
>
> Modeling such a graph with a gmf created editor should work as follows:
>
> The user creates several nodes, which are basically labeled rectangles.
> Drawing a simple polyline connection between two nodes should create an
> edge in the domain model. The polyline connection has a nested label,
> whose value should be the type of the connection.
>
>
> I really have troubles creating a suitable mapping model: I create a link
> mapping that maps the connection to an Edge element, which works fine.
> Furthermore the connections label should map to Direction element. Trying
> to create a nested label-mapping does not seem powerful enough, since i
> can only map the label?s value to Attributes of Edge.
>
> I am aware of that adding multiple edges with the same type will involve
> to check whether a matching Direction already exists. If this is so, only
> the reference has to be set to this Direction. If not I have to create a
> new Direction AND set the reference. Further when deleting a Connection I
> should check whether there are still connections that share the same type,
> etc. After a few desperate hours of try?n error I would however just be
> happy if the Direction element would be created at least.
>
> Does anyone understand what I want to do, and could give a hint on how to
> achieve it?
>
>
> Thanks for any help.
> Felix
Previous Topic:Refreshing Decorations
Next Topic:Ecore diagram editor: how to hide class annotations?
Goto Forum:
  


Current Time: Thu May 08 13:48:25 EDT 2025

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

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

Back to the top