Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Should I call my EMF generated validators myself in standalone mode?
Should I call my EMF generated validators myself in standalone mode? [message #1405114] Wed, 06 August 2014 16:09 Go to next message
Edmundo López Bóbeda is currently offline Edmundo López BóbedaFriend
Messages: 26
Registered: October 2012
Junior Member
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];



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 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1754
Registered: July 2009
Location: Firenze, Italy
Senior Member
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
Re: Should I call my EMF generated validators myself in standalone mode? [message #1405198 is a reply to message #1405148] Wed, 06 August 2014 20:33 Go to previous message
Edmundo López Bóbeda is currently offline Edmundo López BóbedaFriend
Messages: 26
Registered: October 2012
Junior Member
Thanks a lot!
Previous Topic:integrate xtext with graphiti
Next Topic:Xcore generation from ant or gradle
Goto Forum:
  


Current Time: Mon Dec 09 08:14:24 GMT 2019

Powered by FUDForum. Page generated in 0.02271 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top