Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Display EXPENSIVE checks when building
Display EXPENSIVE checks when building [message #1793212] Wed, 01 August 2018 14:46 Go to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
Hey guys,

I want to do the Xtext validation programatically. Therefore I perform the following code:

final IResourceValidator validator = eResource.getResourceServiceProvider().getResourceValidator();
return validator.validate(eResource, CheckMode.ALL, null);

This works fine for getting all validation issues.
The problem is, that the error markers are not shown.

I read in another forum topic that it should be sufficient if a project build just with the XtextBuilder is triggered.

So I've tried this:

project.build(IncrementalProjectBuilder.FULL_BUILD, XTEXT_BUILDER_ID, null, new NullProgressMonitor());


Unfortunately, the markers are not generated too.
The biggest problem for me is, that the markers for EXPENSIVE checks are not shown.

Is there a way to show the markers? Or could you give me a hint about what I'm doing wrong?

Thank you very much! =)

Alex
Re: Display EXPENSIVE checks when building [message #1793214 is a reply to message #1793212] Wed, 01 August 2018 14:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12252
Registered: July 2009
Senior Member
what do you mean by "show markers". ususally you schedule a validation job for expensive validation (see corresponding context menu action)

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Display EXPENSIVE checks when building [message #1793238 is a reply to message #1793214] Thu, 02 August 2018 05:54 Go to previous messageGo to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
I mean that the annotations and markers in the editors and in the project explorer are not shown.
Yes, I already saw the ValidationJob in ValidateActionHandler.

The problem is, in my own code I think I am not sure if I have sufficient info to create the ValidationJob.
And also I wondered if doing this by a ValdationJob is the correct way to go, because as I mentioned, I also read about invoking a build would also create annotations and markers in the editors.
Re: Display EXPENSIVE checks when building [message #1793240 is a reply to message #1793238] Thu, 02 August 2018 06:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12252
Registered: July 2009
Senior Member
the questions is: what should trigger the expensive validation

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Display EXPENSIVE checks when building [message #1793242 is a reply to message #1793240] Thu, 02 August 2018 06:31 Go to previous messageGo to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
We have added a menu entry to the context menu of the Project Explorer.
When this menu entry is clicked, the "whole" validation should be performed, i.e. all files are processed and all validations (FAST, NORMAL and EXPENSIVE) are done.
When the validation is finished, the issues are displayed in a new View, this works just fine. But the annotations in the files and editors are not shown, because we do not know how to do this.

And I just tried to create the ValidationJob somehow, but I think this would be quite difficult.
Re: Display EXPENSIVE checks when building [message #1793244 is a reply to message #1793242] Thu, 02 August 2018 06:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12252
Registered: July 2009
Senior Member
simly have a look at the existing

org.eclipse.xtext.ui.editor.handler.ValidateActionHandler


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Display EXPENSIVE checks when building [message #1793247 is a reply to message #1793244] Thu, 02 August 2018 07:02 Go to previous messageGo to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
I already looked at this class =)
The problem is, I think I do not have sufficient information for creating the ValidationJob, as I said before :).
Re: Display EXPENSIVE checks when building [message #1793248 is a reply to message #1793247] Thu, 02 August 2018 07:03 Go to previous messageGo to next message
Alexander Fichtinger is currently offline Alexander FichtingerFriend
Messages: 62
Registered: January 2013
Member
The question is, if there is any other possibility for doing what I want, or if creating a ValidationJob is the only possible solution.
Re: Display EXPENSIVE checks when building [message #1793250 is a reply to message #1793248] Thu, 02 August 2018 07:11 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12252
Registered: July 2009
Senior Member
of course you could call the vaidator manually and created the annotations and markers manually too.
see that MarkerCreator does. and what ValidationJob+ ValidateActionHandler do.

=> you need to call the validator
=> you need to create markers
=> maybe you need to do something to update marker annotations in open editors


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:RuntimeException - Context not valid for type
Next Topic:How to define Xtext grammar for a strange scenario
Goto Forum:
  


Current Time: Wed Sep 26 12:17:25 GMT 2018

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

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

Back to the top