Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » formatting/serializing of optional attributes
formatting/serializing of optional attributes [message #1067994] Thu, 11 July 2013 15:21 Go to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 251
Registered: July 2009
Senior Member
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
Re: formatting/serializing of optional attributes [message #1133037 is a reply to message #1067994] Fri, 11 October 2013 15:10 Go to previous messageGo to next message
Axel Guckelsberger is currently offline Axel GuckelsbergerFriend
Messages: 341
Registered: July 2009
Senior Member
Hi Henrik,

did you find a solution to your question?

Re: formatting/serializing of optional attributes [message #1410716 is a reply to message #1133037] Thu, 21 August 2014 12:52 Go to previous messageGo to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 251
Registered: July 2009
Senior Member
Hi Axel,

no, I couldn't find a solution (but didn't investigate with newer versions of Xtext).

-Henrik

Am 11.10.2013 um 17:10 schrieb Axel Guckelsberger:
> Hi Henrik,
>
> did you find a solution to your question?
>
>
Re: formatting/serializing of optional attributes [message #1411048 is a reply to message #1410716] Fri, 22 August 2014 09:03 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 246
Registered: June 2013
Senior Member
I'm no expert on this, but just an idea:

In your Quickfix, you use the semantic model approach and set the value to 0.
What about deleting the complete interval instance from the AST?

Previous Topic: Highlighting problem
Next Topic:Referencing elements of one DSL from another DSL
Goto Forum:
  


Current Time: Sun Dec 15 12:26:48 GMT 2019

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

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

Back to the top