Class EvlValidator

java.lang.Object
org.eclipse.epsilon.evl.emf.validation.EvlValidator
All Implemented Interfaces:
org.eclipse.emf.ecore.EValidator

public class EvlValidator extends Object implements org.eclipse.emf.ecore.EValidator
  • Field Details

    • diagnosticVariables

      protected Set<String> diagnosticVariables
    • module

      protected IEvlModule module
    • source

      protected URI source
    • printer

      protected EmfPrettyPrinter printer
    • currentResource

      protected org.eclipse.emf.ecore.resource.Resource currentResource
    • results

      protected ValidationResults results
    • history

      protected Collection<org.eclipse.emf.ecore.EObject> history
    • modelName

      protected String modelName
    • ePackageUri

      protected String ePackageUri
    • bundleId

      protected String bundleId
    • showErrorDialog

      protected boolean showErrorDialog
    • logErrors

      protected boolean logErrors
    • problemListeners

    • diagnostics

      protected org.eclipse.emf.common.util.DiagnosticChain diagnostics
    • ePackages

      protected Collection<org.eclipse.emf.ecore.EPackage> ePackages
      Collection of all packages that are available to this validator
    • DEFAULT_MODEL_NAME

      public static final String DEFAULT_MODEL_NAME
      See Also:
    • VALIDATION_MONITOR

      public static final String VALIDATION_MONITOR
      Key for the validation context, that (when provided) holds a IProgressMonitor object
      See Also:
  • Constructor Details

  • Method Details

    • initialise

      public void initialise(URI source, String modelName, String ePackageUri, String bundleId)
    • addDiagnosticianVariable

      public void addDiagnosticianVariable(String name)

      Indicates that the value of the entry of the Diagnostician context Map with the specified name should be published as a global variable in the EVL script. If the context map does not contain an entry with the specified name, the variable will be set to null.

      Note: this map is received through the validate methods in this class.

      See Also:
    • addAdditionalPackage

      public void addAdditionalPackage(String packageUri)
      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:
      validate in interface org.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:
      validate in interface org.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:
      validate in interface org.eclipse.emf.ecore.EValidator
    • createDiagnostic

      protected org.eclipse.emf.common.util.Diagnostic createDiagnostic(String msgPrefix, UnsatisfiedConstraint unsatisfied)
    • newModule

      protected IEvlModule newModule()
      Returns:
      A new IEvlModule
      Since:
      1.6
    • validate

      protected void validate(org.eclipse.emf.ecore.resource.Resource resource, Map<Object,Object> context)
    • 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

      public boolean logException(Exception exception)
      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 of logException()
      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

      public void addValidationProblemListener(EvlValidator.ValidationProblemListener listener)
    • removeValidationProblemListener

      public boolean removeValidationProblemListener(EvlValidator.ValidationProblemListener listener)