DSL showing attributes based on its content value [message #995615] |
Sun, 30 December 2012 17:19 |
|
Hi,
Backgroud:
I have following EMF model:
EClass - View
uielements [list containing of type UIElement]
EClass - UIElement
properties [list containing of type Property]
EClass - Property
name [String]
value [String]
You can think of this View as any html page which contains many UI elements and each UI element has many properties.
There are existing xmi files each containing content of a View.
I am loadoing this xmi file using XMIResource and then moved the content to XTextResource (with different file extension). When i save the XTextResource, i can see the DSL format.
Problem:
The DSL shows all Properties for a UI Element.
I want to show only those properties which have value not equal to its non-default value.
In this way the size of DSL will be small.
Any hint on how i can achieve this will be really helpful.
Thanks and Regards,
Ashwani Kr Sharma
[Updated on: Sun, 30 December 2012 17:44] Report message to a moderator
|
|
|
|
Re: DSL showing attributes based on its content value [message #995811 is a reply to message #995664] |
Mon, 31 December 2012 07:08 |
|
Hi Ed,
Thanks for your reply.
These features are optional in both ECore model and xtext grammar.
Actually the xmi file have UIElement with all properties set to their values (even if they are default). Hence, when DSL is generated based on the model these values are part of the DSL.
I think i have to do something in the Serializer, to not serialize the property if the value is equal to default value. But i am not able to understand where to do this.
Any hints ?
Regards,
Ashwani Kr Sharma
[Updated on: Mon, 31 December 2012 07:09] Report message to a moderator
|
|
|
|
|
|
Re: DSL showing attributes based on its content value [message #1006989 is a reply to message #999623] |
Sun, 03 February 2013 15:45 |
|
Hi Ed,
Sorry to follow up late. Was stuck up in some parallel work.
I read my post and your replies. I think missed an important part of in problem description.
Actually there are two models:
ViewModel:
EClass - View
uielements [list containing of type UIElement]
EClass - UIElement
properties [list containing of type Property]
EClass - Property
name [String]
value [String]
AND
UI Element Definitions
EClass - UIElementDef
properties [list containing of type PropertyDef]
EClass - PropertyDef
name [String]
defaultvalue [String]
I want to create text modeling for xmi coming from View Model.
While doing so only those property has to be shown which has
(property.name = propertyDef.name and property.value != propertyDef.defaultvalue)
The logic of eIsSet would have worked if the value for EObject was not equal to its default Value in EMF Model.
In my use case, i guess i need to put code somewhere to skip the property.name to display in the DSL.
I should have specified the complete scenario but i missed somehow.
Where can i put the logic to skip property.name when property.value != propertyDef.defaultvalue
Regards,
Ashwani Kr Sharma
[Updated on: Sun, 03 February 2013 15:46] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02751 seconds