|
Re: Father/Child Relationship [message #206059 is a reply to message #206033] |
Thu, 18 September 2008 15:38 |
Zsolt Török 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 |
Stephan Arenswald 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
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04889 seconds