diff options
author | ptessier | 2014-03-13 10:36:58 -0400 |
---|---|---|
committer | ptessier | 2014-03-13 10:36:58 -0400 |
commit | 1a08f4c9af22318f711e5b9e8121f1d9bdd978b8 (patch) | |
tree | 5f48e69749d25d9baf0741008a8da1344faa604c /tests/junit | |
parent | 2b0d2af622c6482b4a6109d12463c28f1374588a (diff) | |
parent | da393269bea1fa51a453c731b609358c38884f1a (diff) | |
download | org.eclipse.papyrus-1a08f4c9af22318f711e5b9e8121f1d9bdd978b8.tar.gz org.eclipse.papyrus-1a08f4c9af22318f711e5b9e8121f1d9bdd978b8.tar.xz org.eclipse.papyrus-1a08f4c9af22318f711e5b9e8121f1d9bdd978b8.zip |
Merge branch 'bugs/386118-emf-facet'
Conflicts:
plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/listeners/DropTargetListener.java
Diffstat (limited to 'tests/junit')
9 files changed, 54 insertions, 32 deletions
diff --git a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/META-INF/MANIFEST.MF index 7c71c7f6f70..605872464a1 100644 --- a/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/infra/services/org.eclipse.papyrus.infra.services.labelprovider.tests/META-INF/MANIFEST.MF @@ -8,9 +8,10 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.uml.tools;bundle-version="1.0.0",
org.eclipse.emf.ecore;bundle-version="2.8.1",
org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.1",
org.eclipse.uml2.uml;bundle-version="4.0.0",
- org.junit;bundle-version="4.10.0"
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.0.0",
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.infra.services.labelprovider.tests
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF index d767afa793a..f6ebe099f5f 100644 --- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/META-INF/MANIFEST.MF @@ -2,7 +2,8 @@ Manifest-Version: 1.0 Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.300",
org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.junit;bundle-version="4.10.0"
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.emf.facet.custom.core
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.papyrus.sysml.modelexplorer;bundle-version=
"0.10.0"
diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test-gen/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test-gen/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java index ae1c576fe7b..165a3329338 100644 --- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test-gen/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java +++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test-gen/org/eclipse/papyrus/sysml/modelexplorer/tests/common/AbstractModelExplorerTest.java @@ -30,13 +30,14 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.facet.infra.browser.uicore.internal.model.ModelElementItem; import org.eclipse.emf.transaction.RunnableWithResult; import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart; import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.Customization; +import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.resource.additional.AdditionalResourcesModel; import org.eclipse.papyrus.sysml.modelexplorer.Activator; @@ -207,9 +208,23 @@ public abstract class AbstractModelExplorerTest { Assert.assertNotNull("Impossible to find IBD_B1", iBD_B1_Diagram); bDD_Main_Diagram = getDiagram("BDD_Main"); Assert.assertNotNull("Impossible to find BDD_Main", bDD_Main_Diagram); + List<Customization> appliedCustomizations=org.eclipse.papyrus.views.modelexplorer.Activator.getDefault().getCustomizationManager().getManagedCustomizations(); + Customization SimpleUML=null; + Iterator<?>iter=appliedCustomizations.iterator(); + while(iter.hasNext()) { + Customization custo = (Customization)iter.next(); + if( custo.getName().equals("SimpleUML")){ + SimpleUML=custo; + } + } + org.junit.Assert.assertNotNull("Custom SimpleUML not found", SimpleUML); + org.eclipse.papyrus.views.modelexplorer.Activator.getDefault().getCustomizationManager().getManagedCustomizations().add(0, SimpleUML); + + + org.junit.Assert.assertEquals("bad order of applied Custom", "SimpleUML", appliedCustomizations.get(0).getName()); - /** end of generated selectable objects */ + /** end of generated selectable objects */ } /** @@ -347,12 +362,15 @@ public abstract class AbstractModelExplorerTest { if(bookViewPart != null) { modelExplorerView = (ModelExplorerView)bookViewPart.getActiveView(); } + modelExplorerView.getCommonViewer().expandAll(); // Set selection on new element in the model explorer if((modelExplorerView != null) && (newDiagrams != null)) { List<Diagram> semanticElementList = new ArrayList<Diagram>(); semanticElementList.addAll(newDiagrams); // reveal 'container' of the diagram - reveal(semanticElementList, modelExplorerView.getCommonViewer()); + + modelExplorerView.revealSemanticElement(semanticElementList); + //reveal(semanticElementList, modelExplorerView.getCommonViewer()); } else { throw new Exception("Impossible to find the model explorer required to select: " + newDiagrams); } @@ -455,15 +473,15 @@ public abstract class AbstractModelExplorerTest { * @throws Exception * exception thrown in case of issue */ - protected ModelElementItem findSemanticModelElementItem(EObject objectToFind) throws Exception { + protected EObjectTreeElement findSemanticModelElementItem(EObject objectToFind) throws Exception { selectAndReveal(objectToFind); IStructuredSelection selection = (IStructuredSelection)modelExplorerPart.getSite().getSelectionProvider().getSelection(); Assert.assertEquals("one and only one object should be selected", 1, selection.size()); Object selectedElement = selection.getFirstElement(); - Assert.assertTrue("selection should be a model item element", selectedElement instanceof ModelElementItem); - Assert.assertTrue("selection should be linked to a EObject", ((ModelElementItem)selectedElement).getEObject() instanceof EObject); - Assert.assertTrue("selection should be linked to the Object: " + objectToFind, ((ModelElementItem)selectedElement).getEObject().equals(objectToFind)); - return (ModelElementItem)selectedElement; + Assert.assertTrue("selection should be a model item element", selectedElement instanceof EObjectTreeElement); + Assert.assertTrue("selection should be linked to a EObject", ((EObjectTreeElement)selectedElement).getEObject() instanceof EObject); + Assert.assertTrue("selection should be linked to the Object: " + objectToFind, ((EObjectTreeElement)selectedElement).getEObject().equals(objectToFind)); + return (EObjectTreeElement)selectedElement; } /** @@ -475,15 +493,16 @@ public abstract class AbstractModelExplorerTest { * @throws Exception * exception thrown in case of issue */ - protected ModelElementItem findSemanticModelElementItem(Diagram diagramToFind) throws Exception { + protected EObjectTreeElement findSemanticModelElementItem(Diagram diagramToFind) throws Exception { + selectAndRevealDiagram(diagramToFind); IStructuredSelection selection = (IStructuredSelection)modelExplorerPart.getSite().getSelectionProvider().getSelection(); Assert.assertEquals("one and only one diagram should be selected", 1, selection.size()); Object selectedElement = selection.getFirstElement(); - Assert.assertTrue("selection should be a model item element", selectedElement instanceof ModelElementItem); - Assert.assertTrue("selection should be linked to a Diagram", ((ModelElementItem)selectedElement).getEObject() instanceof Diagram); - Assert.assertTrue("selection should be linked to the Object: " + diagramToFind, ((ModelElementItem)selectedElement).getEObject().equals(diagramToFind)); - return (ModelElementItem)selectedElement; + Assert.assertTrue("selection should be a model item element", selectedElement instanceof EObjectTreeElement); + Assert.assertTrue("selection should be linked to a Diagram", ((EObjectTreeElement)selectedElement).getEObject() instanceof Diagram); + Assert.assertTrue("selection should be linked to the Object: " + diagramToFind, ((EObjectTreeElement)selectedElement).getEObject().equals(diagramToFind)); + return (EObjectTreeElement)selectedElement; } protected String printElement(EObject object) { diff --git a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/dragdrop/AbstractDragDropTest.java b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/dragdrop/AbstractDragDropTest.java index e8525c958c9..82e15f263d6 100644 --- a/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/dragdrop/AbstractDragDropTest.java +++ b/tests/junit/plugins/sysml/org.eclipse.papyrus.sysml.modelexplorer.tests/test/org/eclipse/papyrus/sysml/modelexplorer/tests/dragdrop/AbstractDragDropTest.java @@ -22,11 +22,11 @@ import java.util.List; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.facet.infra.browser.uicore.internal.model.ModelElementItem;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ViewerDropAdapter;
+import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EObjectTreeElement;
import org.eclipse.papyrus.sysml.modelexplorer.tests.common.AbstractModelExplorerTest;
import org.eclipse.papyrus.sysml.modelexplorer.tests.utils.EditorUtils;
import org.eclipse.papyrus.views.modelexplorer.CustomCommonViewer;
@@ -69,13 +69,13 @@ public class AbstractDragDropTest extends AbstractModelExplorerTest { public List<CompoundCommand> getListOfDropCommands(EObject sourceElement, EObject targetElement) throws Exception {
// init source object
- ModelElementItem sourceMEI = null;
+ EObjectTreeElement sourceMEI = null;
if(sourceElement instanceof Diagram) {
sourceMEI = findSemanticModelElementItem((Diagram)sourceElement);
} else {
sourceMEI = findSemanticModelElementItem(sourceElement);
}
- ModelElementItem targetMEI = null;
+ EObjectTreeElement targetMEI = null;
if(targetElement instanceof Diagram) {
targetMEI = findSemanticModelElementItem((Diagram)targetElement);
} else {
diff --git a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/META-INF/MANIFEST.MF index 45335126385..a6ffe40397d 100644 --- a/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/tools/org.eclipse.papyrus.uml.tools.tests/META-INF/MANIFEST.MF @@ -10,7 +10,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
org.junit;bundle-version="4.10.0",
org.eclipse.papyrus.junit.utils;bundle-version="1.0.0",
- org.eclipse.emf.transaction;bundle-version="1.4.0"
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.uml.tools.tests,
org.eclipse.papyrus.uml.tools.tests.tests
Bundle-Vendor: Eclipse Modeling Project
diff --git a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/META-INF/MANIFEST.MF index d0fd039419a..d1f486cca15 100644 --- a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/META-INF/MANIFEST.MF @@ -15,7 +15,9 @@ Require-Bundle: org.eclipse.ui, org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0",
org.eclipse.papyrus.views.modelexplorer;bundle-version="1.0.0",
org.eclipse.papyrus.infra.widgets;bundle-version="1.0.0",
- org.junit;bundle-version="4.10.0"
+ org.junit;bundle-version="4.10.0",
+ org.eclipse.papyrus.emf.facet.custom.metamodel,
+ org.eclipse.papyrus.infra.emf
Export-Package: org.eclipse.papyrus.views.modelexplorer.tests
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
diff --git a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/AbstractHandlerTest.java b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/AbstractHandlerTest.java index a700e2a5271..481420d48d7 100644 --- a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/AbstractHandlerTest.java +++ b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/AbstractHandlerTest.java @@ -38,6 +38,7 @@ import org.eclipse.emf.transaction.util.TransactionUtil; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
+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;
@@ -296,9 +297,7 @@ public abstract class AbstractHandlerTest { // store the root of the model
Object[] visibleElement = commonViewer.getVisibleExpandedElements();
- if(visibleElement[0] instanceof IAdaptable) {
- modelRoot = (EObject)((IAdaptable)visibleElement[0]).getAdapter(EObject.class);
- }
+ modelRoot = EMFHelper.getEObject(visibleElement[0]);
setStatus(Status.OK_STATUS);
}
diff --git a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/DeleteHandlerTest.java b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/DeleteHandlerTest.java index ab04aafea6c..c261cd3399e 100644 --- a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/DeleteHandlerTest.java +++ b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/DeleteHandlerTest.java @@ -24,6 +24,8 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.facet.infra.browser.uicore.internal.model.ITreeElement;
import org.eclipse.emf.transaction.RunnableWithResult;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.EStructuralFeatureTreeElement;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPage;
@@ -90,9 +92,7 @@ public class DeleteHandlerTest extends AbstractHandlerTest { final IStructuredSelection currentSelection = getCurrentSelection();
Assert.assertEquals("Only one element should be selected", currentSelection.size(), 1); //$NON-NLS-1$
Object obj = currentSelection.getFirstElement();
- if(obj instanceof IAdaptable) {
- obj = ((IAdaptable)obj).getAdapter(EObject.class);
- }
+ obj = EMFHelper.getEObject(obj);
Assert.assertSame(getRootOfTheModel(), obj);
final IHandler currentHandler = getActiveHandler();
if(currentHandler == null) {
@@ -118,8 +118,8 @@ public class DeleteHandlerTest extends AbstractHandlerTest { final Object[] expandedElement = runnable.getResult();
for(final Object object : expandedElement) {
- if(object instanceof org.eclipse.emf.facet.infra.browser.uicore.internal.model.LinkItem) {
- selectElementInTheModelexplorer((ITreeElement)object);
+ if(object instanceof EStructuralFeatureTreeElement) {
+ selectElementInTheModelexplorer((EStructuralFeatureTreeElement)object);
final IHandler handler = getActiveHandler();
if(handler != null) {
Assert.assertFalse("The handler " + handler + " is active on LinkItem, it is not the wanted behavior", handler.isEnabled()); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/ModelExplorerViewTests.java b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/ModelExplorerViewTests.java index cf8c7180bc9..660aa92a500 100644 --- a/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/ModelExplorerViewTests.java +++ b/tests/junit/plugins/views/modelexplorer/org.eclipse.papyrus.views.modelexplorer.tests/src/org/eclipse/papyrus/views/modelexplorer/tests/ModelExplorerViewTests.java @@ -22,6 +22,7 @@ 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.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.modelexplorer.ModelExplorerPageBookView;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbenchPage;
@@ -76,9 +77,7 @@ public class ModelExplorerViewTests extends AbstractHandlerTest { final IStructuredSelection currentSelection = getCurrentSelection();
Assert.assertEquals("Only one element should be selected", currentSelection.size(), 1); //$NON-NLS-1$
Object obj = currentSelection.getFirstElement();
- if(obj instanceof IAdaptable) {
- obj = ((IAdaptable)obj).getAdapter(EObject.class);
- }
+ obj = EMFHelper.getEObject(obj);
Assert.assertSame("The function revealSemanticElement seems doesn't work on the root of the model", obj, getRootOfTheModel()); //$NON-NLS-1$
}
|