Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpguilet2018-01-25 10:37:41 +0000
committerpguilet2018-02-05 10:17:15 +0000
commit159293b92dafb406cc95ba1ee985dbdf932276f4 (patch)
tree3b030ca34bc420197ac7ca1b963a8703c105a578
parent663ec121bfe946d312d410296395e674491caddf (diff)
downloadorg.eclipse.sirius-159293b92dafb406cc95ba1ee985dbdf932276f4.tar.gz
org.eclipse.sirius-159293b92dafb406cc95ba1ee985dbdf932276f4.tar.xz
org.eclipse.sirius-159293b92dafb406cc95ba1ee985dbdf932276f4.zip
[529879] Fix viewpoint activation side effects
Changing the activation status of a viewpoint in an session editor now does not change the activation status of this viewpoint in other opened session editors. The label provider TooltipAwareNavigatorDecoratingLabelProvider has been removed because it causes the problem and it is not necessary to display tooltips in viewpoints viewer of session editor whereas it is the only reason for its usage. Bug: 529879 Change-Id: I19eefde42f77242812143f4adaa62444c03d7f32 Signed-off-by: pguilet <pierre.guilet@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/layoutingMode/vp2120_2.aird111
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorPageProvidingTest.java976
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorTest.java965
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java3
-rw-r--r--plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/graphicalcomponents/GraphicalRepresentationHandler.java3
5 files changed, 1202 insertions, 856 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/layoutingMode/vp2120_2.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/layoutingMode/vp2120_2.aird
new file mode 100644
index 0000000000..b70ce38722
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/layoutingMode/vp2120_2.aird
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:description="http://www.eclipse.org/sirius/description/1.1.0" xmlns:description_1="http://www.eclipse.org/sirius/diagram/description/1.1.0" xmlns:diagram="http://www.eclipse.org/sirius/diagram/1.1.0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:viewpoint="http://www.eclipse.org/sirius/1.1.0" xsi:schemaLocation="http://www.eclipse.org/sirius/description/1.1.0 http://www.eclipse.org/sirius/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style">
+ <viewpoint:DAnalysis xmi:id="_Tf_kgIUYEeC3ftmLixaZXg" selectedViews="_jfkQ0AKwEeiflLvTBgrrEw" version="12.1.0.201708031200">
+ <semanticResources>vp2120.ecore</semanticResources>
+ <ownedViews xmi:type="viewpoint:DView" xmi:id="_T6-QUIUYEeC3ftmLixaZXg">
+ <viewpoint xmi:type="description:Viewpoint" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']"/>
+ <ownedRepresentationDescriptors xmi:type="viewpoint:DRepresentationDescriptor" xmi:id="_gd_WMAKwEeiflLvTBgrrEw" name="new LayoutingMode Diagram" repPath="#_gdzI8AKwEeiflLvTBgrrEw">
+ <description xmi:type="description_1:DiagramDescription" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']"/>
+ <target xmi:type="viewpoint:DAnalysis" href="vp2120.ecore#_Tf_kgIUYEeC3ftmLixaZXg"/>
+ </ownedRepresentationDescriptors>
+ </ownedViews>
+ <ownedViews xmi:type="viewpoint:DView" xmi:id="_Dvn0gIVDEeCnb7qGDutJ5Q">
+ <viewpoint xmi:type="description:Viewpoint" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']"/>
+ </ownedViews>
+ <ownedViews xmi:type="viewpoint:DView" xmi:id="_jfkQ0AKwEeiflLvTBgrrEw">
+ <viewpoint xmi:type="description:Viewpoint" href="platform:/resource/DesignerTestProject/vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']"/>
+ </ownedViews>
+ </viewpoint:DAnalysis>
+ <diagram:DSemanticDiagram xmi:id="_deplMIVIEeCSGf835_Mdqg" name="new LayoutingMode Diagram" uid="_gdzI8AKwEeiflLvTBgrrEw">
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_dfQCIIVIEeCSGf835_Mdqg" source="GMF_DIAGRAMS">
+ <data xmi:type="notation:Diagram" xmi:id="_dfQCIYVIEeCSGf835_Mdqg" type="Sirius" element="_deplMIVIEeCSGf835_Mdqg" measurementUnit="Pixel">
+ <children xmi:type="notation:Node" xmi:id="_dkw0QIVIEeCSGf835_Mdqg" type="2002" element="_H7gbkJjKEeCGbO5oLE72PQ">
+ <children xmi:type="notation:Node" xmi:id="_dlNgMIVIEeCSGf835_Mdqg" type="5006"/>
+ <children xmi:type="notation:Node" xmi:id="_dlWqIIVIEeCSGf835_Mdqg" type="7001">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_dlWqIYVIEeCSGf835_Mdqg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_dlWqIoVIEeCSGf835_Mdqg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_dnSj0IVIEeCSGf835_Mdqg" type="3012" element="_H7hpsJjKEeCGbO5oLE72PQ">
+ <children xmi:type="notation:Node" xmi:id="_dncU0IVIEeCSGf835_Mdqg" type="5010">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_dncU0YVIEeCSGf835_Mdqg" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_dt2e0IVIEeCSGf835_Mdqg" type="3003" element="_H7hpsZjKEeCGbO5oLE72PQ">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_dt2e0YVIEeCSGf835_Mdqg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dt2e0oVIEeCSGf835_Mdqg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_dnSj0YVIEeCSGf835_Mdqg" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dnSj0oVIEeCSGf835_Mdqg" x="55" y="70" width="20" height="20"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_dkw0QYVIEeCSGf835_Mdqg" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dkw0QoVIEeCSGf835_Mdqg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_dlWqI4VIEeCSGf835_Mdqg" type="2002" element="_H7hCpZjKEeCGbO5oLE72PQ">
+ <children xmi:type="notation:Node" xmi:id="_dlWqJoVIEeCSGf835_Mdqg" type="5006"/>
+ <children xmi:type="notation:Node" xmi:id="_dlWqJ4VIEeCSGf835_Mdqg" type="7001">
+ <styles xmi:type="notation:SortingStyle" xmi:id="_dlWqKIVIEeCSGf835_Mdqg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_dlWqKYVIEeCSGf835_Mdqg"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_du5AoIVIEeCSGf835_Mdqg" type="3012" element="_H7iQwJjKEeCGbO5oLE72PQ">
+ <children xmi:type="notation:Node" xmi:id="_du5Ao4VIEeCSGf835_Mdqg" type="5010">
+ <layoutConstraint xmi:type="notation:Location" xmi:id="_du5ApIVIEeCSGf835_Mdqg" y="5"/>
+ </children>
+ <children xmi:type="notation:Node" xmi:id="_du5ApYVIEeCSGf835_Mdqg" type="3003" element="_H7iQwZjKEeCGbO5oLE72PQ">
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_du5ApoVIEeCSGf835_Mdqg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_du5Ap4VIEeCSGf835_Mdqg"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_du5AoYVIEeCSGf835_Mdqg" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_du5AooVIEeCSGf835_Mdqg" x="75" y="70" width="20" height="20"/>
+ </children>
+ <styles xmi:type="notation:ShapeStyle" xmi:id="_dlWqJIVIEeCSGf835_Mdqg" fontHeight="8"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_dlWqJYVIEeCSGf835_Mdqg" x="210"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_dfQCIoVIEeCSGf835_Mdqg"/>
+ </data>
+ </ownedAnnotationEntries>
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_gd_WMQKwEeiflLvTBgrrEw" source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_gd_WMgKwEeiflLvTBgrrEw"/>
+ </ownedAnnotationEntries>
+ <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_H7gbkJjKEeCGbO5oLE72PQ" name="new Package 1">
+ <target xmi:type="ecore:EPackage" href="vp2120.ecore#//new%20Package%201"/>
+ <semanticElements xmi:type="ecore:EPackage" href="vp2120.ecore#//new%20Package%201"/>
+ <ownedBorderedNodes xmi:type="diagram:DNode" xmi:id="_H7hpsJjKEeCGbO5oLE72PQ" name="new EClass 3" width="2" height="2">
+ <target xmi:type="ecore:EClass" href="vp2120.ecore#//new%20Package%201/new%20EClass%203"/>
+ <semanticElements xmi:type="ecore:EClass" href="vp2120.ecore#//new%20Package%201/new%20EClass%203"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:Square" xmi:id="_H7hpsZjKEeCGbO5oLE72PQ" borderColor="173,127,168" width="2" height="2" color="239,41,41">
+ <description xmi:type="style:SquareDescription" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer/@containerMappings[name='CM_EPackage']/@borderedNodeMappings[name='BN_EClass']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer/@containerMappings[name='CM_EPackage']/@borderedNodeMappings[name='BN_EClass']"/>
+ </ownedBorderedNodes>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_H7hCoJjKEeCGbO5oLE72PQ" borderSize="1" borderSizeComputationExpression="1" borderColor="39,76,114" backgroundColor="114,159,207" foregroundColor="204,242,166">
+ <description xmi:type="style:FlatContainerStyleDescription" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer/@containerMappings[name='CM_EPackage']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer/@containerMappings[name='CM_EPackage']"/>
+ </ownedDiagramElements>
+ <ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_H7hCpZjKEeCGbO5oLE72PQ" name="new EPackage 2">
+ <target xmi:type="ecore:EPackage" href="vp2120.ecore#//new%20EPackage%202"/>
+ <semanticElements xmi:type="ecore:EPackage" href="vp2120.ecore#//new%20EPackage%202"/>
+ <ownedBorderedNodes xmi:type="diagram:DNode" xmi:id="_H7iQwJjKEeCGbO5oLE72PQ" name="new EClass 4" width="2" height="2">
+ <target xmi:type="ecore:EClass" href="vp2120.ecore#//new%20EPackage%202/new%20EClass%204"/>
+ <semanticElements xmi:type="ecore:EClass" href="vp2120.ecore#//new%20EPackage%202/new%20EClass%204"/>
+ <arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
+ <arrangeConstraints>KEEP_SIZE</arrangeConstraints>
+ <arrangeConstraints>KEEP_RATIO</arrangeConstraints>
+ <ownedStyle xmi:type="diagram:Square" xmi:id="_H7iQwZjKEeCGbO5oLE72PQ" borderColor="173,127,168" width="2" height="2" color="239,41,41">
+ <description xmi:type="style:SquareDescription" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer/@containerMappings[name='CM_EPackage']/@borderedNodeMappings[name='BN_EClass']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:NodeMapping" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer/@containerMappings[name='CM_EPackage']/@borderedNodeMappings[name='BN_EClass']"/>
+ </ownedBorderedNodes>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_H7hCppjKEeCGbO5oLE72PQ" borderSize="1" borderSizeComputationExpression="1" borderColor="39,76,114" backgroundColor="114,159,207" foregroundColor="204,242,166">
+ <description xmi:type="style:FlatContainerStyleDescription" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer/@containerMappings[name='CM_EPackage']/@style"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_1:ContainerMapping" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer/@containerMappings[name='CM_EPackage']"/>
+ </ownedDiagramElements>
+ <description xmi:type="description_1:DiagramDescription" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']"/>
+ <filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_deplMYVIEeCSGf835_Mdqg"/>
+ <activatedLayers xmi:type="description_1:Layer" href="vp2120.odesign#//@ownedViewpoints[name='LayoutingMode']/@ownedRepresentations[name='LayoutingMode%20Diagram']/@defaultLayer"/>
+ <target xmi:type="viewpoint:DAnalysis" href="vp2120.ecore#_Tf_kgIUYEeC3ftmLixaZXg"/>
+ </diagram:DSemanticDiagram>
+</xmi:XMI>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorPageProvidingTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorPageProvidingTest.java
new file mode 100644
index 0000000000..5acd2d3bd7
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorPageProvidingTest.java
@@ -0,0 +1,976 @@
+/*******************************************************************************
+ * Copyright (c) 2017, 2018 Obeo.
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.sirius.tests.swtbot;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.sirius.business.internal.resource.AirDResourceImpl;
+import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
+import org.eclipse.sirius.tests.unit.airdeditor.SessionEditorTestPageProvider;
+import org.eclipse.sirius.tests.unit.airdeditor.SessionEditorTestPageProvider.CommandSynchronization;
+import org.eclipse.sirius.tests.unit.airdeditor.SessionEditorTestPageProvider.PageProviderExtension;
+import org.eclipse.sirius.ui.editor.SessionEditor;
+import org.eclipse.sirius.ui.editor.SessionEditorPlugin;
+import org.eclipse.sirius.ui.editor.api.pages.AbstractSessionEditorPage;
+import org.eclipse.sirius.ui.editor.api.pages.PageProvider;
+import org.eclipse.sirius.ui.editor.api.pages.PageProviderRegistry;
+import org.eclipse.sirius.ui.editor.api.pages.PageProviderRegistry.PositioningKind;
+import org.eclipse.sirius.ui.editor.api.pages.PageUpdateCommandBuilder;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.editor.IFormPage;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+
+/**
+ * This class tests the {@link SessionEditor} page extensibility functionality
+ * from the UI point of view.
+ *
+ * Warning: the plugin org.eclipse.sirius.ui.debug must be not in runtime so the
+ * tests can work.
+ *
+ * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a>
+ *
+ */
+public class SessionEditorPageProvidingTest extends AbstractSiriusSwtBotGefTestCase {
+
+ private static final String NEW_LABEL_INVISIBLE = "newLabelInvisible";
+
+ private static final String NEW_LABEL_VISIBLE = "newLabelVisible";
+
+ private static final String UPDATED_PAGE_LABEL = "newLabel";
+
+ private static final String PAGE2_TAB_LABEL = "page2";
+
+ private static final String DEFAULT_PAGE_TAB_LABEL = "Overview";
+
+ public static final String PATH = "/data/unit/layoutingMode/";
+
+ private static final String SEMANTIC_MODEL_FILENAME = "vp2120.ecore";
+
+ private static final String MODELER_MODEL_FILENAME = "vp2120.odesign";
+
+ private static final String SESSION_PATH = "vp2120.aird";
+
+ private static final String FILE_DIR = "/";
+
+ private SessionEditor sessionEditor;
+
+ private SessionEditorTestPageProvider sessionEditorTestPageProvider;
+
+ private Map<String, AbstractSessionEditorPage> idToPageMap;
+
+ private PageProviderRegistry pageRegistry;
+
+ private List<PageProviderExtension> pageProviders;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ copyFileToTestProject(Activator.PLUGIN_ID, PATH, SEMANTIC_MODEL_FILENAME, MODELER_MODEL_FILENAME, SESSION_PATH);
+
+ sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_PATH);
+
+ localSession = designerPerspective.openSessionFromFile(sessionAirdResource);
+
+ RunnableWithResult<IEditorPart> result = new RunnableWithResult<IEditorPart>() {
+ private IEditorPart resultEditor;
+
+ @Override
+ public void run() {
+ URI uri = localSession.getOpenedSession().getSessionResource().getURI();
+ try {
+ resultEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor(new FileEditorInput(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)))), SessionEditor.EDITOR_ID);
+ } catch (PartInitException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public IEditorPart getResult() {
+ return resultEditor;
+ }
+
+ @Override
+ public void setStatus(IStatus status) {
+
+ }
+
+ @Override
+ public IStatus getStatus() {
+ return null;
+ }
+ };
+
+ PlatformUI.getWorkbench().getDisplay().syncExec(result);
+ sessionEditor = (SessionEditor) result.getResult();
+ assertEquals("There should be only the default page after initialization.", 1, sessionEditor.getPages().size());
+
+ idToPageMap = new HashMap<String, AbstractSessionEditorPage>();
+ idToPageMap.put(SessionEditorPlugin.DEFAULT_PAGE_ID, (AbstractSessionEditorPage) sessionEditor.getPages().get(0));
+
+ pageRegistry = SessionEditorPlugin.getPlugin().getPageRegistry();
+
+ pageProviders = new ArrayList<PageProviderExtension>();
+
+ sessionEditorTestPageProvider = new SessionEditorTestPageProvider(sessionEditor, idToPageMap, pageRegistry, pageProviders);
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ sessionEditor.close(false);
+ for (PageProviderExtension pageProviderExtension : pageProviders) {
+ pageRegistry.removePageProvider(pageProviderExtension);
+ }
+ idToPageMap.clear();
+ sessionEditor = null;
+ sessionEditorTestPageProvider = null;
+ pageRegistry = null;
+ pageProviders = null;
+ idToPageMap = null;
+ super.tearDown();
+
+ }
+
+ private CTabItem[] getPageTabItems(SessionEditor sessionEditor) {
+ Field f;
+ try {
+ f = MultiPageEditorPart.class.getDeclaredField("container");
+
+ f.setAccessible(true);
+ CTabFolder tabFolder = (CTabFolder) f.get(sessionEditor);
+ return tabFolder.getItems();
+ } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Asserts that computed pages order have the right order by testing tab
+ * labels.
+ *
+ * @param expectedTotalPagesNumber
+ * @param orderedExpectedPages
+ */
+ protected void assertRightPageOrderingByLabel(int expectedTotalPagesNumber, String... orderedExpectedPages) {
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ List<IFormPage> pagesOrdered = sessionEditor.getPages();
+ CTabItem[] pageItems = getPageTabItems(sessionEditor);
+ int i = 0;
+ for (String expectedPageTabLAbel : orderedExpectedPages) {
+ assertEquals("The test context is wrong", expectedPageTabLAbel, pageItems[i].getText());
+ i++;
+ }
+ assertEquals("The number of page in the editor is wrong.", expectedTotalPagesNumber, pageItems.length);
+ assertEquals("The number of page in the editor is wrong.", expectedTotalPagesNumber, pagesOrdered.size());
+ });
+ }
+
+ /**
+ * Asserts that computed pages order have the right order.
+ *
+ * @param expectedTotalPagesNumber
+ * @param orderedExpectedPages
+ */
+ protected void assertRightPageOrdering(int expectedTotalPagesNumber, String... orderedExpectedPages) {
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ List<IFormPage> pagesOrdered = sessionEditor.getPages();
+ int i = 0;
+ for (String expectedPageId : orderedExpectedPages) {
+ assertEquals("The page order is wrong.", idToPageMap.get(expectedPageId), pagesOrdered.get(i));
+ i++;
+ }
+ CTabItem[] pageItems = getPageTabItems(sessionEditor);
+ assertEquals("The number of page in the editor is wrong.", expectedTotalPagesNumber, pageItems.length);
+ assertEquals("The number of page in the editor is wrong.", expectedTotalPagesNumber, pagesOrdered.size());
+ });
+ }
+
+ /**
+ * Test {@link PositioningKind#BEFORE} positioning:
+ *
+ * There are the default page "Overview". We add a page before the default
+ * one.
+ */
+ public void testPageOrderingBefore() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ assertRightPageOrdering(2, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
+ }
+
+ /**
+ * Tests that when a page is placed after a page that does not exists, then
+ * it is added to the end.
+ *
+ * We have the default page P1 and we add a page P2 before a page P3 that
+ * does not exist.
+ *
+ * Result should be P1,P2.
+ */
+ public void testPageOrderingBeforeMissingPage() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Tests that when a page is placed after a page that does not exists, then
+ * it is added to the end.
+ *
+ * We have the default page P1 and we add a page P2 after a page P3 that
+ * does not exist.
+ *
+ * Result should be P1,P2.
+ */
+ public void testPageOrderingAfterMissingPage() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Tests that when a page is placed after a page that does not exists, then
+ * it is added to the end.
+ *
+ * We have the default page P1 and we add a page P2 that replaces a page P3
+ * that does not exist.
+ *
+ * Result should be P1,P2.
+ */
+ public void testPageOrderingReplaceMissingPage() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.REPLACE, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test {@link PositioningKind#AFTER} positioning:
+ *
+ * There are the default page "Overview". We add a page after the default
+ * one.
+ */
+ public void testPageOrderingAfter() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test {@link PositioningKind#REPLACE} positioning:
+ *
+ * There are the default page "Overview". We add a page that replaces the
+ * default one.
+ */
+ public void testPageOrderingReplacement() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ assertRightPageOrdering(1, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test positioning when no positioning is provided by the added page:
+ *
+ * There are the default page "Overview". We add a page without positioning
+ * information that is put at the most right position.
+ */
+ public void testPageOrderingNoPositioning() {
+ sessionEditorTestPageProvider.initOnePageProvider(null, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test positioning when no positioning is provided by the added page:
+ *
+ * There are the default page "Overview". We add two pages without
+ * positioning information that are put at the most right position.
+ */
+ public void testMultiPageOrderingNoPositioning() {
+ sessionEditorTestPageProvider.initTwoPageProvider(null, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, SessionEditorPlugin.DEFAULT_PAGE_ID,
+ SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview".
+ *
+ * One page P2 is placed after the default one P1.
+ *
+ * Another page P3 is provided and is placed before P2.
+ *
+ * The page order should be P1, P3, P2.
+ */
+ public void testMultiPageOrderingBeforeConflict() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
+ SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview".
+ *
+ * One page P2 is placed before the default one P1.
+ *
+ * Another page P3 is provided and is placed after P2.
+ *
+ * The page order should be P2, P3, P1.
+ */
+ public void testMultiPageOrderingAfterFirstPage() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.AFTER,
+ SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 is placed after the default one P1.
+ *
+ * Another page P3 is provided and is placed after P1 also.
+ *
+ * The page order should be P1,P3,P2.
+ */
+ public void testMultiPageOrderingAfterConflict() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.AFTER,
+ SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 is placed before the default one P1.
+ *
+ * Another page P3 is placed after P2.
+ *
+ * The page order should be P1,P3,P2.
+ */
+ public void testMultiPageOrderingAfterConflict2() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.AFTER,
+ SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 is placed before the default one P1.
+ *
+ * Another page P3 is provided and is placed before P1 also.
+ *
+ * The page order should be P2,P3,P1.
+ */
+ public void testMultiPageOrderingBeforeConflict2() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
+ SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 replaces the default one P1.
+ *
+ * Another page P3 replaces P1 also.
+ *
+ * The page order should be P2,P3 because P2 replace P1 and P3 has no P1 to
+ * replace after P2 replacement.
+ */
+ public void testMultiPageOrderingReplaceConflict() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.REPLACE,
+ SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(2, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 replaces the default one P1.
+ *
+ * Another page P3 replaces P2.
+ *
+ * The page order should be P3 only.
+ */
+ public void testMultiPageOrderingReplace() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.REPLACE,
+ SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(1, SessionEditorTestPageProvider.PAGE3_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 is placed before the default one P1.
+ *
+ * Another page P3 is placed before P2.
+ *
+ * The page order should be P3,P2,P1.
+ */
+ public void testMultiPageOrderingBefore() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
+ SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 is placed after the default one P1.
+ *
+ * Another page P3 is placed after P2.
+ *
+ * The page order should be P1, P2, P3.
+ */
+ public void testMultiPageOrderingAfter() {
+ sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.AFTER,
+ SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 has no positioning information.
+ *
+ * Another page P3 is placed before P1.
+ *
+ * The page order should be P3, P1, P2.
+ */
+ public void testMultiPageOrderingNoPositioningAndBefore() {
+ sessionEditorTestPageProvider.initTwoPageProvider(null, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
+ SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 is placed after P3.
+ *
+ * Another page P3 is placed before P1.
+ *
+ * The page order should be P3, P1, P2.
+ */
+ public void testMultiPageOrderingConflict() {
+ sessionEditorTestPageProvider.initTwoPageProvider(null, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
+ SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
+ assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 is placed before P1
+ *
+ * Another page P3 is not placed.
+ *
+ * Another page P4 is placed before P3.
+ *
+ * We have two independent cluster {P4, P3} and {P2, P1}.
+ *
+ * The page order should be P4, P3, P2, P1.
+ */
+ public void testMultiPageOrderingClustering() {
+ sessionEditorTestPageProvider.initThreePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, null,
+ SessionEditorTestPageProvider.PAGE3_ID, PositioningKind.BEFORE, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE4_ID);
+ assertRightPageOrdering(4, SessionEditorTestPageProvider.PAGE4_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * There are the default page "Overview" P1.
+ *
+ * One page P2 is not placed
+ *
+ * Another page P3 is placed before P1.
+ *
+ * Another page P4 is placed before P3.
+ *
+ * We have two independent cluster {P4, P3, P1} and {P2}.
+ *
+ * The page order should be P4, P3, P1, P2.
+ */
+ public void testMultiPageOrderingClustering2() {
+ sessionEditorTestPageProvider.initThreePageProvider(null, null, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID,
+ SessionEditorTestPageProvider.PAGE3_ID, PositioningKind.BEFORE, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE4_ID);
+ assertRightPageOrdering(4, SessionEditorTestPageProvider.PAGE4_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * We add a page by adding a {@link PageProvider}. Then we remove the page
+ * provider from the registry. The page should be removed.
+ */
+ public void testPageProviderRemoval() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
+
+ pageRegistry.removePageProvider(pageProviders.get(0));
+
+ assertRightPageOrdering(1, SessionEditorPlugin.DEFAULT_PAGE_ID);
+ });
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * A page has its tab label updated each time the session's resource set is
+ * updated. This tests the rename is done correctly.
+ */
+ public void testDynamicPageRenameUpdate() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
+ return Optional.of(new PageUpdateCommandBuilder().renameTab(UPDATED_PAGE_LABEL).build());
+ }, null);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, UPDATED_PAGE_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, UPDATED_PAGE_LABEL);
+
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * A page has its tab label set to newLabelVisible when the page is made
+ * visible and newLabelInvisible when it is made not visible.
+ */
+ public void testDynamicPageRenameVisibilityUpdate() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
+ if (isVisible) {
+ return Optional.of(new PageUpdateCommandBuilder().renameTab(NEW_LABEL_VISIBLE).build());
+ } else {
+ return Optional.of(new PageUpdateCommandBuilder().renameTab(NEW_LABEL_INVISIBLE).build());
+ }
+ }, null, null);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, NEW_LABEL_VISIBLE);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, NEW_LABEL_VISIBLE);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, NEW_LABEL_INVISIBLE);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, NEW_LABEL_INVISIBLE);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * A page is removed when any change occurs from session's resource set. But
+ * the page provider has no condition preventing its initialization when
+ * called. The page visibility is not synchronized between page and page
+ * provider.
+ *
+ * So just after the removal, the page should be added again.
+ */
+ public void testDynamicPageRemovalDesynchroUpdate() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
+ return Optional.of(new PageUpdateCommandBuilder().removePage().build());
+ }, null);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * A page is removed when the {@link AirDResourceImpl} resource is removed.
+ * The page provider and the page method
+ * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)}
+ * are synchronized. I.e if the page is removed dynamically, the page
+ * provider update will not provide the page again The page removal
+ * condition is the the exact contrary of the page providing condition.
+ */
+ public void testDynamicPageRemovalUpdate() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
+ return Optional.of(new PageUpdateCommandBuilder().removePage().build());
+ }, CommandSynchronization.RESOURCE_SET_CHANGE_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(1, DEFAULT_PAGE_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(1, DEFAULT_PAGE_TAB_LABEL);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * A page is removed when the {@link AirDResourceImpl} resource is removed
+ * and the page is visible. The page provider and the page method
+ * {@link AbstractSessionEditorPage#pageChanged(boolean)} are synchronized.
+ * I.e if the page is removed dynamically, the page provider update will not
+ * provide the page again The page removal condition is the the exact
+ * contrary of the page providing condition.
+ */
+ public void testDynamicPageRemovalVisibilityUpdate() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
+ return Optional.of(new PageUpdateCommandBuilder().removePage().build());
+ }, null, CommandSynchronization.VISIBILITY_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(1, DEFAULT_PAGE_TAB_LABEL);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * A page is reordered before the default one when the
+ * {@link AirDResourceImpl} resource is removed. The method
+ * {@link AbstractSessionEditorPage#getPositioning()} is synchronized with
+ * the method
+ * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)}
+ * doing the removal. So the page reorder information when called from a
+ * resource set changed are the same than the page positioning from methods
+ * {@link AbstractSessionEditorPage#getPositioning()} and
+ * {@link AbstractSessionEditorPage#getLocationId()}
+ */
+ public void testDynamicPageReorderUpdate() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
+ return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
+ }, CommandSynchronization.RESOURCE_SET_CHANGE_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * The default page is reordered after another page when the
+ * {@link AirDResourceImpl} resource is removed. The method
+ * {@link AbstractSessionEditorPage#getPositioning()} is synchronized with
+ * the method
+ * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)}
+ * doing the removal. So the page reorder information when called from a
+ * resource set changed are the same than the page positioning from methods
+ * {@link AbstractSessionEditorPage#getPositioning()} and
+ * {@link AbstractSessionEditorPage#getLocationId()}
+ */
+ public void testDynamicPageReorderUpdate2() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
+ return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
+ }, CommandSynchronization.RESOURCE_SET_CHANGE_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * The default page is reordered after another page when the
+ * {@link AirDResourceImpl} resource is removed. The method
+ * {@link AbstractSessionEditorPage#getPositioning()} is synchronized with
+ * the method
+ * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)}
+ * doing the removal. So the page reorder information when called from a
+ * resource set changed are the same than the page positioning from methods
+ * {@link AbstractSessionEditorPage#getPositioning()} and
+ * {@link AbstractSessionEditorPage#getLocationId()}
+ */
+ public void testDynamicPageReorderUpdate3() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
+ return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
+ }, CommandSynchronization.RESOURCE_SET_CHANGE_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(1, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(1, PAGE2_TAB_LABEL);
+ }
+
+ /**
+ * Removes the first resource of the session's resource set.
+ */
+ private void removeFirstResource() {
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ sessionEditor.getSession().getTransactionalEditingDomain().getResourceSet().getResources().remove(0);
+ });
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * The default page is replaced by another page when the
+ * {@link AirDResourceImpl} resource is removed and the page gains focus.
+ * This tests the method
+ * {@link AbstractSessionEditorPage#pageChanged(boolean)}. The page reorder
+ * information when called from the previous method are the same than the
+ * page positioning from methods
+ * {@link AbstractSessionEditorPage#getPositioning()} and
+ * {@link AbstractSessionEditorPage#getLocationId()}
+ */
+ public void testDynamicPageReorderVisibilityUpdate() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
+ return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
+ }, null, CommandSynchronization.VISIBILITY_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(1, PAGE2_TAB_LABEL);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * The default page is reordered before another page when the
+ * {@link AirDResourceImpl} resource is removed and the page gains focus.
+ * This tests the method
+ * {@link AbstractSessionEditorPage#pageChanged(boolean)}. The page reorder
+ * information when called from the previous method are the same than the
+ * page positioning from methods
+ * {@link AbstractSessionEditorPage#getPositioning()} and
+ * {@link AbstractSessionEditorPage#getLocationId()}
+ */
+ public void testDynamicPageReorderVisibilityUpdate2() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
+ return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
+ }, null, CommandSynchronization.VISIBILITY_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * The default page is reordered after another page when the
+ * {@link AirDResourceImpl} resource is removed and the page gains focus.
+ * This tests the method
+ * {@link AbstractSessionEditorPage#pageChanged(boolean)}. The page reorder
+ * information when called from the previous method are the same than the
+ * page positioning from methods
+ * {@link AbstractSessionEditorPage#getPositioning()} and
+ * {@link AbstractSessionEditorPage#getLocationId()}.
+ */
+ public void testDynamicPageReorderVisibilityUpdate3() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
+ return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
+ }, null, CommandSynchronization.VISIBILITY_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ setActivePage(1);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ setActivePage(1);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+ }
+
+ /**
+ * Test page positioning :
+ *
+ * The methods
+ * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)}
+ * and {@link AbstractSessionEditorPage#pageChanged(boolean)} reorder the
+ * page after and before the default one respectively when
+ * {@link AirDResourceImpl} is removed and when the page is set visible.
+ */
+ public void testBothDynamicPageUpdate() {
+ sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
+ return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
+ }, () -> {
+ return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
+ }, CommandSynchronization.BOTH_SYNCHRONIZATION);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ setActivePage(1);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);;
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+
+ removeFirstResource();
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(0);
+
+ assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
+
+ setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
+
+ assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
+ }
+
+ /**
+ * Change selected page with the one at the given index.
+ */
+ private void setActivePage(int pageIndex) {
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ sessionEditor.setActivePage(pageIndex);
+ });
+ }
+
+ /**
+ * Change selected page with the one with the given name.
+ */
+ private void setActivePage(String pageName) {
+ PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
+ sessionEditor.setActivePage(pageName);
+ });
+ }
+
+}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorTest.java
index f195a9a097..7ace3ef2dc 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SessionEditorTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017 Obeo.
+ * Copyright (c) 2017, 2018 Obeo.
* 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
@@ -10,927 +10,186 @@
*******************************************************************************/
package org.eclipse.sirius.tests.swtbot;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.sirius.business.internal.resource.AirDResourceImpl;
+import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper;
+import org.eclipse.sirius.tests.support.api.ICondition;
+import org.eclipse.sirius.tests.support.api.TestsUtil;
import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UILocalSession;
+import org.eclipse.sirius.tests.swtbot.support.api.business.UIProject;
import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
-import org.eclipse.sirius.tests.unit.airdeditor.SessionEditorTestPageProvider;
-import org.eclipse.sirius.tests.unit.airdeditor.SessionEditorTestPageProvider.CommandSynchronization;
-import org.eclipse.sirius.tests.unit.airdeditor.SessionEditorTestPageProvider.PageProviderExtension;
+import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils;
import org.eclipse.sirius.ui.editor.SessionEditor;
-import org.eclipse.sirius.ui.editor.SessionEditorPlugin;
-import org.eclipse.sirius.ui.editor.api.pages.AbstractSessionEditorPage;
-import org.eclipse.sirius.ui.editor.api.pages.PageProvider;
-import org.eclipse.sirius.ui.editor.api.pages.PageProviderRegistry;
-import org.eclipse.sirius.ui.editor.api.pages.PageProviderRegistry.PositioningKind;
-import org.eclipse.sirius.ui.editor.api.pages.PageUpdateCommandBuilder;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.editor.IFormPage;
import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.MultiPageEditorPart;
/**
- * This class tests the {@link SessionEditor} page extensibility functionality from the UI point of view.
- *
- * Warning: the plugin org.eclipse.sirius.ui.debug must be not in runtime so the tests can work.
+ * This class tests various functionalities of the {@link SessionEditor}.
*
* @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a>
*
*/
public class SessionEditorTest extends AbstractSiriusSwtBotGefTestCase {
+ private final class SessionEditorOpener implements RunnableWithResult<IEditorPart> {
+ private IEditorPart resultEditor;
- private static final String NEW_LABEL_INVISIBLE = "newLabelInvisible";
+ private UILocalSession localSession;
- private static final String NEW_LABEL_VISIBLE = "newLabelVisible";
+ public SessionEditorOpener(UILocalSession localSession) {
+ this.localSession = localSession;
+ }
+
+ @Override
+ public void run() {
+ URI uri = localSession.getOpenedSession().getSessionResource().getURI();
+ try {
+ resultEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor(new FileEditorInput(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)))), SessionEditor.EDITOR_ID);
+ } catch (PartInitException e) {
+ throw new RuntimeException(e);
+ }
+ }
- private static final String UPDATED_PAGE_LABEL = "newLabel";
+ @Override
+ public IEditorPart getResult() {
+ return resultEditor;
+ }
- private static final String PAGE2_TAB_LABEL = "page2";
+ @Override
+ public void setStatus(IStatus status) {
+ }
- private static final String DEFAULT_PAGE_TAB_LABEL = "Overview";
+ @Override
+ public IStatus getStatus() {
+ return null;
+ }
+ }
- public static final String PATH = "/data/unit/layoutingMode/";
+ private static final String TEMP_SECOND_PROJECT_NAME = "DesignerTestProject2";
+
+ private static final String PATH = "/data/unit/layoutingMode/";
private static final String SEMANTIC_MODEL_FILENAME = "vp2120.ecore";
private static final String MODELER_MODEL_FILENAME = "vp2120.odesign";
- private static final String SESSION_PATH = "vp2120.aird";
+ private static final String SESSION_FILE_NAME = "vp2120.aird";
+
+ private static final String SESSION_FILE_NAME_2 = "vp2120_2.aird";
private static final String FILE_DIR = "/";
private SessionEditor sessionEditor;
- private SessionEditorTestPageProvider sessionEditorTestPageProvider;
+ private SessionEditor sessionEditor2;
- private Map<String, AbstractSessionEditorPage> idToPageMap;
+ private UIResource sessionAirdResource2;
- private PageProviderRegistry pageRegistry;
+ private UILocalSession localSession2;
- private List<PageProviderExtension> pageProviders;
+ private UIProject designerProject2;
@Override
public void setUp() throws Exception {
super.setUp();
- copyFileToTestProject(Activator.PLUGIN_ID, PATH, SEMANTIC_MODEL_FILENAME, MODELER_MODEL_FILENAME, SESSION_PATH);
-
- sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_PATH);
-
- localSession = designerPerspective.openSessionFromFile(sessionAirdResource);
-
- RunnableWithResult<IEditorPart> result = new RunnableWithResult<IEditorPart>() {
- private IEditorPart resultEditor;
-
- @Override
- public void run() {
- URI uri = localSession.getOpenedSession().getSessionResource().getURI();
- try {
- resultEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .openEditor(new FileEditorInput(ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)))), SessionEditor.EDITOR_ID);
- } catch (PartInitException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public IEditorPart getResult() {
- return resultEditor;
- }
-
- @Override
- public void setStatus(IStatus status) {
+ copyFileToTestProject(Activator.PLUGIN_ID, PATH, SEMANTIC_MODEL_FILENAME, MODELER_MODEL_FILENAME, SESSION_FILE_NAME);
- }
+ designerProject2 = designerPerspective.createProject(TEMP_SECOND_PROJECT_NAME);
+ EclipseTestsSupportHelper.INSTANCE.copyFile(Activator.PLUGIN_ID, PATH + SESSION_FILE_NAME, TEMP_SECOND_PROJECT_NAME + "/" + SEMANTIC_MODEL_FILENAME);
+ EclipseTestsSupportHelper.INSTANCE.copyFile(Activator.PLUGIN_ID, PATH + SESSION_FILE_NAME_2, TEMP_SECOND_PROJECT_NAME + "/" + SESSION_FILE_NAME_2);
- @Override
- public IStatus getStatus() {
- return null;
- }
- };
+ sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE_NAME);
+ sessionAirdResource2 = new UIResource(designerProject2, FILE_DIR, SESSION_FILE_NAME_2);
- PlatformUI.getWorkbench().getDisplay().syncExec(result);
- sessionEditor = (SessionEditor) result.getResult();
- assertEquals("There should be only the default page after initialization.", 1, sessionEditor.getPages().size());
+ localSession = designerPerspective.openSessionFromFile(sessionAirdResource);
+ localSession2 = designerPerspective.openSessionFromFile(sessionAirdResource2);
- idToPageMap = new HashMap<String, AbstractSessionEditorPage>();
- idToPageMap.put(SessionEditorPlugin.DEFAULT_PAGE_ID, (AbstractSessionEditorPage) sessionEditor.getPages().get(0));
+ RunnableWithResult<IEditorPart> sessionEditor1Launcher = new SessionEditorOpener(localSession);
- pageRegistry = SessionEditorPlugin.getPlugin().getPageRegistry();
+ PlatformUI.getWorkbench().getDisplay().syncExec(sessionEditor1Launcher);
+ sessionEditor = (SessionEditor) sessionEditor1Launcher.getResult();
- pageProviders = new ArrayList<PageProviderExtension>();
+ SWTBotEditor activeEditor = bot.activeEditor();
+ SWTBotTree tree = activeEditor.bot().tree(1);
+ try {
+ tree.getTreeItem("LayoutingMode");
+ } catch (WidgetNotFoundException e) {
+ fail("Test setup is wrong. The activated viewpoint 'LayoutingMode' should be present");
+ }
- sessionEditorTestPageProvider = new SessionEditorTestPageProvider(sessionEditor, idToPageMap, pageRegistry, pageProviders);
+ RunnableWithResult<IEditorPart> sessionEditor2Launcher = new SessionEditorOpener(localSession2);
+ PlatformUI.getWorkbench().getDisplay().syncExec(sessionEditor2Launcher);
+ sessionEditor2 = (SessionEditor) sessionEditor2Launcher.getResult();
}
@Override
protected void tearDown() throws Exception {
sessionEditor.close(false);
- for (PageProviderExtension pageProviderExtension : pageProviders) {
- pageRegistry.removePageProvider(pageProviderExtension);
- }
- idToPageMap.clear();
sessionEditor = null;
- sessionEditorTestPageProvider = null;
- pageRegistry = null;
- pageProviders = null;
- idToPageMap = null;
+ sessionEditor2.close(false);
+ sessionEditor2 = null;
+ sessionAirdResource2 = null;
+ localSession2.close(false);
+ designerProject2 = null;
super.tearDown();
}
- private CTabItem[] getPageTabItems(SessionEditor sessionEditor) {
- Field f;
- try {
- f = MultiPageEditorPart.class.getDeclaredField("container");
-
- f.setAccessible(true);
- CTabFolder tabFolder = (CTabFolder) f.get(sessionEditor);
- return tabFolder.getItems();
- } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- }
-
/**
- * Asserts that computed pages order have the right order by testing tab labels.
- *
- * @param expectedTotalPagesNumber
- * @param orderedExpectedPages
+ * Test that changing a viewpoint activation status of a viewpoint in a
+ * session editor does not change the activation status of a viewpoint in
+ * another opened session editor.
*/
- protected void assertRightPageOrderingByLabel(int expectedTotalPagesNumber, String... orderedExpectedPages) {
- PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
- List<IFormPage> pagesOrdered = sessionEditor.getPages();
- CTabItem[] pageItems = getPageTabItems(sessionEditor);
- int i = 0;
- for (String expectedPageTabLAbel : orderedExpectedPages) {
- assertEquals("The test context is wrong", expectedPageTabLAbel, pageItems[i].getText());
- i++;
- }
- assertEquals("The number of page in the editor is wrong.", expectedTotalPagesNumber, pageItems.length);
- assertEquals("The number of page in the editor is wrong.", expectedTotalPagesNumber, pagesOrdered.size());
- });
- }
+ public void testViewpointActivationStatusChange() {
+ SWTBotEditor activeEditor = bot.activeEditor();
+ final SWTBotTree secondEditorTree = activeEditor.bot().tree(1);
+ SWTBotTreeItem viewpoint = null;
+ try {
+ viewpoint = secondEditorTree.getTreeItem("LayoutingMode");
+ } catch (IndexOutOfBoundsException | WidgetNotFoundException e) {
+ fail("Test setup is wrong. The activated viewpoint 'LayoutingMode' should be present");
+ }
+ viewpoint.doubleClick();
+ TestsUtil.waitUntil(new ICondition() {
- /**
- * Asserts that computed pages order have the right order.
- *
- * @param expectedTotalPagesNumber
- * @param orderedExpectedPages
- */
- protected void assertRightPageOrdering(int expectedTotalPagesNumber, String... orderedExpectedPages) {
- PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
- List<IFormPage> pagesOrdered = sessionEditor.getPages();
- int i = 0;
- for (String expectedPageId : orderedExpectedPages) {
- assertEquals("The page order is wrong.", idToPageMap.get(expectedPageId), pagesOrdered.get(i));
- i++;
+ @Override
+ public boolean test() throws Exception {
+ SWTBotUtils.waitAllUiEvents();
+ try {
+ secondEditorTree.getTreeItem("LayoutingMode (disabled)");
+ } catch (IndexOutOfBoundsException | WidgetNotFoundException e) {
+ return false;
+ }
+ return true;
}
- CTabItem[] pageItems = getPageTabItems(sessionEditor);
- assertEquals("The number of page in the editor is wrong.", expectedTotalPagesNumber, pageItems.length);
- assertEquals("The number of page in the editor is wrong.", expectedTotalPagesNumber, pagesOrdered.size());
- });
- }
-
- /**
- * Test {@link PositioningKind#BEFORE} positioning:
- *
- * There are the default page "Overview". We add a page before the default one.
- */
- public void testPageOrderingBefore() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- assertRightPageOrdering(2, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
- }
-
- /**
- * Tests that when a page is placed after a page that does not exists, then it is added to the end.
- *
- * We have the default page P1 and we add a page P2 before a page P3 that does not exist.
- *
- * Result should be P1,P2.
- */
- public void testPageOrderingBeforeMissingPage() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
- assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Tests that when a page is placed after a page that does not exists, then it is added to the end.
- *
- * We have the default page P1 and we add a page P2 after a page P3 that does not exist.
- *
- * Result should be P1,P2.
- */
- public void testPageOrderingAfterMissingPage() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
- assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Tests that when a page is placed after a page that does not exists, then it is added to the end.
- *
- * We have the default page P1 and we add a page P2 that replaces a page P3 that does not exist.
- *
- * Result should be P1,P2.
- */
- public void testPageOrderingReplaceMissingPage() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.REPLACE, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
- assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test {@link PositioningKind#AFTER} positioning:
- *
- * There are the default page "Overview". We add a page after the default one.
- */
- public void testPageOrderingAfter() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test {@link PositioningKind#REPLACE} positioning:
- *
- * There are the default page "Overview". We add a page that replaces the default one.
- */
- public void testPageOrderingReplacement() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- assertRightPageOrdering(1, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test positioning when no positioning is provided by the added page:
- *
- * There are the default page "Overview". We add a page without positioning information that is put at the most
- * right position.
- */
- public void testPageOrderingNoPositioning() {
- sessionEditorTestPageProvider.initOnePageProvider(null, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test positioning when no positioning is provided by the added page:
- *
- * There are the default page "Overview". We add two pages without positioning information that are put at the most
- * right position.
- */
- public void testMultiPageOrderingNoPositioning() {
- sessionEditorTestPageProvider.initTwoPageProvider(null, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, SessionEditorPlugin.DEFAULT_PAGE_ID,
- SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview".
- *
- * One page P2 is placed after the default one P1.
- *
- * Another page P3 is provided and is placed before P2.
- *
- * The page order should be P1, P3, P2.
- */
- public void testMultiPageOrderingBeforeConflict() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
- SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview".
- *
- * One page P2 is placed before the default one P1.
- *
- * Another page P3 is provided and is placed after P2.
- *
- * The page order should be P2, P3, P1.
- */
- public void testMultiPageOrderingAfterFirstPage() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.AFTER,
- SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 is placed after the default one P1.
- *
- * Another page P3 is provided and is placed after P1 also.
- *
- * The page order should be P1,P3,P2.
- */
- public void testMultiPageOrderingAfterConflict() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.AFTER,
- SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 is placed before the default one P1.
- *
- * Another page P3 is placed after P2.
- *
- * The page order should be P1,P3,P2.
- */
- public void testMultiPageOrderingAfterConflict2() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.AFTER,
- SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 is placed before the default one P1.
- *
- * Another page P3 is provided and is placed before P1 also.
- *
- * The page order should be P2,P3,P1.
- */
- public void testMultiPageOrderingBeforeConflict2() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
- SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 replaces the default one P1.
- *
- * Another page P3 replaces P1 also.
- *
- * The page order should be P2,P3 because P2 replace P1 and P3 has no P1 to replace after P2 replacement.
- */
- public void testMultiPageOrderingReplaceConflict() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.REPLACE,
- SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(2, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 replaces the default one P1.
- *
- * Another page P3 replaces P2.
- *
- * The page order should be P3 only.
- */
- public void testMultiPageOrderingReplace() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.REPLACE,
- SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(1, SessionEditorTestPageProvider.PAGE3_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 is placed before the default one P1.
- *
- * Another page P3 is placed before P2.
- *
- * The page order should be P3,P2,P1.
- */
- public void testMultiPageOrderingBefore() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
- SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 is placed after the default one P1.
- *
- * Another page P3 is placed after P2.
- *
- * The page order should be P1, P2, P3.
- */
- public void testMultiPageOrderingAfter() {
- sessionEditorTestPageProvider.initTwoPageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.AFTER,
- SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorTestPageProvider.PAGE3_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 has no positioning information.
- *
- * Another page P3 is placed before P1.
- *
- * The page order should be P3, P1, P2.
- */
- public void testMultiPageOrderingNoPositioningAndBefore() {
- sessionEditorTestPageProvider.initTwoPageProvider(null, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
- SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 is placed after P3.
- *
- * Another page P3 is placed before P1.
- *
- * The page order should be P3, P1, P2.
- */
- public void testMultiPageOrderingConflict() {
- sessionEditorTestPageProvider.initTwoPageProvider(null, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE,
- SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE3_ID);
- assertRightPageOrdering(3, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 is placed before P1
- *
- * Another page P3 is not placed.
- *
- * Another page P4 is placed before P3.
- *
- * We have two independent cluster {P4, P3} and {P2, P1}.
- *
- * The page order should be P4, P3, P2, P1.
- */
- public void testMultiPageOrderingClustering() {
- sessionEditorTestPageProvider.initThreePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, null,
- SessionEditorTestPageProvider.PAGE3_ID, PositioningKind.BEFORE, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE4_ID);
- assertRightPageOrdering(4, SessionEditorTestPageProvider.PAGE4_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE2_ID, SessionEditorPlugin.DEFAULT_PAGE_ID);
- }
-
- /**
- * Test page positioning :
- *
- * There are the default page "Overview" P1.
- *
- * One page P2 is not placed
- *
- * Another page P3 is placed before P1.
- *
- * Another page P4 is placed before P3.
- *
- * We have two independent cluster {P4, P3, P1} and {P2}.
- *
- * The page order should be P4, P3, P1, P2.
- */
- public void testMultiPageOrderingClustering2() {
- sessionEditorTestPageProvider.initThreePageProvider(null, null, SessionEditorTestPageProvider.PAGE2_ID, PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID,
- SessionEditorTestPageProvider.PAGE3_ID, PositioningKind.BEFORE, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorTestPageProvider.PAGE4_ID);
- assertRightPageOrdering(4, SessionEditorTestPageProvider.PAGE4_ID, SessionEditorTestPageProvider.PAGE3_ID, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
- }
-
- /**
- * Test page positioning :
- *
- * We add a page by adding a {@link PageProvider}. Then we remove the page provider from the registry. The page
- * should be removed.
- */
- public void testPageProviderRemoval() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
-
- PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
- assertRightPageOrdering(2, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID);
-
- pageRegistry.removePageProvider(pageProviders.get(0));
-
- assertRightPageOrdering(1, SessionEditorPlugin.DEFAULT_PAGE_ID);
- });
- }
-
- /**
- * Test page positioning :
- *
- * A page has its tab label updated each time the session's resource set is updated. This tests the rename is done
- * correctly.
- */
- public void testDynamicPageRenameUpdate() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
- return Optional.of(new PageUpdateCommandBuilder().renameTab(UPDATED_PAGE_LABEL).build());
- }, null);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, UPDATED_PAGE_LABEL);
-
- removeFirstResource();
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, UPDATED_PAGE_LABEL);
-
- }
-
- /**
- * Test page positioning :
- *
- * A page has its tab label set to newLabelVisible when the page is made visible and newLabelInvisible when it is
- * made not visible.
- */
- public void testDynamicPageRenameVisibilityUpdate() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
- if (isVisible) {
- return Optional.of(new PageUpdateCommandBuilder().renameTab(NEW_LABEL_VISIBLE).build());
- } else {
- return Optional.of(new PageUpdateCommandBuilder().renameTab(NEW_LABEL_INVISIBLE).build());
+ @Override
+ public String getFailureMessage() {
+ return "Viewpoint deactivation failed.";
}
- }, null, null);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, NEW_LABEL_VISIBLE);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, NEW_LABEL_VISIBLE);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, NEW_LABEL_INVISIBLE);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, NEW_LABEL_INVISIBLE);
- }
-
- /**
- * Test page positioning :
- *
- * A page is removed when any change occurs from session's resource set. But the page provider has no condition
- * preventing its initialization when called. The page visibility is not synchronized between page and page
- * provider.
- *
- * So just after the removal, the page should be added again.
- */
- public void testDynamicPageRemovalDesynchroUpdate() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
- return Optional.of(new PageUpdateCommandBuilder().removePage().build());
- }, null);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
- }
-
- /**
- * Test page positioning :
- *
- * A page is removed when the {@link AirDResourceImpl} resource is removed. The page provider and the page method
- * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)} are
- * synchronized. I.e if the page is removed dynamically, the page provider update will not provide the page again
- * The page removal condition is the the exact contrary of the page providing condition.
- */
- public void testDynamicPageRemovalUpdate() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
- return Optional.of(new PageUpdateCommandBuilder().removePage().build());
- }, CommandSynchronization.RESOURCE_SET_CHANGE_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(1, DEFAULT_PAGE_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(1, DEFAULT_PAGE_TAB_LABEL);
- }
-
- /**
- * Test page positioning :
- *
- * A page is removed when the {@link AirDResourceImpl} resource is removed and the page is visible. The page
- * provider and the page method {@link AbstractSessionEditorPage#pageChanged(boolean)} are synchronized. I.e if the
- * page is removed dynamically, the page provider update will not provide the page again The page removal condition
- * is the the exact contrary of the page providing condition.
- */
- public void testDynamicPageRemovalVisibilityUpdate() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
- return Optional.of(new PageUpdateCommandBuilder().removePage().build());
- }, null, CommandSynchronization.VISIBILITY_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(1, DEFAULT_PAGE_TAB_LABEL);
- }
-
- /**
- * Test page positioning :
- *
- * A page is reordered before the default one when the {@link AirDResourceImpl} resource is removed. The method
- * {@link AbstractSessionEditorPage#getPositioning()} is synchronized with the method
- * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)} doing
- * the removal. So the page reorder information when called from a resource set changed are the same than the page
- * positioning from methods {@link AbstractSessionEditorPage#getPositioning()} and
- * {@link AbstractSessionEditorPage#getLocationId()}
- */
- public void testDynamicPageReorderUpdate() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
- return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
- }, CommandSynchronization.RESOURCE_SET_CHANGE_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
- }
-
- /**
- * Test page positioning :
- *
- * The default page is reordered after another page when the {@link AirDResourceImpl} resource is removed. The
- * method {@link AbstractSessionEditorPage#getPositioning()} is synchronized with the method
- * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)} doing
- * the removal. So the page reorder information when called from a resource set changed are the same than the page
- * positioning from methods {@link AbstractSessionEditorPage#getPositioning()} and
- * {@link AbstractSessionEditorPage#getLocationId()}
- */
- public void testDynamicPageReorderUpdate2() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
- return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
- }, CommandSynchronization.RESOURCE_SET_CHANGE_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
- }
-
- /**
- * Test page positioning :
- *
- * The default page is reordered after another page when the {@link AirDResourceImpl} resource is removed. The
- * method {@link AbstractSessionEditorPage#getPositioning()} is synchronized with the method
- * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)} doing
- * the removal. So the page reorder information when called from a resource set changed are the same than the page
- * positioning from methods {@link AbstractSessionEditorPage#getPositioning()} and
- * {@link AbstractSessionEditorPage#getLocationId()}
- */
- public void testDynamicPageReorderUpdate3() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, null, () -> {
- return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
- }, CommandSynchronization.RESOURCE_SET_CHANGE_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(1, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(1, PAGE2_TAB_LABEL);
- }
-
- /**
- * Removes the first resource of the session's resource set.
- */
- private void removeFirstResource() {
- PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
- sessionEditor.getSession().getTransactionalEditingDomain().getResourceSet().getResources().remove(0);
- });
- }
-
- /**
- * Test page positioning :
- *
- * The default page is replaced by another page when the {@link AirDResourceImpl} resource is removed and the page
- * gains focus. This tests the method {@link AbstractSessionEditorPage#pageChanged(boolean)}. The page reorder
- * information when called from the previous method are the same than the page positioning from methods
- * {@link AbstractSessionEditorPage#getPositioning()} and {@link AbstractSessionEditorPage#getLocationId()}
- */
- public void testDynamicPageReorderVisibilityUpdate() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
- return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.REPLACE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
- }, null, CommandSynchronization.VISIBILITY_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(1, PAGE2_TAB_LABEL);
- }
-
- /**
- * Test page positioning :
- *
- * The default page is reordered before another page when the {@link AirDResourceImpl} resource is removed and the
- * page gains focus. This tests the method {@link AbstractSessionEditorPage#pageChanged(boolean)}. The page reorder
- * information when called from the previous method are the same than the page positioning from methods
- * {@link AbstractSessionEditorPage#getPositioning()} and {@link AbstractSessionEditorPage#getLocationId()}
- */
- public void testDynamicPageReorderVisibilityUpdate2() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
- return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
- }, null, CommandSynchronization.VISIBILITY_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
- }
-
- /**
- * Test page positioning :
- *
- * The default page is reordered after another page when the {@link AirDResourceImpl} resource is removed and the
- * page gains focus. This tests the method {@link AbstractSessionEditorPage#pageChanged(boolean)}. The page reorder
- * information when called from the previous method are the same than the page positioning from methods
- * {@link AbstractSessionEditorPage#getPositioning()} and {@link AbstractSessionEditorPage#getLocationId()}.
- */
- public void testDynamicPageReorderVisibilityUpdate3() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
- return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
- }, null, CommandSynchronization.VISIBILITY_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- setActivePage(1);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- setActivePage(1);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
- }
-
- /**
- * Test page positioning :
- *
- * The methods
- * {@link AbstractSessionEditorPage#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent)} and
- * {@link AbstractSessionEditorPage#pageChanged(boolean)} reorder the page after and before the default one
- * respectively when {@link AirDResourceImpl} is removed and when the page is set visible.
- */
- public void testBothDynamicPageUpdate() {
- sessionEditorTestPageProvider.initOnePageProvider(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID, SessionEditorTestPageProvider.PAGE2_ID, (isVisible) -> {
- return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.BEFORE, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
- }, () -> {
- return Optional.of(new PageUpdateCommandBuilder().reorderPage(PositioningKind.AFTER, SessionEditorPlugin.DEFAULT_PAGE_ID).build());
- }, CommandSynchronization.BOTH_SYNCHRONIZATION);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- setActivePage(1);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);;
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
-
- removeFirstResource();
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(0);
-
- assertRightPageOrderingByLabel(2, DEFAULT_PAGE_TAB_LABEL, PAGE2_TAB_LABEL);
-
- setActivePage(SessionEditorTestPageProvider.PAGE2_ID);
-
- assertRightPageOrderingByLabel(2, PAGE2_TAB_LABEL, DEFAULT_PAGE_TAB_LABEL);
- }
-
- /**
- * Change selected page with the one at the given index.
- */
- private void setActivePage(int pageIndex) {
- PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
- sessionEditor.setActivePage(pageIndex);
});
- }
+ activeEditor.close();
+ SWTBotUtils.waitAllUiEvents();
+ SWTBotEditor firstEditor = bot.editorByTitle(SESSION_FILE_NAME);
+ SWTBotTree firstEditorTree = firstEditor.bot().tree(1);
+ try {
+ firstEditorTree.getTreeItem("LayoutingMode");
+ } catch (IndexOutOfBoundsException | WidgetNotFoundException e) {
+ fail("The activated viewpoint 'LayoutingMode' should be present in first opened session editor. Something should have activated it wrongly.");
+ }
- /**
- * Change selected page with the one with the given name.
- */
- private void setActivePage(String pageName) {
- PlatformUI.getWorkbench().getDisplay().syncExec(() -> {
- sessionEditor.setActivePage(pageName);
- });
}
}
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
index 9070e6fb1f..47643764a0 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES.
+ * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES.
* 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
@@ -225,6 +225,7 @@ public class AllTestSuite extends TestCase {
suite.addTestSuite(StraightenToTest.class);
suite.addTest(new JUnit4TestAdapter(DndWorkspaceToAirdEditorTest.class));
suite.addTestSuite(SessionEditorTest.class);
+ suite.addTestSuite(SessionEditorPageProvidingTest.class);
}
/**
diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/graphicalcomponents/GraphicalRepresentationHandler.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/graphicalcomponents/GraphicalRepresentationHandler.java
index 7827031e45..36fcfe914e 100644
--- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/graphicalcomponents/GraphicalRepresentationHandler.java
+++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/graphicalcomponents/GraphicalRepresentationHandler.java
@@ -66,7 +66,6 @@ import org.eclipse.sirius.ui.tools.internal.views.common.navigator.SiriusCommonC
import org.eclipse.sirius.ui.tools.internal.views.common.navigator.sorter.CommonItemSorter;
import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.DeleteActionHandler;
import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.RenameActionHandler;
-import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.TooltipAwareNavigatorDecoratingLabelProvider;
import org.eclipse.sirius.ui.tools.internal.wizards.CreateRepresentationWizard;
import org.eclipse.sirius.ui.tools.internal.wizards.pages.SiriusRepresentationWithInactiveStatusLabelProvider;
import org.eclipse.sirius.viewpoint.DAnalysis;
@@ -790,7 +789,7 @@ public class GraphicalRepresentationHandler implements SessionManagerListener {
if (labelProvider != null) {
treeViewer.setLabelProvider(labelProvider);
} else {
- treeViewer.setLabelProvider(new TooltipAwareNavigatorDecoratingLabelProvider(new SiriusRepresentationWithInactiveStatusLabelProvider()));
+ treeViewer.setLabelProvider(new SiriusRepresentationWithInactiveStatusLabelProvider());
}
treeViewer.setSorter(new CommonItemSorter());

Back to the top