Class EvlValidator
java.lang.Object
org.eclipse.epsilon.evl.emf.validation.EvlValidator
- All Implemented Interfaces:
org.eclipse.emf.ecore.EValidator
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.eclipse.emf.ecore.EValidator
org.eclipse.emf.ecore.EValidator.Descriptor, org.eclipse.emf.ecore.EValidator.PatternMatcher, org.eclipse.emf.ecore.EValidator.Registry, org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider, org.eclipse.emf.ecore.EValidator.ValidationDelegate -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected org.eclipse.emf.ecore.resource.Resourcestatic final Stringprotected org.eclipse.emf.common.util.DiagnosticChainprotected Collection<org.eclipse.emf.ecore.EPackage>Collection of all packages that are available to this validatorprotected Stringprotected Collection<org.eclipse.emf.ecore.EObject>protected booleanprotected Stringprotected IEvlModuleprotected EmfPrettyPrinterprotected Collection<EvlValidator.ValidationProblemListener>protected ValidationResultsprotected booleanprotected URIstatic final StringKey for the validation context, that (when provided) holds a IProgressMonitor objectFields inherited from interface org.eclipse.emf.ecore.EValidator
MARKER, RELATED_URIS_ATTRIBUTE, URI_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionNote when using this constructor, make sure to callinitialise(URI, String, String, String)afterwardsEvlValidator(URI source, String modelName, String ePackageUri, String bundleId) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalPackage(String packageUri) Make an additional package available to be used by this validator.voidIndicates that the value of the entry of theDiagnosticiancontextMapwith the specifiednameshould be published as a global variable in the EVL script.protected voidaddMarkers(String msgPrefix, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.util.DiagnosticChain diagnostics) voidprotected org.eclipse.emf.common.util.DiagnosticcreateDiagnostic(String msgPrefix, UnsatisfiedConstraint unsatisfied) voidinitialise(URI source, String modelName, String ePackageUri, String bundleId) booleanThis method is used by the default implementation oflogException()booleanbooleanlogException(Exception exception) Method to determine whether the given exception needs to be logged.protected IEvlModulebooleanvoidsetLogErrors(boolean logErrors) Sets whether errors need to be logged or notvoidsetShowErrorDialog(boolean showErrorDialog) Sets whether an error dialog needs to be shownbooleanvalidate(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.util.DiagnosticChain diagnostics, Map<Object, Object> context) booleanvalidate(org.eclipse.emf.ecore.EDataType dataType, Object value, org.eclipse.emf.common.util.DiagnosticChain diagnostics, Map<Object, Object> context) booleanvalidate(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.common.util.DiagnosticChain diagnostics, Map<Object, Object> context) protected void
-
Field Details
-
diagnosticVariables
-
module
-
source
-
printer
-
currentResource
protected org.eclipse.emf.ecore.resource.Resource currentResource -
results
-
history
-
modelName
-
ePackageUri
-
bundleId
-
showErrorDialog
protected boolean showErrorDialog -
logErrors
protected boolean logErrors -
problemListeners
-
diagnostics
protected org.eclipse.emf.common.util.DiagnosticChain diagnostics -
ePackages
Collection of all packages that are available to this validator -
DEFAULT_MODEL_NAME
- See Also:
-
VALIDATION_MONITOR
Key for the validation context, that (when provided) holds a IProgressMonitor object- See Also:
-
-
Constructor Details
-
EvlValidator
public EvlValidator()Note when using this constructor, make sure to callinitialise(URI, String, String, String)afterwards -
EvlValidator
-
-
Method Details
-
initialise
-
addDiagnosticianVariable
Indicates that the value of the entry of the
DiagnosticiancontextMapwith the specifiednameshould be published as a global variable in the EVL script. If the context map does not contain an entry with the specifiedname, the variable will be set tonull.Note: this map is received through the
validatemethods in this class. -
addAdditionalPackage
Make an additional package available to be used by this validator.- Parameters:
packageUri- Namespace URI of the package
-
validate
public boolean validate(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.common.util.DiagnosticChain diagnostics, Map<Object, Object> context) - Specified by:
validatein interfaceorg.eclipse.emf.ecore.EValidator
-
validate
public boolean validate(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.util.DiagnosticChain diagnostics, Map<Object, Object> context) - Specified by:
validatein interfaceorg.eclipse.emf.ecore.EValidator
-
validate
public boolean validate(org.eclipse.emf.ecore.EDataType dataType, Object value, org.eclipse.emf.common.util.DiagnosticChain diagnostics, Map<Object, Object> context) - Specified by:
validatein interfaceorg.eclipse.emf.ecore.EValidator
-
createDiagnostic
protected org.eclipse.emf.common.util.Diagnostic createDiagnostic(String msgPrefix, UnsatisfiedConstraint unsatisfied) -
newModule
- Returns:
- A new
IEvlModule - Since:
- 1.6
-
validate
-
addMarkers
protected void addMarkers(String msgPrefix, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.util.DiagnosticChain diagnostics) -
isShowErrorDialog
public boolean isShowErrorDialog()- Returns:
- true if an error dialog needs to be shown when an error occurs
-
setShowErrorDialog
public void setShowErrorDialog(boolean showErrorDialog) Sets whether an error dialog needs to be shown- See Also:
-
logException
Method to determine whether the given exception needs to be logged. Can be overridden to filter out certain types of exceptions (e.g. when the user cancelled the validation)- Returns:
- true if error needs to be logged
-
isLogErrors
public boolean isLogErrors()This method is used by the default implementation oflogException()- Returns:
- true if errors need to be logged
- See Also:
-
setLogErrors
public void setLogErrors(boolean logErrors) Sets whether errors need to be logged or not- See Also:
-
addValidationProblemListener
-
removeValidationProblemListener
-