|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.wst.validation.ValidationResult
public final class ValidationResult
The result of running a validate operation. Validators create and return this objects as part of performing their validation.
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 | |
---|---|
ValidationResult()
|
Method Summary | |
---|---|
void |
add(ValidatorMessage message)
This is an optional method, that a validator can use to return error messages. |
IResource[] |
getDependsOn()
Answer the resources that the validated resource depends on. |
ValidatorMessage[] |
getMessages()
Answer any validation messages that were added by the validator. |
ValidatorMessage[] |
getMessagesAsCopy()
Answer a copy of any validation messages that were added by the validator. |
int |
getNumberOfValidatedResources()
Answer the number of resources that have been validated. |
IReporter |
getReporter(IProgressMonitor monitor)
Answer an IReporter for handing error messages. |
int |
getSeverityError()
Answer the number of error messages that were generated as part of this validation operation. |
int |
getSeverityInfo()
Answer the number of informational messages that were generated as part of this validation operation. |
int |
getSeverityWarning()
Answer the number of warning messages that were generated as part of this validation operation. |
IProject |
getSuspendValidation()
Answer the project that the validator would like to have suspended. |
IResource[] |
getValidated()
|
org.eclipse.wst.validation.internal.core.ValidationException |
getValidationException()
If the validation ended with an exception, answer it. |
int |
incrementError(int errors)
Increment the number of error messages that were generated as part of this validation operation. |
int |
incrementInfo(int info)
Increment the number of informational messages that were generated as part of this validation operation. |
int |
incrementWarning(int warnings)
Increment the number of warning messages that were generated as part of this validation operation. |
boolean |
isCanceled()
Was the operation canceled before it completed? |
void |
mergeResults(ValidationResult result)
Merge the message counts and messages from an individual validator into this result. |
void |
setCanceled(boolean canceled)
Indicate if the operation was canceled. |
void |
setDependsOn(IResource[] dependsOn)
Update the resources that the validated resource depends on. |
void |
setSeverityError(int severityError)
Set the number of error messages that were generated as part of this validation operation. |
void |
setSeverityInfo(int severityInfo)
Set the number of informational messages that were generated as part of this validation operation. |
void |
setSeverityWarning(int severityWarning)
Set the number of warning messages that were generated as part of this validation operation. |
void |
setSuspendValidation(IProject project)
Calling this method will inform the framework, that this validator does not wish to be called again for any resources in this project, for the duration of this validation operation. |
void |
setValidated(IResource[] validated)
Indicate that additional resources have been validated as part of this validate operation. |
void |
setValidationException(org.eclipse.wst.validation.internal.core.ValidationException validationException)
If the validation failed with an exception, it can be recorded here. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ValidationResult()
Method Detail |
---|
public void add(ValidatorMessage message)
The scenario that motivated this method, is when a validator is used both for as you type validation and build validation. When called in as you type mode, the validator doesn't want to directly create IMarkers, because the resource hasn't been saved yet. It needs to return something other than an IMarker. But when called in build mode, it does ultimately want IMarkers. By returning ValidatorMessages, it only needs to return one type of message, and those messages can be either be directly used by the caller, or automatically converted into IMarkers by the validation framework.
To make matters even more complicated there is a third way to return messages. To make it easier for old validators to port to the new framework, they can continue to use an IReporter. If a validator calls the getReporter() method then it is assumed by the framework that that is the approach that they have chosen.
message
- A validation message.getReporter(IProgressMonitor)
public IReporter getReporter(IProgressMonitor monitor)
This is a transition method, to help old validators port to the new validation framework. If this method is called it is assumed by the framework, that this IReporter will be used as the only way of passing messages back to the framework.
monitor
- add(ValidatorMessage)
public void mergeResults(ValidationResult result)
result
- it can be null, in which case it is ignored.public IResource[] getDependsOn()
public ValidatorMessage[] getMessages()
public ValidatorMessage[] getMessagesAsCopy()
public void setDependsOn(IResource[] dependsOn)
dependsOn
- If this is null then the dependency information is not updated. To
remove the dependency information, an empty array needs to be
supplied. A non null parameter, replaces all the dependency
information for this resource, for this validator.public IResource[] getValidated()
public void setValidated(IResource[] validated)
validated
- Any additional resources that were validated.public int getSeverityError()
public void setSeverityError(int severityError)
Messages added through the add(ValidationMessage) method should not be included here, as this information will be determined from the ValidationMessage.
public int incrementError(int errors)
Messages added through the add(ValidationMessage) method should not be included here, as this information will be determined from the ValidationMessage.
public int getSeverityWarning()
public void setSeverityWarning(int severityWarning)
Messages added through the add(ValidationMessage) method should not be included here, as this information will be determined from the ValidationMessage.
public int incrementWarning(int warnings)
Messages added through the add(ValidationMessage) method should not be included here, as this information will be determined from the ValidationMessage.
public int getSeverityInfo()
public void setSeverityInfo(int severityInfo)
Messages added through the add(ValidationMessage) method should not be included here, as this information will be determined from the ValidationMessage.
public int incrementInfo(int info)
Messages added through the add(ValidationMessage) method should not be included here, as this information will be determined from the ValidationMessage.
public boolean isCanceled()
public void setCanceled(boolean canceled)
canceled
- Set to true if it was canceled and false if it was not canceled.public int getNumberOfValidatedResources()
public org.eclipse.wst.validation.internal.core.ValidationException getValidationException()
public void setValidationException(org.eclipse.wst.validation.internal.core.ValidationException validationException)
This method is provided for old validators to ease their transition to the new framework.
validationException
- public IProject getSuspendValidation()
public void setSuspendValidation(IProject project)
Some validators may have a rich set of triggers, but once they have been invoked once, do not need to be invoked again during the course of the current validation.
project
- The project that this validator no longer wants to be notified on.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |