Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-01-17 17:27:59 +0000
committerChristian W. Damus2016-01-22 15:57:11 +0000
commitb089eab1fca586752027404cc398a173237337f8 (patch)
tree3d5f106bd6ba19ab6364284dec8cd34341cfd758 /tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests
parente8587f9c60ed458d6daee5128186f5b1ee54ac00 (diff)
downloadorg.eclipse.papyrus-b089eab1fca586752027404cc398a173237337f8.tar.gz
org.eclipse.papyrus-b089eab1fca586752027404cc398a173237337f8.tar.xz
org.eclipse.papyrus-b089eab1fca586752027404cc398a173237337f8.zip
Bug 485220: [Architecture] Provide a more modular architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485220 Move UI-dependent APIs from the org.eclipse.papyrus.infra.tools bundle to org.eclipse.papyrus.infra.ui. Accordingly move tests into a new org.eclipse.papyrus.infra.ui.tests bundle. Two crucial UI dependencies are inverted by introduction of new OSGi services with core interfaces specified in the non-UI layer: * IExecutorService extends Java Platform's ExecutorService with APIs for synchronous execution (a la Display.syncExec). A new CoreExecutors class in the infra.tools bundle supplies the instance provided by the OSGi service implementation in the infra.ui bundle. This provides compatibility for clients of various UIUtil APIs that they can no longer access * IContextualServiceRegistryTracker abstracts the concept of the default ServicesRegistry found in the currently active editor, which the ServiceUtilsForHandlers class (and hence all of its clients) relies on. Again an OSGi service implementation in the infra.ui bundle supplies the implementation of this tracker, which is exposed in infra.core through the service-utils API Also move UI-dependent APIs from the org.eclipse.papyrus.infra.core bundle into org.eclipse.papyrus.infra.ui. This includes * moving the 'papyrusDiagram' and 'papyrusContentOutline' extension points into the org.eclipse.papyrus.infra.ui namespace * moving various UI-related services such as EditorLifeycleManager, SaveLayoutBeforeClose, and the IMultiDiagramEditor, itself, into the org.eclipse.papyrus.infra.ui bundle This necessitates not only widespread refactorings on the moved APIs, but also concomitant move of other APIs in other bundles because they cannot plausibly use these moved APIs from their new home in org.eclipse.papyrus.infra.ui and/or they cannot reasonably also be moved to the UI bundle and/or they must be used by bundles that now have no UI dependency: * the DI/sash-windows EMF model is moved out of infra.core.sasheditor.di bundle into a new model-only org.eclipse.papyrus.infra.sashwindows.di bundle (which symbolic name incidentally now better reflects the contained Java package names) * the IPageManager and ILocalPageService interfaces are moved out of infra.core.sasheditor.di bundle because they need to remain accessible by headless code such as the edit advices that ensure deletion of sash-model pages for notations that are deleted. These are now in a package named org.eclipse.papyrus.infra.code.sashwindows.di.service. Accordingly the class hierarchy implementing the IPageManager interface is changed: the obsolete PageMngrImpl is deleted, replaced by a BasicPageManagerImpl which now the PageManagerImpl extends. A service factory creates the basic page manager in a headless context, but is overridden by the UI-aware implementation when the UI bundles are installed * the MultiDiagramEditorGefDelegate (which has a GEF 3 dependency) is moved from the org.eclipse.papyrus.infra.core.sasheditor bundle to a new org.eclipse.papyrus.infra.gmfdiag.gef bundle. Its usage for an adapter of ActionRegistry type is extracted out of the CoreMultiDiagramEditor class into a new external adapter-factory in the infra.gmfdiag.gef bundle Tests all still pass (inasmuch as they do in the nightly master builds). Change-Id: I573dee5d9312d6e5746d74575350d0152b591ab3
Diffstat (limited to 'tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests')
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF5
-rw-r--r--tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java40
2 files changed, 25 insertions, 20 deletions
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF
index 17eb6108d31..3715265e7dd 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/META-INF/MANIFEST.MF
@@ -22,7 +22,10 @@ Require-Bundle: org.junit;bundle-version="4.11.0",
org.eclipse.core.expressions,
org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0"
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0"
Export-Package: org.eclipse.papyrus.uml.nattable.stereotype.display.tests.tests
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
diff --git a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java
index 5e04ca5e24e..62c24f9d867 100644
--- a/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java
+++ b/tests/junit/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display.tests/src/org/eclipse/papyrus/uml/nattable/stereotype/display/tests/tests/StereotypeDisplayTableTest.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST.
- *
+ * Copyright (c) 2015, 2016 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -9,6 +8,7 @@
*
* Contributors:
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ * Christian W. Damus - bug 485220
*
*****************************************************************************/
package org.eclipse.papyrus.uml.nattable.stereotype.display.tests.tests;
@@ -26,7 +26,7 @@ import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForEObject;
@@ -61,7 +61,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
* The class diagram name.
*/
private static final String CLASS_DIAGRAM_NAME = "ClassDiagram";
-
+
/**
* The component diagram name.
*/
@@ -81,7 +81,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
* The component name.
*/
private static final String COMPONENT1_NAME = "Component1";
-
+
/**
* The port name.
*/
@@ -181,7 +181,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
error = new StringBuilder(COMPONENT1_NAME);
error.append(" doesn't exist");
Assert.assertNotNull(error.toString(), component1);
- port1 = (org.eclipse.uml2.uml.Port) component1.getOwnedPort(PORT1_NAME, null);
+ port1 = component1.getOwnedPort(PORT1_NAME, null);
error = new StringBuilder(PORT1_NAME);
error.append(" doesn't exist");
Assert.assertNotNull(error.toString(), port1);
@@ -367,7 +367,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), COMPONENT_DIAGRAM_NAME);
editorFixture.getPageManager().openPage(mainDiagram);
Assert.assertEquals("Current opened diagram is not the expected one", COMPONENT_DIAGRAM_NAME, mainDiagram.getName());
-
+
// Get the interface view
final View component1View = DiagramUtils.findShape(mainDiagram, COMPONENT1_NAME);
Assert.assertNotNull("Component view not present", component1View);
@@ -408,7 +408,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
editorFixture.deselect(portEP);
editorFixture.flushDisplayEvents();
}
-
+
/**
* This allow to test the stereotype display for the association object.
*
@@ -421,7 +421,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME);
editorFixture.getPageManager().openPage(mainDiagram);
Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName());
-
+
// Get the interface view
final View associationView = DiagramUtils.findEdge(mainDiagram, ASSOCIATION1_NAME);
Assert.assertNotNull("Association view not present", associationView);
@@ -460,7 +460,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
editorFixture.deselect(associationEP);
editorFixture.flushDisplayEvents();
}
-
+
/**
* This allow to test the stereotype display for the time observation object.
*
@@ -473,7 +473,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
final Diagram mainDiagram = DiagramUtils.getNotationDiagram(editorFixture.getModelSet(), CLASS_DIAGRAM_NAME);
editorFixture.getPageManager().openPage(mainDiagram);
Assert.assertEquals("Current opened diagram is not the expected one", CLASS_DIAGRAM_NAME, mainDiagram.getName());
-
+
// Get the interface view
final View timeObservationView = DiagramUtils.findShape(mainDiagram, TIME_OBSERVATION1_NAME);
Assert.assertNotNull("Time Observation view not present", timeObservationView);
@@ -487,7 +487,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
final StringBuilder error = new StringBuilder("The object selected is not the ");
error.append(TIME_OBSERVATION1_NAME);
Assert.assertEquals(error.toString(), timeObservationEP, editorSelection);
-
+
// Create the table
final ITreeNattableModelManager manager = createTable(timeObservationView);
@@ -512,15 +512,17 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
editorFixture.deselect(timeObservationEP);
editorFixture.flushDisplayEvents();
}
-
+
/**
* This allow to create the table and the nattable manager.
*
- * @param context The context of the table.
+ * @param context
+ * The context of the table.
* @return The created nattable manager.
- * @throws Exception The exception.
+ * @throws Exception
+ * The exception.
*/
- public ITreeNattableModelManager createTable(final View context) throws Exception{
+ public ITreeNattableModelManager createTable(final View context) throws Exception {
ITreeNattableModelManager manager = null;
// Create the table from the selected class in the diagram
@@ -531,11 +533,11 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
final IEditorPart timeObservationTableEditor = editorFixture.getEditor().getActiveEditor();
Assert.assertTrue(timeObservationTableEditor instanceof NatTableEditor);
manager = (ITreeNattableModelManager) timeObservationTableEditor.getAdapter(INattableModelManager.class);
-
+
// expand the table
manager.doCollapseExpandAction(CollapseAndExpandActionsEnum.EXPAND_ALL, null);
editorFixture.flushDisplayEvents();
-
+
return manager;
}
@@ -565,7 +567,7 @@ public class StereotypeDisplayTableTest extends AbstractPapyrusTest {
model.addPapyrusTable(editorModel);
// Get the manager allowing to add/open new editor.
- final IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry);
+ final IPageManager pageMngr = ServiceUtils.getInstance().getService(IPageManager.class, serviceRegistry);
pageMngr.openPage(editorModel);
} catch (Exception e) {
Activator.log.error(e);

Back to the top