Search in sources :

Example 1 with SelectModelElementVariableProvider

use of org.eclipse.sirius.components.compatibility.services.SelectModelElementVariableProvider in project sirius-components by eclipse-sirius.

the class ToolProvider method convertContainerCreationDescription.

private SingleClickOnDiagramElementTool convertContainerCreationDescription(Map<UUID, NodeDescription> id2NodeDescriptions, AQLInterpreter interpreter, ContainerCreationDescription containerCreationDescription) {
    String id = this.identifierProvider.getIdentifier(containerCreationDescription);
    String label = new IdentifiedElementQuery(containerCreationDescription).getLabel();
    String imagePath = this.toolImageProviderFactory.getToolImageProvider(containerCreationDescription).get();
    List<NodeDescription> targetDescriptions = this.getParentNodeDescriptions(containerCreationDescription.getContainerMappings(), id2NodeDescriptions);
    var selectModelElementVariableOpt = new SelectModelElementVariableProvider().getSelectModelElementVariable(containerCreationDescription.getVariable());
    String selectionDescriptionId = null;
    if (selectModelElementVariableOpt.isPresent()) {
        selectionDescriptionId = this.identifierProvider.getIdentifier(selectModelElementVariableOpt.get());
    }
    // @formatter:off
    return SingleClickOnDiagramElementTool.newSingleClickOnDiagramElementTool(id).label(label).imageURL(imagePath).handler(this.createContainerCreationHandler(interpreter, containerCreationDescription)).targetDescriptions(targetDescriptions).appliesToDiagramRoot(this.atLeastOneRootMapping(containerCreationDescription.getContainerMappings())).selectionDescriptionId(selectionDescriptionId).build();
// @formatter:on
}
Also used : NodeDescription(org.eclipse.sirius.components.diagrams.description.NodeDescription) IdentifiedElementQuery(org.eclipse.sirius.business.api.query.IdentifiedElementQuery) SelectModelElementVariableProvider(org.eclipse.sirius.components.compatibility.services.SelectModelElementVariableProvider)

Example 2 with SelectModelElementVariableProvider

use of org.eclipse.sirius.components.compatibility.services.SelectModelElementVariableProvider in project sirius-components by eclipse-sirius.

the class ToolProvider method convertNodeCreationDescription.

private SingleClickOnDiagramElementTool convertNodeCreationDescription(Map<UUID, NodeDescription> id2NodeDescriptions, AQLInterpreter interpreter, NodeCreationDescription nodeCreationTool) {
    String id = this.identifierProvider.getIdentifier(nodeCreationTool);
    String label = new IdentifiedElementQuery(nodeCreationTool).getLabel();
    String imagePath = this.toolImageProviderFactory.getToolImageProvider(nodeCreationTool).get();
    List<NodeDescription> targetDescriptions = this.getParentNodeDescriptions(nodeCreationTool.getNodeMappings(), id2NodeDescriptions);
    var selectModelElementVariableOpt = new SelectModelElementVariableProvider().getSelectModelElementVariable(nodeCreationTool.getVariable());
    String selectionDescriptionId = null;
    if (selectModelElementVariableOpt.isPresent()) {
        selectionDescriptionId = this.identifierProvider.getIdentifier(selectModelElementVariableOpt.get());
    }
    // @formatter:off
    return SingleClickOnDiagramElementTool.newSingleClickOnDiagramElementTool(id).label(label).imageURL(imagePath).handler(this.createNodeCreationHandler(interpreter, nodeCreationTool)).targetDescriptions(targetDescriptions).appliesToDiagramRoot(this.atLeastOneRootMapping(nodeCreationTool.getNodeMappings())).selectionDescriptionId(selectionDescriptionId).build();
// @formatter:on
}
Also used : NodeDescription(org.eclipse.sirius.components.diagrams.description.NodeDescription) IdentifiedElementQuery(org.eclipse.sirius.business.api.query.IdentifiedElementQuery) SelectModelElementVariableProvider(org.eclipse.sirius.components.compatibility.services.SelectModelElementVariableProvider)

Aggregations

IdentifiedElementQuery (org.eclipse.sirius.business.api.query.IdentifiedElementQuery)2 SelectModelElementVariableProvider (org.eclipse.sirius.components.compatibility.services.SelectModelElementVariableProvider)2 NodeDescription (org.eclipse.sirius.components.diagrams.description.NodeDescription)2