Search in sources :

Example 6 with Diagnostician

use of org.eclipse.emf.ecore.util.Diagnostician in project sirius-components by eclipse-sirius.

the class EMFValidationService method validate.

@Override
public List<Object> validate(Object object, Object feature) {
    if (object instanceof EObject) {
        Diagnostician diagnostician = this.getNewDiagnostician();
        Diagnostic diagnostic = diagnostician.validate((EObject) object);
        if (Diagnostic.OK != diagnostic.getSeverity()) {
            // @formatter:off
            return diagnostic.getChildren().stream().filter(diag -> this.filterDiagnosticByObject(diag, object)).filter(diag -> this.filterDiagnosticByFeature(diag, feature)).collect(Collectors.toList());
        // @formatter:on
        }
    }
    return List.of();
}
Also used : Registry(org.eclipse.emf.ecore.EValidator.Registry) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) Collection(java.util.Collection) Diagnostic(org.eclipse.emf.common.util.Diagnostic) HashMap(java.util.HashMap) EObject(org.eclipse.emf.ecore.EObject) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) EValidator(org.eclipse.emf.ecore.EValidator) List(java.util.List) Diagnostician(org.eclipse.emf.ecore.util.Diagnostician) IItemLabelProvider(org.eclipse.emf.edit.provider.IItemLabelProvider) Service(org.springframework.stereotype.Service) Map(java.util.Map) Resource(org.eclipse.emf.ecore.resource.Resource) Optional(java.util.Optional) IValidationService(org.eclipse.sirius.components.collaborative.validation.api.IValidationService) AdapterFactoryEditingDomain(org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) ComposedAdapterFactory(org.eclipse.emf.edit.provider.ComposedAdapterFactory) Diagnostician(org.eclipse.emf.ecore.util.Diagnostician) EObject(org.eclipse.emf.ecore.EObject) Diagnostic(org.eclipse.emf.common.util.Diagnostic)

Aggregations

EValidator (org.eclipse.emf.ecore.EValidator)6 Diagnostician (org.eclipse.emf.ecore.util.Diagnostician)6 Collectors (java.util.stream.Collectors)4 EValidatorRegistryImpl (org.eclipse.emf.ecore.impl.EValidatorRegistryImpl)4 Lists (com.google.common.collect.Lists)2 ElementsPackage (io.vrap.rmf.raml.model.elements.ElementsPackage)2 ModulesPackage (io.vrap.rmf.raml.model.modules.ModulesPackage)2 ResourcesPackage (io.vrap.rmf.raml.model.resources.ResourcesPackage)2 ResponsesPackage (io.vrap.rmf.raml.model.responses.ResponsesPackage)2 SecurityPackage (io.vrap.rmf.raml.model.security.SecurityPackage)2 TypesPackage (io.vrap.rmf.raml.model.types.TypesPackage)2 ValuesPackage (io.vrap.rmf.raml.model.values.ValuesPackage)2 java.util (java.util)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Diagnostic (org.eclipse.emf.common.util.Diagnostic)2