From 22a313fb132695be700c18fcf4ab9f405748098d Mon Sep 17 00:00:00 2001 From: Axel RICHARD Date: Wed, 11 Jan 2023 17:19:35 +0100 Subject: [PATCH] [doc] add ADR for the support of Edges as targets of single click tools Bug: https://github.com/eclipse-sirius/sirius-components/issues/1574 Signed-off-by: Axel RICHARD --- CHANGELOG.adoc | 1 + ...e_click_tools_to_be_executed_on_edges.adoc | 99 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 doc/adrs/086_allow_single_click_tools_to_be_executed_on_edges.adoc diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index cd6e24f65bb..18898538b87 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -5,6 +5,7 @@ === Architectural decision records - [ADR-085] Add support for project templates +- [ADR-086] Add support of Edges as targets of single click tools === Breaking changes diff --git a/doc/adrs/086_allow_single_click_tools_to_be_executed_on_edges.adoc b/doc/adrs/086_allow_single_click_tools_to_be_executed_on_edges.adoc new file mode 100644 index 00000000000..7dddef6b76a --- /dev/null +++ b/doc/adrs/086_allow_single_click_tools_to_be_executed_on_edges.adoc @@ -0,0 +1,99 @@ += ADR-086 - Allow single click tools to be executed on edges + +== Context + +Today a single click tool can only be executed on Nodes. An enhancement could be to allow single click tools to also be executed on Edges as it is the case in Sirius Desktop. + +== Decision + +Single click tools can also be executed on Edges. + +=== Frontend + +In `DiagramRepresentation.types.ts`, a new interface named `DiagramElementDescription` will be introduced. +`NodeDescription` (there is no `EdgeDescription` in this file) will implement it. +The target descriptions of a `SingleClickOnDiagramElementTool` will be `DiagramElementDescription` instead of `NodeDescription`. + +[source,ts] +---- +export interface DiagramElementDescription { + id: string; +} + +export interface NodeDescription extends DiagramElementDescription { + id: string; +} + +export interface SingleClickOnDiagramElementTool extends Tool { + appliesToDiagramRoot: boolean; + selectionDescriptionId: string; + targetDescriptions: DiagramElementDescription[]; +} +---- + +=== Backend + +==== sirius-components-collaborative-diagrams + +In `diagram.graphqls`, a new interface `DiagramElementDescription` will be introduced. `NodeDescription` and `EdgeDescription` will implement it. + +The target descriptions of a `SingleClickOnDiagramElementTool` will be `DiagramElementDescription` instead of `NodeDescription`. + +[source,graphql] +---- +interface DiagramElementDescription { + id: ID! + synchronizationPolicy: SynchronizationPolicy! +} + +type NodeDescription implements DiagramElementDescription { + id: ID! + synchronizationPolicy: SynchronizationPolicy! + borderNodeDescriptions: [NodeDescription!]! + childNodeDescriptions: [NodeDescription!]! +} + +type EdgeDescription implements DiagramElementDescription { + id: ID! + synchronizationPolicy: SynchronizationPolicy! + sourceNodeDescriptions: [NodeDescription!]! + targetNodeDescriptions: [NodeDescription!]! +} + +type SingleClickOnDiagramElementTool implements Tool { + id: ID! + label: String! + imageURL: String! + appliesToDiagramRoot: Boolean! + selectionDescriptionId: String + targetDescriptions: [DiagramElementDescription!]! +} +---- + +In `InvokeSingleClickOnDiagramElementToolEventHandler.java`, the `executeTool` method shall handle edges in addition to nodes. + +==== sirius-components-diagrams + +A new interface named `IDiagramElementDescription.java` will be introduced. +`NodeDescription.java` and `EdgeDescription.java` will implement it. + +[source,java] +---- +public interface IDiagramElementDescription { + UUID getId(); +} +---- + +The target descriptions of `SingleClickOnDiagramElementTool.java` will be `DiagramElementDescription` instead of `NodeDescription`. + +==== sirius-components-view-emf + +`ViewDiagramDescriptionConverter.java` && `ViewToolSectionsProvider.java` will be updated to handle edges in addition to nodes. + +==== sirius-components-compatibility + +`CompatibilityToolSectionsProvider.java` && `ToolProvider.java` will be updated to handle edges in addition to nodes. + +== Status + +WIP