Class EvlValidator

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

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

      • diagnosticVariables

        protected Set<String> diagnosticVariables
      • source

        protected URI source
      • currentResource

        protected org.eclipse.emf.ecore.resource.Resource currentResource
      • 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
      • 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
      • VALIDATION_MONITOR

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

      • initialise

        public void initialise​(URI source,
                               String modelName,
                               String ePackageUri,
                               String bundleId)
      • 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)
      • 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:
        isShowErrorDialog()
      • 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:
        logException(Exception)
      • setLogErrors

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