Steps to reproduce
- In a General View diagram, create an Action
- Open
action flow compartment
- Create a nested action inside the first one
- Create a
Done Action
- Create an edge starting the action to the Done action.
- In the edge menu choose
New Connection (connect)
Expected behavior
A new connection edge appears between action usage and done action.
Actual behavior
Nothing happens: the menu does not close, and no edge is created.
The project is corrupted and can no longer be opened.
Fix
This issue is caused by the fact that the connection creation service (org.eclipse.syson.diagram.services.DiagramMutationElementService#createConnectionUsage) uses the semantic parents of the given source and target elements.
In the pathological case, the target element belongs to a library because the start and end actions are directly those defined in Actions.
The proposed fix is to retrieve the parents using the graphical nodes instead.
First, we need to look up the parent nodes of the edge source and target nodes. Then, using the object IDs from those nodes, we can retrieve the semantic elements associated with those IDs.
This way, we ensure that the parents of the library elements represented in the diagram are correct.
In the org.eclipse.syson.diagram.common.view.services.ViewCreateService class, there is a method that already does this parent retrieval:
private Element getSourceOwner(Node sourceNode, IEditingContext editingContext, IDiagramService diagramService) {
Diagram diagram = diagramService.getDiagramContext().diagram();
String id;
var parentNode = new NodeFinder(diagram).getParent(sourceNode);
if (parentNode instanceof Node node) {
id = node.getTargetObjectId();
} else {
// parent is diagram
id = diagram.getTargetObjectId();
}
return this.objectSearchService.getObject(editingContext, id)
.filter(Element.class::isInstance)
.map(Element.class::cast)
.orElse(null);
}
We might need to expose the method above in order to use it in org.eclipse.syson.diagram.services.DiagramMutationElementService#createConnectionUsage.
Steps to reproduce
action flowcompartmentDone ActionNew Connection (connect)Expected behavior
A new connection edge appears between action usage and done action.
Actual behavior
Nothing happens: the menu does not close, and no edge is created.
The project is corrupted and can no longer be opened.
Fix
This issue is caused by the fact that the connection creation service (
org.eclipse.syson.diagram.services.DiagramMutationElementService#createConnectionUsage) uses the semantic parents of the given source and target elements.In the pathological case, the target element belongs to a library because the start and end actions are directly those defined in
Actions.The proposed fix is to retrieve the parents using the graphical nodes instead.
First, we need to look up the parent nodes of the edge source and target nodes. Then, using the object IDs from those nodes, we can retrieve the semantic elements associated with those IDs.
This way, we ensure that the parents of the library elements represented in the diagram are correct.
In the
org.eclipse.syson.diagram.common.view.services.ViewCreateServiceclass, there is a method that already does this parent retrieval:We might need to expose the method above in order to use it in
org.eclipse.syson.diagram.services.DiagramMutationElementService#createConnectionUsage.