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..7dddef6b76 --- /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