Wrong labels for generic typed attributes/features [message #229335] |
Mon, 11 May 2009 11:55 |
Eclipse User |
|
|
|
Originally posted by: rholland.igw.tfh-wildau.de
Hello,
I have an abstract generic type Source<V> with an attribute "value" of type
param V and a parametrized type IntSource extending Source<V> as
Source<Integer> so that the type param V of the attribute "value" for
IntSource is Integer (for definitions see end of this message). There is a
label mapping for IntSource having the value of Source as label value(see
end of message).
In the generated diagram I'm able to modify the label of IntSource but it
behaves like a String value, so i can even insert letters.
The problem seems to be, that the MessageFormatParser tries to examine the
type of the attribute "value" which is Object but it doesn't consider
generic types. As a result parser returns a String Object as new value for
the attribute "value". The code then doesn't try to set the attribute with
the help of the type IntSource but directly with the eSet method of the type
Source so it sets a String instead of an Integer.
So the question is, whether there is another Parser I could use, which
considers gerneric types or if I could tell the MessageFormatParser via the
edit pattern in gmfmap for the edit method MESSAGE_FORMAT to use Integer as
type of the attribute "value".
Another question is, whether the MessageFormatParser shouldn't be able to
examine that a type is generic in common because EMF since 2.3 states to
support generics. So is it worth a feature request or even a bug report?
My definitions are as follows:
<eClassifiers xsi:type="ecore:EClass" name="Source" abstract="true">
<eTypeParameters name="V"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value">
<eGenericType eTypeParameter="#//Source/V"/>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="IntSource">
<eGenericSuperTypes eClassifier="#//Source">
<eTypeArguments eClassifier="ecore:EDataType
http://www.eclipse.org/emf/2002/Ecore#//EIntegerObject"/>
</eGenericSuperTypes>
</eClassifiers>
label mapping in gmfmap:
<labelMappings
xsi:type="gmfmap:FeatureLabelMapping"
viewPattern=""
editPattern="">
<diagramLabel
href="operatorgraph.gmfgraph#SourceValue"/>
<features
href="operatorgraph.ecore#//Source/value"/>
</labelMappings>
Thanks in advance.
Ralph
|
|
|
|
Powered by
FUDForum. Page generated in 0.01744 seconds