Search in sources :

Example 1 with ValidationConfiguration

use of org.eclipse.sirius.components.collaborative.validation.api.ValidationConfiguration in project sirius-components by eclipse-sirius.

the class ValidationEventProcessorFactory method createRepresentationEventProcessor.

@Override
public <T extends IRepresentationEventProcessor> Optional<T> createRepresentationEventProcessor(Class<T> representationEventProcessorClass, IRepresentationConfiguration configuration, IEditingContext editingContext) {
    if (IValidationEventProcessor.class.isAssignableFrom(representationEventProcessorClass) && configuration instanceof ValidationConfiguration) {
        ValidationDescription validationDescription = this.validationDescriptionProvider.getDescription();
        ValidationContext validationContext = new ValidationContext(null);
        IRepresentationEventProcessor validationEventProcessor = new ValidationEventProcessor(editingContext, validationDescription, validationContext, this.validationEventHandlers, this.subscriptionManagerFactory.create(), new SimpleMeterRegistry(), this.representationRefreshPolicyRegistry);
        // @formatter:off
        return Optional.of(validationEventProcessor).filter(representationEventProcessorClass::isInstance).map(representationEventProcessorClass::cast);
    // @formatter:on
    }
    return Optional.empty();
}
Also used : ValidationDescription(org.eclipse.sirius.components.validation.description.ValidationDescription) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) IValidationEventProcessor(org.eclipse.sirius.components.collaborative.validation.api.IValidationEventProcessor) ValidationConfiguration(org.eclipse.sirius.components.collaborative.validation.api.ValidationConfiguration) IValidationEventProcessor(org.eclipse.sirius.components.collaborative.validation.api.IValidationEventProcessor) IRepresentationEventProcessor(org.eclipse.sirius.components.collaborative.api.IRepresentationEventProcessor)

Aggregations

SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)1 IRepresentationEventProcessor (org.eclipse.sirius.components.collaborative.api.IRepresentationEventProcessor)1 IValidationEventProcessor (org.eclipse.sirius.components.collaborative.validation.api.IValidationEventProcessor)1 ValidationConfiguration (org.eclipse.sirius.components.collaborative.validation.api.ValidationConfiguration)1 ValidationDescription (org.eclipse.sirius.components.validation.description.ValidationDescription)1