|ILocationInFileProvider Fails to Get Correct Position [message #1219754]
||Thu, 05 December 2013 16:08
| Philip Alldredge
Registered: February 2013
I am editing an XtextResource semantically without the xtext document being open. After editing, I would like to find the position in the text document of one of the semantic objects I have added to the model and then open the editor. |
I have attempted to use ILocationInFileProvider and NodeModelUtil to get this information. However, NodeModelUtil returns null unless I first manually open the text file. Once I have manually opened the text file then I can close the xtext editor and my code can now find the correct location.
I have also attempted to use XtextResource.getParseResult with unforutnate results. The parse results contains the semantic element accessible by navigating etRootASTElement(), but does not contain a corresponding node as provided by getRootNode().getAsTreeIterable().
In this particular case, I can work around the issue by loading the resource into a new resource set, but that seems inefficient and I believe it could cause issues in the future.
Does anyone have any suggestions on how to do what I'm attempting? Is there a way to force xtext to refresh the node model without opening the editor?
Powered by FUDForum
. Page generated in 0.05741 seconds