Hi,
i'm trying to figure out how to use EMFProperties.resource()
Here is example:
Resource r = ...; // Contains MyEObject's
Text comboR = ...; // Simple combo
IObservableList widget = WidgetProperties.items().observe(comboTemplates);
IObservableList emfList = EMFProperties.resource().observe(r);
I want to bind resource contents to combobox items.
i tried this:
bindingContext.bindList(widget, emfList, null, null);
this fails with exception: Cannot convert MyEObject to String
This is because bindingContext use default converter.
I tried this:
m_bindingContext.bindList(widget, emfList, new EMFUpdateListStrategy(), new EMFUpdateListStrategy());
This also doesn't work.
EMFProperties.resource().observe(r) creates EMFResourceContentProperty with getElementType() which returns null.
So, when we do bindingContext.bindList, it cannot determine model type and doesn't create converter:
// part of code from fillDefaults which is used at bindingContext.bindList
protected void fillDefaults(IObservableList source, IObservableList destination) {
Object sourceType = source.getElementType();
Object destinationType = destination.getElementType();
if (provideDefaults && [b]sourceType != null && destinationType != null[/b]) {
if (converter == null) {
setConverter(createConverter(sourceType, destinationType));
}
}
So, could anyone advise please, HOW EMFProperties.resource() can be used? Any working example?
Thanks!
[Updated on: Wed, 12 October 2011 02:25]
Report message to a moderator