use of org.eclipse.sirius.components.collaborative.trees.api.TreeCreationParameters 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();
}
Aggregations