Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Remove warning/error marker
Remove warning/error marker [message #1776923] Wed, 22 November 2017 20:02 Go to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 258
Registered: July 2009
Senior Member
Hi,

Is there a way from within Xtext to remove a marker created at a previous validation run?

I have implemented some validation checks in the usual Xtext way. One of these checks is potentially fairly expensive, but is also only relevant if a model contains a particular keyword. To make sure users are aware of the check not running by default, I have implemented a FAST check that simply adds a warning to the keyword if the keyword is present. This warning basically instructs users to run the expensive test.

When they do run the expensive test, it is possible that this produces an error marker. I would like the warning marker to be removed when the expensive test is run (regardless of whether this produces an error or not).

I think I know how to do this with standard Eclipse on-board tools (using ResourcePlugin). However, for obvious reasons these are not available to me from within the Xtext validation infrastructure. For the same reasons I don't want to introduce such a dependency in that plugin. Presumably, I could override parts of the validation infrastructure provided by Xtext, but I would rather want to avoid that if possible.

Is there a way to remove existing warnings/errors when running a validator?

Many thanks,

Steffen
Re: Remove warning/error marker [message #1776926 is a reply to message #1776923] Wed, 22 November 2017 20:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11625
Registered: July 2009
Senior Member
have a look at org.eclipse.xtext.ui.editor.validation.MarkerCreator
and how it is utilized during validation.

i am not sure if you need to remove or if you need to not to check the fast if expensive is running (i assume then all checks are running as well)
so you might have a look at org.eclipse.xtext.validation.AbstractDeclarativeValidator.getCheckMode()
and do a if on that in your fast check.
then you wont need to remove anything


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Remove warning/error marker [message #1776927 is a reply to message #1776926] Wed, 22 November 2017 20:18 Go to previous messageGo to next message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 258
Registered: July 2009
Senior Member
I'm already checking for the check mode when creating the warning so that it is not created when running expensive checks. For some reason, the warning marker is still shown in the editor.
Re: Remove warning/error marker [message #1776932 is a reply to message #1776927] Wed, 22 November 2017 21:10 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11625
Registered: July 2009
Senior Member
so you ae not talking about markers but about annotations?
and how do you execute expensive validation?

for me this could be a bug .
org.eclipse.xtext.ui.editor.validation.MarkerIssueProcessor.processIssues(List<Issue>, IProgressMonitor)
seems to add stuff only but not remove existing ones.
can you please create a ticket at github.com/eclipse/xtext-eclipse

org.eclipse.xtext.ui.editor.validation.AddMarkersOperation.execute(IProgressMonitor) deletes the markers.
org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel.batchedUpdate(IMarkerDelta[])
treats thst in the editor.

but thats marker annotations only.
this leaves the xtext annotations unattended

these are handle by org.eclipse.xtext.ui.editor.validation.AnnotationIssueProcessor.

imho the validationjob should use a hybrid of AnnotationIssueProcessor and MarkerIssueProcessor (in ValidateActionHandler)
maybe you can do some digging yourself



Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Previous Topic:Request Guidance on Best Practice for Parsing/Content Assist
Next Topic:How to retrieve all visible entities from the global index?
Goto Forum:
  


Current Time: Mon Jan 22 16:31:49 GMT 2018

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

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