Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Access a feature in a Xtext Model
Access a feature in a Xtext Model [message #715071] Fri, 12 August 2011 09:49 Go to next message
Daniel Trierweiler is currently offline Daniel TrierweilerFriend
Messages: 67
Registered: June 2011
Member
Hi guys,

I've got a question about how to access certain information from the Xtext Model/Grammar.

If I have a line in the grammar like
datafield += InputDatafield
.

How can I access the information, that the feature is called "datafield"? I mean, Xtext generates the method getDataField(), so the information must be somewhere...
Currently I am using a XtextResource, would it be possible to get the information from there?

Thanks a lot Smile
Best,
Daniel
Re: Access a feature in a Xtext Model [message #715075 is a reply to message #715071] Fri, 12 August 2011 10:03 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

do you mean something like eObject.eContainingFeature()? Otherwise, you have the grammar access for your languange and the DSLPackage containing Literals for all the stuff in the metamodel.

Alex


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Access a feature in a Xtext Model [message #715094 is a reply to message #715075] Fri, 12 August 2011 10:54 Go to previous message
Daniel Trierweiler is currently offline Daniel TrierweilerFriend
Messages: 67
Registered: June 2011
Member
Hi Alex,

thanks for your answer!
Actually I don't see any feature names, when I call the eContainingFeature().
If I have something like described above with:
Data:

dataField += InputDatafield


How can I access the value "dataField"? If I call Data.eContainingFeature() I just get some Information like (ordered: true, unique: true, lowerBound: 0, upperBound: -1), but not something like featurenames ("dataField").
Previous Topic:Bug in Mwe2ExecutionEngine?
Next Topic:Re: Access a feature in a Xtext Model
Goto Forum:
  


Current Time: Fri Apr 26 07:32:55 GMT 2024

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

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

Back to the top