|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.wst.validation.ValidationFramework
public final class ValidationFramework
The central class of the Validation Framework.
This is a singleton class that is accessed through the getDefault() method.
Provisional API: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.
Nested Class Summary | |
---|---|
static class |
ValidationFramework.ResourceAdder
|
Method Summary | |
---|---|
void |
clearMessages(IResource resource,
java.lang.String validatorId)
Clear any validation markers that may have been set by this validator. |
void |
disableValidation(IResource resource)
Disable all validation for the given resource. |
void |
enableValidation(IResource resource)
Enable validation for the given resource. |
static ValidationFramework |
getDefault()
Answer the singleton, default instance of this class. |
IDependencyIndex |
getDependencyIndex()
Answer the dependency index. |
java.util.Set<Validator> |
getDisabledValidatorsFor(IResource resource)
Answer all the validators that should not validate the resource, either because their filters don't support the resource, or the validator has been disabled for both build validation and manual validation. |
IPerformanceMonitor |
getPerformanceMonitor()
Answer a performance monitor for the validators. |
IEclipsePreferences |
getPreferenceStore()
Answer the preference store that holds the global validation settings. |
IReporter |
getReporter(IProject project,
IProgressMonitor monitor)
|
Validator |
getValidator(java.lang.String id)
Deprecated. Use getValidator(String id, IProject project) with a null project instead. |
Validator |
getValidator(java.lang.String id,
IProject project)
Answer the validator with the given id that is in effect for the given project. |
Validator[] |
getValidatorsFor(IResource resource)
Answer all the validators that are applicable for the given resource. |
Validator[] |
getValidatorsFor(IResource resource,
boolean isManual,
boolean isBuild)
Answer all the validators that are applicable for the given resource. |
boolean |
hasValidators(IResource resource,
boolean isManual,
boolean isBuild)
Answer true if the resource has any enabled validators. |
boolean |
isProjectSuspended(IProject project)
This method should be called by any code that is preparing to suspend validation on a project. |
boolean |
isSuspended()
Return true if "suspend all" is enabled, false otherwise. |
boolean |
isSuspended(IProject project)
Returns true if validation will not run on the project because it's been suspended. |
void |
join(IProgressMonitor monitor)
Waits until all validation jobs are finished. |
void |
suspendAllValidation(boolean suspend)
Suspends, or undoes the suspension of, validation on all projects in the workbench. |
void |
suspendValidation(IProject project,
boolean suspend)
Suspends, or undoes the suspension of, validation on the current project. |
ValidationResults |
validate(IProject[] projects,
boolean isManual,
boolean isBuild,
IProgressMonitor monitor)
Validate the projects. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static ValidationFramework getDefault()
public void clearMessages(IResource resource, java.lang.String validatorId) throws CoreException
resource
- The resource that may have it's markers cleared.validatorId
- The id of validator that created the marker.
CoreException
public void disableValidation(IResource resource)
Use the enableValidation method to restore validation.
resource
- The resource that is having validation disabled. It must be an IFolder or an IFile.enableValidation(IResource)
public void enableValidation(IResource resource)
resource
- The resource that is having validation re-enabled.disableValidation(IResource)
public IDependencyIndex getDependencyIndex()
public IPerformanceMonitor getPerformanceMonitor()
public IEclipsePreferences getPreferenceStore()
public IReporter getReporter(IProject project, IProgressMonitor monitor)
public Validator[] getValidatorsFor(IResource resource, boolean isManual, boolean isBuild)
The caller may still need to test if the validator has been turned off by the user, by using the isBuildValidation() and isManualValidation() methods.
resource
- The resource that determines which validators are applicable.isManual
- If true then the validator must be turned on for manual validation.
If false then the isManualValidation setting isn't used to filter
out validators.isBuild
- If true then the validator must be turned on for build based
validation. If false then the isBuildValidation setting isn't used
to filter out validators.Validator.isBuildValidation()
,
Validator.isManualValidation()
public java.util.Set<Validator> getDisabledValidatorsFor(IResource resource)
resource
- The resource this is being tested.public Validator getValidator(java.lang.String id)
id
-
public Validator getValidator(java.lang.String id, IProject project)
Individual projects may override the global validation preference settings. If this is allowed and if the project has it's own settings, then those validators are returned via this method.
The following approach is used. For version 1 validators, the validator is only returned if it is defined to operate on this project type. This is the way that the previous version of the framework did it. For version 2 validators, they are all returned.
id
- Validator id.project
- This can be null, in which case all the registered validators are
checked.
public Validator[] getValidatorsFor(IResource resource)
resource
- the resource that determines which validators are applicable.public boolean hasValidators(IResource resource, boolean isManual, boolean isBuild)
resource
- A file, folder or project.isManual
- If true then the validator must be turned on for manual validation.
If false then the isManualValidation setting isn't used to filter
out validators.isBuild
- If true then the validator must be turned on for build based
validation. If false then the isBuildValidation setting isn't used
to filter out validators.public void join(IProgressMonitor monitor) throws java.lang.InterruptedException, OperationCanceledException
If this method is called while the job manager is suspended, only jobs
that are currently running will be joined. Once there are no jobs in the
family in the Job#RUNNING
state, this method returns.
Note that there is a deadlock risk when using join. If the calling thread owns a lock or object monitor that the joined thread is waiting for, deadlock will occur. This method can also result in starvation of the current thread if another thread continues to add jobs of the given family, or if a job in the given family reschedules itself in an infinite loop.
monitor
- Progress monitor for reporting progress on how the wait is
progressing, or null
if no progress monitoring is
required.
java.lang.InterruptedException
- if this thread is interrupted while waiting
OperationCanceledException
- if the progress monitor is canceled while waitingpublic void suspendValidation(IProject project, boolean suspend)
Be very careful when you use this method! Turn validation back on in a finally block because if the code which suspended validation crashes, the user has no way to reset the suspension. The user will have to shut down and restart the workbench to get validation to work again.
project
- The project that is to be suspended or unsuspended.suspend
- If true, validation on the project will be suspend. If false it will
not be suspended.public void suspendAllValidation(boolean suspend)
Be very careful when you use this method! Turn validation back on in a finally block because if the code which suspended validation crashes, the user has no way to reset the suspension. The user will have to shut down and restart the workbench to get validation to work again.
public boolean isSuspended()
public boolean isSuspended(IProject project)
public boolean isProjectSuspended(IProject project)
project
- the project that is being tested
public ValidationResults validate(IProject[] projects, boolean isManual, boolean isBuild, IProgressMonitor monitor) throws CoreException
projects
- The projects to be validated.isManual
- Is this being done as part of a manual validation? i.e. did
the user select the Validate menu item?isBuild
- Is this being done as part of a build?monitor
-
CoreException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |