Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMFProperties.resource() strange behaviour  () 1 Vote
EMFProperties.resource() strange behaviour [message #735491] Wed, 12 October 2011 02:22
Victor  is currently offline Victor Friend
Messages: 1
Registered: October 2011
Junior Member
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

Previous Topic:EMF-TableViewer databinding Tutorial
Next Topic:[CDO] Dynamic models under CDO 2.0
Goto Forum:
  


Current Time: Fri Apr 26 18:54:10 GMT 2024

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

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

Back to the top