Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2019-08-28 14:42:21 +0000
committerPatrick Tessier2019-09-17 09:58:49 +0000
commitd72fb6cccf471b28e310279f03f26bd19774197e (patch)
tree77039c35d3cfb1bb3bc156341e1b2548a6e79663 /tests
parent77bc626b92bce788ca117d1d556b72554b52c1d1 (diff)
downloadorg.eclipse.papyrus-d72fb6cccf471b28e310279f03f26bd19774197e.tar.gz
org.eclipse.papyrus-d72fb6cccf471b28e310279f03f26bd19774197e.tar.xz
org.eclipse.papyrus-d72fb6cccf471b28e310279f03f26bd19774197e.zip
Bug 550535: [AF] When switch viewpoints, the editors not managed by
current viewpoints must be closed Add a command to manage the close of needed editors when switch viewpoints. Change-Id: I1562d03bc0400a835e5d8d4495d658e8ec78d611 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/META-INF/MANIFEST.MF5
-rwxr-xr-xtests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/test/org/eclipse/papyrus/infra/suite/tests/AllTests.java5
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.classpath11
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.project28
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF17
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/about.html28
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/build.properties8
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/plugin.properties15
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/pom.xml13
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.di2
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.notation86
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.uml10
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/Activator.java68
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java33
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/editors/SwitchViewpointsTest.java133
-rwxr-xr-xtests/junit/plugins/infra/pom.xml1
17 files changed, 466 insertions, 4 deletions
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/META-INF/MANIFEST.MF
index 516351a04fc..d1d22517d56 100755
--- a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/META-INF/MANIFEST.MF
@@ -39,6 +39,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.gmfdiag.css.tests;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.infra.emf.expressions.tests;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.infra.internationalization.tests;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.viewpoints.policy.tests;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.architecture.tests;bundle-version="1.0.0"
+ org.eclipse.papyrus.infra.viewpoints.policy.tests;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.architecture.tests;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.ui.architecture.tests;bundle-version="[1.0.0,2.0.0)"
Automatic-Module-Name: org.eclipse.papyrus.infra.suite.tests
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/test/org/eclipse/papyrus/infra/suite/tests/AllTests.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/test/org/eclipse/papyrus/infra/suite/tests/AllTests.java
index 63e64bea5e0..29a81c7ffe3 100755
--- a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/test/org/eclipse/papyrus/infra/suite/tests/AllTests.java
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.suite.tests/test/org/eclipse/papyrus/infra/suite/tests/AllTests.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others.
+ * Copyright (c) 2010, 2016, 2019 CEA LIST, Christian W. Damus, and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,6 +12,7 @@
* Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation
* Christian W. Damus (CEA) - bugs 402525, 323802, 431953, 433310, 434993
* Christian W. Damus - bugs 399859, 451230, 433206, 463156, 474610, 469188, 485220, 488791, 496598, 508629
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 550359
*
*****************************************************************************/
package org.eclipse.papyrus.infra.suite.tests;
@@ -76,7 +77,7 @@ public class AllTests {
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.viewpoints.policy.tests.AllTests.class));
suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.architecture.tests.AllTests.class));
-
+ suiteClasses.add(new PluginTestSuiteClass(org.eclipse.papyrus.infra.ui.architecture.tests.AllTests.class));
// end
}
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.classpath b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.classpath
new file mode 100644
index 00000000000..3e5654f17eb
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.classpath
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src">
+ <attributes>
+ <attribute name="test" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.project b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.project
new file mode 100644
index 00000000000..c8ef6484f9c
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.ui.architecture.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.settings/org.eclipse.jdt.core.prefs b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..86d75e629de
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.ui.architecture.tests
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Automatic-Module-Name: org.eclipse.papyrus.infra.ui.architecture.tests
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.junit;bundle-version="4.12.0",
+ org.eclipse.papyrus.junit.utils;bundle-version="2.2.0",
+ org.eclipse.papyrus.infra.architecture;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.ui.architecture;bundle-version="[2.1.0,3.0.0)"
+Export-Package: org.eclipse.papyrus.infra.ui.architecture.tests
+Bundle-Activator: org.eclipse.papyrus.infra.ui.architecture.tests.Activator
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/about.html b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/about.html
new file mode 100644
index 00000000000..997c5a2284d
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 30, 2017</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 2.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="https://www.eclipse.org/legal/epl-2.0/">https://www.eclipse.org/legal/epl-2.0/</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/build.properties b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/build.properties
new file mode 100644
index 00000000000..9de44fbc9f5
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.properties,\
+ about.html,\
+ resources/
+src.includes = about.html
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/plugin.properties b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/plugin.properties
new file mode 100644
index 00000000000..a074779c9e7
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/plugin.properties
@@ -0,0 +1,15 @@
+# Copyright (c) 2019 CEA LIST and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License 2.0
+# which accompanies this distribution, and is available at
+# https://www.eclipse.org/legal/epl-2.0/
+#
+# SPDX-License-Identifier: EPL-2.0
+#
+# Contributors:
+# Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+#
+
+pluginName = Papyrus Infra UI Architecture Tests
+providerName = Eclipse Modeling Project
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/pom.xml b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/pom.xml
new file mode 100644
index 00000000000..1a08230a44f
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/pom.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus.tests</groupId>
+ <artifactId>org.eclipse.papyrus.infra.tests.releng</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.ui.architecture.tests</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-test-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.di b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.di
new file mode 100644
index 00000000000..8c549eecdc6
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.infra.services.edit.TypeContext"/>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.notation b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.notation
new file mode 100644
index 00000000000..d7342e31c06
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.notation
@@ -0,0 +1,86 @@
+<?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:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattable="http://www.eclipse.org/papyrus/nattable/model" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xsi:schemaLocation="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis http://www.eclipse.org/papyrus/nattable/model#//nattableaxis http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider http://www.eclipse.org/papyrus/nattable/model#//nattableaxisprovider">
+ <nattable:Table xmi:id="_80uvkM4rEemJH8FcCaThIQ" name="Class Tree Table" currentRowAxisProvider="_80uvk84rEemJH8FcCaThIQ" currentColumnAxisProvider="_80uvkc4rEemJH8FcCaThIQ" tableKindId="org.eclipse.papyrus.uml.table.classTree">
+ <eAnnotations xmi:id="_802EUM4rEemJH8FcCaThIQ" source="http://www.eclipse.org/papyrus/infra/nattable/version">
+ <details xmi:id="_802EUc4rEemJH8FcCaThIQ" key="version" value="1.3.0"/>
+ </eAnnotations>
+ <context href="SwitchViewpoints.uml#_8ySfkM4rEemJH8FcCaThIQ"/>
+ <owner href="SwitchViewpoints.uml#_8ySfkM4rEemJH8FcCaThIQ"/>
+ <tableConfiguration href="platform:/resource/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#PapyrusClassTreeTable_XMI_ID"/>
+ <columnAxisProvidersHistory xsi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_80uvkc4rEemJH8FcCaThIQ" description="This axis provider provides available columns according to the rows of the table (features of the object displayed on the other axis)" name="UML Feature axis provider">
+ <axis xsi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_80uvks4rEemJH8FcCaThIQ">
+ <manager href="platform:/resource/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#_UJa7yDzQEei_1txcmoHe_A"/>
+ <element xsi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement/name"/>
+ </axis>
+ </columnAxisProvidersHistory>
+ <rowAxisProvidersHistory xsi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_80uvk84rEemJH8FcCaThIQ" description="This axis provider manages the rows, according to the wanted hierarchy" name="HierarchicalRowaAxisManager" disconnectSlave="true"/>
+ </nattable:Table>
+ <notation:Diagram xmi:id="_82XuUM4rEemJH8FcCaThIQ" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+ <styles xsi:type="notation:StringValueStyle" xmi:id="_82XuUc4rEemJH8FcCaThIQ" name="diagram_compatibility_version" stringValue="1.4.0"/>
+ <styles xsi:type="notation:DiagramStyle" xmi:id="_82XuUs4rEemJH8FcCaThIQ"/>
+ <styles xsi:type="style:PapyrusDiagramStyle" xmi:id="_82XuU84rEemJH8FcCaThIQ" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+ <owner href="SwitchViewpoints.uml#_8ySfkM4rEemJH8FcCaThIQ"/>
+ </styles>
+ <element href="SwitchViewpoints.uml#_8ySfkM4rEemJH8FcCaThIQ"/>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_84OvgM4rEemJH8FcCaThIQ" type="PapyrusUMLStateMachineDiagram" name="State Machine Diagram" measurementUnit="Pixel">
+ <children xsi:type="notation:Shape" xmi:id="_84Ovgc4rEemJH8FcCaThIQ" type="StateMachine_Shape">
+ <children xsi:type="notation:DecorationNode" xmi:id="_84Ovgs4rEemJH8FcCaThIQ" type="StateMachine_NameLabel">
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84Ovg84rEemJH8FcCaThIQ" width="700" height="20"/>
+ </children>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_84OvhM4rEemJH8FcCaThIQ" type="StateMachine_RegionCompartment">
+ <children xsi:type="notation:Shape" xmi:id="_84Ovhc4rEemJH8FcCaThIQ" type="Region_Shape">
+ <eAnnotations xmi:id="_84Ovhs4rEemJH8FcCaThIQ" source="RegionAnnotationKey">
+ <details xmi:id="_84Ovh84rEemJH8FcCaThIQ" key="RegionZoneKey" value=""/>
+ </eAnnotations>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_84OviM4rEemJH8FcCaThIQ" type="Region_SubvertexCompartment">
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84Ovic4rEemJH8FcCaThIQ"/>
+ </children>
+ <element href="SwitchViewpoints.uml#_84GMoM4rEemJH8FcCaThIQ"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84Ovis4rEemJH8FcCaThIQ" width="700" height="280"/>
+ </children>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84Ovi84rEemJH8FcCaThIQ" y="20" width="700" height="280"/>
+ </children>
+ <element href="SwitchViewpoints.uml#_83PRAM4rEemJH8FcCaThIQ"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84OvjM4rEemJH8FcCaThIQ" x="30" y="30" width="700" height="300"/>
+ </children>
+ <styles xsi:type="notation:StringValueStyle" xmi:id="_84Ovjc4rEemJH8FcCaThIQ" name="diagram_compatibility_version" stringValue="1.4.0"/>
+ <styles xsi:type="notation:DiagramStyle" xmi:id="_84Ovjs4rEemJH8FcCaThIQ"/>
+ <styles xsi:type="style:PapyrusDiagramStyle" xmi:id="_84Ovj84rEemJH8FcCaThIQ" diagramKindId="org.eclipse.papyrus.uml.diagram.stateMachine">
+ <owner href="SwitchViewpoints.uml#_8ySfkM4rEemJH8FcCaThIQ"/>
+ </styles>
+ <element href="SwitchViewpoints.uml#_83PRAM4rEemJH8FcCaThIQ"/>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_84q0YM4rEemJH8FcCaThIQ" type="PapyrusUMLActivityDiagram" name="Activity Diagram" measurementUnit="Pixel">
+ <children xsi:type="notation:Shape" xmi:id="_84q0Yc4rEemJH8FcCaThIQ" type="Activity_Shape">
+ <children xsi:type="notation:DecorationNode" xmi:id="_84q0Ys4rEemJH8FcCaThIQ" type="Activity_NameLabel"/>
+ <children xsi:type="notation:DecorationNode" xmi:id="_84q0Y84rEemJH8FcCaThIQ" type="Activity_KeywordLabel"/>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_84q0ZM4rEemJH8FcCaThIQ" type="Activity_ParameterCompartment">
+ <styles xsi:type="notation:SortingStyle" xmi:id="_84q0Zc4rEemJH8FcCaThIQ"/>
+ <styles xsi:type="notation:FilteringStyle" xmi:id="_84q0Zs4rEemJH8FcCaThIQ"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84q0Z84rEemJH8FcCaThIQ"/>
+ </children>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_84q0aM4rEemJH8FcCaThIQ" type="Activity_PreconditionCompartment">
+ <styles xsi:type="notation:SortingStyle" xmi:id="_84q0ac4rEemJH8FcCaThIQ"/>
+ <styles xsi:type="notation:FilteringStyle" xmi:id="_84q0as4rEemJH8FcCaThIQ"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84q0a84rEemJH8FcCaThIQ"/>
+ </children>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_84q0bM4rEemJH8FcCaThIQ" type="Activity_PostconditionCompartment">
+ <styles xsi:type="notation:SortingStyle" xmi:id="_84q0bc4rEemJH8FcCaThIQ"/>
+ <styles xsi:type="notation:FilteringStyle" xmi:id="_84q0bs4rEemJH8FcCaThIQ"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84q0b84rEemJH8FcCaThIQ"/>
+ </children>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_84q0cM4rEemJH8FcCaThIQ" type="Activity_ActivityNodeCompartment">
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84q0cc4rEemJH8FcCaThIQ"/>
+ </children>
+ <element href="SwitchViewpoints.uml#_84bj0M4rEemJH8FcCaThIQ"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_84q0cs4rEemJH8FcCaThIQ"/>
+ </children>
+ <styles xsi:type="notation:StringValueStyle" xmi:id="_84q0c84rEemJH8FcCaThIQ" name="diagram_compatibility_version" stringValue="1.4.0"/>
+ <styles xsi:type="notation:DiagramStyle" xmi:id="_84q0dM4rEemJH8FcCaThIQ"/>
+ <styles xsi:type="style:PapyrusDiagramStyle" xmi:id="_84q0dc4rEemJH8FcCaThIQ" diagramKindId="org.eclipse.papyrus.uml.diagram.activity">
+ <owner href="SwitchViewpoints.uml#_8ySfkM4rEemJH8FcCaThIQ"/>
+ </styles>
+ <element href="SwitchViewpoints.uml#_84bj0M4rEemJH8FcCaThIQ"/>
+ </notation:Diagram>
+</xmi:XMI>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.uml b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.uml
new file mode 100644
index 00000000000..30fd49c1618
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/SwitchViewpoints.uml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_8ySfkM4rEemJH8FcCaThIQ" name="SwitchViewpoints">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_88Gi4M4rEemJH8FcCaThIQ">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:StateMachine" xmi:id="_83PRAM4rEemJH8FcCaThIQ" name="StateMachine1">
+ <region xmi:type="uml:Region" xmi:id="_84GMoM4rEemJH8FcCaThIQ" name="Region1"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Activity" xmi:id="_84bj0M4rEemJH8FcCaThIQ" name="Activity2"/>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/Activator.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/Activator.java
new file mode 100644
index 00000000000..ba6858045bb
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/Activator.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.ui.architecture.tests;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.ui.architecture.tests"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+
+}
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java
new file mode 100644
index 00000000000..0bccc3d14ba
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.ui.architecture.tests;
+
+import org.eclipse.papyrus.infra.ui.architecture.tests.editors.SwitchViewpointsTest;
+import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
+import org.eclipse.papyrus.junit.framework.runner.Headless;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * The master test suite for the plug-in.
+ */
+@RunWith(ClassificationSuite.class)
+@SuiteClasses({
+ SwitchViewpointsTest.class,
+ })
+@Headless
+public class AllTests {
+ // Nothing required
+}
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/editors/SwitchViewpointsTest.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/editors/SwitchViewpointsTest.java
new file mode 100644
index 00000000000..a1fa87438ca
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/editors/SwitchViewpointsTest.java
@@ -0,0 +1,133 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.ui.architecture.tests.editors;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.architecture.ArchitectureDescriptionUtils;
+import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureViewpoint;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.ui.architecture.commands.CloseEditorsForViewpointsCommand;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * This class allows to test the switch of viewpoints and its behavior.
+ */
+@SuppressWarnings("nls")
+@PluginResource("/resources/SwitchViewpoints.di")
+public class SwitchViewpointsTest extends AbstractPapyrusTest {
+
+ /**
+ * The editor fixture to manage the opening model.
+ */
+ @Rule
+ public final PapyrusEditorFixture editorFixture = new PapyrusEditorFixture();
+
+ /**
+ * This allows to test the switch of viewpoint.
+ */
+ @Test
+ public void switchViewpoints() {
+
+ // Get the active editor
+ final IMultiDiagramEditor activeEditor = editorFixture.getEditor();
+
+ // Get the page manager
+ final IPageManager pageManager = ((IMultiPageEditorPart) activeEditor).getAdapter(IPageManager.class);
+ Assert.assertNotNull("The page manager cannot be null", null != pageManager);
+
+ // Open the diagram and tables
+ int numberOpenedPage = 0;
+ for (final Object pageIdentifier : pageManager.allPages()) {
+ pageManager.openPage(pageIdentifier);
+ numberOpenedPage++;
+ }
+
+ // Check the pages number
+ editorFixture.flushDisplayEvents();
+ Assert.assertEquals("The number of pages is not the correct one", 4, numberOpenedPage);
+
+ // Change the architecture viewpoints
+ final ArchitectureDescriptionUtils helper = new ArchitectureDescriptionUtils(editorFixture.getModelSet());
+ // Only keep the analysis viewpoint
+ final Set<String> viewpointIds = helper.getArchitectureViewpointIds().stream()
+ .filter(id -> id.equals("org.eclipse.papyrus.uml.analysis")).collect(Collectors.toSet());
+ final Collection<MergedArchitectureViewpoint> viewpoints = helper.getArchitectureViewpoints();
+
+ // execute the command to change viewpoint and close editors
+ final EditingDomain domain = editorFixture.getEditingDomain();
+ final CompoundCommand cc = new CompoundCommand();
+ cc.append(helper.switchArchitectureViewpointIds(viewpointIds.toArray(new String[0])));
+ // More than set the architecture viewpoints used, close needed editors
+ cc.append(new CloseEditorsForViewpointsCommand(viewpoints.stream()
+ .filter(viewpoint -> viewpointIds.contains(viewpoint.getId())).collect(Collectors.toList())));
+ domain.getCommandStack().execute(cc);
+
+ // Get the number of opened page
+ numberOpenedPage = getNumberOfOpenedPages(pageManager);
+
+ // Now, re-check the active editors number
+ editorFixture.flushDisplayEvents();
+ Assert.assertEquals("The number of pages is not the correct one", 2, numberOpenedPage);
+
+ // check the undo
+ domain.getCommandStack().undo();
+
+ // Get the number of opened page
+ numberOpenedPage = getNumberOfOpenedPages(pageManager);
+
+ // Check the pages number
+ editorFixture.flushDisplayEvents();
+ Assert.assertEquals("The number of pages is not the correct one", 4, numberOpenedPage);
+
+ // check the redo
+ domain.getCommandStack().redo();
+
+ // Get the number of opened page
+ numberOpenedPage = getNumberOfOpenedPages(pageManager);
+
+ // Now, re-check the active editors number
+ editorFixture.flushDisplayEvents();
+ Assert.assertEquals("The number of pages is not the correct one", 2, numberOpenedPage);
+ }
+
+ /**
+ * Get the number of opened pages.
+ *
+ * @param pageManager The page manager.
+ * @return The number of opened diagrams and tables.
+ */
+ private int getNumberOfOpenedPages(final IPageManager pageManager) {
+ int numberOpenedPage = 0;
+ for (final Object pageIdentifier : pageManager.allPages()) {
+ if (pageManager.isOpen(pageIdentifier)) {
+ numberOpenedPage++;
+ }
+ }
+ return numberOpenedPage;
+ }
+}
diff --git a/tests/junit/plugins/infra/pom.xml b/tests/junit/plugins/infra/pom.xml
index f433a0e2dd4..9e08119b71e 100755
--- a/tests/junit/plugins/infra/pom.xml
+++ b/tests/junit/plugins/infra/pom.xml
@@ -33,6 +33,7 @@
<!-- Standalone Plugins -->
<module>org.eclipse.papyrus.infra.architecture.tests</module>
+ <module>org.eclipse.papyrus.infra.ui.architecture.tests</module>
<module>org.eclipse.papyrus.infra.filters.tests</module>
<module>org.eclipse.papyrus.infra.newchild.tests</module>
<module>org.eclipse.papyrus.infra.tools.tests</module>

Back to the top