public class ValidationServiceImpl extends Object implements ValidationService
ValidationService
.Constructor and Description |
---|
ValidationServiceImpl()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addValidator(Validator validator)
Adds a validation provider to the list of known validators.
|
void |
cancel()
Allows to cancel the current validation run (if any).
|
protected org.eclipse.emf.common.util.Diagnostic |
getDiagnosticForEObject(org.eclipse.emf.ecore.EObject object)
Computes the
Diagnostic for the given eObject. |
protected org.eclipse.emf.ecore.EValidator |
getEValidatorForEObject(org.eclipse.emf.ecore.EObject eObject)
Returns a
EValidator for the given EObject . |
protected Map<Object,Object> |
getValidationContext(org.eclipse.emf.ecore.EValidator eValidator)
Obtains the shared validation context for a validation of multiple objects
or a one-off context for validation of a single object.
|
boolean |
isBusy()
Returns true as long as a validation is in process.
|
void |
registerValidationFilter(ValidationFilter filter)
Registers a validation filter.
|
void |
registerValidationResultListener(ValidationResultListener listener)
Registers a
ValidationResultListener . |
void |
removeValidator(Validator validator)
Removes a validation provider from the list of known validators.
|
void |
setSubstitutionLabelProvider(org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider substitutionLabelProvider)
Set a
EValidator.SubstitutionLabelProvider to be used for substituting labels in Diagnostic s. |
void |
unregisterValidationFilter(ValidationFilter filter)
Unregisters a validation filter.
|
void |
unregisterValidationResultListener(ValidationResultListener listener)
Unregisters a
ValidationResultListener . |
org.eclipse.emf.common.util.Diagnostic |
validate(org.eclipse.emf.ecore.EObject eObject)
Validates the given eObject.
|
Set<org.eclipse.emf.common.util.Diagnostic> |
validate(Iterator<org.eclipse.emf.ecore.EObject> eObjectsIterator)
Uses the given iterator to validate all eObjects in a collection.
|
public org.eclipse.emf.common.util.Diagnostic validate(org.eclipse.emf.ecore.EObject eObject)
ValidationService
validate
in interface ValidationService
eObject
- the eObject to validateDiagnostic
, or null if the eObject is filtered by a ValidationFilter
public Set<org.eclipse.emf.common.util.Diagnostic> validate(Iterator<org.eclipse.emf.ecore.EObject> eObjectsIterator) throws ValidationCanceledException
ValidationService
validate
in interface ValidationService
eObjectsIterator
- the list to validateDiagnostic
sValidationCanceledException
- in case ValidationService.cancel()
has been calledprotected org.eclipse.emf.ecore.EValidator getEValidatorForEObject(org.eclipse.emf.ecore.EObject eObject)
EValidator
for the given EObject
.eObject
- the EObject
to retrieve a EValidator
forEValidator
protected org.eclipse.emf.common.util.Diagnostic getDiagnosticForEObject(org.eclipse.emf.ecore.EObject object)
Diagnostic
for the given eObject.object
- the EObject
to validateDiagnostic
protected Map<Object,Object> getValidationContext(org.eclipse.emf.ecore.EValidator eValidator)
substitution label provider
,
thn it will also be put into the context. Subclasses may extend this to populate
the context with anything else of interest.eValidator
- the validator to put into the contextpublic void addValidator(Validator validator)
ValidationService
addValidator
in interface ValidationService
validator
- the Validator
to addpublic void removeValidator(Validator validator)
ValidationService
removeValidator
in interface ValidationService
validator
- the Validator
to removepublic void registerValidationFilter(ValidationFilter filter)
ValidationService
registerValidationFilter
in interface ValidationService
filter
- the ValidationFilter
to registerpublic void unregisterValidationFilter(ValidationFilter filter)
ValidationService
unregisterValidationFilter
in interface ValidationService
filter
- the ValidationFilter
to unregisterpublic void registerValidationResultListener(ValidationResultListener listener)
ValidationService
ValidationResultListener
.registerValidationResultListener
in interface ValidationService
listener
- the ValidationResultListener
to registerpublic void unregisterValidationResultListener(ValidationResultListener listener)
ValidationService
ValidationResultListener
.unregisterValidationResultListener
in interface ValidationService
listener
- the ValidationResultListener
to unregisterpublic void setSubstitutionLabelProvider(org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider substitutionLabelProvider)
ValidationService
EValidator.SubstitutionLabelProvider
to be used for substituting labels in Diagnostic
s.setSubstitutionLabelProvider
in interface ValidationService
substitutionLabelProvider
- the EValidator.SubstitutionLabelProvider
to be set for this serviceEValidator.SubstitutionLabelProvider
public boolean isBusy()
ValidationService
ValidationService.validate(EObject)
.
See ValidationService.cancel()
to interrupt a running validation process.isBusy
in interface ValidationService
public void cancel()
ValidationService
ValidationService.validate(EObject)
.cancel
in interface ValidationService
Copyright © 2018. All rights reserved.