formatting/serializing of optional attributes [message #1067994] |
Thu, 11 July 2013 11:21  |
Eclipse User |
|
|
|
Hi,
I have this rule using an optional integer attribute 'time':
PhysicalThread:
(default?='DefaultThread' | 'Thread') name=ID '{'
'execmode' '=' execmode=ExecMode
('interval' '=' time=TIME)?
'prio' '=' prio=PRIO
'stacksize' '=' stacksize=INT
'msgblocksize' '=' msgblocksize=INT
'msgpoolsize' '=' msgpoolsize=INT
'}'
;
Where TIME is a data type rule with a value converter to Integer.
Some execmodes need a time interval specified, others don't.
This is checked by validation and a quick fix is offered for both cases.
When the quick fix should remove the time interval I use an ISemanticModification to set the value to its default of 0.
The result is e.g.
DefaultThread PhysicalThread1 {
execmode = blocked
interval = 0s
prio = 0
stacksize = 1024
msgblocksize = 32
msgpoolsize = 10
}
But I would prefer the equivalent with the optional attribute assignment omitted completely
DefaultThread PhysicalThread1 {
execmode = blocked
prio = 0
stacksize = 1024
msgblocksize = 32
msgpoolsize = 10
}
How can this be achieved?
I already tried to make the attribute unsettable and then unsetting it in the quick fix - same result.
Thanks,
Henrik
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07569 seconds