Class EvlValidator
java.lang.Object
org.eclipse.epsilon.evl.emf.validation.EvlValidator
- All Implemented Interfaces:
org.eclipse.emf.ecore.EValidator
-
Nested Class Summary
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
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
protected org.eclipse.emf.ecore.resource.Resource
static final String
protected org.eclipse.emf.common.util.DiagnosticChain
protected Collection<org.eclipse.emf.ecore.EPackage>
Collection of all packages that are available to this validatorprotected String
protected Collection<org.eclipse.emf.ecore.EObject>
protected boolean
protected String
protected IEvlModule
protected EmfPrettyPrinter
protected Collection<EvlValidator.ValidationProblemListener>
protected ValidationResults
protected boolean
protected URI
static final String
Key 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
ConstructorDescriptionNote 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 TypeMethodDescriptionvoid
addAdditionalPackage
(String packageUri) Make an additional package available to be used by this validator.void
Indicates that the value of the entry of theDiagnostician
contextMap
with the specifiedname
should be published as a global variable in the EVL script.protected void
addMarkers
(String msgPrefix, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.util.DiagnosticChain diagnostics) void
protected org.eclipse.emf.common.util.Diagnostic
createDiagnostic
(String msgPrefix, UnsatisfiedConstraint unsatisfied) void
initialise
(URI source, String modelName, String ePackageUri, String bundleId) boolean
This method is used by the default implementation oflogException()
boolean
boolean
logException
(Exception exception) Method to determine whether the given exception needs to be logged.protected IEvlModule
boolean
void
setLogErrors
(boolean logErrors) Sets whether errors need to be logged or notvoid
setShowErrorDialog
(boolean showErrorDialog) Sets whether an error dialog needs to be shownboolean
validate
(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EObject eObject, org.eclipse.emf.common.util.DiagnosticChain diagnostics, Map<Object, Object> context) boolean
validate
(org.eclipse.emf.ecore.EDataType dataType, Object value, org.eclipse.emf.common.util.DiagnosticChain diagnostics, Map<Object, Object> context) boolean
validate
(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
Diagnostician
contextMap
with the specifiedname
should 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
validate
methods 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:
validate
in 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:
validate
in 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:
validate
in 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
-