how to deal with EDataType [message #909662] |
Fri, 07 September 2012 14:22 |
Junior Lekane Nimpa Messages: 23 Registered: September 2012 |
Junior Member |
|
|
Hello everybody,
i am new to graphiti and actually i try to implement my first editor for the ecore meta model.I want to implement direct editing feature for EAttribute but i am facing some problems.I hope that someone could help me.
I use shape with text to represent EAttributes. You can see here the format that i use to store the informations as text :
attributeName : attributeType [= initialValue]
My questions are the following.
1 -how can i check if attributeType is a well EDataType?
(as represented above attributeType is a String)
2- Assuming that attributeType is an EDataType (e.g EString)
how can create the corresponding dataType from this string?
3- How can i check that initialValue is a value from the data type represented by
attributeType ?
Thanks,
Junior
|
|
|
Re: how to deal with EDataType [message #909932 is a reply to message #909662] |
Sat, 08 September 2012 05:08 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 07/09/2012 4:22 PM, Junior Lekane Nimpa wrote:
> Hello everybody,
>
> i am new to graphiti and actually i try to implement my first editor
> for the ecore meta model.I want to implement direct editing feature
> for EAttribute but i am facing some problems.I hope that someone could
> help me.
> I use shape with text to represent EAttributes. You can see here the
> format that i use to store the informations as text :
> attributeName : attributeType [= initialValue]
>
> My questions are the following.
> 1 -how can i check if attributeType is a well EDataType?
> (as represented above attributeType is a String)
Using instanceof EDataType?
>
> 2- Assuming that attributeType is an EDataType (e.g EString) how can
> create the corresponding dataType from this string?
EcoreUtil.createFromString/convertToString.
>
> 3- How can i check that initialValue is a value from the data type
> represented by attributeType ?
Assuming you're specifying a literal, calling
EcoreUtil.createFromString; note that if these are new data types you're
developing, you can't generally use them as if the logic for converting
instances to and from strings has already been hand written and
available for use.
>
> Thanks,
> Junior
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04529 seconds