blob: 8c3c426d5fc6e374428c829b52823e637173943f [file] [log] [blame]
<html>
<head>
<title>Validation Framework</title>
</head>
<body>
<p>A framework for calling validators that are build based.</p>
<p>Also see <a href="doc-files/faq.html">Frequently Asked Questions</a></p>
<p>
There are two main types of validation, <b>build based</b> and
<b>as you type</b>. This framework supports build based
validation. If auto build is turned on then the validators are called
when the user saves their file. If auto build is not turned on then
the validators are called when the user starts a build.</p>
<p>This framework was added to WTP in version 3.0.</p>
<h3>Dependency Support</h3>
<p>Sometimes resources depend on other resources, to determine whether they are
valid or not. An example would be that an XML resource could depend on a DTD. If at some
point in the future the DTD changes, then the dependent XML resource should be
revalidated to ensure that it still meets the requirements of the changed DTD
file. In order to do this efficiently, there needs to be an association between
the DTD and all the resources that depend on it.<p>To be as efficient as possible, the validation framework allows
this dependency information to be returned as part of a
<a href="AbstractValidator.html#validate(org.eclipse.core.resources.IResource, int, ValidationState, org.eclipse.core.runtime.IProgressMonitor)">
validate operation</a>. Since the validator needed to figure this out anyways,
why not pass this information back to the framework, so that it can be saved.
This saves the cost of having to parse the file at some later point in time
(when the file is probably sitting cold on disk). The fewer times that we need
to open, read and/or parse the same file, will improve the performance of the
product.
<p>In particular when the validate method returns, a
<a href="ValidationResult.html">ValidationResult</a> must be returned, inside of
this result, all your dependencies need to be specified with the
<a href="ValidationResult.html#setDependsOn(org.eclipse.core.resources.IResource[])">
setDependsOn</a> method.<p>In addition to keeping the dependency information
up-to-date through the normal course of validation, direct access is also
provided to the dependency support through the
<a href="ValidationFramework.html#getDependencyIndex()">getDependencyIndex</a>
method. The <a href="IDependencyIndex.html">IDependencyIndex</a> allows you to
directly manipulate the dependency information for a validator.
<h3>Entry Points into the Validation Framework</h3>
<p>Here are some of the points where the platform calls into the framework:</p>
<ul>
<li><b>Builder</b> - ValidationBuilder</li>
<li><b>IFacetedProjectListener</b> - ValManager</li>
<li><b>IJobChangeListener</b> - ValidationOperation, ValidationOperation.ValidationLauncherJob</li>
<li><b>IProjectChangeListener</b> - ValManager</li>
<li><b>IPropertyChangeListener</b> - ValidationConfiguration, DisabledResourceManager</li>
<li><b>IResourceChangeListener</b> - EventManger</li>
<li><b>IValChangedListener</b> - ValManager, DisabledValidatorManager</li>
</ul>
</body>
</html>