Hello Christoph, Working with string-based properties got slightly more fiddly after the addition of type parameters to the databinding classes. But it also got a bit more clear and got more static type checking!
The Vogella tutorial is apparently not updated to use new versions of the databinding framework. The best way to solve your problem is to use the versions of BeanProperties#value that also specify the return type. Like this: import org.eclipse.core.databinding.beans.typed.BeanProperties; ObservableListContentProvider<Person> contentProvider = new ObservableListContentProvider<>(); IObservableSet<Person> knownElements = contentProvider.getKnownElements(); IObservableMap<Person, String> streetName = BeanProperties.value(Person.class, "address", Address.class) .value(BeanProperties.value(Address.class, "street", String.class)) .observeDetail(knownElements); The above code type-checks fine. The other alternative is to specify Object as the type argument of ObservableListContentProvider. In that case you throw type information away and you have to work with Object all the way: ObservableListContentProvider<Object> contentProvider = new ObservableListContentProvider<>(); IObservableSet<Object> knownElements = contentProvider.getKnownElements(); IObservableMap<Object, Object> streetName = BeanProperties.value("address") .value(BeanProperties.value("street")) .observeDetail(knownElements); BR, Jens Lideström On 2021-04-21 10:04, Christoph Läubrich wrote: > [1] shows how to observe a property of an object to have a label updating, > that works as long as it is a direct property of the (person) object. > > [2] shows how to chain properties to access "sub-objects" (lets say > persons address) > > But how do I combine both? > > IObservableMap streetName = BeanProperties.value(Person.class, > "adress").value(BeanProperties.value(Address.class, > "street")).observeDetail(knownElements); > > obviously won't work as the "knownElements" are of type > IObservableSet<Person> ... > > > [1] > https://www.vogella.com/tutorials/EclipseDataBinding/article.html#observing-list-details > > [2] > https://www.vogella.com/tutorials/EclipseDataBinding/article.html#chaining-properties > > _______________________________________________ > platform-dev mailing list > platform-dev@eclipse.org > To unsubscribe from this list, visit > https://www.eclipse.org/mailman/listinfo/platform-dev _______________________________________________ platform-dev mailing list platform-dev@eclipse.org To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/platform-dev