|
Re: Should I call my EMF generated validators myself in standalone mode? [message #1405148 is a reply to message #1405114] |
Wed, 06 August 2014 17:54 |
|
On 06/08/2014 18:09, Edmundo López Bóbeda wrote:
> Hi,
>
> I'm implementing an xtext standalone application. I get to load my model
> (the code is in scala), but the EValidator errors do not appear when I
> do getErrors on the resource.
> Should I call my EMF generated validators myself in standalone mode or
> will it be done automatically?
>
>
> val injector = (new
> TransitionSystemDslStandaloneSetup()).createInjectorAndDoEMFRegistration();
> val resourceSet: XtextResourceSet =
> injector.getInstance(classOf[XtextResourceSet]);
> resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, true);
> val uri = config.model.toURI().toString()
> val resource = resourceSet.getResource(URI.createURI(uri), true);
> logger.trace(s"Starting to load model from url: $uri")
> val ts =
> resource.getContents().get(0).asInstanceOf[TransitionSystem];
>
Hi
yes, you need to call it yourself, e.g.,
// validate the resource
List<Issue> issues = validator.validate(resource, CheckMode.ALL,
CancelIndicator.NullImpl);
if (!issues.isEmpty()) {
for (Issue issue : issues) {
System.err.println(issue);
}
}
hope this helps
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
|
Powered by
FUDForum. Page generated in 0.03439 seconds