Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2018-08-24 11:24:41 -0400
committerNicolas FAUVERGUE2018-08-27 03:54:23 -0400
commit2956b6a0684f57185916bd290f2ff793269536fa (patch)
tree6a3d5ba30d9d769038357b8c7ec874d1140b2736
parenta707f2f45fa7848f6a99c4418348dd9e91fc9703 (diff)
downloadorg.eclipse.papyrus-2956b6a0684f57185916bd290f2ff793269536fa.tar.gz
org.eclipse.papyrus-2956b6a0684f57185916bd290f2ff793269536fa.tar.xz
org.eclipse.papyrus-2956b6a0684f57185916bd290f2ff793269536fa.zip
Bug 538256: [Sequence Diagram] Resizing ExecutionSpecification with
oblique start message move incorrectly the message - For the oblique message, manage differently the oblique start or end message of ExecutionSpecification Change-Id: Idc5d92db4fc7274e4d6ee3296a000f880de0dad3 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java
index 5ef5505d2e3..b17ca9ff235 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateConnectionReferenceEditPolicy.java
@@ -10,6 +10,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Nicolas FAUVERGUE (nicolas.fauvergue@cea.fr) - Bug 538256
*
*****************************************************************************/
@@ -67,9 +68,11 @@ public class UpdateConnectionReferenceEditPolicy extends GraphicalEditPolicy {
if (request instanceof ChangeBoundsRequest && (!org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_AUTOSIZE.equals(request.getType()))) {
Point nextLocation = ((ChangeBoundsRequest) request).getLocation();
UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG, "+ MOVE at " + nextLocation + " of " + getHost());//$NON-NLS-1$ //$NON-NLS-2$
- Rectangle locationAndSize = new PrecisionRectangle(getHostFigure().getBounds());
+ Rectangle initialLocationAndSize = new PrecisionRectangle(getHostFigure().getBounds());
+ Rectangle locationAndSize = new Rectangle(initialLocationAndSize);
if (getHost() instanceof AbstractExecutionSpecificationEditPart) {
+ getHostFigure().translateToAbsolute(initialLocationAndSize);
getHostFigure().translateToAbsolute(locationAndSize);
locationAndSize = ((ChangeBoundsRequest) request).getTransformedRectangle(locationAndSize);
}
@@ -84,20 +87,25 @@ public class UpdateConnectionReferenceEditPolicy extends GraphicalEditPolicy {
if (editPart instanceof ConnectionEditPart) {
ConnectionEditPart connectionEditPart = (ConnectionEditPart) editPart;
ArrayList<EditPart> senderList = SenderRequestUtils.getSenders(request);
-
+
// Calculate the target position if the message is not vertical
+ final Rectangle startLocation = new Rectangle(locationAndSize);
final Rectangle endLocation = new Rectangle(locationAndSize);
- if(connectionEditPart instanceof ConnectionNodeEditPart) {
+ if (connectionEditPart instanceof ConnectionNodeEditPart) {
final Point startPoint = SequenceUtil.getAbsoluteEdgeExtremity((ConnectionNodeEditPart) connectionEditPart, true);
final Point endPoint = SequenceUtil.getAbsoluteEdgeExtremity((ConnectionNodeEditPart) connectionEditPart, false);
-
- if(endPoint.y() != startPoint.y()) {
- endLocation.setY(endLocation.y() + (endPoint.y() - startPoint.y()));
+
+ if (endPoint.y() != startPoint.y()) {
+ if (endPoint.y() <= initialLocationAndSize.y()) {
+ startLocation.setY(locationAndSize.y() - (endPoint.y() - startPoint.y()));
+ } else {
+ endLocation.setY(locationAndSize.y() + (endPoint.y() - startPoint.y()));
+ }
}
}
-
+
// create the request
- ReconnectRequest reconnectSourceRequest = createReconnectRequest(connectionEditPart, locationAndSize, senderList, RequestConstants.REQ_RECONNECT_SOURCE, references);
+ ReconnectRequest reconnectSourceRequest = createReconnectRequest(connectionEditPart, startLocation, senderList, RequestConstants.REQ_RECONNECT_SOURCE, references);
reconnectSourceRequest.getExtendedData().put(SequenceUtil.DO_NOT_CHECK_HORIZONTALITY, true);
ReconnectRequest reconnectTargetRequest = createReconnectRequest(connectionEditPart, endLocation, senderList, RequestConstants.REQ_RECONNECT_TARGET, references);
reconnectTargetRequest.getExtendedData().put(SequenceUtil.DO_NOT_CHECK_HORIZONTALITY, true);

Back to the top