Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF databinding] Problems with EMFMapProperty
[EMF databinding] Problems with EMFMapProperty [message #505971] Tue, 05 January 2010 16:48 Go to next message
Eclipse UserFriend
Originally posted by: Thomas.Kowatsch.ruag.com

Hi all.

I have a problem with a ClassCastException when
EMFMapProperty#doGetMap(Object source) is called.

I tried to track down the problem a bit and found the following:

The doGetMap call in EMFMapProperty is doing the following:
EObject eObj = (EObject)source;
return (Map< ? , ? >)eObj.eGet(eStructuralFeature);

Tracking down the eGet for the related EObject, I found that the
eGet(eStructuralFeature) in the related EOBject calls
eGet(eStructuralFeature, true) and this calls eGet(eStructuralFeature,
true, true). So the coreType parameter for eGet(int featureID, boolean
resolve, boolean coreType) is always true.

The related EObject's eGet(int featureID, boolean resolve, boolean
coreType) method does:
....
case WhitepagePackage.BLABLA :
if (coreType)
return ((EMap.InternalMapView<PropertyKey, String>)
getUserProperties()).eMap();
else
return getUserProperties();
....

So the eGet will always return an EMap, which cannot be casted to a
java.util.Map, as it is an EList internally.

In my understanding the doGetMap() should call then the eGet with
coreType to false, to return a java.util.Map.

I know I could create my own IObservableMap without using a EMFProperty
to avoid the problem. I just wanted to know if I'm doing something wrong
or if the problem is related to a bug.

Cheers.
--Thomas
Re: [EMF databinding] Problems with EMFMapProperty [message #505976 is a reply to message #505971] Tue, 05 January 2010 17:04 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
I don't have time to wrap my head around it right now - could you file a
bugzilla, ideally with a test case so that I can reproduce the problem
and I take a look tomorrow or on the weekend.

Tom

Am 05.01.10 17:48, schrieb Thomas Kowatsch:
> Hi all.
>
> I have a problem with a ClassCastException when
> EMFMapProperty#doGetMap(Object source) is called.
>
> I tried to track down the problem a bit and found the following:
>
> The doGetMap call in EMFMapProperty is doing the following:
> EObject eObj = (EObject)source;
> return (Map< ? , ? >)eObj.eGet(eStructuralFeature);
>
> Tracking down the eGet for the related EObject, I found that the
> eGet(eStructuralFeature) in the related EOBject calls
> eGet(eStructuralFeature, true) and this calls eGet(eStructuralFeature,
> true, true). So the coreType parameter for eGet(int featureID, boolean
> resolve, boolean coreType) is always true.
>
> The related EObject's eGet(int featureID, boolean resolve, boolean
> coreType) method does:
> ....
> case WhitepagePackage.BLABLA :
> if (coreType)
> return ((EMap.InternalMapView<PropertyKey, String>)
> getUserProperties()).eMap();
> else
> return getUserProperties();
> ....
>
> So the eGet will always return an EMap, which cannot be casted to a
> java.util.Map, as it is an EList internally.
>
> In my understanding the doGetMap() should call then the eGet with
> coreType to false, to return a java.util.Map.
>
> I know I could create my own IObservableMap without using a EMFProperty
> to avoid the problem. I just wanted to know if I'm doing something wrong
> or if the problem is related to a bug.
>
> Cheers.
> --Thomas
Re: [EMF databinding] Problems with EMFMapProperty [message #505981 is a reply to message #505971] Tue, 05 January 2010 17:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070802030404090501060309
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Thomas,

I think it should be like this:

protected Map< ? , ? > doGetMap(Object source)
{
EObject eObj = (EObject)source;
return ((EMap< ? , ? >)eObj.eGet(eStructuralFeature)).map();
}


Thomas Kowatsch wrote:
> Hi all.
>
> I have a problem with a ClassCastException when
> EMFMapProperty#doGetMap(Object source) is called.
>
> I tried to track down the problem a bit and found the following:
>
> The doGetMap call in EMFMapProperty is doing the following:
> EObject eObj = (EObject)source;
> return (Map< ? , ? >)eObj.eGet(eStructuralFeature);
>
> Tracking down the eGet for the related EObject, I found that the
> eGet(eStructuralFeature) in the related EOBject calls
> eGet(eStructuralFeature, true) and this calls eGet(eStructuralFeature,
> true, true). So the coreType parameter for eGet(int featureID, boolean
> resolve, boolean coreType) is always true.
>
> The related EObject's eGet(int featureID, boolean resolve, boolean
> coreType) method does:
> ....
> case WhitepagePackage.BLABLA :
> if (coreType)
> return ((EMap.InternalMapView<PropertyKey, String>)
> getUserProperties()).eMap();
> else
> return getUserProperties();
> ....
>
> So the eGet will always return an EMap, which cannot be casted to a
> java.util.Map, as it is an EList internally.
>
> In my understanding the doGetMap() should call then the eGet with
> coreType to false, to return a java.util.Map.
>
> I know I could create my own IObservableMap without using a
> EMFProperty to avoid the problem. I just wanted to know if I'm doing
> something wrong or if the problem is related to a bug.
>
> Cheers.
> --Thomas

