Skip to content

Commit

Permalink
[352] Fix edge smoothness setting
Browse files Browse the repository at this point in the history
Bug: #352
Signed-off-by: Pierre-Charles David <[email protected]>
  • Loading branch information
pcdavid committed Jun 27, 2024
1 parent 049f646 commit cba2097
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2021 THALES GLOBAL SERVICES and others.
* Copyright (c) 2008, 2024 THALES GLOBAL SERVICES and others.
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
Expand Down Expand Up @@ -44,8 +44,10 @@
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
import org.eclipse.gmf.runtime.draw2d.ui.internal.routers.ITreeConnection;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
import org.eclipse.gmf.runtime.notation.RoutingStyle;
import org.eclipse.gmf.runtime.notation.Smoothness;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.sirius.common.tools.api.util.StringUtil;
import org.eclipse.sirius.diagram.DDiagram;
Expand Down Expand Up @@ -199,6 +201,31 @@ public Command getCommand(final Request request) {
final Command cmd = super.getCommand(request);
return CommonEditPartOperation.handleAutoPinOnInteractiveMove(this, request, cmd);
}

@Override
protected void refreshSmoothness() {
super.refreshSmoothness();
Connection connection = getConnectionFigure();
if (!(connection instanceof SiriusPolylineConnectionEx)) {
return;
}

SiriusPolylineConnectionEx poly = (SiriusPolylineConnectionEx) connection;
RoutingStyle style = (RoutingStyle) ((View) getModel()).getStyle(NotationPackage.Literals.ROUTING_STYLE);
if (style != null) {
Smoothness smoothness = style.getSmoothness();

if (Smoothness.LESS_LITERAL == smoothness) {
poly.setSiriusSmoothness(PolylineConnectionEx.SMOOTH_LESS);
} else if (Smoothness.NORMAL_LITERAL == smoothness) {
poly.setSiriusSmoothness(PolylineConnectionEx.SMOOTH_NORMAL);
} else if (Smoothness.MORE_LITERAL == smoothness) {
poly.setSiriusSmoothness(PolylineConnectionEx.SMOOTH_MORE);
} else if (Smoothness.NONE_LITERAL == smoothness) {
poly.setSiriusSmoothness(PolylineConnectionEx.SMOOTH_NONE);
}
}
}

@Override
protected void addNotationalListeners() {
Expand Down

0 comments on commit cba2097

Please sign in to comment.