Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-24 12:25:04 -0400
committerChristian W. Damus2014-03-24 12:28:43 -0400
commit5f2fb9930de81ca13af27c64c085d97be0029cff (patch)
treebc16bf3498b3c08f362ac8d70518be9aec844aac /tests/junit
parent8d6c69c92a326e00484be59825117cb137b45f83 (diff)
downloadorg.eclipse.papyrus-5f2fb9930de81ca13af27c64c085d97be0029cff.tar.gz
org.eclipse.papyrus-5f2fb9930de81ca13af27c64c085d97be0029cff.tar.xz
org.eclipse.papyrus-5f2fb9930de81ca13af27c64c085d97be0029cff.zip
386118: [EMF Facet] Papyrus should progressively support EMF Facet 0.2
Fix spurious JUnit failures caused by EMF Facet 0.2 refactoring.
Diffstat (limited to 'tests/junit')
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF3
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java17
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
index e2f81cdc12b..0a1f1350817 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/META-INF/MANIFEST.MF
@@ -15,7 +15,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.editor;bundle-version="1.0.0",
org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.infra.core.log;bundle-version="1.0.0",
- org.eclipse.papyrus.infra.tools;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.tools;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.junit.utils,
org.eclipse.papyrus.junit.utils.classification,
org.eclipse.papyrus.junit.utils.rules,
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java
index 994bc52eb5d..ad3541dd4e7 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/ModelExplorerUtils.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 386118
*
*****************************************************************************/
package org.eclipse.papyrus.junit.utils;
@@ -23,14 +24,13 @@ import org.eclipse.core.commands.Command;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPage;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerView;
@@ -102,10 +102,9 @@ public class ModelExplorerUtils {
final Iterator<?> iter = currentSelection.iterator();
while(iter.hasNext()) {
final Object current = iter.next();
- if(current instanceof IAdaptable) {
- final EObject adaptedObject = (EObject)((IAdaptable)current).getAdapter(EObject.class);
- Assert.assertNotNull(NLS.bind("The object {0} can't be adapted to EObject", current), adaptedObject);
- selection.add(adaptedObject);
+ EObject eObject = EMFHelper.getEObject(current);
+ if(eObject != null) {
+ selection.add(eObject);
} else {
selection.add(current);
}
@@ -128,8 +127,8 @@ public class ModelExplorerUtils {
// store the root of the model
final Object[] visibleElement = view.getCommonViewer().getVisibleExpandedElements();
EObject modelRoot = null;
- if(visibleElement[0] instanceof IAdaptable) {
- modelRoot = (EObject)((IAdaptable)visibleElement[0]).getAdapter(EObject.class);
+ if(visibleElement.length > 0) {
+ modelRoot = EMFHelper.getEObject(visibleElement[0]);
}
Assert.assertNotNull(modelRoot);
while(modelRoot.eContainer() != null) {

Back to the top