Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Wrong labels for generic typed attributes/features
Wrong labels for generic typed attributes/features [message #229335] Mon, 11 May 2009 11:55 Go to next message
Eclipse UserFriend
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
Re: Wrong labels for generic typed attributes/features [message #229684 is a reply to message #229335] Tue, 12 May 2009 15:16 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Ralph,

Looks like generated AbstractParser should properly handle int values and
transform String to Integer inside getValidNewValue() method. It this method
works incorrectly with the generics used in domain model then please file
a request for it and we'll fix it.

For now as a workaround I think you can try using LabelTextAccessMethod.NATIVE
as an EditMethod for this LabelMapping in .gmfmap model.

-----------------
Alex Shatalin
Previous Topic:Restrict links from connecting to geoshapes
Next Topic:problems in gmfgen file
Goto Forum:
  


Current Time: Fri Apr 19 07:37:59 GMT 2024

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

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

Back to the top