Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext Validation Error
Xtext Validation Error [message #1070992] Fri, 19 July 2013 01:24 Go to next message
Low Coupling is currently offline Low Coupling
Messages: 31
Registered: June 2013
Member
I have a DSL with the possibility to import element from other files.
while I am typing the uri of the imported file an error message continuously pops up warning me the typed uri is not valid. Is there any way to fix it?

thank you


interested on Eclipse, DSL and MDA? Visit http://www.lowcoupling.com
Re: Xtext Validation Error [message #1071070 is a reply to message #1070992] Fri, 19 July 2013 05:27 Go to previous messageGo to next message
Yueming Hong is currently offline Yueming Hong
Messages: 87
Registered: April 2013
Member
Hi,
Maybe you need to give more details about your grammar (validator if you have changed it).

I am also new hand in xtext. I guess there might be some ambiguity in your grammar then the uri you typed in was recognized as other Eobject(in other rule but nor uri).

I hope this might help.
Re: Xtext Validation Error [message #1071458 is a reply to message #1071070] Sat, 20 July 2013 02:22 Go to previous messageGo to next message
Low Coupling is currently offline Low Coupling
Messages: 31
Registered: June 2013
Member
Hi,
here is the definition of the Import nonterminal element:
Import :
     'import' importURI=STRING 
 ;

it is the only element in the grammar starting with 'import'

this is the complete error

An internal error occurred during: "Xtext validation".
java.lang.IllegalStateException: No IResourceServiceProvider found in registry for uri ../folder

where ../folder is the path I was typing.
Consider that when I finish to write the path everything works fine


interested on Eclipse, DSL and MDA? Visit http://www.lowcoupling.com
Re: Xtext Validation Error [message #1071501 is a reply to message #1071458] Sat, 20 July 2013 05:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6198
Registered: July 2009
Senior Member
Hi so you want to disable this completely. Have a Look at the Workflow of the languAge or the validator. Importurivalidator Must be Activated Somewhere there
Re: Xtext Validation Error [message #1071999 is a reply to message #1071501] Sun, 21 July 2013 16:55 Go to previous messageGo to next message
Low Coupling is currently offline Low Coupling
Messages: 31
Registered: June 2013
Member
hi Christina,
the function is in principle useful. The problem is that it checks the uri while I am still writing it, which is annoying. Also it would be better if the wrong uri was underlined in red as a syntactical error instead of the dialog that pops up.

 // java-based API for validation
                fragment = validation.JavaValidatorFragment {
                    //composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
                    composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
                }


The ImportUriValidator is already commented. So there has to be something else


interested on Eclipse, DSL and MDA? Visit http://www.lowcoupling.com
Re: Xtext Validation Error [message #1072004 is a reply to message #1071999] Sun, 21 July 2013 17:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6198
Registered: July 2009
Senior Member
Hi then copy and paste the code to your validator and use
@Check(CheckType.NORMAL) to check only on save (or type faster so
that the check will not be triggered ;-))

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Xtext Validation Error [message #1211477 is a reply to message #1072004] Tue, 26 November 2013 08:05 Go to previous messageGo to next message
anudeep arya is currently offline anudeep arya
Messages: 29
Registered: March 2013
Junior Member
Did anyone get the solution for this.i need the solution ,i am having the same problem now:)
Re: Xtext Validation Error [message #1211509 is a reply to message #1211477] Tue, 26 November 2013 08:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6198
Registered: July 2009
Senior Member
Hi,

i posted the solution before
Re: Xtext Validation Error [message #1213172 is a reply to message #1211509] Wed, 27 November 2013 01:04 Go to previous messageGo to next message
anudeep arya is currently offline anudeep arya
Messages: 29
Registered: March 2013
Junior Member
I don't want the error to come on save(Even if there is an empty URI),it is annoying.Can i somehow disable the entire import validation. As mentioned already i tried commenting importURI validation

// java-based API for validation
fragment = validation.JavaValidatorFragment {
//composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}

but this doesn't help me .I want the validation to be disabled so that i can provide some custom validations myself in java validator
Re: Xtext Validation Error [message #1213332 is a reply to message #1213172] Wed, 27 November 2013 02:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6198
Registered: July 2009
Senior Member
Sure you reran the workflow and don't hook in the validator yourself?
Eg via @ComposedChecks?

Creating a new example from scratch works for me

Which Xtext version so you use?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Xtext Validation Error [message #1213793 is a reply to message #1213332] Wed, 27 November 2013 06:53 Go to previous messageGo to next message
anudeep arya is currently offline anudeep arya
Messages: 29
Registered: March 2013
Junior Member
Yes i reran the workflow after commenting importvalidator.

i didn't understand what do you mean by @ComposedChecks..can you please brief it

i use XTEXT SDK 2.2.1

Regards,
Anudeep
Re: Xtext Validation Error [message #1213818 is a reply to message #1213793] Wed, 27 November 2013 07:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6198
Registered: July 2009
Senior Member
I will see if I find the time to test with that version. Did you
search for refs of the validator? Where is it used?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Xtext Validation Error [message #1213868 is a reply to message #1213818] Wed, 27 November 2013 07:31 Go to previous messageGo to next message
anudeep arya is currently offline anudeep arya
Messages: 29
Registered: March 2013
Junior Member
The refs of validation.JavaValidatorFragment is used in my mydslJavaValidator class to highlight the errors in my XEXT editor.

I donot know if that answers your question Razz
Re: Xtext Validation Error [message #1214118 is a reply to message #1213868] Wed, 27 November 2013 09:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6198
Registered: July 2009
Senior Member
I asked about the usage of importurivalidator class

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Xtext Validation Error [message #1215926 is a reply to message #1214118] Thu, 28 November 2013 03:50 Go to previous messageGo to next message
anudeep arya is currently offline anudeep arya
Messages: 29
Registered: March 2013
Junior Member
Actually i have my mydslImportvalidator class in fragment validation.JavaValidatorFragment and this mydslImportValidator extends org.eclipse.xtext.validation.ImportUriValidatorvalidator also i have written custom validations for imports in mydslImportValidator.It is not used explicitly anywhere else.

Regards,
Anudeep
Re: Xtext Validation Error [message #1215945 is a reply to message #1215926] Thu, 28 November 2013 03:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6198
Registered: July 2009
Senior Member
Sorry I don't understand what's your problem then

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de
Re: Xtext Validation Error [message #1215990 is a reply to message #1070992] Thu, 28 November 2013 04:22 Go to previous message
Aaron Digulla is currently offline Aaron Digulla
Messages: 258
Registered: July 2009
Location: Switzerland
Senior Member
@Christian: His problem is that Eclipse *shows a dialog box*

@anudeep arya

Xtext shouldn't display a dialog when you type. All validation problems go into the problems view.

The reason why you get a dialog isn't validation, it's that there is an *exception* while the validation runs.

Fix the exception and you should get the default red underline as you type.
Previous Topic:Deleting unused dependencies in Eclipse
Next Topic:[Xtext 2.4.1] Register parser without file extension
Goto Forum:
  


Current Time: Thu Aug 21 02:38:16 EDT 2014

Powered by FUDForum. Page generated in 0.02227 seconds