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 theValidationService
to validate a resource. This class may be used as is or it may be extended by clients to customize any ofloading the model file
finding the model object
to validateconfiguring the validation service
for the model's peculiar needsunloading the model
to 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 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
.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.protected org.eclipse.emf.ecore.resource.ResourceSet
loadModel(org.eclipse.core.resources.IFile file)
Load a model into a resource set.protected void
unload(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 afile
in 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:ValidationDelegate
Validate afile
in the workspace.- Specified by:
validate
in 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.IOException
Load 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
null
if 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 themodel
model
- 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)
-
-