<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">We don't call our validators (CDI, EL,
JSF, Seam, ...) directly. These validators are registered in
plugin.xml's and managed by
org.jboss.tools.common.validation.ValidatorManager<br>
This manager is called by eclipse wst validation builder.<br>
You could call ValidatorManager.validateInJob(IValidationContext
helper, IReporter reporter) with proper helper
(validationHelper.getValidationContextManager().getRegisteredFiles()
should be empty) but in this case you will start all the
validators to validate the entire projects! So it's not the way
you are looking for.<br>
So you have two options here:<br>
1. Call your validator directly validateAll(..) when you need it
w/o builder<br>
or<br>
2. Save the validation state between sessions and relay on wst
builder/ValidationManager.<br>
In CDI/JSF/Seam tools we use KB project framework to save states.
This framework is not a part of common-validation framework, so
it's up to you if you want to use KB project or your own solution
to save the state. <br>
<br>
On 09/17/2012 08:27 AM, Xavier Coulon wrote:<br>
</div>
<blockquote
cite="mid:BD326BB6-6AE7-4093-9B22-2C7E667D6758@redhat.com"
type="cite">Never mind, I found the reason why the validate(..)
method is called: some xml files need to be checked. They are not
part of the 'changedFiles', but they are returned by the
validationHelper.getURIs() method.
<div><br>
</div>
<div>So, instead, I'd like to ask: how can I force the validation
framework to trigger a validateAll() at workbench startup ?</div>
<div><br>
</div>
<div>Thanks.</div>
<div><br>
</div>
<div>Best regards, <br>
<div>
<div apple-content-edited="true">
/Xavier<br>
<br>
<br>
</div>
<br>
<div>
<div>On Sep 17, 2012, at 4:49 PM, Xavier Coulon wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div style="word-wrap: break-word; -webkit-nbsp-mode:
space; -webkit-line-break: after-white-space; ">Hi !
<div><br>
</div>
<div>The JAX-RS tooling is now aligned on the CDI
tooling and relies on the common-validation plugin to
validate the JAX-RS elements. </div>
<div>So far, so good, but I have this issue that I'd
like to solve: at workbench start-up, the method </div>
<div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 11px/normal Menlo; "><span
style="color: #921f67"><b><br>
</b></span></div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 11px/normal Menlo; "><span
style="color: #921f67"><b><span
class="Apple-tab-span" style="white-space:pre">
</span>public</b></span> IStatus
validate(Set<IFile> changedFiles, IProject
project, ContextValidationHelper validationHelper,</div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 11px/normal Menlo; "><span
class="Apple-tab-span" style="white-space:pre"> </span>IProjectValidationContext
context, ValidatorManager manager, IReporter
reporter) <span style="color: #921f67"><b>throws</b></span>
ValidationException</div>
<p style="margin: 0.0px 0.0px 0.0px 0.0px; font:
11.0px Menlo; min-height: 13.0px"><span
class="Apple-tab-span" style="white-space:pre"> </span><br
class="webkit-block-placeholder">
</p>
<div apple-content-edited="true">of my validator is
called, but with an empty set of 'changedFiles'.
Wouldn't it make more sense to call the </div>
<div apple-content-edited="true">
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 11px/normal Menlo; "><span
style="color: #921f67"><b><span
class="Apple-tab-span"
style="white-space:pre"> </span>public</b></span>
IStatus validateAll(IProject project,
ContextValidationHelper validationHelper,</div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 11px/normal Menlo; "><span
class="Apple-tab-span" style="white-space:pre">
</span>IProjectValidationContext
validationContext, ValidatorManager manager,
IReporter reporter)</div>
<div style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 11px/normal Menlo; "><span
class="Apple-tab-span" style="white-space:pre">
</span><span style="color: #921f67"><b>throws</b></span>
ValidationException </div>
</div>
<div apple-content-edited="true">method instead ? </div>
<div apple-content-edited="true"><br>
</div>
<div apple-content-edited="true">I can workaround that
and call validateAll(..) when changesFiles.isEmpty()
in the validate(..) method call, but I don't think
it's the best approach.</div>
<div apple-content-edited="true"><br>
</div>
<div apple-content-edited="true">WDYT ?</div>
<div apple-content-edited="true"><br>
</div>
<div apple-content-edited="true">Thanks.</div>
<div apple-content-edited="true"><br>
</div>
<div apple-content-edited="true">Best regards,</div>
<div apple-content-edited="true">
/Xavier<br>
<br>
<br>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
jbosstools-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:jbosstools-dev@lists.jboss.org">jbosstools-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/jbosstools-dev">https://lists.jboss.org/mailman/listinfo/jbosstools-dev</a></pre>
</blockquote>
<br>
</body>
</html>