diff options
9 files changed, 57 insertions, 48 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java index ab7072e76d6..96da854b342 100644 --- a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java +++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EAttributeTreeElementImpl.java @@ -1,5 +1,5 @@ /**
- * Copyright (c) 2012 Mia-Software.
+ * Copyright (c) 2012, 2014 Mia-Software, CEA, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,10 +8,12 @@ * Contributors:
* Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
* Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements()
+ * Christian W. Damus (CEA) - bug 434133
*/
package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl;
import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EAttributeTreeElement;
/**
@@ -45,5 +47,10 @@ public class EAttributeTreeElementImpl extends EStructuralFeatureTreeElementImpl public void setEAttribute(EAttribute newEAttribute) {
eAttribute = newEAttribute;
}
+
+ @Override
+ protected EStructuralFeature getEStructuralFeature() {
+ return getEAttribute();
+ }
} //EAttributeTreeElementImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java index f4cde724fb4..43b5c1d7be4 100644 --- a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java +++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EReferenceTreeElementImpl.java @@ -1,5 +1,5 @@ /**
- * Copyright (c) 2012 Mia-Software.
+ * Copyright (c) 2012, 2014 Mia-Software, CEA, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,11 +8,13 @@ * Contributors:
* Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
* Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements()
+ * Christian W. Damus (CEA) - bug 434133
*/
package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EReferenceTreeElement;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement;
@@ -57,5 +59,10 @@ public class EReferenceTreeElementImpl extends EStructuralFeatureTreeElementImpl public void setParent(EObjectTreeElement parent) {
super.setParent(parent);
}
+
+ @Override
+ protected EStructuralFeature getEStructuralFeature() {
+ return getEReference();
+ }
} //EReferenceTreeElementImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java index 6d9d8dc11fa..3702493a8dc 100644 --- a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java +++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.metamodel/src/org/eclipse/papyrus/emf/facet/custom/metamodel/v0_2_0/internal/treeproxy/impl/EStructuralFeatureTreeElementImpl.java @@ -1,5 +1,5 @@ /**
- * Copyright (c) 2012 Mia-Software.
+ * Copyright (c) 2012, 2014 Mia-Software, CEA, and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,6 +8,7 @@ * Contributors:
* Nicolas Bros (Mia-Software) - Bug 379683 - customizable Tree content provider
* Gregoire Dupe (Mia-Software) - Bug 386387 - [CustomizedTreeContentProvider] The TreeElements are not preserved between two calls to getElements()
+ * Christian W. Damus (CEA) - bug 434133
*/
package org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.impl;
@@ -62,7 +63,7 @@ public class EStructuralFeatureTreeElementImpl extends TreeElementImpl implement */
public Object getAdapter(Class key) {
if(key == EStructuralFeature.Setting.class) { //Metamodel element
- EStructuralFeature.Setting result = new EStructuralFeature.Setting() {
+ return new EStructuralFeature.Setting() {
public void unset() {
getEObject().eUnset(getEStructuralFeature());
@@ -77,7 +78,7 @@ public class EStructuralFeatureTreeElementImpl extends TreeElementImpl implement }
public EStructuralFeature getEStructuralFeature() {
- return getEStructuralFeature();
+ return EStructuralFeatureTreeElementImpl.this.getEStructuralFeature();
}
public EObject getEObject() {
@@ -102,6 +103,10 @@ public class EStructuralFeatureTreeElementImpl extends TreeElementImpl implement return null;
}
+ protected EStructuralFeature getEStructuralFeature() {
+ throw new UnsupportedOperationException();
+ }
+
// The semantic EObject of a EReferenceTreeElement is the semantic EObject of it's parent (Which is an EObjectTreeElement)
protected EObject getEObject() {
TreeElement parent = getParent();
diff --git a/plugins/uml/org.eclipse.papyrus.uml.commands/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.commands/plugin.xml index 71b9ca20ada..d8e3bccf5eb 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.commands/plugin.xml +++ b/plugins/uml/org.eclipse.papyrus.uml.commands/plugin.xml @@ -65,11 +65,6 @@ <count
value="1">
</count>
- <iterate>
- <instanceof
- value="org.eclipse.emf.ecore.EObject">
- </instanceof>
- </iterate>
<!-- we add these test to force the refresh of the Menu + to avoid handlers conflit -->
<test
forcePluginActivation="true"
diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/DeleteModelExplorerTest.java b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/DeleteModelExplorerTest.java index cd45006958b..2692fe4551f 100644 --- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/DeleteModelExplorerTest.java +++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/DeleteModelExplorerTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 434133 * *****************************************************************************/ package org.eclipse.papyrus.uml.modelexplorer.tests; @@ -19,7 +20,6 @@ import java.util.List; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.IHandler; import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.junit.utils.HandlerUtils; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; @@ -86,7 +86,7 @@ public class DeleteModelExplorerTest extends AbstractEditorTest { modelExplorerView.revealSemanticElement(elements); //getItem for model - EObject modelTreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object modelTreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Model TreeElement is null", modelTreeObject); //$NON-NLS-1$ IHandler deleteHandler = HandlerUtils.getActiveHandlerFor(DELETE_COMMAND_ID); //$NON-NLS-1$ @@ -112,7 +112,7 @@ public class DeleteModelExplorerTest extends AbstractEditorTest { modelExplorerView.revealSemanticElement(elements); //getItem for model - EObject modelTreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object modelTreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Model TreeElement is null", modelTreeObject); //$NON-NLS-1$ //get Item for class1 @@ -122,7 +122,7 @@ public class DeleteModelExplorerTest extends AbstractEditorTest { elements.clear(); elements.add(class1); modelExplorerView.revealSemanticElement(elements); - EObject class1TreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object class1TreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Class1 TreeElement is null", class1TreeObject); //$NON-NLS-1$ IHandler deleteHandler = HandlerUtils.getActiveHandlerFor(DELETE_COMMAND_ID); //$NON-NLS-1$ @@ -155,7 +155,7 @@ public class DeleteModelExplorerTest extends AbstractEditorTest { modelExplorerView.revealSemanticElement(elements); //getItem for model - EObject modelTreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object modelTreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Model TreeElement is null", modelTreeObject); //$NON-NLS-1$ //get read only item @@ -166,7 +166,7 @@ public class DeleteModelExplorerTest extends AbstractEditorTest { elements.clear(); elements.add(packagedElement); modelExplorerView.revealSemanticElement(elements); - EObject treeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object treeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Boolean Primitive TreeElement is null", treeObject); //$NON-NLS-1$ IHandler deleteHandler = HandlerUtils.getActiveHandlerFor(DELETE_COMMAND_ID); diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/CopyPasteModelExplorerTest.java b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/CopyPasteModelExplorerTest.java index be12a0d7766..794a95cc525 100644 --- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/CopyPasteModelExplorerTest.java +++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/CopyPasteModelExplorerTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 434133 * *****************************************************************************/ package org.eclipse.papyrus.uml.modelexplorer.tests.paste; @@ -19,7 +20,6 @@ import java.util.List; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.IHandler; import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.junit.utils.HandlerUtils; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; @@ -96,7 +96,7 @@ public class CopyPasteModelExplorerTest extends AbstractEditorTest { elements.clear(); elements.add(class1); modelExplorerView.revealSemanticElement(elements); - EObject class1TreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object class1TreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Class1 TreeElement is null", class1TreeObject); //$NON-NLS-1$ IHandler copyHandler = HandlerUtils.getActiveHandlerFor(COPY_COMMAND_ID); @@ -139,7 +139,7 @@ public class CopyPasteModelExplorerTest extends AbstractEditorTest { modelExplorerView.revealSemanticElement(elements); //getItem for model - EObject modelTreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object modelTreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Model TreeElement is null", modelTreeObject); //$NON-NLS-1$ // copy class1 @@ -147,7 +147,7 @@ public class CopyPasteModelExplorerTest extends AbstractEditorTest { elements.clear(); elements.add(class1); modelExplorerView.revealSemanticElement(elements); - EObject class1TreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object class1TreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Class1 TreeElement is null", class1TreeObject); //$NON-NLS-1$ IHandler copyHandler = HandlerUtils.getActiveHandlerFor(COPY_COMMAND_ID); @@ -161,7 +161,7 @@ public class CopyPasteModelExplorerTest extends AbstractEditorTest { elements.clear(); elements.add(primitiveTypes); modelExplorerView.revealSemanticElement(elements); - EObject treeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object treeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("PrimitiveTypes TreeElement is null", treeObject); //$NON-NLS-1$ IHandler pasteHandler = HandlerUtils.getActiveHandlerFor(PASTE_COMMAND_ID); @@ -195,10 +195,10 @@ public class CopyPasteModelExplorerTest extends AbstractEditorTest { elements.add(class1); elements.add(class2); modelExplorerView.revealSemanticElement(elements); - EObject class1TreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object class1TreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Class1 TreeElement is null", class1TreeObject); //$NON-NLS-1$ - EObject class2TreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object class2TreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Class2 TreeElement is null", class2TreeObject); //$NON-NLS-1$ IHandler copyHandler = HandlerUtils.getActiveHandlerFor(COPY_COMMAND_ID); diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/CutPasteModelExplorerTest.java b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/CutPasteModelExplorerTest.java index 6b46343c3c3..b81b085a047 100644 --- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/CutPasteModelExplorerTest.java +++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/CutPasteModelExplorerTest.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -9,6 +9,7 @@ * * Contributors: * Benoit Maggi (CEA LIST) benoit.maggi@cea.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 434133 * *****************************************************************************/ package org.eclipse.papyrus.uml.modelexplorer.tests.paste; @@ -19,7 +20,6 @@ import java.util.List; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.IHandler; import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.junit.utils.HandlerUtils; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; @@ -87,7 +87,7 @@ public class CutPasteModelExplorerTest extends AbstractEditorTest { modelExplorerView.revealSemanticElement(elements); //getItem for model - EObject modelTreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object modelTreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Model TreeElement is null", modelTreeObject); //$NON-NLS-1$ IHandler cutHandler = HandlerUtils.getActiveHandlerFor(CUT_COMMAND_ID); //$NON-NLS-1$ @@ -114,7 +114,7 @@ public class CutPasteModelExplorerTest extends AbstractEditorTest { modelExplorerView.revealSemanticElement(elements); //getItem for model - EObject modelTreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object modelTreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Model TreeElement is null", modelTreeObject); //$NON-NLS-1$ //get read only item @@ -125,7 +125,7 @@ public class CutPasteModelExplorerTest extends AbstractEditorTest { elements.clear(); elements.add(packagedElement); modelExplorerView.revealSemanticElement(elements); - EObject treeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object treeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Boolean Primitive PrimitiveTypes TreeElement is null", treeObject); //$NON-NLS-1$ IHandler cutHandler = HandlerUtils.getActiveHandlerFor(CUT_COMMAND_ID); @@ -156,14 +156,14 @@ public class CutPasteModelExplorerTest extends AbstractEditorTest { //getItem for model - EObject modelTreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object modelTreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Model TreeElement is null", modelTreeObject); //$NON-NLS-1$ //get Item for class1 elements.clear(); elements.add(class1); modelExplorerView.revealSemanticElement(elements); - EObject class1TreeObject = (EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object class1TreeObject = ((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Class1 TreeElement is null", class1TreeObject); //$NON-NLS-1$ diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/ContentProviderTest.java b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/ContentProviderTest.java index a9aa94685c7..f3597667d9f 100644 --- a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/ContentProviderTest.java +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/src/org/eclipse/papyrus/uml/tools/tests/tests/ContentProviderTest.java @@ -9,6 +9,7 @@ * Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bug 422257
+ * Christian W. Damus (CEA) - bug 434133
*
*****************************************************************************/
package org.eclipse.papyrus.uml.tools.tests.tests;
@@ -146,7 +147,9 @@ public class ContentProviderTest extends AbstractPapyrusTest { Assert.assertTrue(current instanceof IAdaptable);
if(adaptedValue instanceof EReference) {
- Assert.assertEquals(adaptedValue, ((IAdaptable)current).getAdapter(EReference.class));
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting)((IAdaptable)current).getAdapter(EStructuralFeature.Setting.class);
+ Assert.assertNotNull(setting);
+ Assert.assertEquals(adaptedValue, setting.getEStructuralFeature());
} else if(adaptedValue instanceof EObject) {
Assert.assertEquals(adaptedValue, ((IAdaptable)current).getAdapter(EObject.class));
}
diff --git a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/OpendiagramTest.java b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/OpendiagramTest.java index 70b5b326239..90225374ac5 100644 --- a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/OpendiagramTest.java +++ b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/OpendiagramTest.java @@ -1,6 +1,5 @@ - /***************************************************************************** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014 CEA LIST and others. * * * All rights reserved. This program and the accompanying materials @@ -10,24 +9,17 @@ * * Contributors: * Patrick Tessier (CEA LIST) Patrick.Tessier.fr - Initial API and implementation + * Christian W. Damus (CEA) - bug 434133 * *****************************************************************************/ package org.eclipse.papyrus.views.modelexplorer.tests; import java.util.ArrayList; -import org.eclipse.emf.ecore.EObject; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.papyrus.infra.emf.providers.EMFLabelProvider; import org.eclipse.papyrus.junit.utils.tests.AbstractEditorTest; import org.eclipse.papyrus.views.modelexplorer.DecoratingLabelProviderWTooltips; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.ISelectionService; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; @@ -62,34 +54,34 @@ public class OpendiagramTest extends AbstractEditorTest { //getItem for model - EObject modelTreeObject=(EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object modelTreeObject=((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Model TreeElement is null", modelTreeObject); //$NON-NLS-1$ //get Item for class1 elements.clear(); elements.add(class1); modelExplorerView.revealSemanticElement( elements); - EObject class1TreeObject=(EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object class1TreeObject=((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Class1 TreeElement is null", class1TreeObject); //$NON-NLS-1$ //get Item for class2 elements.clear(); elements.add(class2); modelExplorerView.revealSemanticElement( elements); - EObject class2TreeObject=(EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object class2TreeObject=((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("Class2 TreeElement is null", class2TreeObject); //$NON-NLS-1$ //get Item for diagram1 elements.clear(); elements.add(diagram1); modelExplorerView.revealSemanticElement( elements); - EObject diagram1TreeObject=(EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object diagram1TreeObject=((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("digram1 TreeElement is null", diagram1TreeObject); //$NON-NLS-1$ //get Item for diagram2 elements.clear(); elements.add(diagram2); modelExplorerView.revealSemanticElement( elements); - EObject diagram2TreeObject=(EObject)((IStructuredSelection)selectionService.getSelection()).getFirstElement(); + Object diagram2TreeObject=((IStructuredSelection)selectionService.getSelection()).getFirstElement(); Assert.assertNotNull("digram2 TreeElement is null", diagram2TreeObject); //$NON-NLS-1$ //test icons of closed diagram |