Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » HowTo: bidirectionnal relation between two classes
HowTo: bidirectionnal relation between two classes [message #512512] Fri, 05 February 2010 10:47 Go to next message
Chandresh Gandhi is currently offline Chandresh GandhiFriend
Messages: 30
Registered: July 2009
Member
I'd tried to design core model (class diagram)using Ecore Tools à Ecore Diagram. I'm surprised to not to see option OR way for defining bidirectional relationship between two classes.

I see Connections àEReference option but it defines unidirectional relation between two classes.

I'm sure how to manipulate it OR approach for bidirectional relation between two classes. Can someone please help me on this.

Re: HowTo: bidirectionnal relation between two classes [message #512529 is a reply to message #512512] Fri, 05 February 2010 11:35 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Chandresh,

Via the properties view for a reference, you can set another reference
as the opposite to pair them up. Once you've done that, they render as
a single line connecting the classes.


Chandresh Gandhi wrote:
> I'd tried to design core model (class diagram)using Ecore Tools à
> Ecore Diagram. I'm surprised to not to see option OR way for defining
> bidirectional relationship between two classes.
>
> I see Connections àEReference option but it defines unidirectional
> relation between two classes.
>
> I'm sure how to manipulate it OR approach for bidirectional relation
> between two classes. Can someone please help me on this.
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: HowTo: bidirectionnal relation between two classes [message #513162 is a reply to message #512529] Tue, 09 February 2010 07:18 Go to previous messageGo to next message
Chandresh Gandhi is currently offline Chandresh GandhiFriend
Messages: 30
Registered: July 2009
Member
Hi Ed,

Thanks for your tip.
Indeed I'd tried to set EOpposite property (Model tab) for a reference in property view but object selection dialog has blank list of references. How can I add Opposite references for selection ??

I feel in order to make this work, Container property (Advanced tab) for same reference should be set with "true". In my case, It's non-editable at all.
How can I approach this ??

-Chandresh Gandhi

Re: HowTo: bidirectionnal relation between two classes [message #513210 is a reply to message #513162] Tue, 09 February 2010 11:29 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Chandresh,

Comments below.

Chandresh Gandhi wrote:
> Hi Ed,
>
> Thanks for your tip.
> Indeed I'd tried to set EOpposite property (Model tab) for a reference
> in property view but object selection dialog has blank list of
> references. How can I add Opposite references for selection ??
If class A has a reference b to class B then you'll only be able to pick
as the opposite a reference r from B when the type of r is A. So if the
selection is blank, it's likely there are no valid choices.
>
> I feel in order to make this work, Container property (Advanced tab)
> for same reference should be set with "true".
No, that's a derived property. It's true only if the opposite's
reference has containment true.
> In my case, It's non-editable at all. How can I approach this ??
Consider carefully the implications of what I said about the types of
the features your trying to make as opposites.
>
> -Chandresh Gandhi
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: HowTo: bidirectionnal relation between two classes [message #514205 is a reply to message #512512] Fri, 12 February 2010 19:42 Go to previous message
Herb Miller is currently offline Herb MillerFriend
Messages: 139
Registered: January 2010
Senior Member
I hit this same problem running through the databinding examples here:
http://tomsondev.bestsolution.at/2009/06/06/galileo-emf-data binding-part-1/

The 1st reply is accurate, but I found it easier to do the following.

1. Draw a reference from class A to class B and name it.
2. Draw a reference from class B to class A and name it something else.
There should now be 2 separate references with arrowheads at different ends (one arrowhead points to class A; the other 2 class B).
3. Use the properties view on the 1st reference to set the other reference as the Eopposite. The box that pops up after selecting the ... (ellipsis button) should now be populated with the name of the other reference, so it can be selected now.

The 2 references become 1, and the arrowheads disappear.

Thanks.
Previous Topic:Why PropertySheetPage doesn't work?
Next Topic:Pattern for corecing Java datatypes to EObject
Goto Forum:
  


Current Time: Fri Apr 26 23:09:14 GMT 2024

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

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

Back to the top