Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2018-04-24 11:57:09 -0400
committerNicolas FAUVERGUE2018-05-14 11:15:01 -0400
commit044dc1170629e1657f39305fdaf900abca5a7aa1 (patch)
treeb656954fda95873d62852e982786b15a0cb56759 /tests/junit/framework
parenteb963d6206eeed64210d2ac31caa880cd8489caf (diff)
downloadorg.eclipse.papyrus-044dc1170629e1657f39305fdaf900abca5a7aa1.tar.gz
org.eclipse.papyrus-044dc1170629e1657f39305fdaf900abca5a7aa1.tar.xz
org.eclipse.papyrus-044dc1170629e1657f39305fdaf900abca5a7aa1.zip
Bug 533671: [Sequence Diagram] CombinedFragment should be created on Lifeline and Interaction
Add test coverage for combined fragment creation on lifelines. Change-Id: I9657a74b412fab102422b33e6b85956bdb43f3ae Signed-off-by: Christian W. Damus <give.a.damus@gmail.com>
Diffstat (limited to 'tests/junit/framework')
-rw-r--r--tests/junit/framework/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/rules/PapyrusEditorFixture.java16
1 files changed, 7 insertions, 9 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 932b51085ee..759cf747fb5 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
@@ -23,9 +23,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.Set;
+import java.util.Objects;
import java.util.function.Supplier;
-import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.eclipse.core.commands.operations.IOperationHistory;
@@ -79,7 +78,6 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequestFactory;
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;
-import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
@@ -93,6 +91,7 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
import org.eclipse.papyrus.infra.nattable.common.editor.AbstractEMFNattableEditor;
import org.eclipse.papyrus.infra.nattable.common.modelresource.PapyrusNattableModel;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
@@ -136,7 +135,6 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.ListMultimap;
import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
/**
@@ -1493,17 +1491,17 @@ public class PapyrusEditorFixture extends AbstractModelFixture<TransactionalEdit
public EditPart createShape(EditPart parent, IElementType type, Point location, Dimension size) {
CreateViewRequest request = CreateViewRequestFactory.getCreateShapeRequest(type, ((IGraphicalEditPart) parent).getDiagramPreferencesHint());
- // Collect existing children
- Set<EditPart> initialChildren = stream(parent.getChildren(), EditPart.class).collect(Collectors.toSet());
request.setLocation(location);
request.setSize(size);
org.eclipse.gef.commands.Command command = parent.getCommand(request);
execute(command);
// Find the new edit-part
- Set<EditPart> children = stream(parent.getChildren(), EditPart.class).collect(Collectors.toSet());
- return Sets.difference(children, initialChildren).stream()
- .filter(ep -> ep.getModel() instanceof Shape)
+ return request.getViewDescriptors().stream()
+ .map(desc -> desc.getAdapter(View.class)).map(View.class::cast)
+ .filter(Objects::nonNull)
+ .map(view -> DiagramEditPartsUtil.getEditPartFromView(view, parent))
+ .filter(Objects::nonNull)
.findAny().orElseGet(failOnAbsence("Could not find new shape edit-part"));
}

Back to the top