Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED] @SuppressWarning in my DSL
[SOLVED] @SuppressWarning in my DSL [message #1740411] Fri, 12 August 2016 15:25 Go to next message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
In my DSL, it is possible to attach annotations to the features of my DSL.

I would like that the DSL validator ignore warnings when a annotation "@SuppressWarning" is attached.

I guess Xbase and Xtend are not providing this particular feature.

I planned to create a specific ValidationMessageAcceptor that is delegating to the acceptors of my validator if there is not "@SuppressWarning".

It is the best approach?

Thank you.
Stéphane.

[Updated on: Wed, 17 August 2016 06:10]

Report message to a moderator

Re: @SuppressWarning in my DSL [message #1740415 is a reply to message #1740411] Fri, 12 August 2016 15:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13882
Registered: July 2009
Senior Member
Hmm what about leveraging

org.eclipse.xtext.validation.AbstractDeclarativeValidator.getIssueSeverities(Map<Object, Object>, EObject)


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: @SuppressWarning in my DSL [message #1740672 is a reply to message #1740415] Wed, 17 August 2016 06:09 Go to previous message
Stéphane Galland is currently offline Stéphane GallandFriend
Messages: 123
Registered: July 2014
Location: Belfort, France
Senior Member
For the one who want to do the same, pointers are below:

1) Creating a warning suppressor for the validators.

https://github.com/sarl/sarl/blob/master/eclipse-sarl/plugins/io.sarl.lang/src/io/sarl/lang/validation/IProgrammaticWarningSuppressor.java
https://github.com/sarl/sarl/blob/master/eclipse-sarl/plugins/io.sarl.lang/src/io/sarl/lang/validation/DefaultProgrammaticWarningSuppressor.java

2) Update the validators by overriding the getIssueSeverities functions.

https://github.com/sarl/sarl/blob/master/eclipse-sarl/plugins/io.sarl.lang/src/io/sarl/lang/validation/SARLValidator.java
https://github.com/sarl/sarl/blob/master/eclipse-sarl/plugins/io.sarl.lang/src/io/sarl/lang/validation/SARLEarlyExitValidator.java

3) Adding the quickfix.

https://github.com/sarl/sarl/blob/master/eclipse-sarl/plugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/acceptors/AddSuppressWarningsModification.java

Stéphane.

[Updated on: Wed, 17 August 2016 08:56]

Report message to a moderator

Previous Topic:Xtext runtime questions
Next Topic:Xtext showing unwanted contents
Goto Forum:
  


Current Time: Wed Apr 14 11:57:32 GMT 2021

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

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

Back to the top