diff options
author | Benoit Maggi | 2018-05-29 12:39:59 +0000 |
---|---|---|
committer | Quentin Le Menez | 2018-05-29 16:11:35 +0000 |
commit | 66266b375f946ec40b51d3f2cfe47875789971cd (patch) | |
tree | 987062eca2ecea1cb36790409d07d06abf21e147 | |
parent | e7af437ab447162ae07d8e36d92ebc645fec19d1 (diff) | |
download | org.eclipse.papyrus-66266b375f946ec40b51d3f2cfe47875789971cd.tar.gz org.eclipse.papyrus-66266b375f946ec40b51d3f2cfe47875789971cd.tar.xz org.eclipse.papyrus-66266b375f946ec40b51d3f2cfe47875789971cd.zip |
Bug 535272 - Exception when selecting actor
- check parameter
- use UnexecutableCommand if invalid parameters
Change-Id: Ic59c77cd03d8cc8c91c6ea1073cf989afb2f1f61
Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java index bf5706c05e0..21314904e8b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/ConstrainedItemBorderLayoutEditPolicy.java @@ -19,14 +19,13 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gef.EditPart; import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.Request; import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; import org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy; import org.eclipse.gef.editpolicies.NonResizableEditPolicy; 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; @@ -50,15 +49,11 @@ public class ConstrainedItemBorderLayoutEditPolicy extends ConstrainedLayoutEdit */ @Override protected Command createChangeConstraintCommand(EditPart child, Object constraint) { - - // code that comes form XYLayoutEditPolicy - Rectangle newBounds = (Rectangle) constraint; - View shapeView = (View) child.getModel(); - - TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); - - ICommand boundsCommand = new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter(shapeView), newBounds); - return new ICommandProxy(boundsCommand); + if (constraint instanceof Rectangle) { + TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain(); + return new ICommandProxy(new SetBoundsCommand(editingDomain, DiagramUIMessages.SetLocationCommand_Label_Resize, new EObjectAdapter((View) child.getModel()), (Rectangle) constraint)); + } + return UnexecutableCommand.INSTANCE; } /** @@ -68,7 +63,6 @@ public class ConstrainedItemBorderLayoutEditPolicy extends ConstrainedLayoutEdit @Override protected EditPolicy createChildEditPolicy(EditPart child) { if ((child instanceof IBorderItemEditPart) && !(child instanceof IFloatingLabelEditPart)) { - // return new BorderItemSelectionEditPolicy(); return new BorderItemResizableEditPolicy(); } EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); @@ -97,18 +91,7 @@ public class ConstrainedItemBorderLayoutEditPolicy extends ConstrainedLayoutEdit * {@inheritDoc} */ @Override - protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) { - - return super.getConstraintFor(request, child); - } - - /** - * - * {@inheritDoc} - */ - @Override protected Object getConstraintFor(Point point) { - return null; } @@ -127,8 +110,8 @@ public class ConstrainedItemBorderLayoutEditPolicy extends ConstrainedLayoutEdit */ @Override protected Command getCreateCommand(CreateRequest request) { - return null; } + } |