Home » Modeling » EMF » IObservableMap EMF implementation(Implementation of IObservableMap for EMF doesn't work properly)
IObservableMap EMF implementation [message #1238486] |
Sat, 01 February 2014 14:06 |
Peter N Messages: 6 Registered: February 2014 |
Junior Member |
|
|
I'm working with EMF databinding now, and in one case, when I use editing properties to get model map feature to work with - I get ClassCastException inside observable:
First, I created map observable for my model map feature (EMap<String, String> field in generated model instance):
EMFEditProperties.map(domain, feature).observe(model) // now I got IObservableMap instance
but when I try to invoke .putAll(...) method on it - I get ClassCastException. When I try to work with it with databinding context - I get similar behavior - databinding doesn't work, and if i look on it in debug, exception just swallowed inside databinding mechanism.
Investigating this issue, I realized, that it seems that there is wrong implementation of IObservableMap in EMF. Some details:
EMFEditProperties.map(...) method creates EMFEditMapProperty instance inside it.
Looking inside EMFEditMapProperty, we have method doSetMap(...):
protected void doSetMap(Object source, Map map, MapDiff diff)
{
EObject eObject = (EObject)source;
Command command = SetCommand.create(editingDomain, eObject, getFeature(), map);
editingDomain.getCommandStack().execute(command);
}
and then inside SetCommand.create(...):
104: List<?> values = value == UNSET_VALUE ? Collections.EMPTY_LIST : (List<?>)value;
as we see, we took Map in doSetMap(...) and then cast it to list inside SetCommand.create(...). Looks like there must be another Command in EMFEditMapProperty, not SetCommand.
The question is, if there is someone working with IObservableMap, explain me please, it is wrong implementation of IObservableMap in EMF, or I just use it in a wrong way.
|
|
|
Re: IObservableMap EMF implementation [message #1240965 is a reply to message #1238486] |
Fri, 07 February 2014 09:21 |
Ed Merks Messages: 33140 Registered: July 2009 |
Senior Member |
|
|
Peter,
It (doSetMap) looks kind of buggy to me. Please open a bugzilla.
On 01/02/2014 3:46 PM, Peter N wrote:
> I'm working with EMF databinding now, and in one case, when I use
> editing properties to get model map feature to work with - I get
> ClassCastException inside observable:
>
> First, I created map observable for my model map feature (EMap<String,
> String> field in generated model instance):
>
> EMFEditProperties.map(domain, feature).observe(model) // now I got
> IObservableMap instance
>
> but when I try to invoke .putAll(...) method on it - I get
> ClassCastException. When I try to work with it with databinding
> context - I get similar behavior - databinding doesn't work, and if i
> look on it in debug, exception just swallowed inside databinding
> mechanism.
>
> Investigating this issue, I realized, that it seems that there is
> wrong implementation of IObservableMap in EMF. Some details:
>
> EMFEditProperties.map(...) method creates EMFEditMapProperty instance
> inside it.
> Looking inside EMFEditMapProperty, we have method doSetMap(...):
>
> protected void doSetMap(Object source, Map map, MapDiff diff)
> {
> EObject eObject = (EObject)source;
> Command command = SetCommand.create(editingDomain, eObject,
> getFeature(), map);
> editingDomain.getCommandStack().execute(command);
> }
>
> and then inside SetCommand.create(...):
>
> 104: List<?> values = value == UNSET_VALUE ? Collections.EMPTY_LIST :
> (List<?>)value;
>
> as we see, we took Map in doSetMap(...) and then cast it to list
> inside SetCommand.create(...). Looks like there must be another
> Command in EMFEditMapProperty, not SetCommand.
>
> The question is, if there is someone working with IObservableMap,
> explain me please, it is wrong implementation of IObservableMap in
> EMF, or I just use it in a wrong way.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Goto Forum:
Current Time: Thu Apr 25 01:13:08 GMT 2024
Powered by FUDForum. Page generated in 0.02936 seconds
|