--------------070802030404090501060309
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thomas,<br>
<br>
I think it should be like this:<br>
<blockquote>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [EMF databinding] Problems with EMFMapProperty [message #506001 is a reply to message #505976] Tue, 05 January 2010 18:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Thomas.Kowatsch.ruag.com

https://bugs.eclipse.org/bugs/show_bug.cgi?id=298886

I have no idea how to create a test case. I check with a colleague
tomorrow and might add one to the bug.

--Thomas

Tom Schindl schrieb:
> I don't have time to wrap my head around it right now - could you file a
> bugzilla, ideally with a test case so that I can reproduce the problem
> and I take a look tomorrow or on the weekend.
>
> Tom
>
> Am 05.01.10 17:48, schrieb Thomas Kowatsch:
>> Hi all.
>>
>> I have a problem with a ClassCastException when
>> EMFMapProperty#doGetMap(Object source) is called.
>>
>> I tried to track down the problem a bit and found the following:
>>
>> The doGetMap call in EMFMapProperty is doing the following:
>> EObject eObj = (EObject)source;
>> return (Map< ? , ? >)eObj.eGet(eStructuralFeature);
>>
>> Tracking down the eGet for the related EObject, I found that the
>> eGet(eStructuralFeature) in the related EOBject calls
>> eGet(eStructuralFeature, true) and this calls eGet(eStructuralFeature,
>> true, true). So the coreType parameter for eGet(int featureID, boolean
>> resolve, boolean coreType) is always true.
>>
>> The related EObject's eGet(int featureID, boolean resolve, boolean
>> coreType) method does:
>> ....
>> case WhitepagePackage.BLABLA :
>> if (coreType)
>> return ((EMap.InternalMapView<PropertyKey, String>)
>> getUserProperties()).eMap();
>> else
>> return getUserProperties();
>> ....
>>
>> So the eGet will always return an EMap, which cannot be casted to a
>> java.util.Map, as it is an EList internally.
>>
>> In my understanding the doGetMap() should call then the eGet with
>> coreType to false, to return a java.util.Map.
>>
>> I know I could create my own IObservableMap without using a EMFProperty
>> to avoid the problem. I just wanted to know if I'm doing something wrong
>> or if the problem is related to a bug.
>>
>> Cheers.
>> --Thomas
>
Re: [EMF databinding] Problems with EMFMapProperty [message #506002 is a reply to message #505981] Tue, 05 January 2010 18:03 Go to previous message
Eclipse UserFriend
Originally posted by: Thomas.Kowatsch.ruag.com

Even better then my fix Ed. :-)
You are the expert ...

Ed Merks schrieb:
> Thomas,
>
> I think it should be like this:
>
> protected Map< ? , ? > doGetMap(Object source)
> {
> EObject eObj = (EObject)source;
> return ((EMap< ? , ? >)eObj.eGet(eStructuralFeature)).map();
> }
>
>
> Thomas Kowatsch wrote:
>> Hi all.
>>
>> I have a problem with a ClassCastException when
>> EMFMapProperty#doGetMap(Object source) is called.
>>
>> I tried to track down the problem a bit and found the following:
>>
>> The doGetMap call in EMFMapProperty is doing the following:
>> EObject eObj = (EObject)source;
>> return (Map< ? , ? >)eObj.eGet(eStructuralFeature);
>>
>> Tracking down the eGet for the related EObject, I found that the
>> eGet(eStructuralFeature) in the related EOBject calls
>> eGet(eStructuralFeature, true) and this calls eGet(eStructuralFeature,
>> true, true). So the coreType parameter for eGet(int featureID, boolean
>> resolve, boolean coreType) is always true.
>>
>> The related EObject's eGet(int featureID, boolean resolve, boolean
>> coreType) method does:
>> ....
>> case WhitepagePackage.BLABLA :
>> if (coreType)
>> return ((EMap.InternalMapView<PropertyKey, String>)
>> getUserProperties()).eMap();
>> else
>> return getUserProperties();
>> ....
>>
>> So the eGet will always return an EMap, which cannot be casted to a
>> java.util.Map, as it is an EList internally.
>>
>> In my understanding the doGetMap() should call then the eGet with
>> coreType to false, to return a java.util.Map.
>>
>> I know I could create my own IObservableMap without using a
>> EMFProperty to avoid the problem. I just wanted to know if I'm doing
>> something wrong or if the problem is related to a bug.
>>
>> Cheers.
>> --Thomas
Previous Topic:EMF compare and merge
Next Topic:[teneo] drag and drop in resources
Goto Forum:
  


Current Time: Tue Apr 23 15:27:10 GMT 2024

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

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

Back to the top