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
}
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
}
Aggregations