I found that the listener of WritableList can only be notified if there is any "add", "remove" or "set" operation occurs on the list.

Sometimes, I want to add observable beans to the WritableList, and I want the listener of this WritableList can be notified if the list's element - observable bean - fired property changed event.

I've noticed that this snippet used a observable Person class, which can emit PropertyChangeEvent to listeners. But I cannot understand how the final listener (the TableViewer intance) is able to perceive that event.

You need to translate the IObservableList into an IObservableSet in case
of a Viewer you can get the set from
ObservableListContentProvider#getKnownElements().

The IObservableMap is informed when *any* of the lists-elements
myproperty changes. If you are not using an
ObservableListContentProvider you can transform an IObservableList using
ListToSetAdapter and the code below reads:

IObservableMap map = p.observeDetail(new ListToSetAdapter(l));

Tom

Am 11.09.10 11:56, schrieb Frank:
> Thanks, Tom.
> p.observeDetail(I) returns IObservableList, right?why IObservableMap?
>
> Tom Schindl wrote on Sat, 11 September 2010 05:21
>> Then you need to create an ObservableMap from the WritableList.
>>
>> IObservableList l = new WritableList();
>> IBeanValueProperty p = BeanProperties.value("myattribute");
>> IObservableMap map = p.observeDetail(l);
>> map.addMapChangeListener( new IMapChangeListener() {
>> public void handleMapChange(MapChangeEvent event) {
>> // ...
>> }
>> });
>>
>> Tom
>>
>> Am 11.09.10 10:47, schrieb Frank:
>> > I found that the listener of WritableList can only be notified if there
>> > is any "add", "remove" or "set" operation occurs on the list.
>> > > Sometimes, I want to add observable beans to the WritableList, and I
>> > want the listener of this WritableList can be notified if the list's
>> > element - observable bean - fired property changed event.
>> > > I've noticed that this
>> > http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.e
>> xamples.databinding/src/org/eclipse/jface/examples/databindi
>> ng/snippets/Snippet009TableViewer.java?view=markup
>> > used a observable Person class, which can emit PropertyChangeEvent to
>> > listeners. But I cannot understand how the final listener (the
>> > TableViewer intance) is able to perceive that event.
>> > > Can any body show me a right way to do this? Thanks.
>
>