From 254ca708fbd0c969b6951c440deeeffb91c1074e 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 | 96 +++++++++++++++++++ 2 files changed, 97 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 cd6e24f65b..18898538b8 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 0000000000..c223d0a406 --- /dev/null +++ b/doc/adrs/086_allow_single_click_tools_to_be_executed_on_edges.adoc @@ -0,0 +1,96 @@ += 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 { +} + +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! +} + +type NodeDescription implements DiagramElementDescription { + synchronizationPolicy: SynchronizationPolicy! + borderNodeDescriptions: [NodeDescription!]! + childNodeDescriptions: [NodeDescription!]! +} + +type EdgeDescription implements DiagramElementDescription { + 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 (out-of-scope) + +`ViewDiagramDescriptionConverter.java` and `ViewToolSectionsProvider.java` should be updated to handle edges in addition to nodes. + +==== sirius-components-compatibility + +`CompatibilityToolSectionsProvider.java` and `ToolProvider.java` will be updated to handle edges in addition to nodes. + +== Status + +WIP