Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Set an property which not defined in the grammar
Set an property which not defined in the grammar [message #1386837] Sat, 21 June 2014 10:22 Go to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 268
Registered: March 2010
Senior Member
Hi,

I want to set programatically a property of an EMF Object. If we take for instance the grammar below, i need to set a property that is not present in the grammar (but it is in my metamodel) when the name is writen.

Model:
greetings+=Greeting*;
Greeting:
'Hello' name=ID '!';


Thanks in advance

Re: Set an property which not defined in the grammar [message #1386841 is a reply to message #1386837] Sat, 21 June 2014 12:50 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13358
Registered: July 2009
Senior Member
Hi,

do you have a handwritten metamodel? if no you can use http://christiandietrich.wordpress.com/2011/07/22/customizing-xtext-metamodel-inference-using-xtend2/ to add additional stuff to the metamodel.
to acutally set the property you could use IDerivedStateComputer. You may have to adapt ITransientValueService as well.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Generate xtext artifacts for an edited metamodel
Next Topic:Tutorial about Quick Fixes
Goto Forum:
  


Current Time: Thu Feb 20 14:28:01 GMT 2020

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

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

Back to the top