Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Display ports that are not contained by object
Display ports that are not contained by object [message #1000228] Mon, 14 January 2013 05:10 Go to next message
Matthias N is currently offline Matthias N
Messages: 65
Registered: June 2012
Member
Hi,

I have a meta-model which looks the following:

+------+      type +-----------+
| Type |<----------| Prototype |
+------+           +-----------+
   <>
    |
    |
+-------+
+ Port  +
+-------+


The type contains a set of Ports. A Prototype references a type.

Type:
In GMF Type is top-node-reference and Port is a child reference.

Prototype:
In GMF Prototye is a top-node-reference.

What I want to do now is the following. I create a type (TypeA) with some ports. Then I create a prototype and select the type (TypeA) in the properties. Now all the ports which are on TypeA shall be displayed on the Prototype as well.

Is this possible with GMF ?!
Re: Display ports that are not contained by object [message #1000296 is a reply to message #1000228] Mon, 14 January 2013 08:06 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

in your edit part of prototype you could overwrite handleNotification and change the figure to look like what you intend to. This could give you a starting point: http://wiki.eclipse.org/GMF/Tips#Making_figures_sensitive_to_attributes_of_semantic_elements. Once you decide to modify generated code I would recommend you to place this code in a custom template which can save you a lot of work. Alternatively you could use the extension points of the GMF Runtime.

Ralph
Re: Display ports that are not contained by object [message #1000300 is a reply to message #1000228] Mon, 14 January 2013 08:16 Go to previous messageGo to next message
Matthias N is currently offline Matthias N
Messages: 65
Registered: June 2012
Member
Hi Ralph,
thanks for you answer. I was trying sth. similar today:

PrototypeEditPart
protected void handleNotificationEvent(Notification notification) {
PortEditPart port = new PortEditPart(getDiagramView());
addChildVisual(port);
addFixedChild(port);


However, now the port is not attached to the border, instead he is inside the port figure and too big.

Any ideas?
Re: Display ports that are not contained by object [message #1000689 is a reply to message #1000300] Tue, 15 January 2013 04:07 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

you could try to reuse the generated code that is already used for the other figure. Did you try to copy this code over?

Ralph
Previous Topic:Assign File to a GMF node
Next Topic:Apply changes in editor
Goto Forum:
  


Current Time: Sat Aug 30 00:38:09 EDT 2014

Powered by FUDForum. Page generated in 0.09106 seconds