How to modify a model which is not opened in an editor ? [message #1732811] |
Fri, 20 May 2016 07:43  |
Eclipse User |
|
|
|
Dear all,
I have an XtextResource, and I would like to modify the model it contains. As this resource is not opened in an editor, XtextDocumentUtil.get(iFile) (with iFile = ResourceUtil.getFile(new URIEditorInput(resourceUri));) returns null. Thus, I don't know how to get an IXtextDocument associated to my resource, on which I could call org.eclipse.xtext.util.concurrent.IWriteAccess.modify(IUnitOfWork<T, P>).
What is the right way to modify a model which is not opened in an editor ?
Thanks in advance !
Flo
|
|
|
|
|
|
|
|
|
Re: How to modify a model which is not opened in an editor ? [message #1732952 is a reply to message #1732950] |
Mon, 23 May 2016 07:00  |
Eclipse User |
|
|
|
Sadly, ReconcilingUnitOfWork heavily relies on the underlying IXtextDocument (in particular it applies the computed text edits using a RewriteSessionEditProcessor which takes the document in parameter), and I don't know how to get an IXtextDocument associated to my resource without opening it in an editor (which is not possible for my commands modifying many files).
|
|
|
Powered by
FUDForum. Page generated in 0.05017 seconds