Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-12-10 08:55:29 +0000
committerptessier2014-12-10 08:55:29 +0000
commit5c7dd9c031fe0ba0fab49817f3aeaea095537013 (patch)
treec4a86e8290a42adc753c4b42aadd70e1688a36fb /plugins/uml
parent5344eb6dc1f37e2316a77b9bdb3135d238894dfd (diff)
parent37076154b2b7c1b286f0ab51811901a67c13b80e (diff)
downloadorg.eclipse.papyrus-5c7dd9c031fe0ba0fab49817f3aeaea095537013.tar.gz
org.eclipse.papyrus-5c7dd9c031fe0ba0fab49817f3aeaea095537013.tar.xz
org.eclipse.papyrus-5c7dd9c031fe0ba0fab49817f3aeaea095537013.zip
Merge branch 'streams/1.0-maintenance' of ssh://ptessier@git.eclipse.org:29418/papyrus/org.eclipse.papyrus into streams/1.0-maintenance
Diffstat (limited to 'plugins/uml')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java25
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java81
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionOperandEditPart.java11
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName2EditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName3EditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName4EditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName5EditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName6EditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName7EditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageNameEditPart.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateEditPart.java12
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java42
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java22
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java20
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java152
15 files changed, 252 insertions, 155 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java
index d2284573c8a..91d58f5832f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PaletteProfileApplicationListener.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2009 CEA LIST.
+ * Copyright (c) 2009, 2014 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 454578
*
*****************************************************************************/
@@ -19,6 +20,7 @@ import org.eclipse.papyrus.commands.Activator;
import org.eclipse.papyrus.infra.core.listenerservice.IPapyrusListener;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
import org.eclipse.uml2.uml.ProfileApplication;
@@ -50,7 +52,22 @@ public class PaletteProfileApplicationListener implements IPapyrusListener {
if (editor == null) {
return;
}
- PapyrusPaletteService.getInstance().providerChanged(new ProviderChangeEvent(PapyrusPaletteService.getInstance()));
+
+ Display display = editor.getSite().getWorkbenchWindow().getShell().getDisplay();
+ if ((display != null) && (display != Display.getCurrent())) {
+ // Update the palette service on the UI thread because it may need to add/remove palette content,
+ // which implies changing SWT controls
+ display.asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ updatePaletteService();
+ }
+ });
+ } else {
+ // Just do it synchronously
+ updatePaletteService();
+ }
} catch (ServiceException ex) {
// Nothing to do. The ServiceRegistry is not available or there is no active editor. Don't update the palette
} catch (Exception ex) {
@@ -60,4 +77,8 @@ public class PaletteProfileApplicationListener implements IPapyrusListener {
}
}
}
+
+ protected void updatePaletteService() {
+ PapyrusPaletteService.getInstance().providerChanged(new ProviderChangeEvent(PapyrusPaletteService.getInstance()));
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java
index e5a8094652d..85aa058014e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/AbstractExecutionSpecificationEditPart.java
@@ -1,6 +1,7 @@
package org.eclipse.papyrus.uml.diagram.sequence.edit.parts;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.draw2d.ConnectionAnchor;
@@ -22,6 +23,7 @@ import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
import org.eclipse.gef.commands.UnexecutableCommand;
import org.eclipse.gef.handles.HandleBounds;
import org.eclipse.gef.requests.ChangeBoundsRequest;
@@ -60,6 +62,7 @@ import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.LifelineXYLayoutEd
import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes;
import org.eclipse.papyrus.uml.diagram.sequence.util.HighlightUtil;
import org.eclipse.papyrus.uml.diagram.sequence.util.LifelineEditPartUtil;
+import org.eclipse.papyrus.uml.diagram.sequence.util.SequenceUtil;
import org.eclipse.papyrus.uml.diagram.stereotype.edition.editpolicies.AppliedStereotypeCommentCreationEditPolicy;
import org.eclipse.swt.graphics.Color;
import org.eclipse.uml2.uml.ExecutionSpecification;
@@ -141,25 +144,81 @@ public abstract class AbstractExecutionSpecificationEditPart extends ShapeNodeEd
@Override
protected Command getResizeCommand(ChangeBoundsRequest request) {
- // Bugfix: Avoid resize ES with the child size is little than parent one.
+ CompoundCommand command = new CompoundCommand();
+ command.add(super.getResizeCommand(request));
EditPart host = getHost();
+ LifelineEditPart lifelinePart = SequenceUtil.getParentLifelinePart(host);
+ // Calculate children levels
List<ShapeNodeEditPart> movedChildrenParts = LifelineXYLayoutEditPolicy.getAffixedExecutionSpecificationEditParts((ShapeNodeEditPart) host);
- Rectangle r = getInitialFeedbackBounds().getCopy();
- getHostFigure().translateToAbsolute(r);
- r.translate(0, request.getMoveDelta().y);
- r.resize(0, request.getSizeDelta().height);
+ List<ShapeNodeEditPart> testChildrenParts = new ArrayList<ShapeNodeEditPart>(movedChildrenParts);
+ HashMap<ShapeNodeEditPart, Integer> childrenLevels = new HashMap<ShapeNodeEditPart, Integer>();
+ Integer currentLevel = 0;
+ while (!testChildrenParts.isEmpty()) {
+ currentLevel ++;
+ List<ShapeNodeEditPart> testChildrenPartsNew = new ArrayList<ShapeNodeEditPart>(testChildrenParts);
+ HashMap<ShapeNodeEditPart, Integer> childrenLevelsNew = new HashMap<ShapeNodeEditPart, Integer>(childrenLevels);
+ for (ShapeNodeEditPart child : testChildrenParts) {
+ IFigure figure = child.getFigure();
+ Rectangle childRect = figure.getBounds().getCopy();
+ if (figure instanceof HandleBounds) {
+ childRect = ((HandleBounds) figure).getBounds().getCopy();
+ }
+ movedChildrenParts.remove(child);
+ ShapeNodeEditPart parentTest = LifelineXYLayoutEditPolicy.getParent(lifelinePart, childRect, movedChildrenParts);
+ movedChildrenParts.add(child);
+ if (childrenLevels.containsKey(parentTest) || parentTest == null) {
+ testChildrenPartsNew.remove(child);
+ childrenLevelsNew.put(child, currentLevel);
+ }
+ }
+ childrenLevels = childrenLevelsNew;
+ testChildrenParts = testChildrenPartsNew;
+ }
+ // Fetch basic coords
+ Rectangle rectRequest = getInitialFeedbackBounds().getCopy();
+ getHostFigure().translateToAbsolute(rectRequest);
+ rectRequest.translate(0, request.getMoveDelta().y);
+ rectRequest.resize(0, request.getSizeDelta().height);
for (ShapeNodeEditPart child : movedChildrenParts) {
IFigure figure = child.getFigure();
- Rectangle rect = figure.getBounds().getCopy();
+ Rectangle originalRect = figure.getBounds().getCopy();
if (figure instanceof HandleBounds) {
- rect = ((HandleBounds) figure).getBounds().getCopy();
+ originalRect = ((HandleBounds) figure).getBounds().getCopy();
}
- figure.translateToAbsolute(rect);
- if (rect.y < (r.y) || r.bottom() < (rect.y)) {
- return UnexecutableCommand.INSTANCE;
+ Integer level = childrenLevels.get(child);
+ Rectangle r = rectRequest.getCopy();
+ r.translate(0, level*LifelineXYLayoutEditPolicy.SPACING_HEIGHT);
+ r.resize(0, -2*level*LifelineXYLayoutEditPolicy.SPACING_HEIGHT);
+ Rectangle translatedRect = originalRect.getCopy();
+ figure.translateToAbsolute(translatedRect);
+ if (translatedRect.y < r.y || translatedRect.bottom() > r.bottom()) {
+ int moveAmount = 0;
+ int resizeAmount = 0;
+ if (translatedRect.y < r.y) {
+ moveAmount = r.y - translatedRect.y;
+ resizeAmount = moveAmount;
+ } else { // translatedRect.bottom() > r.bottom()
+ resizeAmount = translatedRect.bottom() - r.bottom();
+ }
+ if (translatedRect.height() - resizeAmount < figure.getMinimumSize().height()) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ // Resize child ES
+ ChangeBoundsRequest esRequest = new ChangeBoundsRequest(org.eclipse.gef.RequestConstants.REQ_MOVE);
+ esRequest.setEditParts(child);
+ esRequest.setResizeDirection(PositionConstants.SOUTH);
+ esRequest.setMoveDelta(new Point(0, moveAmount));
+ esRequest.setSizeDelta(new Dimension(0, -resizeAmount));
+ Command moveESCommand = LifelineXYLayoutEditPolicy.getResizeOrMoveChildrenCommand((LifelineEditPart) lifelinePart, esRequest, false, false, true);
+ if (moveESCommand != null && !moveESCommand.canExecute()) {
+ // forbid creation of the message if the es can't be moved correctly
+ return UnexecutableCommand.INSTANCE;
+ } else if (moveESCommand != null) {
+ command.add(moveESCommand);
+ }
}
}
- return super.getResizeCommand(request);
+ return command.unwrap();
}
@Override
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionOperandEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionOperandEditPart.java
index 88d64a46da4..1366114d47e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionOperandEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomInteractionOperandEditPart.java
@@ -232,8 +232,13 @@ public class CustomInteractionOperandEditPart extends InteractionOperandEditPart
}
static String getGuardLabelText(InteractionOperand interactionOperand, boolean edit) {
- CombinedFragment enclosingCF = (CombinedFragment) interactionOperand.getOwner();
- InteractionOperatorKind cfOperator = enclosingCF.getInteractionOperator();
+ Element operationOwner = interactionOperand.getOwner();
+ while (operationOwner != null && false == operationOwner instanceof CombinedFragment) {
+ operationOwner = operationOwner.getOwner();
+ }
+
+ CombinedFragment enclosingCF = (CombinedFragment) operationOwner;
+ InteractionOperatorKind cfOperator = enclosingCF != null ? enclosingCF.getInteractionOperator() : InteractionOperatorKind.SEQ_LITERAL;
InteractionConstraint guard = interactionOperand.getGuard();
String specValue = null;
if (guard != null) {
@@ -252,7 +257,7 @@ public class CustomInteractionOperandEditPart extends InteractionOperandEditPart
sb.append(condition);
}
}
- if (specValue == null) {
+ if (specValue == null && enclosingCF != null) {
EList<InteractionOperand> operands = enclosingCF.getOperands();
if (InteractionOperatorKind.ALT_LITERAL.equals(cfOperator) && interactionOperand.equals(operands.get(operands.size() - 1))) {
specValue = "else";
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName2EditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName2EditPart.java
index f31bdb8a94c..16a80508a7b 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName2EditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName2EditPart.java
@@ -21,6 +21,7 @@ import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.helper.NotificationHelper;
import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageLabelEditPolicy.ICustomMessageLabel;
@@ -59,6 +60,11 @@ public class CustomMessageName2EditPart extends MessageName2EditPart implements
super(view);
}
+ @Override
+ public int getDirectEditionType() {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
/**
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#deactivate()
*
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName3EditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName3EditPart.java
index 67fceab62ca..9050731a413 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName3EditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName3EditPart.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageLabelEditPolicy.ICustomMessageLabel;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.swt.SWT;
@@ -38,6 +39,11 @@ public class CustomMessageName3EditPart extends MessageName3EditPart implements
}
@Override
+ public int getDirectEditionType() {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ @Override
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getParent().getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
if (maskLabelPolicy == null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName4EditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName4EditPart.java
index c1f679da090..1b196b255db 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName4EditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName4EditPart.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageLabelEditPolicy.ICustomMessageLabel;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.swt.SWT;
@@ -38,6 +39,11 @@ public class CustomMessageName4EditPart extends MessageName4EditPart implements
}
@Override
+ public int getDirectEditionType() {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ @Override
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getParent().getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
if (maskLabelPolicy == null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName5EditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName5EditPart.java
index 79c4c74e3b2..cad20391d45 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName5EditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName5EditPart.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageLabelEditPolicy.ICustomMessageLabel;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.swt.SWT;
@@ -38,6 +39,11 @@ public class CustomMessageName5EditPart extends MessageName5EditPart implements
}
@Override
+ public int getDirectEditionType() {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ @Override
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getParent().getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
if (maskLabelPolicy == null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName6EditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName6EditPart.java
index f8a3056c14c..6bfc7609b40 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName6EditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName6EditPart.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageLabelEditPolicy.ICustomMessageLabel;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.swt.SWT;
@@ -38,6 +39,11 @@ public class CustomMessageName6EditPart extends MessageName6EditPart implements
}
@Override
+ public int getDirectEditionType() {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
+
+ @Override
protected void refreshLabel() {
EditPolicy maskLabelPolicy = getParent().getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
if (maskLabelPolicy == null) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName7EditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName7EditPart.java
index cdf650f28b1..bd857c82b04 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName7EditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageName7EditPart.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageLabelEditPolicy.ICustomMessageLabel;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.swt.SWT;
@@ -36,6 +37,11 @@ public class CustomMessageName7EditPart extends MessageName7EditPart implements
public CustomMessageName7EditPart(View view) {
super(view);
}
+
+ @Override
+ public int getDirectEditionType() {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
@Override
protected void refreshLabel() {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageNameEditPart.java
index babeb39b171..7628f0cb5b9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/CustomMessageNameEditPart.java
@@ -18,6 +18,7 @@ import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.MessageLabelEditPolicy.ICustomMessageLabel;
import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.UMLTextSelectionEditPolicy;
import org.eclipse.papyrus.uml.diagram.sequence.util.SelfMessageHelper;
@@ -37,6 +38,11 @@ public class CustomMessageNameEditPart extends MessageNameEditPart implements IC
public CustomMessageNameEditPart(View view) {
super(view);
}
+
+ @Override
+ public int getDirectEditionType() {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
@Override
public void refreshBounds() {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateEditPart.java
index 7d5782276b4..e540004b05c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateEditPart.java
@@ -388,6 +388,18 @@ public class GateEditPart extends AbstractBorderEditPart implements IBorderItemE
}
}
+ /**
+ * this method will return the primary child EditPart inside this edit part
+ *
+ * @return the primary child view inside this edit part
+ */
+ public EditPart getPrimaryChildEditPart() {
+ if (getChildren().size() > 0) {
+ return (EditPart) getChildren().get(0);
+ }
+ return super.getPrimaryChildEditPart();
+ }
+
public GateNameEditPart getLabelEditPart() {
IGraphicalEditPart labelEditPart = getChildBySemanticHint(GateNameEditPart.GATE_NAME_TYPE);
if (labelEditPart instanceof GateNameEditPart) {
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java
index c6cb2e180bc..3633ad93102 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/GateNameEditPart.java
@@ -4,7 +4,6 @@ import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.MarginBorder;
@@ -26,6 +25,7 @@ import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IPapyrusEditPart;
import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
import org.eclipse.papyrus.uml.diagram.common.figure.node.IPapyrusNodeUMLElementFigure;
import org.eclipse.papyrus.uml.diagram.common.util.MessageDirection;
@@ -66,6 +66,11 @@ public class GateNameEditPart extends BorderItemLabelEditPart implements IPapyru
public GateNameEditPart(View view) {
super(view);
}
+
+ @Override
+ public int getDirectEditionType() {
+ return IDirectEdition.DEFAULT_DIRECT_EDITOR;
+ }
@Override
protected void createDefaultEditPolicies() {
@@ -289,14 +294,12 @@ public class GateNameEditPart extends BorderItemLabelEditPart implements IPapyru
}
}
- public class GateNameFigure extends Figure implements ILabelFigure, IPapyrusNodeUMLElementFigure {
+ public class GateNameFigure extends WrappingLabel implements ILabelFigure, IPapyrusNodeUMLElementFigure {
protected static final String LEFT_BRACE = "{";
protected static final String RIGHT_BRACE = "}";
- private WrappingLabel namedLabel;
-
private Label stereotypesLabel;
private Label stereotypePropertiesLabel;
@@ -314,10 +317,8 @@ public class GateNameEditPart extends BorderItemLabelEditPart implements IPapyru
}
protected void createContents() {
- namedLabel = new WrappingLabel();
- namedLabel.setTextWrap(true);
- namedLabel.setAlignment(PositionConstants.CENTER);
- add(namedLabel);
+ setTextWrap(true);
+ setAlignment(PositionConstants.CENTER);
}
@Override
@@ -367,30 +368,5 @@ public class GateNameEditPart extends BorderItemLabelEditPart implements IPapyru
public Label getStereotypesLabel() {
return stereotypesLabel;
}
-
-
- @Override
- public void setText(String text) {
- namedLabel.setText(text);
- }
-
-
- @Override
- public String getText() {
- return namedLabel.getText();
- }
-
-
- @Override
- public void setIcon(Image icon) {
- namedLabel.setIcon(icon);
- }
-
-
- @Override
- public Image getIcon() {
- return namedLabel.getIcon();
- }
-
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java
index eba3b00d106..3b28af3563e 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionOperandDragDropEditPolicy.java
@@ -40,26 +40,26 @@ public class InteractionOperandDragDropEditPolicy extends ResizableEditPolicy {
*/
@Override
protected Command getResizeCommand(ChangeBoundsRequest request) {
- if ((request.getResizeDirection() & PositionConstants.EAST_WEST) != 0) {
+ boolean isVertResize = (request.getResizeDirection() & PositionConstants.NORTH_SOUTH) != 0;
+ boolean isHorResize = (request.getResizeDirection() & PositionConstants.EAST_WEST) != 0;
+ boolean isNorthResize = (request.getResizeDirection() & PositionConstants.NORTH) != 0;
+ boolean isSouthResize = (request.getResizeDirection() & PositionConstants.SOUTH) != 0;
+ if (isHorResize && !isVertResize) {
EditPart parent = getHost().getParent().getParent();
return parent.getCommand(request);
- } else {
+ } else if (isVertResize) {
if (this.getHost() instanceof InteractionOperandEditPart && this.getHost().getParent() instanceof CombinedFragmentCombinedFragmentCompartmentEditPart) {
InteractionOperandEditPart currentIOEP = (InteractionOperandEditPart) this.getHost();
CombinedFragmentCombinedFragmentCompartmentEditPart compartEP = (CombinedFragmentCombinedFragmentCompartmentEditPart) this.getHost().getParent();
- // if first interaction operand and resize direction is NORTH
- if (this.getHost() == OperandBoundsComputeHelper.findFirstIOEP(compartEP) && (request.getResizeDirection() & PositionConstants.NORTH) != 0) {
+ // if the OP's border same as/linked to the CF's border
+ if (this.getHost() == OperandBoundsComputeHelper.findFirstIOEP(compartEP) && isNorthResize
+ || this.getHost() == OperandBoundsComputeHelper.findLastIOEP(compartEP) && isSouthResize) {
return getHost().getParent().getParent().getCommand(request);
} else {
- int heightDelta = request.getSizeDelta().height();
- if ((request.getResizeDirection() & PositionConstants.NORTH) != 0) {
- return OperandBoundsComputeHelper.createIOEPResizeCommand(currentIOEP, heightDelta, compartEP, PositionConstants.NORTH);
- } else if ((request.getResizeDirection() & PositionConstants.SOUTH) != 0) {
- return OperandBoundsComputeHelper.createIOEPResizeCommand(currentIOEP, heightDelta, compartEP, PositionConstants.SOUTH);
- }
+ return OperandBoundsComputeHelper.createIOEPResizeCommand(currentIOEP, request, compartEP);
}
}
- return null;
}
+ return null;
}
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java
index acdb91b3fa3..f65f3545959 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineXYLayoutEditPolicy.java
@@ -84,7 +84,7 @@ public class LifelineXYLayoutEditPolicy extends XYLayoutEditPolicy {
private static final int TIME_BAR_HEIGHT = 1;
/** The default spacing used between Execution Specification */
- private final static int SPACING_HEIGHT = 5;
+ public final static int SPACING_HEIGHT = 5;
// private final static int MAX_CHILD_EXECUTION_DEPTH = 4;
// force location of time/duration elements and ES
@@ -384,7 +384,9 @@ public class LifelineXYLayoutEditPolicy extends XYLayoutEditPolicy {
Command p = new ICommandProxy(new SetBoundsCommand(editPart.getEditingDomain(), "Creation of an ExecutionSpecification", viewDescriptor, newBounds));
// resize parent bar
if (parent != null) {
- p = p.chain(resizeParentExecutionSpecification((LifelineEditPart) getHost(), parent, newBounds.getCopy(), executionSpecificationList));
+ Rectangle newAdjustedBounds = newBounds.getCopy();
+ newAdjustedBounds.height += LifelineXYLayoutEditPolicy.SPACING_HEIGHT;
+ p = p.chain(resizeParentExecutionSpecification((LifelineEditPart) getHost(), parent, newAdjustedBounds, executionSpecificationList));
}
return p;
}
@@ -394,20 +396,26 @@ public class LifelineXYLayoutEditPolicy extends XYLayoutEditPolicy {
childBounds.x = bounds.x;
childBounds.width = bounds.width;
Rectangle rect = bounds.getCopy();
- if (childBounds.y > rect.y) {
+ int spacingY = LifelineXYLayoutEditPolicy.SPACING_HEIGHT;
+ if (childBounds.y - spacingY < rect.y) {
+ rect.height += rect.y - childBounds.y + spacingY;
+ rect.y = childBounds.y - spacingY;
+ } else if (childBounds.bottom() + spacingY> rect.bottom()) {
+ rect.height = childBounds.bottom() - rect.y + spacingY;
+ } else {
return null;
}
- rect.height += rect.y - childBounds.y;
- rect.y = childBounds.y;
Rectangle newBounds = rect.getCopy();
CompoundCommand command = new CompoundCommand();
Command c = new ICommandProxy(new SetBoundsCommand(part.getEditingDomain(), "Resize of Parent Bar", part, newBounds.getCopy()));
command.add(c);
Point moveDelta = new Point(newBounds.x - bounds.x, newBounds.y - bounds.y);
- if (moveDelta.y != 0) {
+ Dimension sizeDelta = new Dimension(newBounds.width() - bounds.width(), newBounds.height() - bounds.height());
+ if (moveDelta.y != 0 || sizeDelta.height() != 0) {
ChangeBoundsRequest request = new ChangeBoundsRequest();
request.setEditParts(part);
request.setMoveDelta(moveDelta);
+ request.setSizeDelta(sizeDelta);
command = OccurrenceSpecificationMoveHelper.completeMoveExecutionSpecificationCommand(command, part, newBounds.getCopy(), request);
}
list.remove(part);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
index d9b8b405fe4..f7d8d134169 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OperandBoundsComputeHelper.java
@@ -36,6 +36,7 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
@@ -552,7 +553,11 @@ public class OperandBoundsComputeHelper {
* @param direction
* @return
*/
- public static Command createIOEPResizeCommand(InteractionOperandEditPart currentIOEP, int heightDelta, CombinedFragmentCombinedFragmentCompartmentEditPart compartEP, int direction) {
+ public static Command createIOEPResizeCommand(InteractionOperandEditPart currentIOEP, ChangeBoundsRequest request, CombinedFragmentCombinedFragmentCompartmentEditPart compartEP) {
+ int heightDelta = request.getSizeDelta().height();
+ int widthDelta = request.getSizeDelta().width();
+ int direction = request.getResizeDirection();
+ int directionEastWest = request.getResizeDirection() & PositionConstants.EAST_WEST;
Bounds currentIOEPBounds = OperandBoundsComputeHelper.getEditPartBounds(currentIOEP);
if (currentIOEPBounds == null) {
return null;
@@ -564,99 +569,68 @@ public class OperandBoundsComputeHelper {
targetIOEP = OperandBoundsComputeHelper.findLatterIOEP(compartEP, currentIOEP);
}
CompositeCommand compositeCommand = new CompositeCommand("Resize Operand");
- // if last operand
- if (targetIOEP == null) {
- if (heightDelta < 0) {
- if (currentIOEPBounds.getHeight() - Math.abs(heightDelta) < OperandBoundsComputeHelper.MIN_INTERACTION_OPERAND_HEIGHT) {
- return null;
- }
- }
- Rectangle currentIOEPRect = OperandBoundsComputeHelper.fillRectangle(currentIOEPBounds);
- currentIOEPRect.setHeight(currentIOEPBounds.getHeight() + heightDelta);
- int minHeight = getMinimumHeightFor(currentIOEP);
- if (currentIOEPRect.height < minHeight) {
- return UnexecutableCommand.INSTANCE;
- }
- ICommand currentIOEPCommand = OperandBoundsComputeHelper.createUpdateEditPartBoundsCommand(currentIOEP, currentIOEPRect);
- compositeCommand.add(currentIOEPCommand);
- Command shiftPreviousExecutions = getShiftEnclosedFragmentsCommand(currentIOEP, currentIOEPRect, heightDelta);
- if (shiftPreviousExecutions != null) {
- compositeCommand.add(new EMFtoGMFCommandWrapper(new GEFtoEMFCommandWrapper(shiftPreviousExecutions)));
- }
- // auto update CombinedFragmentEditPart bounds after resize the last operand
- if (compartEP.getParent() instanceof CombinedFragmentEditPart) {
- CombinedFragmentEditPart parent = (CombinedFragmentEditPart) compartEP.getParent();
- if (parent.getModel() instanceof Node) {
- Node node = (Node) parent.getModel();
- if (node.getLayoutConstraint() instanceof Bounds) {
- Bounds containerBounds = (Bounds) node.getLayoutConstraint();
- Dimension preferredSize = parent.getFigure().getPreferredSize();
- int width = containerBounds.getWidth() != -1 ? containerBounds.getWidth() : preferredSize.width();
- int height = containerBounds.getHeight() != -1 ? containerBounds.getHeight() : preferredSize.height();
- height = height + heightDelta;
- Rectangle containerRect = new Rectangle(containerBounds.getX(), containerBounds.getY(), width, height);
- compositeCommand.add(OperandBoundsComputeHelper.createUpdateEditPartBoundsCommand(parent, containerRect));
- // Preserve Message anchors.
- ICommand preserveMessageAnchorsCommand = MessageAnchorRepairer.createPreserveMessageAnchorsCommand(parent, heightDelta);
- if (preserveMessageAnchorsCommand != null && preserveMessageAnchorsCommand.canExecute()) {
- compositeCommand.add(preserveMessageAnchorsCommand);
- }
- ICommand expandCoveredsCommand = getExpandCoveredsCommand((CombinedFragmentEditPart) compartEP.getParent(), containerRect);
- if (expandCoveredsCommand != null) {
- compositeCommand.add(expandCoveredsCommand);
- }
- }
- }
- }
- } else {
- Bounds targetIOEPBounds = OperandBoundsComputeHelper.getEditPartBounds(targetIOEP);
- if (targetIOEPBounds == null) {
+ // Resize the CF horizontally
+ if (directionEastWest != 0) {
+ ChangeBoundsRequest reqEastWest = new ChangeBoundsRequest();
+ reqEastWest.setEditParts(currentIOEP);
+ reqEastWest.setType(request.getType());
+ reqEastWest.setMoveDelta(new Point(request.getMoveDelta().x, 0));
+ reqEastWest.setSizeDelta(new Dimension(request.getSizeDelta().width, 0));
+ reqEastWest.setLocation(request.getLocation());
+ reqEastWest.setExtendedData(request.getExtendedData());
+ reqEastWest.setResizeDirection(directionEastWest);
+ ICommand horResizeCommand = new CommandProxy(currentIOEP.getParent().getParent().getCommand(reqEastWest));
+ compositeCommand.add(horResizeCommand);
+ }
+ Bounds targetIOEPBounds = OperandBoundsComputeHelper.getEditPartBounds(targetIOEP);
+ if (targetIOEPBounds == null) {
+ return null;
+ }
+ if (heightDelta > 0) {
+ if (targetIOEPBounds.getHeight() - heightDelta < OperandBoundsComputeHelper.MIN_INTERACTION_OPERAND_HEIGHT) {
return null;
}
- if (heightDelta > 0) {
- if (targetIOEPBounds.getHeight() - heightDelta < OperandBoundsComputeHelper.MIN_INTERACTION_OPERAND_HEIGHT) {
- return null;
- }
- } else {
- if (currentIOEPBounds.getHeight() - Math.abs(heightDelta) < OperandBoundsComputeHelper.MIN_INTERACTION_OPERAND_HEIGHT) {
- return null;
- }
- }
- Rectangle targetIOEPRect = OperandBoundsComputeHelper.fillRectangle(targetIOEPBounds);
- Rectangle currentIOEPRect = OperandBoundsComputeHelper.fillRectangle(currentIOEPBounds);
- targetIOEPRect.setHeight(targetIOEPBounds.getHeight() - heightDelta);
- currentIOEPRect.setHeight(currentIOEPBounds.getHeight() + heightDelta);
- int shiftY = 0;
- if ((direction & PositionConstants.NORTH) != 0) {
- currentIOEPRect.setY(currentIOEPRect.y() - heightDelta);
- shiftY = -heightDelta;
- } else if ((direction & PositionConstants.SOUTH) != 0) {
- targetIOEPRect.setY(targetIOEPRect.y() + heightDelta);
- shiftY = heightDelta;
- }
- int minHeightOfTargetOperand = getMinimumHeightFor(targetIOEP);
- if (targetIOEPRect.height < minHeightOfTargetOperand) {
+ } else {
+ if (currentIOEPBounds.getHeight() - Math.abs(heightDelta) < OperandBoundsComputeHelper.MIN_INTERACTION_OPERAND_HEIGHT) {
return null;
}
- ICommand previousIOEPCommand = OperandBoundsComputeHelper.createUpdateEditPartBoundsCommand(targetIOEP, targetIOEPRect);
- compositeCommand.add(previousIOEPCommand);
- if ((shiftY < 0 && targetIOEPRect.y < currentIOEPRect.y) || shiftY > 0 && (targetIOEPRect.y > currentIOEPRect.y)) {
- Command shiftPreviousExecutions = getShiftEnclosedFragmentsCommand(targetIOEP, targetIOEPRect, shiftY);
- if (shiftPreviousExecutions != null) {
- compositeCommand.add(new EMFtoGMFCommandWrapper(new GEFtoEMFCommandWrapper(shiftPreviousExecutions)));
- }
- }
- int minHeughtOfCurrentOperand = getMinimumHeightFor(currentIOEP);
- if (currentIOEPRect.height < minHeughtOfCurrentOperand) {
- return null;
+ }
+ Rectangle targetIOEPRect = OperandBoundsComputeHelper.fillRectangle(targetIOEPBounds);
+ Rectangle currentIOEPRect = OperandBoundsComputeHelper.fillRectangle(currentIOEPBounds);
+ targetIOEPRect.setHeight(targetIOEPBounds.getHeight() - heightDelta);
+ targetIOEPRect.setWidth(targetIOEPBounds.getWidth() + widthDelta);
+ currentIOEPRect.setHeight(currentIOEPBounds.getHeight() + heightDelta);
+ currentIOEPRect.setWidth(currentIOEPBounds.getWidth() + widthDelta);
+ int shiftY = 0;
+ if ((direction & PositionConstants.NORTH) != 0) {
+ currentIOEPRect.setY(currentIOEPRect.y() - heightDelta);
+ shiftY = -heightDelta;
+ } else if ((direction & PositionConstants.SOUTH) != 0) {
+ targetIOEPRect.setY(targetIOEPRect.y() + heightDelta);
+ shiftY = heightDelta;
+ }
+ int minHeightOfTargetOperand = getMinimumHeightFor(targetIOEP);
+ if (targetIOEPRect.height < minHeightOfTargetOperand) {
+ return null;
+ }
+ ICommand previousIOEPCommand = OperandBoundsComputeHelper.createUpdateEditPartBoundsCommand(targetIOEP, targetIOEPRect);
+ compositeCommand.add(previousIOEPCommand);
+ if ((shiftY < 0 && targetIOEPRect.y < currentIOEPRect.y) || shiftY > 0 && (targetIOEPRect.y > currentIOEPRect.y)) {
+ Command shiftPreviousExecutions = getShiftEnclosedFragmentsCommand(targetIOEP, targetIOEPRect, shiftY);
+ if (shiftPreviousExecutions != null) {
+ compositeCommand.add(new EMFtoGMFCommandWrapper(new GEFtoEMFCommandWrapper(shiftPreviousExecutions)));
}
- ICommand currentIOEPCommand = OperandBoundsComputeHelper.createUpdateEditPartBoundsCommand(currentIOEP, currentIOEPRect);
- compositeCommand.add(currentIOEPCommand);
- if ((shiftY < 0 && currentIOEPRect.y < targetIOEPRect.y) || (shiftY > 0 && currentIOEPRect.y > targetIOEPRect.y)) {
- Command shiftCurrentExecutions = getShiftEnclosedFragmentsCommand(currentIOEP, currentIOEPRect, shiftY);
- if (shiftCurrentExecutions != null) {
- compositeCommand.add(new EMFtoGMFCommandWrapper(new GEFtoEMFCommandWrapper(shiftCurrentExecutions)));
- }
+ }
+ int minHeughtOfCurrentOperand = getMinimumHeightFor(currentIOEP);
+ if (currentIOEPRect.height < minHeughtOfCurrentOperand) {
+ return null;
+ }
+ ICommand currentIOEPCommand = OperandBoundsComputeHelper.createUpdateEditPartBoundsCommand(currentIOEP, currentIOEPRect);
+ compositeCommand.add(currentIOEPCommand);
+ if ((shiftY < 0 && currentIOEPRect.y < targetIOEPRect.y) || (shiftY > 0 && currentIOEPRect.y > targetIOEPRect.y)) {
+ Command shiftCurrentExecutions = getShiftEnclosedFragmentsCommand(currentIOEP, currentIOEPRect, shiftY);
+ if (shiftCurrentExecutions != null) {
+ compositeCommand.add(new EMFtoGMFCommandWrapper(new GEFtoEMFCommandWrapper(shiftCurrentExecutions)));
}
}
return new ICommandProxy(compositeCommand);

Back to the top