John Benedetto
John Benedetto

Reputation: 119

Xtext: Run features like validation on demand

Some introduction: I'm writing a plugin that uses Xtext. This plugin opens the Xtext's Eclipse and when the user clicks a button on this eclipse, my plugin computes something on the INode-s. Then, given some INode list, I want to highlight (underline + markers) the lines corresponding to the INodes without re-running the eclipse.

I think the best way to do it is to call a specific validator (if not possible, re-running all of the validators is fine too) on demand. How can I tell Xtext to run the validator after it's already been launched?

Another way I thought of was using SemanticHighlight for a given INodes list. But it's probably the same problem as above.

Thanks.

Upvotes: 1

Views: 103

Answers (1)

Bernhard Stadler
Bernhard Stadler

Reputation: 2385

Xtext validation is usually integrated in the Eclipse build process and thus no user action is required as long as automatic build is enabled. Please refer to http://www.eclipse.org/Xtext/documentation/303_runtime_concepts.html#custom-validation

If you really need access to the Node Model (i.e. INode), you can access it using NodeModelUtils.findActualNodeFor(EObject)

Upvotes: 2

Related Questions