I'm writing a grammar that has an existing validator. I'd like to use the existing validator to validate the code, and integrate it with the built in XText validation mechanism, so it will work seamlessley.
How can I :
A) - Access the raw code so I can pass it to the external validator?
B) - Having parsed the output of the validator, pass the result back to the eclipse UI?
if you want to have access to the textual part of the model aka "node model" NodeModelUtils
will give you helper methods to get the node for an EObject.
Alternatively your EObject
may have a eResource
which may be a XtextResource
which may have a parseResult
which gives you access to the rootNode
.
you can always ask an INode
for its text.
you have to do creating the Xtext Errors from your "other Parsers" errors yourself manually.