Class EvlValidator

  • All Implemented Interfaces:
    org.eclipse.emf.ecore.EValidator

    public class EvlValidator
    extends java.lang.Object
    implements org.eclipse.emf.ecore.EValidator
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  EvlValidator.ValidationProblemListener  
      • Nested 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAdditionalPackage​(java.lang.String packageUri)
      Make an additional package available to be used by this validator.
      void addDiagnosticianVariable​(java.lang.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.
      protected void addMarkers​(java.lang.String msgPrefix, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.util.DiagnosticChain diagnostics)  
      void addValidationProblemListener​(EvlValidator.ValidationProblemListener listener)  
      protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(java.lang.String msgPrefix, UnsatisfiedConstraint unsatisfied)  
      void initialise​(java.net.URI source, java.lang.String modelName, java.lang.String ePackageUri, java.lang.String bundleId)  
      boolean isLogErrors()
      This method is used by the default implementation of logException()
      boolean isShowErrorDialog()  
      boolean logException​(java.lang.Exception exception)
      Method to determine whether the given exception needs to be logged.
      protected IEvlModule newModule()  
      boolean removeValidationProblemListener​(EvlValidator.ValidationProblemListener listener)  
      void setLogErrors​(boolean logErrors)
      Sets whether errors need to be logged or not
      void setShowErrorDialog​(boolean showErrorDialog)
      Sets whether an error dialog needs to be shown
      boolean validate​(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,​java.lang.Object> context)  
      boolean validate​(org.eclipse.emf.ecore.EDataType dataType, java.lang.Object value, org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,​java.lang.Object> context)  
      boolean validate​(org.eclipse.emf.ecore.EObject object, org.eclipse.emf.common.util.DiagnosticChain diagnostics, java.util.Map<java.lang.Object,​java.lang.Object> context)  
      protected void validate​(org.eclipse.emf.ecore.resource.Resource resource, java.util.Map<java.lang.Object,​java.lang.Object> context)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • diagnosticVariables

        protected java.util.Set<java.lang.String> diagnosticVariables
      • source

        protected java.net.URI source
      • currentResource

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

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

        protected java.lang.String modelName
      • ePackageUri

        protected java.lang.String ePackageUri
      • bundleId

        protected java.lang.String bundleId
      • showErrorDialog

        protected boolean showErrorDialog
      • logErrors

        protected boolean logErrors
      • diagnostics

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

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

        public static final java.lang.String DEFAULT_MODEL_NAME
        See Also:
        Constant Field Values
      • VALIDATION_MONITOR

        public static final java.lang.String VALIDATION_MONITOR
        Key for the validation context, that (when provided) holds a IProgressMonitor object
        See Also:
        Constant Field Values
    • Constructor Detail

      • EvlValidator

        public EvlValidator​(java.net.URI source,
                            java.lang.String modelName,
                            java.lang.String ePackageUri,
                            java.lang.String bundleId)
    • Method Detail

      • initialise

        public void initialise​(java.net.URI source,
                               java.lang.String modelName,
                               java.lang.String ePackageUri,
                               java.lang.String bundleId)
      • addAdditionalPackage

        public void addAdditionalPackage​(java.lang.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,
                                java.util.Map<java.lang.Object,​java.lang.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,
                                java.util.Map<java.lang.Object,​java.lang.Object> context)
        Specified by:
        validate in interface org.eclipse.emf.ecore.EValidator
      • validate

        public boolean validate​(org.eclipse.emf.ecore.EDataType dataType,
                                java.lang.Object value,
                                org.eclipse.emf.common.util.DiagnosticChain diagnostics,
                                java.util.Map<java.lang.Object,​java.lang.Object> context)
        Specified by:
        validate in interface org.eclipse.emf.ecore.EValidator
      • createDiagnostic

        protected org.eclipse.emf.common.util.Diagnostic createDiagnostic​(java.lang.String msgPrefix,
                                                                          UnsatisfiedConstraint unsatisfied)
      • validate

        protected void validate​(org.eclipse.emf.ecore.resource.Resource resource,
                                java.util.Map<java.lang.Object,​java.lang.Object> context)
      • addMarkers

        protected void addMarkers​(java.lang.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:
        isShowErrorDialog()
      • logException

        public boolean logException​(java.lang.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:
        logException(Exception)
      • setLogErrors

        public void setLogErrors​(boolean logErrors)
        Sets whether errors need to be logged or not
        See Also:
        isLogErrors()