Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to stop the validation programmatically for dsl project
How to stop the validation programmatically for dsl project [message #1844470] Tue, 14 September 2021 15:43 Go to next message
Venkata Santosh Lingam is currently offline Venkata Santosh LingamFriend
Messages: 7
Registered: October 2014
Junior Member
I want to stop calling the validators programmatically on few scenarios(On the click of context menu).
Is it possible to do this? if yes, please let me know how to do it.
Re: How to stop the validation programmatically for dsl project [message #1844471 is a reply to message #1844470] Tue, 14 September 2021 16:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14283
Registered: July 2009
Senior Member
Hi, am not sure if I understand this.
What do you mean by stop validators

Build? ValidationJob? validateAction?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to stop the validation programmatically for dsl project [message #1844473 is a reply to message #1844471] Tue, 14 September 2021 16:27 Go to previous messageGo to next message
Venkata Santosh Lingam is currently offline Venkata Santosh LingamFriend
Messages: 7
Registered: October 2014
Junior Member
@Christian Dietrich

Validation job,

On my project i have two context menus, "Validation Off" and "Validation ON"

I don't want any validation to run on the project when i click on "Validations Off" context menu.

and i want to run all the validations when i click on "Validation ON" context menu.

i want to achieve this programmatically.
Re: How to stop the validation programmatically for dsl project [message #1844474 is a reply to message #1844473] Tue, 14 September 2021 16:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14283
Registered: July 2009
Senior Member
maybe you can introduce a custom IResourceValidator
that reads a preference you toggle via your commands?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to stop the validation programmatically for dsl project [message #1844536 is a reply to message #1844474] Thu, 16 September 2021 07:19 Go to previous messageGo to next message
Venkata Santosh Lingam is currently offline Venkata Santosh LingamFriend
Messages: 7
Registered: October 2014
Junior Member
@Christian Dietrich,

Thank you for the hint,

I stopped calling validate() method from IResourceValidator. Now when i click on context menu "Validation Off", validations are removed from 'Problems View' and error marker symbol is removed from 'Package Explorer'

But markers from editor is not removed/updated.

Is there any way to remove markers from editor also?
Re: How to stop the validation programmatically for dsl project [message #1844538 is a reply to message #1844536] Thu, 16 September 2021 07:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14283
Registered: July 2009
Senior Member
you need to do that manually

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to stop the validation programmatically for dsl project [message #1844736 is a reply to message #1844538] Thu, 23 September 2021 14:21 Go to previous messageGo to next message
Venkata Santosh Lingam is currently offline Venkata Santosh LingamFriend
Messages: 7
Registered: October 2014
Junior Member
@Christian Dietrich,

I have removed markers from editor using below code. And this is removing the markers successfully.

IAnnotationModel annotationModel = activeXtextEditor.getInternalSourceViewer()
.getAnnotationModel();
Iterator<Annotation> iterator = annotationModel.getAnnotationIterator();
while (iterator.hasNext()) {
annotationModel.removeAnnotation(next);
}

But when i close and re-open the editor, markers are appeared again. Trying to find the solution for this.
Re: How to stop the validation programmatically for dsl project [message #1844738 is a reply to message #1844736] Thu, 23 September 2021 14:56 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14283
Registered: July 2009
Senior Member
are this build markers or editor only markers?!? did you delete markers from resources!?? or annotations only
a assume you dont have any build markers
so check where the job is started
also: what if user starts build?!?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Shared utility object for entire project build
Next Topic:How to solve this ambiguity problem
Goto Forum:
  


Current Time: Wed Jun 29 01:42:17 GMT 2022

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

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

Back to the top