Skip to main content

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 08:37
Nicola Serreli is currently offline Nicola SerreliFriend
Messages: 26
Registered: July 2009
Junior Member

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,
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: Sat Apr 10 19:57:03 GMT 2021

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

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

Back to the top