Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Father/Child Relationship
Father/Child Relationship [message #206033] Thu, 18 September 2008 13:42 Go to next message
Stephan Arenswald is currently offline Stephan ArenswaldFriend
Messages: 11
Registered: July 2009
Junior Member
Hi All,

I have a diagram with a node type that has two attributes. The first is
a reference (EReference) to the father and the second to the sun.

Now if i add two nodes into my diagram i have to draw two lines to make
sure each node knows its parent and its child (If i only had a child
reference the parent node would know its child but the child wouldn't
know its parent).

Is there a way to draw one line and with this add the two references at
the same time?

-----------------
| Node 1 |
|child: Node 2 | <----------------------------------------
----------------- |
| |
| <-- draw only this line and both nodes know their relatives
| |
----------------- |
| Node 2 | |
|parent: Node 1 | <----------------------------------------
-----------------

Greetings
Re: Father/Child Relationship [message #206059 is a reply to message #206033] Thu, 18 September 2008 15:38 Go to previous messageGo to next message
Zsolt Török is currently offline Zsolt TörökFriend
Messages: 22
Registered: July 2009
Junior Member
Hi Stephan,

If I understand you correctly, you have an EClass called "Node" in your
metamodel, with two EReferences pointing to the Node class. What you could
do is go to the "child" reference in your Ecore model, and set the
EOpposite property to "parent". This way the two references will
practically become e single, bidirectional reference, and I think your GMF
editor will pick up this change after you re-generate all the code, and
set both values when you draw one single connection.

Hope that helps,
Zsolt

Stephan Arenswald wrote:

> Hi All,

> I have a diagram with a node type that has two attributes. The first is
> a reference (EReference) to the father and the second to the sun.

> Now if i add two nodes into my diagram i have to draw two lines to make
> sure each node knows its parent and its child (If i only had a child
> reference the parent node would know its child but the child wouldn't
> know its parent).

> Is there a way to draw one line and with this add the two references at
> the same time?

> -----------------
> | Node 1 |
> |child: Node 2 | <----------------------------------------
> ----------------- |
> | |
> | <-- draw only this line and both nodes know their relatives
> | |
> ----------------- |
> | Node 2 | |
> |parent: Node 1 | <----------------------------------------
> -----------------

> Greetings
Re: Father/Child Relationship [message #206091 is a reply to message #206059] Thu, 18 September 2008 21:02 Go to previous message
Stephan Arenswald is currently offline Stephan ArenswaldFriend
Messages: 11
Registered: July 2009
Junior Member
Hi Zsolt,

I always wondered what EOpposite is. Now I know :)
That solved my problem. You were also right in saying I only have to
re-generate the code. Great.

Thank you very much.

Greetings



Zsolt Török wrote:
> Hi Stephan,
>
> If I understand you correctly, you have an EClass called "Node" in your
> metamodel, with two EReferences pointing to the Node class. What you
> could do is go to the "child" reference in your Ecore model, and set the
> EOpposite property to "parent". This way the two references will
> practically become e single, bidirectional reference, and I think your
> GMF editor will pick up this change after you re-generate all the code,
> and set both values when you draw one single connection.
>
> Hope that helps,
> Zsolt
>
> Stephan Arenswald wrote:
>
>> Hi All,
>
>> I have a diagram with a node type that has two attributes. The first
>> is a reference (EReference) to the father and the second to the sun.
>
>> Now if i add two nodes into my diagram i have to draw two lines to
>> make sure each node knows its parent and its child (If i only had a
>> child reference the parent node would know its child but the child
>> wouldn't know its parent).
>
>> Is there a way to draw one line and with this add the two references
>> at the same time?
>
>> -----------------
>> | Node 1 |
>> |child: Node 2 | <----------------------------------------
>> ----------------- |
>> | |
>> | <-- draw only this line and both nodes know their relatives
>> | |
>> ----------------- |
>> | Node 2 | |
>> |parent: Node 1 | <----------------------------------------
>> -----------------
>
>> Greetings
>
>
Previous Topic:Tooltips
Next Topic:URIEditorInput
Goto Forum:
  


Current Time: Thu Apr 25 22:55:17 GMT 2024

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

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

Back to the top