Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Can't find INode.setText(...)(Migrating from Xtext 1.0.x to 2.8.3)
Can't find INode.setText(...) [message #1706370] Wed, 26 August 2015 10:40 Go to next message
Luis Mendes is currently offline Luis MendesFriend
Messages: 7
Registered: August 2015
Location: Denmark
Junior Member
Hi,

my name is Luis and I'm currently migrating from Xtext 1.0.x to 2.8.3. Considering the rewritten node model of the Xtext 2.X, so far I have been unable to find any method equivalent to setText(...) in the LeafNode class.

What I want to do is to is just to create an instance of leaf node, instance of a ILeafeNode, and set it's text to a default text, prior to appending it to the node tree.

Do you know if there is an equivalent way of setting the LeafNode text in the node model of the Xtext 2.X ? The equivalent to setText(...) in the LeafNode class of Xtext 1.0.X ?

Thank you very much in advance for your time.

Best regards,
Luis

Re: Can't find INode.setText(...) [message #1706427 is a reply to message #1706370] Wed, 26 August 2015 19:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
afaik this is not possible at all. what is your actual usecase?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Can't find INode.setText(...) [message #1706481 is a reply to message #1706427] Thu, 27 August 2015 08:51 Go to previous messageGo to next message
Luis Mendes is currently offline Luis MendesFriend
Messages: 7
Registered: August 2015
Location: Denmark
Junior Member
Hi Christian,

thank you very much for the reply. The use case is the following :

1) Fetch the CompositeNode associated to a certain, parametrized, semantic element using (with Xtext 2.X using for instance NodeModelUtils.getNode(semanticElement));
2) Fetch children of 1) as a list (with Xtext 2.X it will have to be in the form of an Iterator)
3) Evict all children found in 2). After this point the composite node from 1) will not have any children.
4) Create a new LeafNode and set it as only child of composite node from 1) (with Xtext 2.X it can be done in one step using newLeafNode (...) of NodeModelBuilder)
5) Set it's text to parametrized text (a string).

So far the only way I see to accomplish this, is to actually fetch the root node from the CompositeNode of 1) and try to manipulate the complete content, obtained from the root node, through the offset and length values of the CompositeNode. Currently I don' know if this is going to work but I will test it. Do you see any other to accomplish the above scenario ?

What I currently don't know how to do is step 3), since as far as I understood all node Iterators in XText 2.X do not support the remove operation. Do you have any ideas on this as well ?

Thank you very much once again for you time.

Best regards,
Luis
Re: Can't find INode.setText(...) [message #1706486 is a reply to message #1706481] Thu, 27 August 2015 09:18 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
still the question: why do you want to do this.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Problem with virtual resource
Next Topic:trouble integrating the Xtext editor to an swt form
Goto Forum:
  


Current Time: Fri Apr 26 15:46:40 GMT 2024

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

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

Back to the top