EContentAdapter does not always see map values changeshttps://www.eclipse.org/forums/index.php/mv/msg/486137/1053559/#msg_1053559
Note that if the EContentAdapter is registered after the new BasicEList() is added to the map, it gets the notification correctly

Any idea if this is a bug, or there is a way to do it that would work?

On 06/05/2013 4:20 PM, David Michonneau wrote:
> I have an issue with EContentAdapter. When I have maps with lists as
> values, it does not detect that new list instances are added as values.
I think that's not true. When I run your test case there is one
notification, i.e., for the map entry being added to the items list...
> And so no notification is triggered when the list changes. Here is an
> example that demonstrates it:
>
> Note that if the EContentAdapter is registered after the new
> BasicEList() is added to the map, it gets the notification correctly
>
> Any idea if this is a bug, or there is a way to do it that would work?
>
> ---- xcore
> package test
>
> class A {
> contains TestMap[] items
> }
> class ItemValue {}
> class TestMap wraps java.util.Map$Entry{
> String key
> contains ItemValue [0..*] value
> }
>
> ---- test
> A a = TestFactory.eINSTANCE.createA();
> Adapter listener = new EContentAdapter() {
> @Override
> public void notifyChanged(Notification notification) {
> System.out.println(notification);
You're not calling super, so the content adapter doesn't attach itself
to the newly added map entry...
> }
> };
> a.eAdapters().add(listener); a.getItems().put("key" , new
> BasicEList<ItemValue>()); // this seems to go unnoticed by
> EContentAdapter
> ItemValue value = TestFactory.eINSTANCE.createItemValue();
> a.getItems().get("key").add(value ); // EContentAdapter not notified]]>Ed Merks2013-05-06T14:39:46-00:00Re: EContentAdapter does not always see map values changeshttps://www.eclipse.org/forums/index.php/mv/msg/486137/1053566/#msg_1053566
David Michonneau2013-05-06T14:43:48-00:00Re: EContentAdapter does not always see map values changeshttps://www.eclipse.org/forums/index.php/mv/msg/486137/1053567/#msg_1053567
Thanks,