Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Parker2013-08-30 18:08:24 +0000
committerMiles Parker2013-08-30 18:08:24 +0000
commit5e761dbdfc371861e1a0fcecda889ae97303f879 (patch)
tree769ecff4a7e55a1d247b8b5325d4de3a47baf266
parent87b0ac895cb47b79256dbef3ccdfab0b474c8009 (diff)
downloadorg.eclipse.mylyn.context.mft-5e761dbdfc371861e1a0fcecda889ae97303f879.tar.gz
org.eclipse.mylyn.context.mft-5e761dbdfc371861e1a0fcecda889ae97303f879.tar.xz
org.eclipse.mylyn.context.mft-5e761dbdfc371861e1a0fcecda889ae97303f879.zip
413129: Attempt Papyrus test fix to support multiple versions
-rw-r--r--org.eclipse.mylyn.mft.papyrus.tests/src/org/eclipse/mylyn/mft/papyrus/tests/PapyrusDiagramEditorTest.java30
1 files changed, 17 insertions, 13 deletions
diff --git a/org.eclipse.mylyn.mft.papyrus.tests/src/org/eclipse/mylyn/mft/papyrus/tests/PapyrusDiagramEditorTest.java b/org.eclipse.mylyn.mft.papyrus.tests/src/org/eclipse/mylyn/mft/papyrus/tests/PapyrusDiagramEditorTest.java
index 4941063..5a9544a 100644
--- a/org.eclipse.mylyn.mft.papyrus.tests/src/org/eclipse/mylyn/mft/papyrus/tests/PapyrusDiagramEditorTest.java
+++ b/org.eclipse.mylyn.mft.papyrus.tests/src/org/eclipse/mylyn/mft/papyrus/tests/PapyrusDiagramEditorTest.java
@@ -16,9 +16,11 @@ import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart;
import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
-import org.eclipse.gmf.runtime.notation.impl.ShapeImpl;
+import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
@@ -85,18 +87,20 @@ public class PapyrusDiagramEditorTest extends AbstractEmfContextTest {
IInteractionElement iInteractionElement = ContextCore.getContextManager().getActiveContext().get(RESOURCE_URI);
assertFalse(iInteractionElement.getInterest().isInteresting());
- ShapeImpl bookShape = (ShapeImpl) ed.getEditingDomain()
- .getResourceSet()
- .getResources()
- .get(0)
- .getContents()
- .get(0)
- .eContents()
- .get(0);
-
- ClassImpl book = (ClassImpl) bookShape.getElement();
- String name = book.getName();
- assertEquals("Book", name); //$NON-NLS-1$
+ TreeIterator<EObject> children = ed.getEditingDomain().getResourceSet().getResources().get(0).getAllContents();
+ ClassImpl book = null;
+ while (children.hasNext()) {
+ EObject child = children.next();
+ if (child instanceof Shape) {
+ ClassImpl candidate = (ClassImpl) ((Shape) child).getElement();
+ if (candidate.getName().equals("Book")) {
+ book = candidate;
+ }
+ }
+ }
+ if (book == null) {
+ fail("No shape in content tree");
+ }
List<?> findEditPartsForElement = ed.getDiagramGraphicalViewer().findEditPartsForElement(
EMFCoreUtil.getProxyID(book), ShapeEditPart.class);

Back to the top