Search in sources :

Example 1 with TreeConfiguration

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

the class TreeEventProcessorFactory method createRepresentationEventProcessor.

@Override
public <T extends IRepresentationEventProcessor> Optional<T> createRepresentationEventProcessor(Class<T> representationEventProcessorClass, IRepresentationConfiguration configuration, IEditingContext editingContext) {
    if (ITreeEventProcessor.class.isAssignableFrom(representationEventProcessorClass) && configuration instanceof TreeConfiguration) {
        TreeConfiguration treeConfiguration = (TreeConfiguration) configuration;
        TreeDescription treeDescription = this.explorerDescriptionProvider.getDescription();
        // @formatter:off
        TreeCreationParameters treeCreationParameters = TreeCreationParameters.newTreeCreationParameters(treeConfiguration.getId()).treeDescription(treeDescription).expanded(treeConfiguration.getExpanded()).editingContext(editingContext).build();
        // @formatter:on
        IRepresentationEventProcessor treeEventProcessor = new TreeEventProcessor(editingContext, this.treeService, treeCreationParameters, this.treeEventHandlers, this.subscriptionManagerFactory.create(), new SimpleMeterRegistry(), this.representationRefreshPolicyRegistry);
        // @formatter:off
        return Optional.of(treeEventProcessor).filter(representationEventProcessorClass::isInstance).map(representationEventProcessorClass::cast);
    // @formatter:on
    }
    return Optional.empty();
}
Also used : TreeCreationParameters(org.eclipse.sirius.components.collaborative.trees.api.TreeCreationParameters) ITreeEventProcessor(org.eclipse.sirius.components.collaborative.trees.api.ITreeEventProcessor) TreeDescription(org.eclipse.sirius.components.trees.description.TreeDescription) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) ITreeEventProcessor(org.eclipse.sirius.components.collaborative.trees.api.ITreeEventProcessor) TreeConfiguration(org.eclipse.sirius.components.collaborative.trees.api.TreeConfiguration) 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 ITreeEventProcessor (org.eclipse.sirius.components.collaborative.trees.api.ITreeEventProcessor)1 TreeConfiguration (org.eclipse.sirius.components.collaborative.trees.api.TreeConfiguration)1 TreeCreationParameters (org.eclipse.sirius.components.collaborative.trees.api.TreeCreationParameters)1 TreeDescription (org.eclipse.sirius.components.trees.description.TreeDescription)1