Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to check from my Java code whether there are any validation errors in DSL editor
How to check from my Java code whether there are any validation errors in DSL editor [message #1187922] Fri, 15 November 2013 10:54 Go to next message
Ashwini Nayak is currently offline Ashwini NayakFriend
Messages: 19
Registered: July 2013
Junior Member
Hello,

I have a Validator.java class where I have put all my validation methods with annotation : @Check.

I have a validation method say,

@Check
public void validate(Server server){

}


I want this validation method to run only if there are no custom validation errors in my DSL editor.
Here, 'Server' is my xcore model.

Is it possible to check from my validation method whether there are any custom validation errors in my DSL editor.

I tried the following:

@Check
public void validate(Server server){
if(server.eResource().getErrors().size() == 0){
//continue execution
}else{
//get out of the method
}
}

But, server.eResource().getErrors().size() gives me the count of the xText Validation errors which does not include custom validation errors.

Can anybody tell me how i can check whether there are custom validation errors in my DSL editor.

Thanks in advance Smile
Re: How to check from my Java code whether there are any validation errors in DSL editor [message #1187966 is a reply to message #1187922] Fri, 15 November 2013 11:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6485
Registered: July 2009
Senior Member
Hi,

i dont get your problem

you are writing a custom validdation and want to check if there are custom validation error.
there is n certain order of checks to be executed you you have to restructure
your checks/logik etc...
Re: How to check from my Java code whether there are any validation errors in DSL editor [message #1193497 is a reply to message #1187966] Mon, 18 November 2013 03:44 Go to previous messageGo to next message
Ashwini Nayak is currently offline Ashwini NayakFriend
Messages: 19
Registered: July 2013
Junior Member
Hi Christian,

First of all, thanks for replying.
Actually, I have a custom validation method. And, I want this custom validation method to run only when a particular Custom Validation error is not there in my DSL editor.
Is there any way where I can check if a particular custom validation error is there in my DSL editor?

If yes, please let me know how I can get it.

Thanks
Re: How to check from my Java code whether there are any validation errors in DSL editor [message #1193687 is a reply to message #1193497] Mon, 18 November 2013 05:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6485
Registered: July 2009
Senior Member
As I said before no
Re: How to check from my Java code whether there are any validation errors in DSL editor [message #1193730 is a reply to message #1193687] Mon, 18 November 2013 06:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6485
Registered: July 2009
Senior Member
Ps: you have to unite both validation methods
Re: How to check from my Java code whether there are any validation errors in DSL editor [message #1219117 is a reply to message #1193730] Mon, 02 December 2013 07:25 Go to previous messageGo to next message
anudeep arya is currently offline anudeep aryaFriend
Messages: 36
Registered: March 2013
Member
Hi Ashwini,

Since the order of execution of checks is not defined for java validator u cannot do anything other than uniting both the validation methods as christian has suggested and put a check inside the single check.
Re: How to check from my Java code whether there are any validation errors in DSL editor [message #1219307 is a reply to message #1219117] Tue, 03 December 2013 09:14 Go to previous message
anudeep arya is currently offline anudeep aryaFriend
Messages: 36
Registered: March 2013
Member
Hi,

If anyone finds any other solution ,please post it here.even i wanted to perform something like this without uniting both the checks:P

Regards,
Anudeep
Previous Topic:Optimize imports on content proposal
Next Topic:Clean build in xtext
Goto Forum:
  


Current Time: Mon Nov 24 08:17:33 GMT 2014

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

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