diff options
author | Christian W. Damus | 2018-05-24 16:41:29 +0000 |
---|---|---|
committer | Nicolas FAUVERGUE | 2018-05-25 08:52:53 +0000 |
commit | c361d453197982874f3d6e0145764583b83f9d8d (patch) | |
tree | 994818f37a0c837caa53051ef89d3183543ea043 /tests/junit/framework/org.eclipse.papyrus.junit.utils | |
parent | 533466f05b354e5c078d9e1cfea1b0101d4ca671 (diff) | |
download | org.eclipse.papyrus-c361d453197982874f3d6e0145764583b83f9d8d.tar.gz org.eclipse.papyrus-c361d453197982874f3d6e0145764583b83f9d8d.tar.xz org.eclipse.papyrus-c361d453197982874f3d6e0145764583b83f9d8d.zip |
Bug 533683: [Sequence Diagram] Deletion of the last InteractionOperand
In the diagram, deletion of a multiple selection obtains a deletion
command separately from each selected edit-part, entirely within its
own context. There is no reasonable way to share a single
InteractionContainerDeletionContext amongst these separate requests
that will not break other situations, so instead of pre-computing
the advice command that deletes the CombinedFragment when it will be
left without any operands, this decision is deferred to the actual
point of execution of an after advice.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=533683
Change-Id: I64b214df5540346c769c1ab769d914b279178e4c
Diffstat (limited to 'tests/junit/framework/org.eclipse.papyrus.junit.utils')
-rw-r--r-- | tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java b/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java index 8753f5f3de8..d0f96b18492 100644 --- a/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java +++ b/tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java @@ -61,7 +61,6 @@ import org.eclipse.gef.EditPart; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.gef.RootEditPart; import org.eclipse.gef.ui.palette.PaletteViewer; -import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; @@ -74,6 +73,7 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditorWithFlyOutPalette; import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory; +import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; import org.eclipse.gmf.runtime.notation.Diagram; @@ -95,8 +95,6 @@ import org.eclipse.papyrus.infra.nattable.common.editor.AbstractEMFNattableEdito import org.eclipse.papyrus.infra.nattable.common.modelresource.PapyrusNattableModel; import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; import org.eclipse.papyrus.infra.nattable.model.nattable.Table; -import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; -import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; import org.eclipse.papyrus.infra.tools.util.PlatformHelper; import org.eclipse.papyrus.infra.tools.util.TypeUtils; import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor; @@ -1539,21 +1537,23 @@ public class PapyrusEditorFixture extends AbstractModelFixture<TransactionalEdit } /** - * Delete an edit-part from the diagram. + * Delete one or more edit-parts from the diagram. * * @param editPart - * the edit-part to delete + * the edit-parts to delete * * @since 2.2 + * + * @throws IllegalArgumentException + * if no edit-parts are specified */ - public void delete(EditPart editPart) { - EObject toDestroy = editPart.getAdapter(EObject.class); - EObject container = toDestroy.eContainer(); - DestroyElementRequest request = new DestroyElementRequest(toDestroy, false); - IElementEditService edit = ElementEditServiceUtils.getCommandProvider(container); - ICommand delete = edit.getEditCommand(request); - - assertThat("No delete command obtained", delete, notNullValue()); + public void delete(EditPart... editPart) { + // In the diagram, deletion of a multiple selection is accomplished with separate + // requests to each edit-part, so do the same here + org.eclipse.gef.commands.Command delete = Stream.of(editPart).map(ep -> ep.getCommand(new EditCommandRequestWrapper(new DestroyElementRequest(false)))) + .reduce(org.eclipse.gef.commands.Command::chain) + .orElseThrow(IllegalArgumentException::new); + execute(delete); } } |