Skip to content

Commit

Permalink
[doc] add ADR for the support of Edges as targets of single click tools
Browse files Browse the repository at this point in the history
Bug: #1574
Signed-off-by: Axel RICHARD <axel.richard@obeo.fr>
  • Loading branch information
AxelRICHARD committed Jan 12, 2023
1 parent 060532e commit 22a313f
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.adoc
Expand Up @@ -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

Expand Down
99 changes: 99 additions & 0 deletions 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

0 comments on commit 22a313f

Please sign in to comment.