Package org.eclipse.emfforms.ide.builder
Class ValidationServiceDelegate
- java.lang.Object
-
- org.eclipse.emfforms.ide.builder.ValidationServiceDelegate
-
- All Implemented Interfaces:
ValidationDelegate
- Direct Known Subclasses:
ViewModelValidationDelegate
public class ValidationServiceDelegate extends java.lang.Object implements ValidationDelegate
Implementation of a validation delegate that uses theValidationServiceto validate a resource. This class may be used as is or it may be extended by clients to customize any ofloading the model filefinding the model objectto validateconfiguring the validation servicefor the model's peculiar needsunloading the modelto clean up any additional resources
-
-
Field Summary
-
Fields inherited from interface org.eclipse.emfforms.ide.builder.ValidationDelegate
NULL
-
-
Constructor Summary
Constructors Constructor Description ValidationServiceDelegate()Initializes me.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigure(ValidationService validationService, org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.ecore.EObject model)Configure the validation service with constraint providers, filters, or whatever else is necessary for complete and correct validation of themodel.protected org.eclipse.emf.ecore.EObjectgetModel(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)Obtain the model object to be validated from the loaded resource set.protected org.eclipse.emf.ecore.resource.ResourceSetloadModel(org.eclipse.core.resources.IFile file)Load a model into a resource set.protected voidunload(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)Unload the model after validation is complete.Optional<org.eclipse.emf.common.util.Diagnostic>validate(org.eclipse.core.resources.IFile file, org.eclipse.core.runtime.IProgressMonitor monitor)Validate afilein the workspace.
-
-
-
Method Detail
-
validate
public Optional<org.eclipse.emf.common.util.Diagnostic> validate(org.eclipse.core.resources.IFile file, org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface:ValidationDelegateValidate afilein the workspace.- Specified by:
validatein interfaceValidationDelegate- Parameters:
file- the file to validatemonitor- for reporting validation progress- Returns:
- the problems found, if any
-
loadModel
protected org.eclipse.emf.ecore.resource.ResourceSet loadModel(org.eclipse.core.resources.IFile file) throws java.io.IOExceptionLoad a model into a resource set.- Parameters:
file- the model file to load- Returns:
- the resource set into which it is loaded
- Throws:
java.io.IOException- on failure to load thefile
-
getModel
protected org.eclipse.emf.ecore.EObject getModel(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Obtain the model object to be validated from the loaded resource set.- Parameters:
resourceSet- the loaded resource set- Returns:
- the model object to validate, or
nullif there is none - See Also:
loadModel(IFile)
-
configure
protected void configure(ValidationService validationService, org.eclipse.emf.ecore.resource.ResourceSet resourceSet, org.eclipse.emf.ecore.EObject model)
Configure the validation service with constraint providers, filters, or whatever else is necessary for complete and correct validation of themodel.- Parameters:
validationService- the validation service to configureresourceSet- the resource set in which it will validate themodelmodel- the model object to be validated
-
unload
protected void unload(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Unload the model after validation is complete.- Parameters:
resourceSet- the model to unload- See Also:
loadModel(IFile)
-
-