|Using refactoring participants with EMF [message #890314]
||Thu, 21 June 2012 21:21
| Ben Cox
Registered: June 2012
I'm currently writing an LTK refactoring participant that will offer to change an attribute in an XML file inside a project as I rename the project that it's contained in.
In order to be able to do so, I need to come up with a Change, and in particular I think I probably want a TextFileChange to describe that change.
Of course, it's all very well messing around directly with the text, but I already have an EMF model for the XML - it would seem best to proceed through EMF, in case the XML layout changes in future and I need to change not only the model but also the change-producing code. I was wondering if EMF contains any in-built support for integrating with the LTK refactoring framework? I believe not, given my searches, but that would be the easiest way to do it if it existed.
If that's not the case, I think the next best solution would be to read the XML into the model, perform the change on the model, and re-serialize the XML. However, that would require having some in-memory version of the refactored XML text, since the refactoring framework needs to display a preview of the change. Is there a way of serializing a model to an in-memory XML document - such as an IDocument - so I can create the diff?
Many thanks for your help. Any other solutions would be gratefully welcomed!
Powered by FUDForum
. Page generated in 0.01634 seconds