Label text for EDatatType values [message #53829] |
Fri, 22 September 2006 12:48 |
Hallvard Traetteberg Messages: 673 Registered: July 2009 Location: Trondheim, Norway |
Senior Member |
|
|
I've a diagram with lots of labels, and many of the labels are objects
that are defined in the model as EDataTypes. In the corresponding
factory implementation I have defined convertXXXToString and
createXXXFromString for handling string conversion, and this is
automatically used by the property sheet, when presenting and editing
values. The label editors do not use these, however. Instead they use
MessageFormat and toString, for EDataType values.
To fix this, I redefined the getValidValue (and getValidNewValue), so
that it converts the value using the appropriate factory method
(i.e. in getValidValue insert value =
type.getEPackage().getEFactoryInstance().convertToString((ED ataType)type,
value); and in getValidNewValue insert
value =
type.getEPackage().getEFactoryInstance().createFromString((E DataType)type,
(String)value);)
giving the same behavior as the property sheet. I can understand that
this is not always the desired behavior, but I suggest that this is a
reasonable default behavior that should be standard for GMF.
Have I missed something? Comments?
Hallvard
|
|
|
Re: Label text for EDatatType values [message #53961 is a reply to message #53829] |
Fri, 22 September 2006 14:28 |
Artem Tikhomirov Messages: 222 Registered: July 2009 |
Senior Member |
|
|
Guess, it's an overlook and would be great if you file a bugzilla.
Thanks
Artem
"Hallvard Tr?tteberg" <hal@idi.ntnu.no> wrote in message
news:bcm7h2lqdedu6k0g4rrajdvpq9oie7btug@4ax.com...
> I've a diagram with lots of labels, and many of the labels are objects
> that are defined in the model as EDataTypes. In the corresponding
> factory implementation I have defined convertXXXToString and
> createXXXFromString for handling string conversion, and this is
> automatically used by the property sheet, when presenting and editing
> values. The label editors do not use these, however. Instead they use
> MessageFormat and toString, for EDataType values.
>
> To fix this, I redefined the getValidValue (and getValidNewValue), so
> that it converts the value using the appropriate factory method
> (i.e. in getValidValue insert value =
> type.getEPackage().getEFactoryInstance().convertToString((ED ataType)type,
> value); and in getValidNewValue insert
> value =
> type.getEPackage().getEFactoryInstance().createFromString((E DataType)type,
> (String)value);)
> giving the same behavior as the property sheet. I can understand that
> this is not always the desired behavior, but I suggest that this is a
> reasonable default behavior that should be standard for GMF.
>
> Have I missed something? Comments?
>
> Hallvard
>
|
|
|
Powered by
FUDForum. Page generated in 0.03404 seconds