Search in sources :

Example 1 with ITreeEventHandler

use of org.eclipse.sirius.components.collaborative.trees.api.ITreeEventHandler in project sirius-components by eclipse-sirius.

the class TreeEventProcessor method handle.

@Override
public void handle(One<IPayload> payloadSink, Many<ChangeDescription> changeDescriptionSink, IRepresentationInput representationInput) {
    if (representationInput instanceof ITreeInput) {
        ITreeInput treeInput = (ITreeInput) representationInput;
        Optional<ITreeEventHandler> optionalTreeEventHandler = this.treeEventHandlers.stream().filter(handler -> handler.canHandle(treeInput)).findFirst();
        if (optionalTreeEventHandler.isPresent()) {
            ITreeEventHandler treeEventHandler = optionalTreeEventHandler.get();
            treeEventHandler.handle(payloadSink, changeDescriptionSink, this.editingContext, this.currentTree.get(), treeInput);
        } else {
            // $NON-NLS-1$
            this.logger.warn("No handler found for event: {}", treeInput);
        }
    }
}
Also used : Sinks(reactor.core.publisher.Sinks) IEditingContext(org.eclipse.sirius.components.core.api.IEditingContext) LoggerFactory(org.slf4j.LoggerFactory) One(reactor.core.publisher.Sinks.One) IInput(org.eclipse.sirius.components.core.api.IInput) AtomicReference(java.util.concurrent.atomic.AtomicReference) Timer(io.micrometer.core.instrument.Timer) Monitoring(org.eclipse.sirius.components.collaborative.api.Monitoring) IRepresentation(org.eclipse.sirius.components.representations.IRepresentation) IRepresentationRefreshPolicyRegistry(org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry) EmitResult(reactor.core.publisher.Sinks.EmitResult) ITreeEventProcessor(org.eclipse.sirius.components.collaborative.trees.api.ITreeEventProcessor) ChangeKind(org.eclipse.sirius.components.collaborative.api.ChangeKind) ISubscriptionManager(org.eclipse.sirius.components.collaborative.api.ISubscriptionManager) Logger(org.slf4j.Logger) ChangeDescription(org.eclipse.sirius.components.collaborative.api.ChangeDescription) Mono(reactor.core.publisher.Mono) IRepresentationInput(org.eclipse.sirius.components.core.api.IRepresentationInput) ITreeEventHandler(org.eclipse.sirius.components.collaborative.trees.api.ITreeEventHandler) IRepresentationRefreshPolicy(org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicy) ITreeInput(org.eclipse.sirius.components.collaborative.trees.api.ITreeInput) ITreeService(org.eclipse.sirius.components.collaborative.trees.api.ITreeService) Objects(java.util.Objects) TimeUnit(java.util.concurrent.TimeUnit) Flux(reactor.core.publisher.Flux) List(java.util.List) IPayload(org.eclipse.sirius.components.core.api.IPayload) TreeRefreshedEventPayload(org.eclipse.sirius.components.collaborative.trees.dto.TreeRefreshedEventPayload) MeterRegistry(io.micrometer.core.instrument.MeterRegistry) TreeCreationParameters(org.eclipse.sirius.components.collaborative.trees.api.TreeCreationParameters) Many(reactor.core.publisher.Sinks.Many) Optional(java.util.Optional) Tree(org.eclipse.sirius.components.trees.Tree) ITreeInput(org.eclipse.sirius.components.collaborative.trees.api.ITreeInput) ITreeEventHandler(org.eclipse.sirius.components.collaborative.trees.api.ITreeEventHandler)

Aggregations

MeterRegistry (io.micrometer.core.instrument.MeterRegistry)1 Timer (io.micrometer.core.instrument.Timer)1 List (java.util.List)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 TimeUnit (java.util.concurrent.TimeUnit)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 ChangeDescription (org.eclipse.sirius.components.collaborative.api.ChangeDescription)1 ChangeKind (org.eclipse.sirius.components.collaborative.api.ChangeKind)1 IRepresentationRefreshPolicy (org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicy)1 IRepresentationRefreshPolicyRegistry (org.eclipse.sirius.components.collaborative.api.IRepresentationRefreshPolicyRegistry)1 ISubscriptionManager (org.eclipse.sirius.components.collaborative.api.ISubscriptionManager)1 Monitoring (org.eclipse.sirius.components.collaborative.api.Monitoring)1 ITreeEventHandler (org.eclipse.sirius.components.collaborative.trees.api.ITreeEventHandler)1 ITreeEventProcessor (org.eclipse.sirius.components.collaborative.trees.api.ITreeEventProcessor)1 ITreeInput (org.eclipse.sirius.components.collaborative.trees.api.ITreeInput)1 ITreeService (org.eclipse.sirius.components.collaborative.trees.api.ITreeService)1 TreeCreationParameters (org.eclipse.sirius.components.collaborative.trees.api.TreeCreationParameters)1 TreeRefreshedEventPayload (org.eclipse.sirius.components.collaborative.trees.dto.TreeRefreshedEventPayload)1 IEditingContext (org.eclipse.sirius.components.core.api.IEditingContext)1