Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Getting the Referenced model objects from an EReference
Getting the Referenced model objects from an EReference [message #427297] Wed, 11 February 2009 13:11 Go to next message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Hi,

I implement an Observer which is notified of changes to my model "Car".
Car has a containment reference to the "Wheel" model object.

When adding a Wheel to the Car, I get a notification and calling
getFeature() on the Notifier, returns the EReference object. How do
I get the actual Wheel object?


Thanks! Christophe
Re: Getting the Referenced model objects from an EReference [message #427298 is a reply to message #427297] Wed, 11 February 2009 13:15 Go to previous messageGo to next message
Ed Merks is currently online Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010607040100050006010904
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Christophe,

Comments below.


Christophe Bouhier wrote:
> Hi,
>
> I implement an Observer which is notified of changes to my model "Car".
> Car has a containment reference to the "Wheel" model object.
>
> When adding a Wheel to the Car, I get a notification and calling
> getFeature() on the Notifier, returns the EReference object. How do
> I get the actual Wheel object?
Using this:

/**
* Returns the value of the notifier's feature after the change
occurred.
* For a list-based feature, this represents a value, or a list of
values, added to the list.
* @return the new value of the notifier's feature.
*/
Object getNewValue();

It will be useful to look at how EContentAdapter processes notifications
since that covers all the cases.
>
>
> Thanks! Christophe

--------------010607040100050006010904
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Christophe,<br>
<br>
Comments below.<br>
<br>
<br>
Christophe Bouhier wrote:
<blockquote cite="mid:gmuipl$n0m$1@build.eclipse.org" type="cite">Hi,
<br>
<br>
I implement an Observer which is notified of changes to my model "Car".
<br>
Car has a containment reference to the "Wheel" model object.
<br>
<br>
When adding a Wheel to the Car, I get a notification and calling
<br>
getFeature() on the Notifier, returns the&nbsp; EReference object. How do
<br>
I get the actual Wheel object?
<br>
</blockquote>
Using this:<br>
<blockquote>&nbsp; /**<br>
&nbsp;&nbsp; * Returns the value of the notifier's feature after the change
occurred.<br>
&nbsp;&nbsp; * For a list-based feature, this represents a value, or a list of
values, added to the list.<br>
&nbsp;&nbsp; * @return the new value of the notifier's feature.<br>
&nbsp;&nbsp; */<br>
&nbsp; Object getNewValue();<br>
</blockquote>
It will be useful to look at how EContentAdapter processes
notifications since that covers all the cases.<br>
<blockquote cite="mid:gmuipl$n0m$1@build.eclipse.org" type="cite"><br>
<br>
Thanks! Christophe
<br>
</blockquote>
</body>
</html>

--------------010607040100050006010904--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Getting the Referenced model objects from an EReference [message #427299 is a reply to message #427298] Wed, 11 February 2009 13:51 Go to previous message
Christophe Bouhier is currently offline Christophe BouhierFriend
Messages: 937
Registered: July 2009
Senior Member
Thanks Ed! (I actually bought your book, but left it at home today :-)


Ed Merks wrote:
> Christophe,
>
> Comments below.
>
>
> Christophe Bouhier wrote:
>> Hi,
>>
>> I implement an Observer which is notified of changes to my model "Car".
>> Car has a containment reference to the "Wheel" model object.
>>
>> When adding a Wheel to the Car, I get a notification and calling
>> getFeature() on the Notifier, returns the EReference object. How do
>> I get the actual Wheel object?
> Using this:
>
> /**
> * Returns the value of the notifier's feature after the change
> occurred.
> * For a list-based feature, this represents a value, or a list of
> values, added to the list.
> * @return the new value of the notifier's feature.
> */
> Object getNewValue();
>
> It will be useful to look at how EContentAdapter processes notifications
> since that covers all the cases.
>>
>>
>> Thanks! Christophe
Previous Topic:Metamodel Evolution
Next Topic:add border shape
Goto Forum:
  


Current Time: Thu Apr 25 15:03:52 GMT 2024

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

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

Back to the top