[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Editing a generic attribute in the property sheet pane

Hi,

We have a ecore model containing several primitive field types (string, long, int..). On some of these fields, we defined a range restriction on them so that, for example, a long's value should be in between 5 and 10 inclusively.

Right now, the way it is modeled, we have a Restriction EObject on which several restriction specializations inherit from. One of these specialization is a range restriction. We have a range restriction created for each field type we want it applied on. For example:


EObject Restriction

EObject LongRangeRestriction extends Restriction
-   EAttribute minimumValue (type ELong)
-   EAttribute maximumValue (type ELong)

EObject IntRangeRestriction extends Restriction
-   EAttribute minimumValue (type EInt)
-   EAttribute maximumValue (type EInt)

EObject Field

EObject Primitive extends Field

EObject Long extends Primitive
-   EAttribute LongRangeRestriction

EObject Int extends Primitive
-   EAttribute IntRangeRestriction


I wanted to generify this structure so that I don't have to repeat the minimumValue/maximumValue attributes in each crafted range restriction. Hence I came up with the following:



EObject Restriction

EObject RangeRestriction<RT extends EJavaObject>
-   EAttribute minimumValue (type RT)
-   EAttribute maximumValue (type RT)

EObject LongRangeRestriction extends RangeRestriction<ELong>

EObject IntRangeRestriction extends RangeRestriction<EInt>

EObject Field

EObject Primitive inherits from Field

EObject Long inherits from Primitive
-   EAttribute LongRangeRestriction

EObject Int inherits from Primitive
-   EAttribute IntRangeRestriction


Now when I do so, I can't edit the minimumValue/maximumValue attribute values in the property sheet editor of my application anymore. In fact, when I click on the minimumValue/maximumValue cells to change their value and it is blank, a value will automatically appear, something address-like as "ACED000570". If I try to put "5" for a IntRangeRestriction, the value disappears after I set it. Additionally, there is a reported exception in the lower left bar when I start entering some input in the cell, namely "RuntimeException: java.io.EOFException" and "RuntimeException: java.io.StreamCurruptedException: invalid stream handler". Unfortunately, I don't get the complete exception information in my console output.


It seems to me that the usage of ecore generics prevent the correct handling of the specified parameter type for a given RangeRestriction specialization.

* Do I make a valid usage of ecore generics?

* If it's a valid usage, do you see what I'm doing wrong and how I can fix this? Do I need to create customized providers for each RangeRestriction specialization to handle the value's type? If so, which method should I overload?

Regards,
Jimmy