Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Getting text in StatefulFactory
Getting text in StatefulFactory [message #929121] Mon, 01 October 2012 04:37
Nicola Serreli is currently offline Nicola Serreli
Messages: 8
Registered: July 2009
Junior Member
Hi,

I was studying the class ParserBasedContentAssistContextFactory.StatefulFactory and I notice that it get the text directly from editor instead of rootNode.
There is a reason about that?

From my tests, everything seams working correctly if I replace lines like
String completeInput = viewer.getDocument().get(0, lastCompleteNode.getOffset());

with the equivalent
INode rootNode = resource.getParseResult().getRootNode();
String completeText = ((RootNode)rootNode).getCompleteContent();
String completeInput = completeText.substring(0, lastCompleteNode.getOffset());


RootNode.getCompleteContent() is already used in a lot of places to get the text related to one or more INode.
Moreover using the text in the rootNode makes a little easier handle c-like inclusion (that is what I'm working on)

Any comment and/or suggestion is appreciated.

best regards,
Nicola
Previous Topic:parsed CompleteOCL file doesn't resolve cross reference to the ecore referenced file
Next Topic:A warning on the performance of syntactic predicates in Xtext
Goto Forum:
  


Current Time: Fri Aug 29 16:18:47 EDT 2014

Powered by FUDForum. Page generated in 0.08222 seconds