Overview | Package | Class | Use | Serialized | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.wst.validation
Class AbstractValidator

    java.lang.Object
      org.eclipse.wst.validation.AbstractValidator

    public abstract class AbstractValidator

extends java.lang.Object

The class that all Validators that wish to use version two of the validation framework must subclass.

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.

Constructor Summary
`AbstractValidator()`

Method Summary
`void` | `clean(IProject project, ValidationState state, IProgressMonitor monitor)` A call back method that lets the validator know that the project is being cleaned.
`Validator.V2` | `getParent()` Answer the validator that you belong to.
`boolean` | `shouldClearMarkers(ValidationEvent event)` Should the validation framework first clear the markers that this validator has placed on this resource?
`ValidationResult` | `validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor)` Validate the resource.
`ValidationResult` | `validate(ValidationEvent event, ValidationState state, IProgressMonitor monitor)` Validate the resource.
`void` | `validationFinishing(IProject project, ValidationState state, IProgressMonitor monitor)` This method will be called when validation is complete.
`void` | `validationStarting(IProject project, ValidationState state, IProgressMonitor monitor)` This method is called before any validation takes place.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractValidator

    public AbstractValidator()

Method Detail

### validate

    public ValidationResult validate(IResource resource,
                                     int kind,
                                     ValidationState state,
                                     IProgressMonitor monitor)

  Validate the resource. The validator is called from a WorkspaceJob, so the validator itself does not need to establish it's own IWorkspaceRunnable.

  If you override this method then you should not override the other validate method.

  Parameters:
    `resource` - The resource to be validated.
    `kind` - The way the resource changed. It uses the same values as the kind parameter in IResourceDelta.
    `state` - A way to pass arbitrary, validator specific, data from one invocation of a validator to the next, during the validation phase. At the end of the validation phase, this object will be cleared, thereby allowing any of this state information to be garbaged collected.
    `monitor` - A monitor that you can use to report your progress. To be a well behaved validator you need to check the isCancelled() method at appropriate times.
  Returns:
    the result of the validation. This may be, but usually isn't, null.

### validate

    public ValidationResult validate(ValidationEvent event,
                                     ValidationState state,
                                     IProgressMonitor monitor)

  Validate the resource. The validator is called from a WorkspaceJob, so the validator itself does not need to establish it's own IWorkspaceRunnable.

  If you override this method then you should not override the other validate method.

  Parameters:
    `event` - An object that describes the resource to be validated and why it should be validated.
    `state` - A way to pass arbitrary, validator specific, data from one invocation of a validator to the next, during the validation phase. At the end of the validation phase, this object will be cleared, thereby allowing any of this state information to be garbaged collected.
    `monitor` - A monitor that you can use to report your progress. To be a well behaved validator you need to check the isCancelled() method at appropriate times.
  Returns:
    the result of the validation. Null should never be returned. If null is returned then the other validate method will be called as well.

### clean

    public void clean(IProject project,
                      ValidationState state,
                      IProgressMonitor monitor)

  A call back method that lets the validator know that the project is being cleaned. This method gives the validator a chance to do any special cleanup. The default is to do nothing.

  If the entire workspace is being cleaned, then the first call will have a null project, and then there will be subsequent calls for each open project in the workspace.

  Parameters:
    `project` - The project being cleaned. This may be null, which is an indication that the workspace is being cleaned.
    `state` - A way to pass arbitrary, validator specific, data from one invocation of a validator to the next, during the validation phase.
    `monitor` - The monitor that should be used for reporting progress if the clean takes a long time.

### validationStarting

    public void validationStarting(IProject project,
                                   ValidationState state,
                                   IProgressMonitor monitor)

  This method is called before any validation takes place. It allows validators to perform any initialization that they might need.

  Parameters:
    `project` - The project that is being validated. For the very first call in the validation phase, this will be null. A null project is the signal that a top level validation is starting. Subsequently, the project will be set, as each of the individual projects are validated.
    `state` - A way to pass arbitrary, validator specific, data from one invocation of a validator to the next, during the validation phase.
    `monitor` - The monitor that should be used for reporting progress if the initialization takes a long time.

### validationFinishing

    public void validationFinishing(IProject project,
                                    ValidationState state,
                                    IProgressMonitor monitor)

  This method will be called when validation is complete. It allows validators to perform any cleanup that they might need to do.

  Parameters:
    `project` - The project that was validated. The very last call in the validation sets this to null so that the validator knows that all the projects have now been validated.
    `state` - A way to pass arbitrary, validator specific, data from one invocation of a validator to the next, during the validation phase.
    `monitor` - The monitor that should be used for reporting progress if the cleanup takes a long time.

### shouldClearMarkers

    public boolean shouldClearMarkers(ValidationEvent event)

  Should the validation framework first clear the markers that this validator has placed on this resource? This method can be overridden by validator implementors to provide a validator specific behavior.

  Parameters:
    `event` - The validation event that triggered the validation.
  Returns:
    true if the validation framework should first clear all the markers that this validator produced. This is the default behavior. Return false to leave the markers unchanged. It then becomes the responsibility of the validator to manage it's own markers for this resource, for this validation event.

### getParent

    public Validator.V2 getParent()

  Answer the validator that you belong to. The validator controls the filters and various other settings.

Overview | Package | Class | Use | Serialized | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD