From a812f2aa123e984fd55d597fdc1a2d9d3eabd66a Mon Sep 17 00:00:00 2001 From: Jerome Gout Date: Fri, 3 Jul 2026 16:18:23 +0200 Subject: [PATCH] [2320] Fix feedback when user tries to reconnect Actor's edge Bug: https://github.com/eclipse-syson/syson/issues/2320 Signed-off-by: Jerome Gout --- CHANGELOG.adoc | 1 + .../common/view/services/ViewToolService.java | 17 +++++++++++++++++ .../NestedActorEdgeDescriptionProvider.java | 10 +++++++++- .../pages/release-notes/2026.7.0.adoc | 1 + 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 823f2f106..3c36ed686 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -36,6 +36,7 @@ It has long been unused by Sirius Web itself (since the transition to MUI). - https://github.com/eclipse-syson/syson/issues/2306[#2306] [diagrams] Fixed an error when trying to rename a constraint displayed as a list item through direct edit. - https://github.com/eclipse-syson/syson/issues/2318[#2318] [diagrams] Direct edit on a constraint label now ignores the expression part (`{ ... }`) if present in the new text. - https://github.com/eclipse-syson/syson/issues/2331[#2331] [diagrams] Fix the broken `New Interface` tool icon. +- https://github.com/eclipse-syson/syson/issues/2320[#2320] [diagrams] Add an explicit warning message when user tries to reconnect one Actor's edge to another Actor. === Improvements diff --git a/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java b/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java index 13736845f..9631abaf4 100644 --- a/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java +++ b/backend/views/syson-diagram-common-view/src/main/java/org/eclipse/syson/diagram/common/view/services/ViewToolService.java @@ -300,6 +300,23 @@ public Element reconnectSourceNestedActorEdge(Element self, Element newSource, E return otherEnd; } + /** + * Reconnects the target of a nested actor edge (the Actor side of the edge). + * This service is only used because edge preconditions are not taken into account. + * + * @param self + * the current UseCase or Requirement + * @return the given self + */ + public Element reconnectTargetNestedActorEdge(Element self) { + // due to https://github.com/eclipse-sirius/sirius-web/issues/2930 we cannot prevent the user to do the reconnect, + // so we just warn him/her that this is not possible. + String errorMessage = "An Actor cannot be disconnected from its UseCase or its Requirement element"; + this.logger.warn(errorMessage); + this.feedbackMessageService.addFeedbackMessage(new Message(errorMessage, MessageLevel.WARNING)); + return self; + } + /** * Reconnects the source of a nested stakeholder edge. *

diff --git a/backend/views/syson-standard-diagrams-view/src/main/java/org/eclipse/syson/standard/diagrams/view/edges/NestedActorEdgeDescriptionProvider.java b/backend/views/syson-standard-diagrams-view/src/main/java/org/eclipse/syson/standard/diagrams/view/edges/NestedActorEdgeDescriptionProvider.java index d9f10e06d..feaef81bc 100644 --- a/backend/views/syson-standard-diagrams-view/src/main/java/org/eclipse/syson/standard/diagrams/view/edges/NestedActorEdgeDescriptionProvider.java +++ b/backend/views/syson-standard-diagrams-view/src/main/java/org/eclipse/syson/standard/diagrams/view/edges/NestedActorEdgeDescriptionProvider.java @@ -120,9 +120,17 @@ protected ChangeContextBuilder getSourceReconnectToolBody() { @Override protected ChangeContextBuilder getTargetReconnectToolBody() { + // Because of https://github.com/eclipse-sirius/sirius-web/issues/2930, it is not possible to prevent user to do the reconnection. + return this.viewBuilderHelper.newChangeContext() + .expression(ServiceMethod.of0(ViewToolService::reconnectTargetNestedActorEdge).aql(AQLConstants.EDGE_SEMANTIC_ELEMENT)); + } + + @Override + protected String getTargetReconnectToolPreconditionExpression() { // It is not possible to reconnect the target (actor) of this edge. This would mean that the existing actor is // not contained in a UseCase/Requirement anymore. - return this.viewBuilderHelper.newChangeContext(); + // Once https://github.com/eclipse-sirius/sirius-web/issues/2930 is fixed, this precondition could be evaluated. + return "aql:false"; } } diff --git a/doc/content/modules/user-manual/pages/release-notes/2026.7.0.adoc b/doc/content/modules/user-manual/pages/release-notes/2026.7.0.adoc index 376240678..2443c6d9f 100644 --- a/doc/content/modules/user-manual/pages/release-notes/2026.7.0.adoc +++ b/doc/content/modules/user-manual/pages/release-notes/2026.7.0.adoc @@ -108,6 +108,7 @@ Now, the label dynamically adapts based on whether the `ConcernUsage` or `Constr *** Elements without a name and an owned reference subsetting display only the reference subsetting name. *** Elements without a reference subsetting display their name. ** Fix the broken `New Interface` tool icon. +** Add an explicit warning message when user tries to reconnect one `Actor` 's graphical edge to another `Actor`. == Improvements