Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Get all text for a node?
Get all text for a node? [message #896280] Tue, 17 July 2012 20:47 Go to next message
Ian Warwick is currently offline Ian WarwickFriend
Messages: 44
Registered: April 2012
Member
Appologies if I am using incorrect terminology here I am very new to xtext.

when generating code from my model, for any given node, how do I just get the text parsed for the node (and children), so it represents a section of text in the model before it was parsed.

I just want to take some text as-is and not care about having to rebuilt it from an AST.

I have found one way to get at it but was unsure if this is the right way as it feels a bit clumsy:

String text =((CompositeNodeWithSemanticElement)node.eAdapters().get(0)).getText();


Is there a better way?

Thanks in advance!
Re: Get all text for a node? [message #896292 is a reply to message #896280] Tue, 17 July 2012 22:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

the class NodeModelUtils is your friend.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Get all text for a node? [message #896327 is a reply to message #896292] Wed, 18 July 2012 05:04 Go to previous message
Ian Warwick is currently offline Ian WarwickFriend
Messages: 44
Registered: April 2012
Member
Thanks! thats great.
Previous Topic:TMF Generator does not do anything
Next Topic:importURI 101
Goto Forum:
  


Current Time: Sat Apr 20 03:33:29 GMT 2024

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

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

Back to the top