[jbosstools-dev] "As-you-type" validation for JAX-RS classes

Xavier Coulon xcoulon at redhat.com
Wed Jun 4 03:05:36 EDT 2014


Alexey, Victor,

Thanks a lot for your responses, I'm going to implement the IJavaElementValidator interface, because I want that validator to be called when the user changes the value of an annotation, or adds/removes an annotation. 
I may also implement the IStringValidator interface to track AYT changes in the web.xml.

Again, thanks for your responses ! 
Best regards,
/Xavier



On 03 Jun 2014, at 20:02, Alexey Kazakov <akazakov at exadel.com> wrote:

> On 06/03/2014 10:17 AM, Victor Rubezhny wrote:
>> Xavier,
>> 
>> it looks like JaxrsMetamodelValidator validator doesn't implement neither org.jboss.tools.common.validation.IStringValidator nor IJavaElementValidator interfaces. In order to being called by AsYouTypeValidationManager it should implement at least one of these interfaces. (Alexey may correct me if I'm wrong).
> This is correct. See my previous email.
> We should have mentioned this in the javadoc of IAsYouTypeValidator.
> 
>> 
>> As I can see the JaxrsMetampdelValidator takes a number of files (of different types) and performs the different kinds of validations depending on the types of the given files. But we're not validating any files in As-you-type validator. We're validating either a certain strings in HTML/Java code (like EL-expressions in tag attributes or in Java-Strings) (then we're using IStringValidator) or we're looking for a changes in class structure (then we're using IJavaElement).
>> Not any change in any file (either HTML/JSP or Java) triggers the AsYouType validation. For example, we're not triggering AYT validation on tag changes or on method body changes (not sure now, but we can look at org.jboss.tools.common.validation.java.JavaDirtyRegionProcessor.isJavaElementValidationRequired() method to make sure).
> 
> Any implementation of IAsYouTypeValidator gets a set of the changed regions of the file. It's up to particular validator how to validate these regions. If you implement IJavaElementValidator you will get a set of the regions of the changed java elements (if any). If you implement IStringValidator you will get a set of all changed Strings of the java type in case of *.java file (provided by our JavaDirtyRegionProcessor) or the set of all the changed regions of the structured document in case of xml/html/xhtml/jsp files (provided by Eclipse WST validator). You can't validate other resources using our as-you-type validation framework. It supposed to be used only for java/xml/html/xhtml/jsp resources.
> 
>> 
>> Could you describe what changes in what kind of files/editors should trigger the AYT-validation for JAX-RS projects?
>> 
>> Regards,
>> Victor
>> 
>> On 06/03/2014 07:31 PM, Xavier Coulon wrote:
>>> Hello Victor ! 
>>> 
>>> Looks like I'm lucky ;-) 
>>> You can look at the code here:  https://github.com/jbosstools/jbosstools-webservices/blob/master/plugins/org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/internal/validation/JaxrsMetamodelValidator.java
>>> 
>>> You'll see that there are calls to setAsYouTypeValidation(false) in all 3 validate() methods of JaxrsMetamodelValidator, but passing 'true' did not change anything (so far). Same with overriding the init() method with a call to  setAsYouTypeValidation(true)
>>> 
>>> Any hint would be much appreciated ;-)
>>> 
>>> Thanks in advance.
>>> Best regards,
>>> /Xavier
>>> 
>>> 
>>> 
>>> On 03 Jun 2014, at 16:48, Victor Rubezhny <vrubezhny at exadel.com> wrote:
>>> 
>>>> Looks like a bug. As-you-type validation is proposed to be triggered when a user types something into an editor (with a small timeout). And looks like it works as expected in JBossTools HTML/JSP editor.
>>>> We have a bug in as-you-type validation that we've fixed last week. But that bug was about AYT validation in Java Editor and it's fixed for beta2.
>>>>  
>>>> How I can look at how and where your validator is plugged in into theorg.jboss.tools.common.validation.ValidationErrorManager?
>>>> 
>>>> Regards,
>>>> Victor
>>>> 
>>>> On 06/03/2014 06:20 PM, Xavier Coulon wrote:
>>>>> Hello,
>>>>> 
>>>>> My JAX-RS validator is based on our org.jboss.tools.common.validation.ValidationErrorManager, but it is currently triggered when the user saves a file or during a full build, only. 
>>>>> What I would like to try is to have "as-you-type" validation, so that problem markers can be added/removed without having to wait for the next build, just like JDT does. Is there a way to configure the validator to get this behaviour, or is it a limitation of the WST Validator ?
>>>>> 
>>>>> Thanks.
>>>>> Best regards,
>>>>> /Xavier
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> jbosstools-dev mailing list
>>>>> jbosstools-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
>>>> 
>>>> _______________________________________________
>>>> jbosstools-dev mailing list
>>>> jbosstools-dev at lists.jboss.org
>>>> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
>>> 
>> 
>> 
>> 
>> _______________________________________________
>> jbosstools-dev mailing list
>> jbosstools-dev at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jbosstools-dev
> 
> _______________________________________________
> jbosstools-dev mailing list
> jbosstools-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jbosstools-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jbosstools-dev/attachments/20140604/bef1f206/attachment.html 


More information about the jbosstools-dev mailing list