Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2913 Fix NPE and edge source/target inversion #2924

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2024 THALES GLOBAL SERVICES.
* Copyright (c) 2025 THALES GLOBAL SERVICES.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand Down Expand Up @@ -139,10 +139,10 @@ private void migrateDEdge(DEdge dEdge) {
dEdge.setTargetNode(sourceNode);
dEdge.setBeginLabel(endLabel);
dEdge.setEndLabel(beginLabel);
sourceNodeIncommingEdges.add(dEdge);
targetNodeOutgoingEdges.add(dEdge);
sourceNodeOutgoingEdges.remove(dEdge);
targetNodeIncommingEdges.remove(dEdge);
sourceNodeIncommingEdges.add(dEdge);
targetNodeOutgoingEdges.add(dEdge);

dEdge.getOwnedStyle().setSourceArrow(targetArrow);
dEdge.getOwnedStyle().setTargetArrow(sourceArrow);
Expand Down Expand Up @@ -286,9 +286,11 @@ private void migrateGMFEdge(Edge gmfEdge) {
Optional<Node> endLabel = edgeChildren.stream().filter(this::isEndLabel).map(Node.class::cast).findAny();

// changes
beginLabel.ifPresent(label -> migrateLabelPosition(label, bendpointsList, revBendpointsList));
middleLabel.ifPresent(label -> migrateLabelPosition(label, bendpointsList, revBendpointsList));
endLabel.ifPresent(label -> migrateLabelPosition(label, bendpointsList, revBendpointsList));
if (!bendpointsList.isEmpty()) {
beginLabel.ifPresent(label -> migrateLabelPosition(label, bendpointsList, revBendpointsList));
middleLabel.ifPresent(label -> migrateLabelPosition(label, bendpointsList, revBendpointsList));
endLabel.ifPresent(label -> migrateLabelPosition(label, bendpointsList, revBendpointsList));
}

beginLabel.ifPresent(label -> label.setType(SiriusVisualIDRegistry.getType(DEdgeEndNameEditPart.VISUAL_ID)));
endLabel.ifPresent(label -> label.setType(SiriusVisualIDRegistry.getType(DEdgeBeginNameEditPart.VISUAL_ID)));
Expand Down