diff options
author | Nicolas FAUVERGUE | 2018-04-04 12:13:56 +0000 |
---|---|---|
committer | Patrick Tessier | 2018-04-16 12:22:10 +0000 |
commit | 308983feb893dfb0947876749a2400bb20adff96 (patch) | |
tree | 085b57105b672b08e34e1c40978be6b8b8e5624f | |
parent | 9bb03d919d334eb3b10ad2bbeeb033412da4f3f5 (diff) | |
download | org.eclipse.papyrus-308983feb893dfb0947876749a2400bb20adff96.tar.gz org.eclipse.papyrus-308983feb893dfb0947876749a2400bb20adff96.tar.xz org.eclipse.papyrus-308983feb893dfb0947876749a2400bb20adff96.zip |
Bug 533205: [Sequence Diagram] The 'SetBoundsCommand' need to be splited
in 3 commands
Separate the 'SetBoundsCommand' in 3 commands and manage its calls with
the new ones.
Change-Id: I346353e941d17362a5d49ed3586f200dce9016a4
Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
34 files changed, 569 insertions, 251 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/RequirementsSequenceDiagram.usecases b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/RequirementsSequenceDiagram.usecases index 57b9672e067..f1f48ccafed 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/RequirementsSequenceDiagram.usecases +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/RequirementsSequenceDiagram.usecases @@ -9,6 +9,11 @@ Requirement: ReqTechnical_SequenceDiagram_002: Message anchors must be only on l Code instruction: - org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/figures/LifelineFigure.java - org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifelineChildGraphicalNodeEditPolicy.java +Requirement: ReqTechnical_SequenceDiagram_005: Replace the 'SetBoundsCommand' with 3 different commands used in sequence diagram. +Code instruction: - org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetLocationCommand.java +- org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetResizeCommand.java +- org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetResizeAndLocationCommand.java + Requirement: ReqFunctional_SequenceDiagram_001: When a move of a message is done (with the preference to keep gaps between messages), all the messages and elements in the life lines must be moved down. Code instruction: - org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/UpdateWeakReferenceForMessageSpecEditPolicy.java diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetLocationCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetLocationCommand.java new file mode 100644 index 00000000000..5745b53b20e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetLocationCommand.java @@ -0,0 +1,103 @@ +/***************************************************************************** + * Copyright (c) 2018 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.sequence.command; + +import java.util.List; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; + +/** + * This allows to redefine the SetBoundsCommand into 3 different commands. This ones manage the resize. + */ +public class SetLocationCommand extends AbstractTransactionalCommand { + + /** + * The adapter to the <code>View</code>. + */ + private IAdaptable adapter; + + /** + * The location to set. + */ + private Point location; + + /** + * Creates a <code>CustomSetBoundsCommand</code> for the given view adapter with a given location. + * + * @param editingDomain + * the editing domain through which model changes are made. + * @param label + * The command label. + * @param adapter + * An adapter to the <code>View</code>. + * @param location + * The new location. + */ + public SetLocationCommand(final TransactionalEditingDomain editingDomain, final String label, final IAdaptable adapter, final Point location) { + super(editingDomain, label, null); + Assert.isNotNull(adapter, "view cannot be null"); //$NON-NLS-1$ + Assert.isNotNull(location, "location cannot be null"); //$NON-NLS-1$ + this.adapter = adapter; + this.location = location; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) + */ + @Override + protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) + throws ExecutionException { + + if (adapter == null) { + return CommandResult.newErrorCommandResult("SetLocationCommand: viewAdapter does not adapt to IView.class"); //$NON-NLS-1$ + } + + final View view = (View) adapter.getAdapter(View.class); + + if (location != null) { + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X(), Integer.valueOf(location.x)); + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y(), Integer.valueOf(location.y)); + } + return CommandResult.newOKCommandResult(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#getAffectedFiles() + */ + @Override + public List<?> getAffectedFiles() { + if (adapter != null) { + View view = (View) adapter.getAdapter(View.class); + if (view != null) { + return getWorkspaceFiles(view); + } + } + return super.getAffectedFiles(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetResizeAndLocationCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetResizeAndLocationCommand.java new file mode 100644 index 00000000000..c5c938f5ad3 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetResizeAndLocationCommand.java @@ -0,0 +1,109 @@ +/***************************************************************************** + * Copyright (c) 2018 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.sequence.command; + +import java.util.List; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; + +/** + * This allows to redefine the SetBoundsCommand into 3 different commands. This one manage a resize before a relocate because the listeners of the life lines need this order. + */ +public class SetResizeAndLocationCommand extends AbstractTransactionalCommand { + + /** + * The adapter to the <code>View</code>. + */ + private IAdaptable adapter; + + /** + * The bounds to set. + */ + private Rectangle bounds; + + /** + * Creates a <code>CustomSetBoundsCommand</code> for the given view adapter with a given bounds. + * + * @param editingDomain + * the editing domain through which model changes are made. + * @param label + * The command label. + * @param adapter + * An adapter to the <code>View</code>. + * @param bounds + * The new bounds. + */ + public SetResizeAndLocationCommand(final TransactionalEditingDomain editingDomain, final String label, final IAdaptable adapter, final Rectangle bounds) { + super(editingDomain, label, null); + Assert.isNotNull(adapter, "view cannot be null"); //$NON-NLS-1$ + Assert.isNotNull(bounds, "bounds cannot be null"); //$NON-NLS-1$ + this.adapter = adapter; + this.bounds = bounds; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) + */ + @Override + protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) + throws ExecutionException { + + if (adapter == null) { + return CommandResult.newErrorCommandResult("SetResizeAndLocationCommand: viewAdapter does not adapt to IView.class"); //$NON-NLS-1$ + } + + final View view = (View) adapter.getAdapter(View.class); + + if (bounds != null) { + final Point location = bounds.getLocation(); + final Dimension size = bounds.getSize(); + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width(), Integer.valueOf(size.width)); + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height(), Integer.valueOf(size.height)); + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_X(), Integer.valueOf(location.x)); + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getLocation_Y(), Integer.valueOf(location.y)); + } + return CommandResult.newOKCommandResult(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#getAffectedFiles() + */ + @Override + public List<?> getAffectedFiles() { + if (adapter != null) { + View view = (View) adapter.getAdapter(View.class); + if (view != null) { + return getWorkspaceFiles(view); + } + } + return super.getAffectedFiles(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetResizeCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetResizeCommand.java new file mode 100644 index 00000000000..ea126267adf --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/command/SetResizeCommand.java @@ -0,0 +1,103 @@ +/***************************************************************************** + * Copyright (c) 2018 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.sequence.command; + +import java.util.List; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; + +/** + * This allows to redefine the SetBoundsCommand into 3 different commands. This ones manage the resize. + */ +public class SetResizeCommand extends AbstractTransactionalCommand { + + /** + * The adapter to the <code>View</code>. + */ + private IAdaptable adapter; + + /** + * The size to set. + */ + private Dimension size; + + /** + * Creates a <code>CustomSetBoundsCommand</code> for the given view adapter with a given size. + * + * @param editingDomain + * the editing domain through which model changes are made. + * @param label + * The command label. + * @param adapter + * An adapter to the <code>View</code>. + * @param size + * The new size. + */ + public SetResizeCommand(final TransactionalEditingDomain editingDomain, final String label, final IAdaptable adapter, final Dimension size) { + super(editingDomain, label, null); + Assert.isNotNull(adapter, "view cannot be null"); //$NON-NLS-1$ + Assert.isNotNull(size, "size cannot be null"); //$NON-NLS-1$ + this.adapter = adapter; + this.size = size; + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable) + */ + @Override + protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) + throws ExecutionException { + + if (adapter == null) { + return CommandResult.newErrorCommandResult("SetResizeCommand: viewAdapter does not adapt to IView.class"); //$NON-NLS-1$ + } + + final View view = (View) adapter.getAdapter(View.class); + + if (size != null) { + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Width(), Integer.valueOf(size.width)); + ViewUtil.setStructuralFeatureValue(view, NotationPackage.eINSTANCE.getSize_Height(), Integer.valueOf(size.height)); + } + return CommandResult.newOKCommandResult(); + } + + /** + * {@inheritDoc} + * + * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#getAffectedFiles() + */ + @Override + public List<?> getAffectedFiles() { + if (adapter != null) { + View view = (View) adapter.getAdapter(View.class); + if (view != null) { + return getWorkspaceFiles(view); + } + } + return super.getAffectedFiles(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomBehaviorExecutionSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomBehaviorExecutionSpecificationEditPart.java index 92970222b13..749e52df5df 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomBehaviorExecutionSpecificationEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDCustomBehaviorExecutionSpecificationEditPart.java @@ -37,7 +37,6 @@ import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gef.requests.CreateRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.IBorderItemEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.figures.BorderedNodeFigure; @@ -52,6 +51,7 @@ import org.eclipse.gmf.runtime.notation.NotationFactory; import org.eclipse.gmf.runtime.notation.View; 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.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExecutionGraphicalNodeEditPolicy; import org.eclipse.papyrus.uml.diagram.sequence.util.BehaviorDisplayHelper; import org.eclipse.uml2.uml.Behavior; @@ -135,7 +135,7 @@ public class OLDCustomBehaviorExecutionSpecificationEditPart extends BehaviorExe } location.translate(request.getMoveDelta()); - ICommand moveCommand = new SetBoundsCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), location); + ICommand moveCommand = new SetLocationCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), location); return new ICommandProxy(moveCommand); } return null; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java index 3480f96ef67..64ded36d638 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDGateEditPart.java @@ -38,7 +38,6 @@ import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gef.requests.CreateRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.IBorderItemEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; @@ -51,11 +50,11 @@ import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; import org.eclipse.papyrus.uml.diagram.common.editparts.AbstractBorderEditPart; -import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure; import org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure; import org.eclipse.papyrus.uml.diagram.common.helper.NotificationHelper; import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.ExternalLabelPrimaryDragRoleEditPolicy; import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDGateGraphicalNodeEditPolicy; import org.eclipse.papyrus.uml.diagram.sequence.util.GateHelper; @@ -180,7 +179,7 @@ public class OLDGateEditPart extends AbstractBorderEditPart implements IBorderIt getHostFigure().translateToRelative(rect); Rectangle realLocation = borderItemLocator.getValidLocation(rect.getCopy(), borderItemEP.getFigure()); Point location = realLocation.getLocation(); - ICommand moveCommand = new SetBoundsCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), location); + ICommand moveCommand = new SetLocationCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), location); return new ICommandProxy(moveCommand); } return null; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java index 79a54331244..231989aec0d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/parts/OLDLifelineEditPart.java @@ -62,7 +62,6 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; 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.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy; @@ -97,6 +96,7 @@ import org.eclipse.papyrus.uml.diagram.common.draw2d.LifelineDotLineFigure; import org.eclipse.papyrus.uml.diagram.common.draw2d.anchors.LifelineAnchor; import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; import org.eclipse.papyrus.uml.diagram.common.providers.UIAdapterImpl; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.AbstractHeadImpactLayoutEditPolicy; import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.InteractionCompartmentXYLayoutEditPolicy; @@ -550,7 +550,7 @@ public class OLDLifelineEditPart extends LifelineEditPart { if (newBounds.x + newBounds.width > parentBounds.width) { newBounds.width = parentBounds.width - newBounds.x; } - ICommand boundsCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter((View) child.getModel()), newBounds); + ICommand boundsCommand = new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter((View) child.getModel()), newBounds); composite.add(boundsCommand); composite.add(LifelineResizeHelper.createManualLabelSizeCommand(child)); // Move ExecutionSpecifications diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedCreationEditPolicy.java index 107b1c3e14d..a4b45ea5a75 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedCreationEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedCreationEditPolicy.java @@ -13,19 +13,16 @@ package org.eclipse.papyrus.uml.diagram.sequence.edit.policies; -import java.awt.Rectangle; - import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; /** * @author Patrick Tessier @@ -58,7 +55,7 @@ public class CombinedCreationEditPolicy extends DefaultCreationEditPolicy { height=height-previousheight; } org.eclipse.draw2d.geometry.Rectangle rect= new org.eclipse.draw2d.geometry.Rectangle(0,y ,-1,height); - SetBoundsCommand setBoundsCommand = new SetBoundsCommand(editingDomain, "Set dimension", descriptor, rect); + ICommand setBoundsCommand = new SetResizeAndLocationCommand(editingDomain, "Set dimension", descriptor, rect); return setBoundsCommand; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentHeadImpactLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentHeadImpactLayoutEditPolicy.java index f5172d8e98e..833a0b43bf3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentHeadImpactLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CombinedFragmentHeadImpactLayoutEditPolicy.java @@ -23,11 +23,11 @@ import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.gef.EditPart; import org.eclipse.gef.ExposeHelper; import org.eclipse.gef.commands.Command; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart; @@ -79,7 +79,7 @@ public class CombinedFragmentHeadImpactLayoutEditPolicy extends AbstractHeadImpa Bounds bounds = (Bounds) shape.getLayoutConstraint(); Dimension size = new Dimension(bounds.getWidth(), bounds.getHeight()).expand(0, -resizeDelta); Rectangle newBounds = new Rectangle(new Point(bounds.getX(), bounds.getY() + resizeDelta), size); - commands.appendIfCanExecute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getEditingDomain(), "", operand, newBounds))); + commands.appendIfCanExecute(new GMFtoEMFCommandWrapper(new SetResizeAndLocationCommand(getEditingDomain(), "", operand, newBounds))); Command cmd = OperandBoundsComputeHelper.getShiftEnclosedFragmentsCommand(operand, newBounds, resizeDelta); if (cmd != null) { commands.appendIfCanExecute(new GEFtoEMFCommandWrapper(cmd)); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java index 47d8f873bca..613f5d62fcc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomDiagramDragDropEditPolicy.java @@ -76,6 +76,7 @@ import org.eclipse.papyrus.uml.diagram.common.helper.DurationObservationHelper; import org.eclipse.papyrus.uml.diagram.sequence.command.CreateLocatedConnectionViewCommand; import org.eclipse.papyrus.uml.diagram.sequence.command.OLDCreateGateViewCommand; import org.eclipse.papyrus.uml.diagram.sequence.command.RestoreDurationConstraintLinkCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.ActionExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; @@ -955,7 +956,7 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo lifelinePart.getFigure().translateToRelative(newBounds); Point parentLoc = lifelinePart.getLocation(); newBounds.translate(parentLoc.getNegated()); - SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", descriptor, newBounds); + ICommand setBoundsCommand = new SetResizeAndLocationCommand(getEditingDomain(), "move", descriptor, newBounds); cc.add(new ICommandProxy(setBoundsCommand)); return cc; } @@ -964,7 +965,7 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo if (getHost() instanceof InteractionInteractionCompartmentEditPart) { Rectangle newBounds = new Rectangle(dropLocation, new Dimension(-1, -1)); ((InteractionInteractionCompartmentEditPart) getHost()).getFigure().translateToRelative(newBounds); - SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", descriptor, newBounds); + ICommand setBoundsCommand = new SetResizeAndLocationCommand(getEditingDomain(), "move", descriptor, newBounds); cc.add(new ICommandProxy(setBoundsCommand)); return cc; } @@ -1003,7 +1004,7 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo lifelinePart.getFigure().translateToRelative(newBounds); Point parentLoc = lifelinePart.getLocation(); newBounds.translate(parentLoc.getNegated()); - SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", descriptor, newBounds); + ICommand setBoundsCommand = new SetResizeAndLocationCommand(getEditingDomain(), "move", descriptor, newBounds); cc.add(new ICommandProxy(setBoundsCommand)); return cc; } @@ -1022,7 +1023,7 @@ public class CustomDiagramDragDropEditPolicy extends CommonDiagramDragDropEditPo lifelinePart.getFigure().translateToRelative(newBounds); Point parentLoc = lifelinePart.getLocation(); newBounds.translate(parentLoc.getNegated()); - SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getEditingDomain(), "move", descriptor, newBounds); + ICommand setBoundsCommand = new SetResizeAndLocationCommand(getEditingDomain(), "move", descriptor, newBounds); cc.add(new ICommandProxy(setBoundsCommand)); return cc; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomExternalLabelPrimaryDragRoleEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomExternalLabelPrimaryDragRoleEditPolicy.java index 0ce54229204..4a05646d975 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomExternalLabelPrimaryDragRoleEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/CustomExternalLabelPrimaryDragRoleEditPolicy.java @@ -24,12 +24,12 @@ import org.eclipse.gef.handles.MoveHandle; import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.LabelEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableEditPolicyEx; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; /** * This policy provides the selection handles, feedback and move command for @@ -58,7 +58,7 @@ public class CustomExternalLabelPrimaryDragRoleEditPolicy extends ResizableEditP rect.translate(request.getMoveDelta()); rect.resize(request.getSizeDelta()); getHostFigure().translateToRelative(rect); - ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View) editPart.getModel()), updatedRect); + ICommand moveCommand = new SetResizeAndLocationCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View) editPart.getModel()), updatedRect); return new ICommandProxy(moveCommand); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java index 6cbef7657e5..e2928dca925 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/ExternalLabelPrimaryDragRoleEditPolicy.java @@ -25,13 +25,13 @@ import org.eclipse.gef.handles.MoveHandle; import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.LabelEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusLabelEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; /** * This policy provides the selection handles, feedback and move command for @@ -79,7 +79,7 @@ public class ExternalLabelPrimaryDragRoleEditPolicy extends NonResizableLabelEdi } } - ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View) editPart.getModel()), updatedRect); + ICommand moveCommand = new SetResizeAndLocationCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View) editPart.getModel()), updatedRect); return new ICommandProxy(moveCommand); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCompartmentXYLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCompartmentXYLayoutEditPolicy.java index d86afe17953..00e57bec883 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCompartmentXYLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionCompartmentXYLayoutEditPolicy.java @@ -45,7 +45,6 @@ import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gef.requests.CreateRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.ConnectionEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; @@ -68,13 +67,15 @@ import org.eclipse.gmf.runtime.notation.Shape; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.service.palette.AspectUnspecifiedTypeCreationTool.CreateAspectUnspecifiedTypeRequest; import org.eclipse.papyrus.uml.diagram.common.commands.PreserveAnchorsPositionCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OldCustomInteractionEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDLifelineEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.DurationConstraintEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDLifelineEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OldCustomInteractionEditPart; import org.eclipse.papyrus.uml.diagram.sequence.figures.LifelineDotLineCustomFigure; import org.eclipse.papyrus.uml.diagram.sequence.figures.LifelineFigure; import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; @@ -266,7 +267,7 @@ public class InteractionCompartmentXYLayoutEditPolicy extends XYLayoutEditPolicy // Apply SizeDelta to the children widthDelta = Math.round(widthDelta / ((float) 2 * number)); newBounds.x += widthDelta; - SetBoundsCommand setBoundsCmd = new SetBoundsCommand(executionSpecificationEP.getEditingDomain(), "Re-location of a ExecutionSpecification due to a Lifeline movement", executionSpecificationEP, newBounds); + ICommand setBoundsCmd = new SetResizeAndLocationCommand(executionSpecificationEP.getEditingDomain(), "Re-location of a ExecutionSpecification due to a Lifeline movement", executionSpecificationEP, newBounds); compoundCmd.add(new ICommandProxy(setBoundsCmd)); } // update the enclosing interaction of a moved execution specification @@ -591,7 +592,7 @@ public class InteractionCompartmentXYLayoutEditPolicy extends XYLayoutEditPolicy Dimension d = realLocation.getTopLeft().getDifference(parentOrigin); Point location = new Point(d.width, d.height); location = location.translate(0, moveDelta.y); - ICommandProxy resize = new ICommandProxy(new SetBoundsCommand(dcp.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) dcp.getModel()), location)); + ICommandProxy resize = new ICommandProxy(new SetLocationCommand(dcp.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) dcp.getModel()), location)); compoundCmd.add(resize); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java index 679927e11ee..aebb2dc05e8 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/InteractionHeadImpactLayoutEditPolicy.java @@ -23,7 +23,6 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.gef.NodeEditPart; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor; import org.eclipse.gmf.runtime.notation.Anchor; import org.eclipse.gmf.runtime.notation.Edge; @@ -32,10 +31,11 @@ import org.eclipse.gmf.runtime.notation.Location; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageFoundEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageLostEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart; import org.eclipse.papyrus.uml.diagram.sequence.figures.StereotypeInteractionFigure; import org.eclipse.papyrus.uml.diagram.sequence.util.CommandHelper; @@ -86,7 +86,7 @@ public class InteractionHeadImpactLayoutEditPolicy extends AbstractHeadImpactLay Location location = (Location) view.getLayoutConstraint(); Point pt = new Point(location.getX(), location.getY()); if (pt.x == rect.x - OLDGateEditPart.DEFAULT_SIZE.width / 2 || pt.x == rect.right() - OLDGateEditPart.DEFAULT_SIZE.width / 2) { - commands.appendIfCanExecute(new GMFtoEMFCommandWrapper(new SetBoundsCommand(getEditingDomain(), "Move gate", gateEditPart, pt.getTranslated(0, resizeDelta)))); + commands.appendIfCanExecute(new GMFtoEMFCommandWrapper(new SetLocationCommand(getEditingDomain(), "Move gate", gateEditPart, pt.getTranslated(0, resizeDelta)))); } } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifeLineAffixedNodesCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifeLineAffixedNodesCreationEditPolicy.java index 79614e9f1d3..0f6df2eeba4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifeLineAffixedNodesCreationEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/LifeLineAffixedNodesCreationEditPolicy.java @@ -23,13 +23,13 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.commands.Command; import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.service.palette.AspectUnspecifiedTypeCreationTool; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.figures.DestructionEventFigure; import org.eclipse.papyrus.uml.diagram.sequence.locator.CenterLocator; import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes; @@ -73,7 +73,7 @@ public class LifeLineAffixedNodesCreationEditPolicy extends DefaultCreationEditP requestedLocation.y=requestedLocation.y-destructionEventFigure.getDefaultSize().height/2; } - setBoundsCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, requestedLocation); + setBoundsCommand = new SetLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, requestedLocation); return setBoundsCommand; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionLineSegEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionLineSegEditPolicy.java index 8b3803134e5..10d5b156321 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionLineSegEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MessageConnectionLineSegEditPolicy.java @@ -44,7 +44,6 @@ import org.eclipse.gef.requests.ReconnectRequest; import org.eclipse.gef.ui.parts.ScrollingGraphicalViewer; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.ConnectionEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; @@ -67,6 +66,8 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart; import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages; import org.eclipse.papyrus.uml.diagram.sequence.command.DropDestructionOccurenceSpecification; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeCommand; import org.eclipse.papyrus.uml.diagram.sequence.draw2d.routers.MessageRouter.RouterKind; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPart; @@ -312,7 +313,7 @@ public class MessageConnectionLineSegEditPolicy extends ConnectionBendpointEditP targetFigure.getParent().translateToRelative(refPoint); Bounds bounds = ((Bounds) ((Node) targetLifelinePart.getModel()).getLayoutConstraint()); - SetBoundsCommand setSizeCommand = new SetBoundsCommand(targetLifelinePart.getEditingDomain(), "Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetLifelinePart).getNotationView()), //$NON-NLS-1$ + ICommand setSizeCommand = new SetResizeCommand(targetLifelinePart.getEditingDomain(), "Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetLifelinePart).getNotationView()), //$NON-NLS-1$ new Dimension(bounds.getWidth(), refPoint.y - bounds.getY())); CompoundCommand compoudCmd = new CompoundCommand(CustomMessages.MoveMessageCommand_Label); @@ -553,10 +554,11 @@ public class MessageConnectionLineSegEditPolicy extends ConnectionBendpointEditP final Bounds bounds = (Bounds) view.getLayoutConstraint(); final Point newLocation = new Point(bounds.getX(), bounds.getY()); final Dimension newDimension = new Dimension(bounds.getWidth(), maxY - absoluteBounds.y); - final Rectangle newBounds = new Rectangle(newLocation, newDimension); - final ICommand boundsCommand = new SetBoundsCommand(lifeLineEP.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newBounds); - compoundCommand.add(new ICommandProxy(boundsCommand)); + final ICommand heightCommand = new SetResizeCommand(lifeLineEP.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newDimension); + compoundCommand.add(new ICommandProxy(heightCommand)); + final ICommand locationCommand = new SetLocationCommand(lifeLineEP.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newLocation); + compoundCommand.add(new ICommandProxy(locationCommand)); } } } else if (lifelineEditParts.contains(lifeLineEP)) { @@ -574,9 +576,9 @@ public class MessageConnectionLineSegEditPolicy extends ConnectionBendpointEditP newY = bounds.getY() + yMoveDelta; // If a message create and no message delete exists, calculate the new height of the life line depending to the current height and to the new maximum Y position if (!hasIncomingMessageDelete) { - newHeight = absoluteBounds.height - yMoveDelta; + newHeight = (absoluteBounds.y + absoluteBounds.height) - newY; if (maxY > (newY + newHeight)) { - newHeight = maxY - absoluteBounds.y - yMoveDelta; + newHeight = maxY - newY; } } } else if (hasIncomingMessageDelete) { @@ -585,10 +587,11 @@ public class MessageConnectionLineSegEditPolicy extends ConnectionBendpointEditP final Point newLocation = new Point(bounds.getX(), newY); final Dimension newDimension = new Dimension(bounds.getWidth(), newHeight); - final Rectangle newBounds = new Rectangle(newLocation, newDimension); - final ICommand boundsCommand = new SetBoundsCommand(lifeLineEP.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newBounds); - compoundCommand.add(new ICommandProxy(boundsCommand)); + final ICommand heightCommand = new SetResizeCommand(lifeLineEP.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newDimension); + compoundCommand.add(new ICommandProxy(heightCommand)); + final ICommand locationCommand = new SetLocationCommand(lifeLineEP.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newLocation); + compoundCommand.add(new ICommandProxy(locationCommand)); } } } @@ -615,10 +618,11 @@ public class MessageConnectionLineSegEditPolicy extends ConnectionBendpointEditP final Point newLocation = new Point(bounds.getX(), bounds.getY() + yMoveDelta); final int newHeight = bounds.getHeight() == -1 ? BoundForEditPart.getDefaultHeightFromView(view) : bounds.getHeight(); final Dimension newDimension = new Dimension(bounds.getWidth(), newHeight - yMoveDelta); - final Rectangle newBounds = new Rectangle(newLocation, newDimension); - final ICommand boundsCommand = new SetBoundsCommand(targetLifeLine.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newBounds); - compoundCommand.add(new ICommandProxy(boundsCommand)); + final ICommand heightCommand = new SetResizeCommand(targetLifeLine.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newDimension); + compoundCommand.add(new ICommandProxy(heightCommand)); + final ICommand locationCommand = new SetLocationCommand(targetLifeLine.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newLocation); + compoundCommand.add(new ICommandProxy(locationCommand)); } } @@ -632,12 +636,10 @@ public class MessageConnectionLineSegEditPolicy extends ConnectionBendpointEditP final LifelineEditPart targetLifeLine = (LifelineEditPart) hostConnectionEditPart.getTarget(); if (targetLifeLine.getModel() instanceof Shape) { final Shape view = (ShapeImpl) targetLifeLine.getModel(); - final Bounds bounds = (Bounds) view.getLayoutConstraint(); - final SetBoundsCommand boundsCommand = new SetBoundsCommand(targetLifeLine.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), + final ICommand boundsCommand = new SetResizeCommand(targetLifeLine.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), new Dimension(bounds.getWidth(), bounds.getHeight() + yMoveDelta)); - compoundCommand.add(new ICommandProxy(boundsCommand)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MoveableNonResizableLabelEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MoveableNonResizableLabelEditPolicy.java index 83693c65d5d..c854902575a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MoveableNonResizableLabelEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/MoveableNonResizableLabelEditPolicy.java @@ -32,7 +32,6 @@ import org.eclipse.gef.handles.MoveHandle; import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.ConnectionEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; @@ -44,6 +43,7 @@ import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx; import org.eclipse.gmf.runtime.draw2d.ui.geometry.PointListUtilities; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; /** * This class offers the same features as {@link NonResizableLabelEditPolicy}, except that move is privileged instead of drag and drop. @@ -156,7 +156,7 @@ public class MoveableNonResizableLabelEditPolicy extends NonResizableEditPolicyE rect.resize(request.getSizeDelta()); getHostFigure().translateToRelative(rect); Point normalPoint = LabelHelper.offsetFromRelativeCoordinate(getHostFigure(), rect, refPoint); - ICommand moveCommand = new SetBoundsCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View) editPart.getModel()), normalPoint); + ICommand moveCommand = new SetLocationCommand(editPart.getEditingDomain(), DiagramUIMessages.MoveLabelCommand_Label_Location, new EObjectAdapter((View) editPart.getModel()), normalPoint); return new ICommandProxy(moveCommand); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java index 22bbdcb0aea..5035346c0fa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDGatesHolderGraphicalNodeEditPolicy.java @@ -43,7 +43,6 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; import org.eclipse.gmf.runtime.diagram.ui.commands.CommandUtilities; 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.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.internal.requests.SuppressibleUIRequest; @@ -57,6 +56,7 @@ import org.eclipse.gmf.runtime.emf.type.core.IHintedType; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.sequence.command.OLDCreateGateElementAndViewCommand; import org.eclipse.papyrus.uml.diagram.sequence.command.ReconnectToGateCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionUseEditPart; @@ -116,7 +116,7 @@ public class OLDGatesHolderGraphicalNodeEditPolicy extends OLDSequenceGraphicalN hostFigure.translateToRelative(newBounds); GateLocator locator = new GateLocator(hostFigure); Rectangle validLocation = locator.getValidLocation(newBounds, gateEditPart.getFigure()); - SetBoundsCommand command = new SetBoundsCommand(getEditingDomain(), "Update Gate Location", new EObjectAdapter(gateEditPart.getNotationView()), validLocation.getLocation()); + ICommand command = new SetLocationCommand(getEditingDomain(), "Update Gate Location", new EObjectAdapter(gateEditPart.getNotationView()), validLocation.getLocation()); return new ICommandProxy(command); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifeLineLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifeLineLayoutEditPolicy.java index d302f071472..49f4accdcee 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifeLineLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifeLineLayoutEditPolicy.java @@ -25,7 +25,6 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; @@ -35,6 +34,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.service.palette.AspectUnspecifiedTypeCreationTool; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.figures.DestructionEventFigure; import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes; import org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant; @@ -102,7 +102,7 @@ public class OLDLifeLineLayoutEditPolicy extends DefaultCreationEditPolicy { DestructionEventFigure destructionEventFigure= new DestructionEventFigure(); requestedLocation.y=requestedLocation.y-destructionEventFigure.getDefaultSize().height/2; - setBoundsCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, requestedLocation); + setBoundsCommand = new SetLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, descriptor, requestedLocation); } else{ super.getSetBoundsCommand(request, descriptor); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineCreationEditPolicy.java index 6e9bb54c38d..3b53879db8a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineCreationEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineCreationEditPolicy.java @@ -31,7 +31,6 @@ import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; 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.SemanticCreateCommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; @@ -39,6 +38,7 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.RefreshConnectionsRequest; import org.eclipse.gmf.runtime.emf.type.core.IHintedType; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; import org.eclipse.papyrus.uml.diagram.sequence.figures.LifelineDotLineCustomFigure; import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; @@ -66,7 +66,7 @@ public class OLDLifelineCreationEditPolicy extends CreationEditPolicy { if (hostElement == null && view.getElement() == null) { hostElement = view; } - + CreateElementRequest createElementRequest = (CreateElementRequest) requestAdapter.getAdapter(CreateElementRequest.class); if (createElementRequest.getContainer() == null) { // complete the semantic request by filling in the host's semantic @@ -81,7 +81,7 @@ public class OLDLifelineCreationEditPolicy extends CreationEditPolicy { Map<String, Object> extendedData = request.getExtendedData(); extendedData.put(SequenceRequestConstant.INTERACTIONFRAGMENT_CONTAINER, ift); extendedData.put(org.eclipse.papyrus.uml.service.types.utils.SequenceRequestConstant.COVERED, hostElement); - + createElementRequest.setContainer(ift); // record the nearest event if necessary String requestHint = request.getViewAndElementDescriptor().getSemanticHint(); @@ -151,7 +151,7 @@ public class OLDLifelineCreationEditPolicy extends CreationEditPolicy { childBounds.width = -1; // default size childBounds.y = 0; // y offset from parent childBounds.x = location.x - parentBounds.x; // x offset from parent - SetBoundsCommand cmd = new SetBoundsCommand(parentPart.getEditingDomain(), "set size", request.getViewAndElementDescriptor(), childBounds); + SetResizeAndLocationCommand cmd = new SetResizeAndLocationCommand(parentPart.getEditingDomain(), "set size", request.getViewAndElementDescriptor(), childBounds); cc.compose(cmd); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineXYLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineXYLayoutEditPolicy.java index 64d8b0e2e39..bae648ebf91 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineXYLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/OLDLifelineXYLayoutEditPolicy.java @@ -36,7 +36,6 @@ import org.eclipse.gef.requests.CreateRequest; import org.eclipse.gef.requests.DropRequest; import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; 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.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy; @@ -50,6 +49,7 @@ import org.eclipse.gmf.runtime.notation.Shape; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.common.commands.PreserveAnchorsPositionCommand; import org.eclipse.papyrus.uml.diagram.common.draw2d.LifelineDotLineFigure; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.command.CustomZOrderCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.BehaviorExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CCombinedCompartmentEditPart; @@ -233,7 +233,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { newBounds.performTranslate(t.x, t.y); newBounds.translate(0, bounds.y); TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); + return new ICommandProxy(new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); } @Override @@ -308,7 +308,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { } newBounds = getNewBoundsForChild((LifelineEditPart) getHost(), newBounds, COREGION_INIT_WIDTH); TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); + return new ICommandProxy(new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); } private Command getCommandForDestructionOccuranceCreation(CreateViewRequest cvr, ViewDescriptor viewDescriptor) { @@ -414,7 +414,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { // if(newBounds == null) { // return UnexecutableCommand.INSTANCE; // } - Command p = new ICommandProxy(new SetBoundsCommand(editPart.getEditingDomain(), "Creation of an ExecutionSpecification", viewDescriptor, newBounds)); + Command p = new ICommandProxy(new SetResizeAndLocationCommand(editPart.getEditingDomain(), "Creation of an ExecutionSpecification", viewDescriptor, newBounds)); // resize parent bar if (parent != null) { Rectangle newAdjustedBounds = newBounds.getCopy(); @@ -440,7 +440,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { } Rectangle newBounds = rect.getCopy(); CompoundCommand command = new CompoundCommand(); - Command c = new ICommandProxy(new SetBoundsCommand(part.getEditingDomain(), "Resize of Parent Bar", part, newBounds.getCopy())); + Command c = new ICommandProxy(new SetResizeAndLocationCommand(part.getEditingDomain(), "Resize of Parent Bar", part, newBounds.getCopy())); command.add(c); Point moveDelta = new Point(newBounds.x - bounds.x, newBounds.y - bounds.y); Dimension sizeDelta = new Dimension(newBounds.width() - bounds.width(), newBounds.height() - bounds.height()); @@ -478,7 +478,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { // Define the bounds of the new time element Rectangle newBounds = new Rectangle(referencePoint.x, referencePoint.y - newHeight / 2, -1, newHeight); TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); + return new ICommandProxy(new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); } return null; } @@ -507,7 +507,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { Rectangle newBounds = new Rectangle(referenceTop.x, referenceTop.y, -1, newHeight); newBounds = CustomDurationConstraintEditPart.fixMessageBounds(newBounds, cvr, (LifelineEditPart) getHost()); TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); + return new ICommandProxy(new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); } else if (newHeight < 0) { parentFigure.translateToRelative(referenceBottom); Point parentFigDelta = parentFigure.getBounds().getLocation().getCopy().negate(); @@ -516,7 +516,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { Rectangle newBounds = new Rectangle(referenceBottom.x, referenceBottom.y, -1, -newHeight); newBounds = CustomDurationConstraintEditPart.fixMessageBounds(newBounds, cvr, (LifelineEditPart) getHost()); TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); + return new ICommandProxy(new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, newBounds)); } } return null; @@ -689,7 +689,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { compoundCmd.add(resizeParentExecutionSpecification(lifelineEP, parentBar, newBounds.getCopy(), executionSpecificationList)); } // Create and add the command to the compound command - SetBoundsCommand setBoundsCmd = new SetBoundsCommand(executionSpecificationEP.getEditingDomain(), "Resize of a ExecutionSpecification", executionSpecificationEP, newBounds); + SetResizeAndLocationCommand setBoundsCmd = new SetResizeAndLocationCommand(executionSpecificationEP.getEditingDomain(), "Resize of a ExecutionSpecification", executionSpecificationEP, newBounds); compoundCmd.add(new ICommandProxy(setBoundsCmd)); Rectangle realMoveDelta = getRealMoveDelta(getRelativeBounds(executionSpecificationEP.getFigure()), newBounds); if (isMove) { @@ -775,7 +775,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { lifelineResizeRequest.setSizeDelta(new Dimension(0, heightDelta)); lifelineResizeRequest.setResizeDirection(PositionConstants.NORTH); lifelineResizeRequest.setEditParts(lifelineEP); - compoundCmd.add(new ICommandProxy(new SetBoundsCommand(lifelineEP.getEditingDomain(), "Move of Lifeline/DOS", lifelineEP, rectLifeline))); + compoundCmd.add(new ICommandProxy(new SetResizeAndLocationCommand(lifelineEP.getEditingDomain(), "Move of Lifeline/DOS", lifelineEP, rectLifeline))); PreserveAnchorsPositionCommandEx preserveAnchorsCommand = new PreserveAnchorsPositionCommandEx(lifelineEP, new Dimension(0, heightDelta), PreserveAnchorsPositionCommand.PRESERVE_Y, lifelineEP.getPrimaryShape() .getFigureLifelineDotLineFigure(), PositionConstants.SOUTH); compoundCmd.add(new ICommandProxy(preserveAnchorsCommand)); @@ -1000,7 +1000,7 @@ public class OLDLifelineXYLayoutEditPolicy extends XYLayoutEditPolicy { childBounds.y += moveDelta.y; childBounds.x += moveDelta.x; // Create the child's SetBoundsCommand - SetBoundsCommand childSetBoundsCmd = new SetBoundsCommand(executionSpecificationEP.getEditingDomain(), "Movement of affixed ExecutionSpecification", childExecutionSpecificationEP, childBounds); + SetResizeAndLocationCommand childSetBoundsCmd = new SetResizeAndLocationCommand(executionSpecificationEP.getEditingDomain(), "Movement of affixed ExecutionSpecification", childExecutionSpecificationEP, childBounds); compoundCmd.add(new ICommandProxy(childSetBoundsCmd)); IFigure parentFigure = childExecutionSpecificationEP.getFigure().getParent(); parentFigure.translateToAbsolute(newBounds); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/StateInvariantResizableEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/StateInvariantResizableEditPolicy.java index 8af30cb4d70..80c30ab1b6b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/StateInvariantResizableEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/edit/policies/StateInvariantResizableEditPolicy.java @@ -20,17 +20,18 @@ import org.eclipse.gef.commands.Command; import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.IBorderItemEditPart; import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; /** - * @author Céline JANSSENS + * @author C�line JANSSENS * */ public class StateInvariantResizableEditPolicy extends BorderItemResizableEditPolicy { @@ -49,7 +50,7 @@ public class StateInvariantResizableEditPolicy extends BorderItemResizableEditPo if (borderItemEP.getParent() instanceof LifelineEditPart && !restrictInParentBounds((LifelineEditPart) borderItemEP.getParent(), borderItemEP, realLocation.getCopy())) { return null; } - ICommand moveCommand = new SetBoundsCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), realLocation); + ICommand moveCommand = new SetResizeAndLocationCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), realLocation); return new ICommandProxy(moveCommand); } return null; @@ -70,7 +71,7 @@ public class StateInvariantResizableEditPolicy extends BorderItemResizableEditPo return null; } Point location = realLocation.getTopLeft(); - ICommand moveCommand = new SetBoundsCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), location); + ICommand moveCommand = new SetLocationCommand(borderItemEP.getEditingDomain(), DiagramUIMessages.Commands_MoveElement, new EObjectAdapter((View) getHost().getModel()), location); return new ICommandProxy(moveCommand); } return null; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DurationConstraintContributionItem.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DurationConstraintContributionItem.java index f42b94e165e..dadd8e3697b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DurationConstraintContributionItem.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/providers/DurationConstraintContributionItem.java @@ -9,7 +9,6 @@ import org.eclipse.emf.common.command.Command; import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.diagram.core.commands.SetConnectionAnchorsCommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.draw2d.ui.figures.BaseSlidableAnchor; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; @@ -19,6 +18,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomCommentAnnotatedElementEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationConstraintEditPart; @@ -277,7 +277,7 @@ public class DurationConstraintContributionItem extends ContributionItem impleme compositeCmd.add(new EMFtoGMFCommandWrapper(rotateCmd)); // set bounds command - ICommand boundsCommand = new SetBoundsCommand(durationPart.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(durationPart.getNotationView()), getNewBounds(durationPart.getBounds())); + ICommand boundsCommand = new SetResizeAndLocationCommand(durationPart.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(durationPart.getNotationView()), getNewBounds(durationPart.getBounds())); compositeCmd.add(boundsCommand); // update anchor diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java index a0678007cc5..f9cd5809e62 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectMessageToGridEditPolicy.java @@ -17,12 +17,10 @@ import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PrecisionRectangle; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.EditPart; import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker; import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; @@ -39,6 +37,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper; import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions; import org.eclipse.uml2.uml.Message; @@ -81,12 +80,12 @@ public class ConnectMessageToGridEditPolicy extends GraphicalEditPolicyEx implem Location currentBounds = (Location) axis.getLayoutConstraint(); if (x < currentBounds.getX() - displayImprecision || x > currentBounds.getX() + displayImprecision) { UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS to x=" + x + " y=" + y);//$NON-NLS-1$ //$NON-NLS-2$ - execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter(axis), new Point(x, y))); //$NON-NLS-1$ + execute(new SetLocationCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter(axis), new Point(x, y))); //$NON-NLS-1$ } if (y < currentBounds.getY() - displayImprecision || y > currentBounds.getY() + displayImprecision) { UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS to x=" + x + " y=" + y);//$NON-NLS-1$ //$NON-NLS-2$ - execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(axis), new Point(x, y))); //$NON-NLS-1$ + execute(new SetLocationCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(axis), new Point(x, y))); //$NON-NLS-1$ } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java index 4e11e32de7b..cbe3fa88167 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectRectangleToGridEditPolicy.java @@ -15,16 +15,13 @@ package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling; import org.eclipse.draw2d.geometry.Point; -import org.eclipse.draw2d.geometry.PrecisionGeometry; import org.eclipse.draw2d.geometry.PrecisionRectangle; -import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker; import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; @@ -39,6 +36,7 @@ import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.helper.IdentityAnchorHelper; import org.eclipse.papyrus.infra.gmfdiag.common.helper.NotationHelper; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions; import org.eclipse.uml2.uml.Element; @@ -308,7 +306,7 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im LayoutConstraint layoutConstraint = execSpecNode.getLayoutConstraint(); if (layoutConstraint instanceof Bounds) { int delta = newYValue - oldYValue; - execute(new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update ExecutionSpecification", new EObjectAdapter(execSpecNode), //$NON-NLS-1$ + execute(new SetLocationCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update ExecutionSpecification", new EObjectAdapter(execSpecNode), //$NON-NLS-1$ new Point(((Bounds) layoutConstraint).getX(), ((Bounds) layoutConstraint).getY() - delta))); } } @@ -396,10 +394,8 @@ public class ConnectRectangleToGridEditPolicy extends ConnectToGridEditPolicy im double preciseHeight = nodeHeight; double newPercentY = (yPercent * oldHeight) / preciseHeight; - if (newPercentY <= 1 && newPercentY >= 0 && newPercentY <= 1 && newPercentY >= 0) { - final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xPercent, newPercentY); - execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue)); - } + final String newIdValue = IdentityAnchorHelper.createNewAnchorIdValue(xPercent, newPercentY); + execute(new SetCommand(getDiagramEditPart(getHost()).getEditingDomain(), anchor, NotationPackage.eINSTANCE.getIdentityAnchor_Id(), newIdValue)); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java index a3ce0c55088..f86a1ba6bac 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ConnectToGridEditPolicy.java @@ -15,20 +15,13 @@ package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling; -import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Point; -import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; -import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; import org.eclipse.gmf.runtime.gef.ui.internal.editpolicies.GraphicalEditPolicyEx; -import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.DecorationNode; import org.eclipse.gmf.runtime.notation.Location; -import org.eclipse.gmf.runtime.notation.Node; -import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy; -import org.eclipse.papyrus.uml.diagram.sequence.CustomMessages; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.part.UMLDiagramEditorPlugin; import org.eclipse.papyrus.uml.diagram.sequence.util.LogOptions; @@ -50,12 +43,12 @@ public abstract class ConnectToGridEditPolicy extends GraphicalEditPolicyEx impl Location currentBounds=(Location) axis.getLayoutConstraint(); if(x<currentBounds.getX()-displayImprecision||x>currentBounds.getX()+displayImprecision){ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS FINISH to x=" + x);//$NON-NLS-1$ - execute( new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter(axis), new Point(x,y))); + execute( new SetLocationCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update Column", new EObjectAdapter(axis), new Point(x,y))); } if(y<currentBounds.getY()-displayImprecision||y>currentBounds.getY()+displayImprecision){ UMLDiagramEditorPlugin.log.trace(LogOptions.SEQUENCE_DEBUG_REFERENCEGRID, "+---->ACTION: modifiy AXIS FINISH to y=" + y);//$NON-NLS-1$ - execute( new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(axis), new Point(x,y))); + execute( new SetLocationCommand(getDiagramEditPart(getHost()).getEditingDomain(), "update row", new EObjectAdapter(axis), new Point(x,y))); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java index 9170fd9800a..47144a6e09b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineGraphicalNodeEditPolicy.java @@ -39,7 +39,6 @@ import org.eclipse.gef.requests.CreateRequest; import org.eclipse.gef.requests.DropRequest; import org.eclipse.gef.requests.ReconnectRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy; @@ -58,6 +57,8 @@ import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; import org.eclipse.papyrus.infra.services.edit.utils.RequestParameterConstants; import org.eclipse.papyrus.uml.diagram.sequence.command.CreateExecutionSpecificationWithMessage; import org.eclipse.papyrus.uml.diagram.sequence.command.DropDestructionOccurenceSpecification; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeCommand; import org.eclipse.papyrus.uml.diagram.sequence.draw2d.routers.MessageRouter; import org.eclipse.papyrus.uml.diagram.sequence.edit.helpers.AnchorHelper; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart; @@ -526,7 +527,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol Bounds lifelineBounds = ((Bounds) ((Node) targetEditPart.getModel()).getLayoutConstraint()); Dimension size = new Dimension(lifelineBounds.getWidth(), relativeSnappedLocation.y - lifelineBounds.getY()); - SetBoundsCommand setSizeCommand = new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetEditPart).getNotationView()), //$NON-NLS-1$ + ICommand setSizeCommand = new SetResizeCommand(getDiagramEditPart(getHost()).getEditingDomain(), "Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetEditPart).getNotationView()), //$NON-NLS-1$ size); compoundCommand.add(new GMFtoGEFCommandWrapper(setSizeCommand)); } @@ -592,7 +593,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol Rectangle newBounds = new Rectangle(new Point(bounds.x(), newY), new Dimension(bounds.width(), bounds.height() - snappedLocation.y + stickerHeight)); - SetBoundsCommand setBoundsCommand = new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "Move&Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetEditPart).getNotationView()), newBounds); //$NON-NLS-1$ + ICommand setBoundsCommand = new SetResizeAndLocationCommand(getDiagramEditPart(getHost()).getEditingDomain(), "Move&Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetEditPart).getNotationView()), newBounds); //$NON-NLS-1$ compoundCommand.add(originalCommand); compoundCommand.add(new GMFtoGEFCommandWrapper(setBoundsCommand)); @@ -748,7 +749,7 @@ public class LifeLineGraphicalNodeEditPolicy extends DefaultGraphicalNodeEditPol // Get resize command if (targetEditPart instanceof CLifeLineEditPart) { Bounds lifeLineBounds = ((Bounds) ((Node) targetEditPart.getModel()).getLayoutConstraint()); - SetBoundsCommand setSizeCommand = new SetBoundsCommand(getDiagramEditPart(getHost()).getEditingDomain(), "Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetEditPart).getNotationView()), //$NON-NLS-1$ + ICommand setSizeCommand = new SetResizeCommand(getDiagramEditPart(getHost()).getEditingDomain(), "Size LifeLine", new EObjectAdapter(((GraphicalEditPart) targetEditPart).getNotationView()), //$NON-NLS-1$ new Dimension(lifeLineBounds.getWidth(), request.getLocation().y - lifeLineBounds.getY())); compoundCommand.add(new GMFtoGEFCommandWrapper(setSizeCommand)); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java index 0608155e2ff..4e4fdd4c1a5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/LifeLineXYLayoutEditPolicy.java @@ -33,7 +33,6 @@ import org.eclipse.gef.requests.ChangeBoundsRequest; import org.eclipse.gef.requests.CreateRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.BorderedBorderItemEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart; @@ -48,6 +47,7 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.XYLayoutWithConstrainedResizedEditPolicy; import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.command.SetMoveAllLineAtSamePositionCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart; @@ -244,7 +244,7 @@ public class LifeLineXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEd * the element being resized. * @param constraint * the elements new bounds. - * @return {@link SetBoundsCommand} + * @return {@link SetResizeAndLocationCommand} */ @Override protected Command createChangeConstraintCommand( @@ -306,7 +306,7 @@ public class LifeLineXYLayoutEditPolicy extends XYLayoutWithConstrainedResizedEd TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()) .getEditingDomain(); - ICommand boundsCommand = new SetBoundsCommand(editingDomain, + ICommand boundsCommand = new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(shapeView), newBounds); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java index 65051751a72..003f1b4772a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/ResizeOperandEditPolicy.java @@ -20,7 +20,6 @@ import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EAnnotation; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.Request; @@ -34,7 +33,6 @@ import org.eclipse.gmf.runtime.common.core.command.IdentityCommand; import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker; import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener; 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.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; @@ -45,9 +43,11 @@ import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.AutomaticNotationEditPolicy; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CCombinedFragmentEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CInteractionOperandEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart; import org.eclipse.papyrus.uml.service.types.element.UMLDIElementTypes; import org.eclipse.papyrus.uml.service.types.utils.ElementUtil; @@ -56,8 +56,8 @@ import org.eclipse.papyrus.uml.service.types.utils.ElementUtil; * This class is used to allow the resize and adding of children of the combined Fragment * */ -public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements AutomaticNotationEditPolicy, NotificationListener{ - +public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements AutomaticNotationEditPolicy, NotificationListener { + /** * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate() @@ -66,19 +66,21 @@ public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements Aut @Override public void activate() { super.activate(); - getDiagramEventBroker().addNotificationListener(((EObject)getHost().getModel()), this); + getDiagramEventBroker().addNotificationListener(((EObject) getHost().getModel()), this); } - + /** * @see org.eclipse.gef.editpolicies.AbstractEditPolicy#activate() * */ @Override public void deactivate() { - getDiagramEventBroker().removeNotificationListener(((EObject)getHost().getModel()), this); + getDiagramEventBroker().removeNotificationListener(((EObject) getHost().getModel()), this); super.activate(); } - /* Gets the diagram event broker from the editing domain. + + /* + * Gets the diagram event broker from the editing domain. * * @return the diagram event broker */ @@ -89,83 +91,81 @@ public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements Aut } return null; } + /** * Factors incoming requests into various specific methods. * * @see org.eclipse.gef.EditPolicy#getCommand(Request) */ public Command getCommand(Request request) { - if( request instanceof CreateViewAndElementRequest){ - CreateViewAndElementRequest req=(CreateViewAndElementRequest)request; - ViewAndElementDescriptor descriptor=(req).getViewAndElementDescriptor(); + if (request instanceof CreateViewAndElementRequest) { + CreateViewAndElementRequest req = (CreateViewAndElementRequest) request; + ViewAndElementDescriptor descriptor = (req).getViewAndElementDescriptor(); IElementType elementType = (IElementType) descriptor.getElementAdapter().getAdapter(IElementType.class); - if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.INTERACTION_OPERAND_SHAPE)){ - Node combinedFragmentNode = (Node)((GraphicalEditPart)(getHost().getParent())).getNotationView(); - //we add a new Operand so we add the default height - int height=((Bounds)combinedFragmentNode.getLayoutConstraint()).getHeight(); - if( getHost().getChildren().size()>0) { - int newHeight = height+CInteractionOperandEditPart.DEFAULT_HEIGHT; - - return new ICommandProxy(new SetBoundsCommand(getEditingDomain(), "set dimension", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int)newHeight))); + if (ElementUtil.isTypeOf(elementType, UMLDIElementTypes.INTERACTION_OPERAND_SHAPE)) { + Node combinedFragmentNode = (Node) ((GraphicalEditPart) (getHost().getParent())).getNotationView(); + // we add a new Operand so we add the default height + int height = ((Bounds) combinedFragmentNode.getLayoutConstraint()).getHeight(); + if (getHost().getChildren().size() > 0) { + int newHeight = height + CInteractionOperandEditPart.DEFAULT_HEIGHT; + + return new ICommandProxy(new SetResizeCommand(getEditingDomain(), "set dimension", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int) newHeight))); } } } - if( RequestConstants.REQ_RESIZE_CHILDREN.equals(request.getType())){ - CompositeCommand compositeCommand= new CompositeCommand("Resize Operands"); - ChangeBoundsRequest changeBoundsRequest=(ChangeBoundsRequest)request; - List<?> editParts =changeBoundsRequest.getEditParts(); + if (RequestConstants.REQ_RESIZE_CHILDREN.equals(request.getType())) { + CompositeCommand compositeCommand = new CompositeCommand("Resize Operands"); + ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request; + List<?> editParts = changeBoundsRequest.getEditParts(); // the user can resize only one InteractionOperand - if( editParts.size()>1){ + if (editParts.size() > 1) { return null; } TransactionalEditingDomain editingDomain = getEditingDomain(); - Object currentEditPart= editParts.get(0); - if(changeBoundsRequest.getMoveDelta().y==0){ - if( currentEditPart instanceof GraphicalEditPart){ - if( istheFirstDisplayedOperand((GraphicalEditPart)currentEditPart)){ - compositeCommand.add( new SetBoundsCommand(editingDomain, "Set Position of the first operand", new EObjectAdapter(((GraphicalEditPart) currentEditPart).getNotationView()), new Point(0,0))); + Object currentEditPart = editParts.get(0); + if (changeBoundsRequest.getMoveDelta().y == 0) { + if (currentEditPart instanceof GraphicalEditPart) { + if (istheFirstDisplayedOperand((GraphicalEditPart) currentEditPart)) { + compositeCommand.add(new SetLocationCommand(editingDomain, "Set Position of the first operand", new EObjectAdapter(((GraphicalEditPart) currentEditPart).getNotationView()), new Point(0, 0))); } - //update the current Node + // update the current Node updateCurrentChildSize(compositeCommand, changeBoundsRequest, editingDomain, currentEditPart); - //update the combinedfragment if this the last - if( istheLastDisplayedOperand((GraphicalEditPart)currentEditPart)){ + // update the combinedfragment if this the last + if (istheLastDisplayedOperand((GraphicalEditPart) currentEditPart)) { compositeCommand.add(getResizeCompartmentCommand(changeBoundsRequest)); - } - else{ - //update the next view if this is not the last - View nextView=getNextView((GraphicalEditPart)currentEditPart); - Dimension size= new Dimension(BoundForEditPart.getWidthFromView((Node)nextView), BoundForEditPart.getHeightFromView((Node)nextView)); - size.expand(changeBoundsRequest.getSizeDelta().width*-1, changeBoundsRequest.getSizeDelta().height*-1); - Point locationNext=new Point(((Bounds)((Node)nextView).getLayoutConstraint()).getX(),((Bounds)((Node)nextView).getLayoutConstraint()).getY()); - locationNext.y=locationNext.y+ changeBoundsRequest.getSizeDelta().height; - SetBoundsCommand setBoundsCommand= new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(nextView), new Rectangle (locationNext,size)); + } else { + // update the next view if this is not the last + View nextView = getNextView((GraphicalEditPart) currentEditPart); + Dimension size = new Dimension(BoundForEditPart.getWidthFromView((Node) nextView), BoundForEditPart.getHeightFromView((Node) nextView)); + size.expand(changeBoundsRequest.getSizeDelta().width * -1, changeBoundsRequest.getSizeDelta().height * -1); + Point locationNext = new Point(((Bounds) ((Node) nextView).getLayoutConstraint()).getX(), ((Bounds) ((Node) nextView).getLayoutConstraint()).getY()); + locationNext.y = locationNext.y + changeBoundsRequest.getSizeDelta().height; + ICommand setBoundsCommand = new SetResizeAndLocationCommand(editingDomain, "Resize Operands", new EObjectAdapter(nextView), new Rectangle(locationNext, size)); compositeCommand.add(setBoundsCommand); } } - } - else if(changeBoundsRequest.getMoveDelta().y!=0){ - if( currentEditPart instanceof GraphicalEditPart){ + } else if (changeBoundsRequest.getMoveDelta().y != 0) { + if (currentEditPart instanceof GraphicalEditPart) { updateCurrentChildSize(compositeCommand, changeBoundsRequest, editingDomain, currentEditPart); } - if( istheFirstDisplayedOperand((GraphicalEditPart)currentEditPart)){ + if (istheFirstDisplayedOperand((GraphicalEditPart) currentEditPart)) { compositeCommand.add(getMoveCompartmentCommand(changeBoundsRequest)); - compositeCommand.add( new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(((GraphicalEditPart) currentEditPart).getNotationView()), new Point(0,0))); - for(int i=1;i<getHost().getChildren().size();i++) { - GraphicalEditPart graphicalEditPart= (GraphicalEditPart)getHost().getChildren().get(i); - int y=((Bounds)((Node)graphicalEditPart.getNotationView()).getLayoutConstraint()).getY()-changeBoundsRequest.getMoveDelta().y; - compositeCommand.add( new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(((Node)graphicalEditPart.getNotationView())), new Point(0,y))); + compositeCommand.add(new SetLocationCommand(editingDomain, "Resize Operands", new EObjectAdapter(((GraphicalEditPart) currentEditPart).getNotationView()), new Point(0, 0))); + for (int i = 1; i < getHost().getChildren().size(); i++) { + GraphicalEditPart graphicalEditPart = (GraphicalEditPart) getHost().getChildren().get(i); + int y = ((Bounds) ((Node) graphicalEditPart.getNotationView()).getLayoutConstraint()).getY() - changeBoundsRequest.getMoveDelta().y; + compositeCommand.add(new SetLocationCommand(editingDomain, "Resize Operands", new EObjectAdapter(((Node) graphicalEditPart.getNotationView())), new Point(0, y))); } - - } - else{ - //update the previous view if this is not the last - View previousView=getPreviousView((GraphicalEditPart)currentEditPart); - Dimension size= new Dimension(BoundForEditPart.getWidthFromView((Node)previousView), BoundForEditPart.getHeightFromView((Node)previousView)); - size.expand(changeBoundsRequest.getSizeDelta().width*-1, changeBoundsRequest.getSizeDelta().height*-1); - SetBoundsCommand setBoundsCommand= new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(previousView), size); + + } else { + // update the previous view if this is not the last + View previousView = getPreviousView((GraphicalEditPart) currentEditPart); + Dimension size = new Dimension(BoundForEditPart.getWidthFromView((Node) previousView), BoundForEditPart.getHeightFromView((Node) previousView)); + size.expand(changeBoundsRequest.getSizeDelta().width * -1, changeBoundsRequest.getSizeDelta().height * -1); + ICommand setBoundsCommand = new SetResizeCommand(editingDomain, "Resize Operands", new EObjectAdapter(previousView), size); compositeCommand.add(setBoundsCommand); } } @@ -180,12 +180,12 @@ public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements Aut } private void updateCurrentChildSize(CompositeCommand compositeCommand, ChangeBoundsRequest changeBoundsRequest, TransactionalEditingDomain editingDomain, Object currentEditPart) { - Node shapeView=(Node)((GraphicalEditPart)currentEditPart).getNotationView(); - Dimension size= new Dimension(BoundForEditPart.getWidthFromView(shapeView), BoundForEditPart.getHeightFromView(shapeView)); + Node shapeView = (Node) ((GraphicalEditPart) currentEditPart).getNotationView(); + Dimension size = new Dimension(BoundForEditPart.getWidthFromView(shapeView), BoundForEditPart.getHeightFromView(shapeView)); size.expand(changeBoundsRequest.getSizeDelta().width, changeBoundsRequest.getSizeDelta().height); - Point location= new Point(0,((Bounds)shapeView.getLayoutConstraint()).getY()+changeBoundsRequest.getMoveDelta().y); - Rectangle rect= new Rectangle(location, size); - SetBoundsCommand setBoundsCommand= new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(shapeView), rect); + Point location = new Point(0, ((Bounds) shapeView.getLayoutConstraint()).getY() + changeBoundsRequest.getMoveDelta().y); + Rectangle rect = new Rectangle(location, size); + ICommand setBoundsCommand = new SetResizeAndLocationCommand(editingDomain, "Resize Operands", new EObjectAdapter(shapeView), rect); compositeCommand.add(setBoundsCommand); } @@ -194,84 +194,90 @@ public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements Aut * @param operandEditPart * @return true if this the last children of the compartment. */ - protected boolean istheLastDisplayedOperand(GraphicalEditPart operandEditPart){ - View operandView=operandEditPart.getNotationView(); - int index=((View)operandView.eContainer()).getChildren().indexOf(operandView); - int listSize=((View)operandView.eContainer()).getChildren().size(); - return index==listSize-1; + protected boolean istheLastDisplayedOperand(GraphicalEditPart operandEditPart) { + View operandView = operandEditPart.getNotationView(); + int index = ((View) operandView.eContainer()).getChildren().indexOf(operandView); + int listSize = ((View) operandView.eContainer()).getChildren().size(); + return index == listSize - 1; } + /** * * @param operandEditPart * @return true if this the first children of the compartment. */ - protected boolean istheFirstDisplayedOperand(GraphicalEditPart operandEditPart){ - View operandView=operandEditPart.getNotationView(); - int index=((View)operandView.eContainer()).getChildren().indexOf(operandView); - return index==0; + protected boolean istheFirstDisplayedOperand(GraphicalEditPart operandEditPart) { + View operandView = operandEditPart.getNotationView(); + int index = ((View) operandView.eContainer()).getChildren().indexOf(operandView); + return index == 0; } - /** get the next view at the same level at the current editPart + /** + * get the next view at the same level at the current editPart * * @param operandEditPart * @return can return null if this the last; */ - protected View getNextView(GraphicalEditPart operandEditPart){ - View operandView=operandEditPart.getNotationView(); - int index=((View)operandView.eContainer()).getChildren().indexOf(operandView); - int listSize=((View)operandView.eContainer()).getChildren().size(); - if( index+1<listSize){ - return (View) ((View)operandView.eContainer()).getChildren().get(index+1); + protected View getNextView(GraphicalEditPart operandEditPart) { + View operandView = operandEditPart.getNotationView(); + int index = ((View) operandView.eContainer()).getChildren().indexOf(operandView); + int listSize = ((View) operandView.eContainer()).getChildren().size(); + if (index + 1 < listSize) { + return (View) ((View) operandView.eContainer()).getChildren().get(index + 1); } return null; } - /** get the previous view at the same level at the current editPart + /** + * get the previous view at the same level at the current editPart * * @param operandEditPart * @return can return null if this the last; */ - protected View getPreviousView(GraphicalEditPart operandEditPart){ - View operandView=operandEditPart.getNotationView(); - int index=((View)operandView.eContainer()).getChildren().indexOf(operandView); - if( index-1>=0){ - return (View) ((View)operandView.eContainer()).getChildren().get(index-1); + protected View getPreviousView(GraphicalEditPart operandEditPart) { + View operandView = operandEditPart.getNotationView(); + int index = ((View) operandView.eContainer()).getChildren().indexOf(operandView); + if (index - 1 >= 0) { + return (View) ((View) operandView.eContainer()).getChildren().get(index - 1); } return null; } + /** * the border effect is to resize the combined fragment + * * @param changeBoundsRequest * @return a command to to resize the combinedfragment */ - protected ICommand getResizeCompartmentCommand(ChangeBoundsRequest changeBoundsRequest){ + protected ICommand getResizeCompartmentCommand(ChangeBoundsRequest changeBoundsRequest) { TransactionalEditingDomain editingDomain = getEditingDomain(); - Node combinedFragmentNode = (Node)((GraphicalEditPart)(getHost().getParent())).getNotationView(); - int combinedFragmentHeight=BoundForEditPart.getHeightFromView(combinedFragmentNode); - int newHeight = getComputedCombinedFragmentHeight()+changeBoundsRequest.getSizeDelta().height; - if(newHeight!=combinedFragmentHeight){ - return new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int)newHeight)); + Node combinedFragmentNode = (Node) ((GraphicalEditPart) (getHost().getParent())).getNotationView(); + int combinedFragmentHeight = BoundForEditPart.getHeightFromView(combinedFragmentNode); + int newHeight = getComputedCombinedFragmentHeight() + changeBoundsRequest.getSizeDelta().height; + if (newHeight != combinedFragmentHeight) { + return new SetResizeCommand(editingDomain, "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int) newHeight)); } return IdentityCommand.INSTANCE; } - + /** * the border effect is to move the combined fragment + * * @param changeBoundsRequest * @return a command to to resize the combinedfragment */ - protected ICommand getMoveCompartmentCommand(ChangeBoundsRequest changeBoundsRequest){ + protected ICommand getMoveCompartmentCommand(ChangeBoundsRequest changeBoundsRequest) { TransactionalEditingDomain editingDomain = getEditingDomain(); - //1 get all children size - Node combinedFragmentNode = (Node)((GraphicalEditPart)(getHost().getParent())).getNotationView(); - int newHeight = getComputedCombinedFragmentHeight()+changeBoundsRequest.getSizeDelta().height; - - int combinedFragmentHeight=BoundForEditPart.getHeightFromView(combinedFragmentNode); - Bounds combinedFragmentBound=BoundForEditPart.getBounds(combinedFragmentNode); - int newY= combinedFragmentBound.getY()+changeBoundsRequest.getMoveDelta().y; - - if(newHeight!=combinedFragmentHeight){ - return new SetBoundsCommand(editingDomain, "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Rectangle( combinedFragmentBound.getX(),newY,BoundForEditPart.getWidthFromView(combinedFragmentNode), (int)newHeight)); + // 1 get all children size + Node combinedFragmentNode = (Node) ((GraphicalEditPart) (getHost().getParent())).getNotationView(); + int newHeight = getComputedCombinedFragmentHeight() + changeBoundsRequest.getSizeDelta().height; + + int combinedFragmentHeight = BoundForEditPart.getHeightFromView(combinedFragmentNode); + Bounds combinedFragmentBound = BoundForEditPart.getBounds(combinedFragmentNode); + int newY = combinedFragmentBound.getY() + changeBoundsRequest.getMoveDelta().y; + + if (newHeight != combinedFragmentHeight) { + return new SetResizeAndLocationCommand(editingDomain, "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Rectangle(combinedFragmentBound.getX(), newY, BoundForEditPart.getWidthFromView(combinedFragmentNode), (int) newHeight)); } return IdentityCommand.INSTANCE; } @@ -283,13 +289,13 @@ public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements Aut */ @Override public void notifyChanged(Notification notification) { - if( notification.getEventType()==Notification.REMOVE && (notification.getNotifier().equals(getHost().getModel()))){ - //1 get all children size - Node combinedFragmentNode = (Node)((GraphicalEditPart)(getHost().getParent())).getNotationView(); + if (notification.getEventType() == Notification.REMOVE && (notification.getNotifier().equals(getHost().getModel()))) { + // 1 get all children size + Node combinedFragmentNode = (Node) ((GraphicalEditPart) (getHost().getParent())).getNotationView(); int newHeight = getComputedCombinedFragmentHeight(); - int combinedFragmentHeight=BoundForEditPart.getHeightFromView(combinedFragmentNode); - if(newHeight!=combinedFragmentHeight){ - execute(new SetBoundsCommand(getEditingDomain(), "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int)newHeight))); + int combinedFragmentHeight = BoundForEditPart.getHeightFromView(combinedFragmentNode); + if (newHeight != combinedFragmentHeight) { + execute(new SetResizeCommand(getEditingDomain(), "Resize Operands", new EObjectAdapter(combinedFragmentNode), new Dimension(BoundForEditPart.getWidthFromView(combinedFragmentNode), (int) newHeight))); } } } @@ -300,26 +306,27 @@ public class ResizeOperandEditPolicy extends GraphicalEditPolicy implements Aut */ protected int getComputedCombinedFragmentHeight() { double childrenCumulativeHeight = getOperandCumulativeHeight(); - - //add the size of the label - int newHeight= (int)childrenCumulativeHeight+CCombinedFragmentEditPart.DEFAULT_HEIGHT-CInteractionOperandEditPart.DEFAULT_HEIGHT; - //there is a minimum size - if( newHeight<CCombinedFragmentEditPart.DEFAULT_HEIGHT){ - newHeight= CCombinedFragmentEditPart.DEFAULT_HEIGHT; + + // add the size of the label + int newHeight = (int) childrenCumulativeHeight + CCombinedFragmentEditPart.DEFAULT_HEIGHT - CInteractionOperandEditPart.DEFAULT_HEIGHT; + // there is a minimum size + if (newHeight < CCombinedFragmentEditPart.DEFAULT_HEIGHT) { + newHeight = CCombinedFragmentEditPart.DEFAULT_HEIGHT; } return newHeight; } - /**@return the Height of all interaction operand inside the compartment - * **/ + /** + * @return the Height of all interaction operand inside the compartment + **/ protected double getOperandCumulativeHeight() { - Node compartmentNode=(Node)((GraphicalEditPart)(getHost())).getNotationView(); - double childrenCumulativeHeight =0.0; + Node compartmentNode = (Node) ((GraphicalEditPart) (getHost())).getNotationView(); + double childrenCumulativeHeight = 0.0; for (Iterator<?> iterator = compartmentNode.getChildren().iterator(); iterator.hasNext();) { Node childView = (Node) iterator.next(); - childrenCumulativeHeight= childrenCumulativeHeight+BoundForEditPart.getHeightFromView(childView); + childrenCumulativeHeight = childrenCumulativeHeight + BoundForEditPart.getHeightFromView(childView); } return childrenCumulativeHeight; } - + } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/ExecutionSpecificationUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/ExecutionSpecificationUtil.java index 3fff4bdd825..483845f8327 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/ExecutionSpecificationUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/ExecutionSpecificationUtil.java @@ -22,10 +22,10 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gef.EditPart; import org.eclipse.gef.commands.CompoundCommand; import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; -import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; import org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling.BoundForEditPart; @@ -198,7 +198,7 @@ public class ExecutionSpecificationUtil { // If the rectangle is modified, add the command to modify its bound if (!initialCurrentRectangle.equals(modifiedCurrentRectangle)) { - compoundCommand.add(new ICommandProxy(new SetBoundsCommand(lifeLineEditPart.getEditingDomain(), "Change Execution Specification bounds", modifiedEditPartsEntry.getKey(), modifiedCurrentRectangle))); //$NON-NLS-1$ + compoundCommand.add(new ICommandProxy(new SetResizeAndLocationCommand(lifeLineEditPart.getEditingDomain(), "Change Execution Specification bounds", modifiedEditPartsEntry.getKey(), modifiedCurrentRectangle))); //$NON-NLS-1$ } } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java index 62ec4c6f77d..c9dc75ad4fe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineEditPartUtil.java @@ -27,7 +27,6 @@ import org.eclipse.gef.EditPart; import org.eclipse.gef.commands.Command; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.DiagramEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; @@ -39,6 +38,7 @@ import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.DecorationNode; import org.eclipse.gmf.runtime.notation.Shape; import org.eclipse.gmf.runtime.notation.impl.ShapeImpl; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; @@ -132,7 +132,7 @@ public class LifelineEditPartUtil { Dimension newDimension = new Dimension(bounds.getWidth(), bounds.getHeight() + (bounds.getY() - SequenceUtil.LIFELINE_VERTICAL_OFFSET)); Rectangle newBounds = new Rectangle(newLocation, newDimension); - ICommand boundsCommand = new SetBoundsCommand(target.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newBounds); + ICommand boundsCommand = new SetResizeAndLocationCommand(target.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newBounds); commands = new ICommandProxy(boundsCommand); } @@ -164,7 +164,7 @@ public class LifelineEditPartUtil { Dimension newDimension = new Dimension(bounds.getWidth(), CLifeLineEditPart.DEFAUT_HEIGHT - bounds.getY()); Rectangle newBounds = new Rectangle(newLocation, newDimension); - ICommand boundsCommand = new SetBoundsCommand(target.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newBounds); + ICommand boundsCommand = new SetResizeAndLocationCommand(target.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), newBounds); commands = new ICommandProxy(boundsCommand); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java index 65121a5545d..0f12f2bb050 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/LifelineMessageCreateHelper.java @@ -29,7 +29,6 @@ import org.eclipse.gef.requests.GroupRequest; import org.eclipse.gef.requests.ReconnectRequest; import org.eclipse.gmf.runtime.common.core.command.ICommand; 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.editpolicies.ComponentEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; @@ -38,6 +37,7 @@ import org.eclipse.gmf.runtime.notation.Bounds; import org.eclipse.gmf.runtime.notation.Shape; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.gmf.runtime.notation.impl.ShapeImpl; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CLifeLineEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.MessageCreateEditPart; @@ -102,7 +102,7 @@ public class LifelineMessageCreateHelper { Shape view = (ShapeImpl) target.getModel(); if (view.getLayoutConstraint() instanceof Bounds) { Bounds bounds = (Bounds) view.getLayoutConstraint(); - ICommand boundsCommand = new SetBoundsCommand(target.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), new Point(bounds.getX(), SequenceUtil.LIFELINE_VERTICAL_OFFSET)); + ICommand boundsCommand = new SetLocationCommand(target.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(view), new Point(bounds.getX(), SequenceUtil.LIFELINE_VERTICAL_OFFSET)); commands = commands.chain(new ICommandProxy(boundsCommand)); int dy = SequenceUtil.LIFELINE_VERTICAL_OFFSET - bounds.getY(); commands = moveCascadeLifeline(target, commands, dy); @@ -126,7 +126,7 @@ public class LifelineMessageCreateHelper { Rectangle bounds = lp.getPrimaryShape().getBounds(); Point location = new Point(bounds.x, SequenceUtil.LIFELINE_VERTICAL_OFFSET); int dy = location.y - bounds.y; - ICommand boundsCommand = new SetBoundsCommand(lp.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(lp.getNotationView()), location); + ICommand boundsCommand = new SetLocationCommand(lp.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(lp.getNotationView()), location); command = command.chain(new ICommandProxy(boundsCommand)); command = moveCascadeLifeline(lp, command, dy); } @@ -190,7 +190,7 @@ public class LifelineMessageCreateHelper { Rectangle bounds = oldTarget.getPrimaryShape().getBounds(); Point location = new Point(bounds.x, SequenceUtil.LIFELINE_VERTICAL_OFFSET); int dy = location.y - bounds.y; - ICommand boundsCommand = new SetBoundsCommand(oldTarget.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(oldTarget.getNotationView()), location); + ICommand boundsCommand = new SetLocationCommand(oldTarget.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(oldTarget.getNotationView()), location); command = command.chain(new ICommandProxy(boundsCommand)); command = moveCascadeLifeline(oldTarget, command, dy); } @@ -217,7 +217,7 @@ public class LifelineMessageCreateHelper { int dy = location.y - bounds.y; fig.translateToRelative(location); fig.translateToParent(location); - ICommand boundsCommand = new SetBoundsCommand(part.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(targetView), location); + ICommand boundsCommand = new SetLocationCommand(part.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(targetView), location); command = command.chain(new ICommandProxy(boundsCommand)); command = moveCascadeLifeline(part, command, dy); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java index 53e8cb58b2c..31a6dc27471 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/util/OccurrenceSpecificationMoveHelper.java @@ -40,7 +40,6 @@ import org.eclipse.gef.requests.ReconnectRequest; import org.eclipse.gmf.runtime.common.core.command.CommandResult; import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; 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.ConnectionEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; @@ -57,6 +56,7 @@ import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.gmf.runtime.notation.impl.ConnectorImpl; import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CustomDurationConstraintEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; @@ -521,7 +521,7 @@ public class OccurrenceSpecificationMoveHelper { newBounds = dcep.updateMoveBounds(newBounds); } // return the resize command - ICommandProxy resize = new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter((View) timePart.getModel()), newBounds)); + ICommandProxy resize = new ICommandProxy(new SetResizeAndLocationCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter((View) timePart.getModel()), newBounds)); return resize; } return null; 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 0d15d9c1c8d..3b4c44677d5 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 @@ -38,7 +38,6 @@ 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; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; @@ -61,19 +60,21 @@ import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.Shape; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.commands.wrappers.GEFtoEMFCommandWrapper; +import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetLocationCommand; +import org.eclipse.papyrus.uml.diagram.sequence.command.SetResizeAndLocationCommand; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractExecutionSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.AbstractMessageEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentCombinedFragmentCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.CombinedFragmentEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomCombinedFragmentEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart; -import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionInteractionCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.InteractionOperandEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.LifelineEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomCombinedFragmentEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDCustomInteractionOperandEditPart; +import org.eclipse.papyrus.uml.diagram.sequence.edit.parts.OLDGateEditPart; import org.eclipse.papyrus.uml.diagram.sequence.edit.policies.OLDLifelineXYLayoutEditPolicy; import org.eclipse.papyrus.uml.diagram.sequence.part.UMLVisualIDRegistry; import org.eclipse.papyrus.uml.diagram.sequence.providers.UMLElementTypes; @@ -975,7 +976,7 @@ public class OperandBoundsComputeHelper { height = height + OperandBoundsComputeHelper.DEFAULT_INTERACTION_OPERAND_HEIGHT; View shapeView = (View) parent.getModel(); Rectangle newBounds = new Rectangle(containerBounds.getX(), containerBounds.getY(), width, height); - ICommand setParentBoundsCmd = new SetBoundsCommand(compartment.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(shapeView), newBounds); + ICommand setParentBoundsCmd = new SetResizeAndLocationCommand(compartment.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(shapeView), newBounds); command.add(setParentBoundsCmd); // Preserve Message anchors. ICommand preserveMessageAnchorsCommand = MessageAnchorRepairer.createPreserveMessageAnchorsCommand(parent, OperandBoundsComputeHelper.DEFAULT_INTERACTION_OPERAND_HEIGHT); @@ -992,7 +993,7 @@ public class OperandBoundsComputeHelper { } } } - command.add(new SetBoundsCommand(compartment.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, rect)); + command.add(new SetResizeAndLocationCommand(compartment.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, rect)); } } } else { // first add operand @@ -1006,7 +1007,7 @@ public class OperandBoundsComputeHelper { int width = containerBounds.getWidth() != -1 ? containerBounds.getWidth() : preferredSize.width(); int height = containerBounds.getHeight() != -1 ? containerBounds.getHeight() : preferredSize.height(); height = height - computeCombinedFragementHeaderHeight(parent); - command.add(new SetBoundsCommand(compartment.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, new Rectangle(0, 0, width - COMBINED_FRAGMENT_FIGURE_BORDER * 2, height + command.add(new SetResizeAndLocationCommand(compartment.getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize, viewDescriptor, new Rectangle(0, 0, width - COMBINED_FRAGMENT_FIGURE_BORDER * 2, height - COMBINED_FRAGMENT_FIGURE_BORDER * 2))); } } @@ -1041,7 +1042,7 @@ public class OperandBoundsComputeHelper { if (height > rect.height) { int heightDelta = height - rect.height; rect.height = height; - command.add(new SetBoundsCommand(parent.getEditingDomain(), "Expand covered Lifeline by CombinedFragment", new EObjectAdapter(view), rect)); + command.add(new SetResizeAndLocationCommand(parent.getEditingDomain(), "Expand covered Lifeline by CombinedFragment", new EObjectAdapter(view), rect)); command.add(MessageAnchorRepairer.createPreserveMessageAnchorsCommand((LifelineEditPart) part, heightDelta)); } break; @@ -1583,7 +1584,7 @@ public class OperandBoundsComputeHelper { Rectangle newBounds = fillRectangle(bounds); newBounds.y += moveDelta; CompoundCommand moveCommand = new CompoundCommand(); - SetBoundsCommand cmd = new SetBoundsCommand(getEditingDomain(), getLabel(), child, newBounds); + ICommand cmd = new SetResizeAndLocationCommand(getEditingDomain(), getLabel(), child, newBounds); moveCommand.add(new ICommandProxy(cmd)); moveCommand = OccurrenceSpecificationMoveHelper.completeMoveExecutionSpecificationCommand(moveCommand, child, newBounds, new ChangeBoundsRequest()); List<?> targetConnections = child.getTargetConnections(); @@ -1640,7 +1641,7 @@ public class OperandBoundsComputeHelper { Location layout = (Location) ((Shape) gate.getNotationView()).getLayoutConstraint(); Point location = new Point(layout.getX(), layout.getY()); location.y += moveDelta; - SetBoundsCommand command = new SetBoundsCommand(getEditingDomain(), "", gate, location); + ICommand command = new SetLocationCommand(getEditingDomain(), "", gate, location); commands.add(new ICommandProxy(command)); } else { ConnectionAnchor sourceAnchor = msgFigure.getSourceAnchor(); @@ -1655,7 +1656,7 @@ public class OperandBoundsComputeHelper { Location layout = (Location) ((Shape) gate.getNotationView()).getLayoutConstraint(); Point location = new Point(layout.getX(), layout.getY()); location.y += moveDelta; - SetBoundsCommand command = new SetBoundsCommand(getEditingDomain(), "", gate, location); + ICommand command = new SetLocationCommand(getEditingDomain(), "", gate, location); commands.add(new ICommandProxy(command)); } else { IdentityAnchor gmfTargetAnchor = (IdentityAnchor) edge.getTargetAnchor(); |