| [news.eclipse.tools.emf] Re: Editing a generic attribute in the property sheet pane |
|
Jimmy, Comments below. Jimmy Royer wrote: Hi,In XSD you'd model that as a restricted simple type with min/max facets... This sounds extremely heavy weight. You could achieve the same thing as with XSD using extended metadata annotations on an EDataType. For example:EJavaObject isn't much of a bound... - EAttribute minimumValue (type RT)Which version of EMF are you on? 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".Probably 2.4 then. EJavaObject is a very poor data type because it uses java.io.Serializeable to produce a string, which of course isn't human readable. If I try to put "5" for a IntRangeRestriction, the value disappears after I set it.And of course it's impossible for a human to enter valid bytes for it too. 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.You do, but it seems like complete overkill for what you're trying to achieve. You're not doing anything wrong, it's just that producing a human readable serialization of something as arbitrary as java.lang.Object isn't feasible... Do I need to create customized providers for each RangeRestriction specialization to handle the value's type? If so, which method should I overload?I think you'd be best to define a constrained EDataType. This document shows the annotations produced from a schema which you can also use directly in your Ecore model: http://www.eclipse.org/modeling/emf/docs/overviews/XMLSchemaToEcoreMapping.pdfThe top of page 5 is directly relevant to your problem.
|