Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Barbin2015-07-29 12:48:01 +0000
committerLaurent Redor2015-08-14 07:15:30 +0000
commitb072e3d4be8077b2934fd74ee1fb0932d4501b88 (patch)
tree3b4b321d6b0fca2189e91677759d9aad4cdacec7
parentbf04a73d6efa05ddc069c6e518b3331f69dda132 (diff)
downloadorg.eclipse.sirius-b072e3d4be8077b2934fd74ee1fb0932d4501b88.tar.gz
org.eclipse.sirius-b072e3d4be8077b2934fd74ee1fb0932d4501b88.tar.xz
org.eclipse.sirius-b072e3d4be8077b2934fd74ee1fb0932d4501b88.zip
[460610] Adds SWTBot tests
Bug: 460610 Change-Id: Ie749e98b7fed7786e72ef13dcf8ea0eea98c528d Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/VP-3832.aird88
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/tree.odesign19
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java358
4 files changed, 388 insertions, 80 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF
index ca633b0b08..5de34cd9e0 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.sirius.tests.swtbot/META-INF/MANIFEST.MF
@@ -74,4 +74,5 @@ Export-Package: org.eclipse.sirius.tests.swtbot,
Import-Package: org.eclipse.sirius.ext.base;version="1.0.0",
org.eclipse.sirius.ext.draw2d.figure;version="1.0.0",
org.eclipse.sirius.ext.emf.ui,
- org.eclipse.sirius.ext.gmf.runtime.editparts;version="1.0.0"
+ org.eclipse.sirius.ext.gmf.runtime.editparts;version="1.0.0",
+ org.eclipse.ui.navigator
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/VP-3832.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/VP-3832.aird
index e2f11b2535..41e39295df 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/VP-3832.aird
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/VP-3832.aird
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-<viewpoint:DAnalysis 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/1.1.0#//diagram/description http://www.eclipse.org/sirius/diagram/1.1.0 http://www.eclipse.org/sirius/1.1.0#//diagram http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/1.1.0#//diagram/description/style" xmi:id="_1xEXUWO4EeKAT86OkL5_zA" selectedViews="_627d4GO4EeKAT86OkL5_zA" version="8.0.0">
- <models xmi:type="ecore:EPackage" href="VP-3832.ecore#/"/>
- <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_627d4GO4EeKAT86OkL5_zA" initialized="true">
+<viewpoint:DAnalysis 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:description_2="http://www.eclipse.org/sirius/table/description/1.1.0" xmlns:description_3="http://www.eclipse.org/sirius/tree/description/1.0.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:table="http://www.eclipse.org/sirius/table/1.1.0" xmlns:tree="http://www.eclipse.org/sirius/tree/1.0.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/table/description/1.1.0 http://www.eclipse.org/sirius/table/1.1.0#//description http://www.eclipse.org/sirius/tree/description/1.0.0 http://www.eclipse.org/sirius/tree/1.0.0#//description http://www.eclipse.org/sirius/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_1xEXUWO4EeKAT86OkL5_zA" selectedViews="_627d4GO4EeKAT86OkL5_zA _a2_LYDXwEeWKWI3qJ9vddA" version="10.1.0.201507101000">
+ <semanticResources>VP-3832.ecore</semanticResources>
+ <ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_627d4GO4EeKAT86OkL5_zA">
<ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_7kzQgGO4EeKAT86OkL5_zA" name=" package entities">
<ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_7mwYUGO4EeKAT86OkL5_zA" source="GMF_DIAGRAMS">
<data xmi:type="notation:Diagram" xmi:id="_7mwYUWO4EeKAT86OkL5_zA" type="Sirius" element="_7kzQgGO4EeKAT86OkL5_zA" measurementUnit="Pixel">
@@ -35,42 +35,33 @@
<styles xmi:type="notation:DiagramStyle" xmi:id="_7mwYUmO4EeKAT86OkL5_zA"/>
</data>
</ownedAnnotationEntries>
+ <ownedAnnotationEntries xmi:type="description:AnnotationEntry" xmi:id="_iptsQDT9EeWob9ff_334oA" source="DANNOTATION_CUSTOMIZATION_KEY">
+ <data xmi:type="diagram:ComputedStyleDescriptionRegistry" xmi:id="_iptsQTT9EeWob9ff_334oA"/>
+ </ownedAnnotationEntries>
<ownedDiagramElements xmi:type="diagram:DNodeList" xmi:id="_dT4aQGO5EeKAT86OkL5_zA" name="NewEClass1" tooltipText=".NewEClass1">
<target xmi:type="ecore:EClass" href="VP-3832.ecore#//NewEClass1"/>
<semanticElements xmi:type="ecore:EClass" href="VP-3832.ecore#//NewEClass1"/>
<arrangeConstraints>KEEP_LOCATION</arrangeConstraints>
<arrangeConstraints>KEEP_SIZE</arrangeConstraints>
<arrangeConstraints>KEEP_RATIO</arrangeConstraints>
- <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_dWsdsGO5EeKAT86OkL5_zA" backgroundStyle="GradientTopToBottom">
- <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_dWsdsWO5EeKAT86OkL5_zA"/>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_dWsdsGO5EeKAT86OkL5_zA" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="GradientTopToBottom">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']/@style"/>
- <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_dWsdsmO5EeKAT86OkL5_zA"/>
- <backgroundColor xmi:type="viewpoint:RGBValues" xmi:id="_dWsds2O5EeKAT86OkL5_zA" red="255" green="255" blue="255"/>
- <foregroundColor xmi:type="viewpoint:RGBValues" xmi:id="_dWsdtGO5EeKAT86OkL5_zA" red="209" green="209" blue="209"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@defaultLayer/@containerMappings[name='EC%20EClass']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_19P8sWO5EeKI875sz_lhBA" name="newPackage1">
<target xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage1"/>
<semanticElements xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage1"/>
- <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_1-ZMMGO5EeKI875sz_lhBA" labelSize="10" backgroundStyle="GradientTopToBottom">
- <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_1-bBYGO5EeKI875sz_lhBA"/>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_1-ZMMGO5EeKI875sz_lhBA" labelSize="10" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="GradientTopToBottom" backgroundColor="255,245,181" foregroundColor="255,255,255">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']/@containerMappings[name='Design%20Package']/@style"/>
- <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_1-bBYWO5EeKI875sz_lhBA"/>
- <backgroundColor xmi:type="viewpoint:RGBValues" xmi:id="_1-bBYmO5EeKI875sz_lhBA" red="255" green="245" blue="181"/>
- <foregroundColor xmi:type="viewpoint:RGBValues" xmi:id="_1-bBY2O5EeKI875sz_lhBA" red="255" green="255" blue="255"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']/@containerMappings[name='Design%20Package']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNodeContainer" xmi:id="_2kVx4GO5EeKI875sz_lhBA" name="newPackage2">
<target xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage2"/>
<semanticElements xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage2"/>
- <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_2kdGoGO5EeKI875sz_lhBA" labelSize="10" backgroundStyle="GradientTopToBottom">
- <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_2kdGoWO5EeKI875sz_lhBA"/>
+ <ownedStyle xmi:type="diagram:FlatContainerStyle" xmi:id="_2kdGoGO5EeKI875sz_lhBA" labelSize="10" borderSize="1" borderSizeComputationExpression="1" backgroundStyle="GradientTopToBottom" backgroundColor="255,245,181" foregroundColor="255,255,255">
<description xmi:type="style:FlatContainerStyleDescription" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']/@containerMappings[name='Design%20Package']/@style"/>
- <borderColor xmi:type="viewpoint:RGBValues" xmi:id="_2kdGomO5EeKI875sz_lhBA"/>
- <backgroundColor xmi:type="viewpoint:RGBValues" xmi:id="_2kdGo2O5EeKI875sz_lhBA" red="255" green="245" blue="181"/>
- <foregroundColor xmi:type="viewpoint:RGBValues" xmi:id="_2kdGpGO5EeKI875sz_lhBA" red="255" green="255" blue="255"/>
</ownedStyle>
<actualMapping xmi:type="description_1:ContainerMapping" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']/@containerMappings[name='Design%20Package']"/>
</ownedDiagramElements>
@@ -80,6 +71,67 @@
<activatedLayers xmi:type="description_1:AdditionalLayer" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Entities']/@additionalLayers[name='Package']"/>
<target xmi:type="ecore:EPackage" href="VP-3832.ecore#/"/>
</ownedRepresentations>
+ <ownedRepresentations xmi:type="table:DTable" xmi:id="_nnktYDT9EeWob9ff_334oA" name="Classes in package" headerColumnWidth="166">
+ <target xmi:type="ecore:EPackage" href="VP-3832.ecore#/"/>
+ <lines xmi:type="table:DLine" xmi:id="_nnktYTT9EeWob9ff_334oA" label="NewEClass1">
+ <target xmi:type="ecore:EClass" href="VP-3832.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="VP-3832.ecore#//NewEClass1"/>
+ <originMapping xmi:type="description_2:LineMapping" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Classes']/@ownedLineMappings[name='Classes%20lines']"/>
+ <cells xmi:type="table:DCell" xmi:id="_nnktYjT9EeWob9ff_334oA" label="NewEClass1" column="_nnktaTT9EeWob9ff_334oA">
+ <target xmi:type="ecore:EClass" href="VP-3832.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="VP-3832.ecore#//NewEClass1"/>
+ </cells>
+ </lines>
+ <lines xmi:type="table:DLine" xmi:id="_nnktYzT9EeWob9ff_334oA" label="newPackage1">
+ <target xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage1"/>
+ <semanticElements xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage1"/>
+ <originMapping xmi:type="description_2:LineMapping" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Classes']/@ownedLineMappings[name='Package']"/>
+ <cells xmi:type="table:DCell" xmi:id="_nnktZDT9EeWob9ff_334oA" label="newPackage1" column="_nnktaTT9EeWob9ff_334oA">
+ <target xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage1"/>
+ <semanticElements xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage1"/>
+ </cells>
+ <currentStyle xmi:type="table:DTableElementStyle" xmi:id="_nnktZTT9EeWob9ff_334oA" defaultBackgroundStyle="true" backgroundColor="255,245,181"/>
+ </lines>
+ <lines xmi:type="table:DLine" xmi:id="_nnktZjT9EeWob9ff_334oA" label="newPackage2">
+ <target xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage2"/>
+ <semanticElements xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage2"/>
+ <originMapping xmi:type="description_2:LineMapping" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Classes']/@ownedLineMappings[name='Package']"/>
+ <cells xmi:type="table:DCell" xmi:id="_nnktZzT9EeWob9ff_334oA" label="newPackage2" column="_nnktaTT9EeWob9ff_334oA">
+ <target xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage2"/>
+ <semanticElements xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage2"/>
+ </cells>
+ <currentStyle xmi:type="table:DTableElementStyle" xmi:id="_nnktaDT9EeWob9ff_334oA" defaultBackgroundStyle="true" backgroundColor="255,245,181"/>
+ </lines>
+ <columns xmi:type="table:DFeatureColumn" xmi:id="_nnktaTT9EeWob9ff_334oA" label="Name" cells="_nnktYjT9EeWob9ff_334oA _nnktZDT9EeWob9ff_334oA _nnktZzT9EeWob9ff_334oA" featureName="name">
+ <originMapping xmi:type="description_2:FeatureColumnMapping" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Classes']/@ownedColumnMappings[name='Name']"/>
+ </columns>
+ <description xmi:type="description_2:EditionTableDescription" href="platform:/plugin/org.eclipse.sirius.sample.ecore.design/description/ecore.odesign#//@ownedViewpoints[name='Design']/@ownedRepresentations[name='Classes']"/>
+ </ownedRepresentations>
<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:DRepresentationContainer" xmi:id="_a2_LYDXwEeWKWI3qJ9vddA">
+ <ownedRepresentations xmi:type="tree:DTree" xmi:id="_cEQPwDXwEeWKWI3qJ9vddA" name="Tree">
+ <target xmi:type="ecore:EPackage" href="VP-3832.ecore#/"/>
+ <ownedTreeItems xmi:type="tree:DTreeItem" xmi:id="_cEQPwTXwEeWKWI3qJ9vddA" name="NewEClass1">
+ <target xmi:type="ecore:EClass" href="VP-3832.ecore#//NewEClass1"/>
+ <semanticElements xmi:type="ecore:EClass" href="VP-3832.ecore#//NewEClass1"/>
+ <ownedStyle xmi:type="tree:TreeItemStyle" xmi:id="_cEQPwjXwEeWKWI3qJ9vddA"/>
+ <actualMapping xmi:type="description_3:TreeItemMapping" href="tree.odesign#//@ownedViewpoints[name='tree']/@ownedRepresentations[name='Tree']/@subItemMappings[name='EClass']"/>
+ </ownedTreeItems>
+ <ownedTreeItems xmi:type="tree:DTreeItem" xmi:id="_cEQPwzXwEeWKWI3qJ9vddA" name="newPackage1">
+ <target xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage1"/>
+ <semanticElements xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage1"/>
+ <ownedStyle xmi:type="tree:TreeItemStyle" xmi:id="_cEQPxDXwEeWKWI3qJ9vddA"/>
+ <actualMapping xmi:type="description_3:TreeItemMapping" href="tree.odesign#//@ownedViewpoints[name='tree']/@ownedRepresentations[name='Tree']/@subItemMappings[name='EPackage']"/>
+ </ownedTreeItems>
+ <ownedTreeItems xmi:type="tree:DTreeItem" xmi:id="_cEQPxTXwEeWKWI3qJ9vddA" name="newPackage2">
+ <target xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage2"/>
+ <semanticElements xmi:type="ecore:EPackage" href="VP-3832.ecore#//newPackage2"/>
+ <ownedStyle xmi:type="tree:TreeItemStyle" xmi:id="_cEQPxjXwEeWKWI3qJ9vddA"/>
+ <actualMapping xmi:type="description_3:TreeItemMapping" href="tree.odesign#//@ownedViewpoints[name='tree']/@ownedRepresentations[name='Tree']/@subItemMappings[name='EPackage']"/>
+ </ownedTreeItems>
+ <description xmi:type="description_3:TreeDescription" href="tree.odesign#//@ownedViewpoints[name='tree']/@ownedRepresentations[name='Tree']"/>
+ </ownedRepresentations>
+ <viewpoint xmi:type="description:Viewpoint" href="tree.odesign#//@ownedViewpoints[name='tree']"/>
+ </ownedViews>
</viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/tree.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/tree.odesign
new file mode 100644
index 0000000000..039dc31c19
--- /dev/null
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/VP-3832/tree.odesign
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description:Group 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/tree/description/1.0.0" name="cellEditor" version="10.1.0.201507101000">
+ <ownedViewpoints name="tree">
+ <ownedRepresentations xsi:type="description_1:TreeDescription" name="Tree" domainClass="EPackage">
+ <subItemMappings name="EClass" domainClass="EClass" semanticCandidatesExpression="feature:eClassifiers">
+ <defaultStyle>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/>
+ </defaultStyle>
+ </subItemMappings>
+ <subItemMappings name="EPackage" domainClass="EPackage" semanticCandidatesExpression="feature:eSubpackages">
+ <defaultStyle>
+ <labelColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='black']"/>
+ <backgroundColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='white']"/>
+ </defaultStyle>
+ </subItemMappings>
+ </ownedRepresentations>
+ </ownedViewpoints>
+</description:Group>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java
index 5b1dfcac98..bdb9a1fc54 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/modelexplorer/LinkWithEditorFeatureWithModelExplorerViewTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 THALES GLOBAL SERVICES.
+ * Copyright (c) 2014, 2015 THALES GLOBAL SERVICES and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,16 +10,24 @@
*******************************************************************************/
package org.eclipse.sirius.tests.swtbot.modelexplorer;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.sirius.diagram.DDiagram;
+import org.eclipse.sirius.table.metamodel.table.DTable;
import org.eclipse.sirius.tests.swtbot.Activator;
import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCase;
import org.eclipse.sirius.tests.swtbot.support.api.business.UIResource;
import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor;
import org.eclipse.sirius.tests.swtbot.support.utils.SWTBotUtils;
import org.eclipse.sirius.tests.unit.diagram.modeler.ecore.EcoreModeler;
+import org.eclipse.sirius.tree.DTree;
import org.eclipse.sirius.ui.tools.api.views.modelexplorerview.IModelExplorerView;
+import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.ModelExplorerView;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
/**
@@ -30,65 +38,293 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
*/
public class LinkWithEditorFeatureWithModelExplorerViewTest extends AbstractSiriusSwtBotGefTestCase {
- private static final String SEMANTIC_RESOURCE_NAME = "VP-3832.ecore";
-
- private static final String REPRESENTATIONS_RESOURCE_NAME = "VP-3832.aird";
-
- private static final String PATH = "data/unit/VP-3832/";
-
- private static final String REPRESENTATION_DESCRIPTION_NAME = "Entities";
-
- private static final String REPRESENTATION_NAME = " package entities";
-
- private UIResource sessionAirdResource;
-
- private SWTBot modelExplorerViewBot;
-
- @Override
- protected void onSetUpBeforeClosingWelcomePage() throws Exception {
- copyFileToTestProject(Activator.PLUGIN_ID, PATH, SEMANTIC_RESOURCE_NAME, REPRESENTATIONS_RESOURCE_NAME);
- }
-
- @Override
- protected void onSetUpAfterOpeningDesignerPerspective() throws Exception {
- sessionAirdResource = new UIResource(designerProject, REPRESENTATIONS_RESOURCE_NAME);
- localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true);
-
- SWTBotView modelExplorerView = bot.viewById(IModelExplorerView.ID);
- SWTBotUtils.waitAllUiEvents();
- modelExplorerView.setFocus();
- modelExplorerViewBot = modelExplorerView.bot();
- }
-
- /**
- * Ensure that the "link with editor" feature works correctly in model
- * explorer view by checking if the opened element is the selected one in
- * model explorer view.
- */
- public void testLinkWithEditorFeatureWithModelExplorerView() {
- SWTBotTreeItem projectTreeItemBot = modelExplorerViewBot.tree().expandNode(getProjectName(), true);
- SWTBotTreeItem representationsResourceTreeItemBot = projectTreeItemBot.getNode(REPRESENTATIONS_RESOURCE_NAME);
- SWTBotTreeItem viewpointTreeItemBot = representationsResourceTreeItemBot.getNode(0).getNode(EcoreModeler.DESIGN_VIEWPOINT_NAME);
- SWTBotTreeItem representationDescriptionTreeItemBot = viewpointTreeItemBot.getNode(0);
- SWTBotTreeItem representationTreeItemBot = representationDescriptionTreeItemBot.getNode(0);
- SWTBotView modelExplorerView = bot.viewById(IModelExplorerView.ID);
- boolean linkWithEditorChecked = modelExplorerView.toolbarToggleButton("Link with Editor").isChecked();
- try {
- if (!linkWithEditorChecked) {
- modelExplorerView.toolbarToggleButton("Link with Editor").click();
- }
- openDiagram(REPRESENTATION_NAME);
- assertEquals("The opened representation should be selected in model explorer view", representationTreeItemBot.isSelected(), true);
- } finally {
- // Reset to previous environment
- if (!linkWithEditorChecked) {
- modelExplorerView.toolbarToggleButton("Link with Editor").click();
- }
- }
- }
-
- private void openDiagram(String representationName) {
- editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_DESCRIPTION_NAME, representationName, DDiagram.class);
- }
+ private static final String NEW_PACKAGE1 = "newPackage1";
+
+ private static final String NEW_PACKAGE2 = "newPackage2";
+
+ private static final String SEMANTIC_RESOURCE_NAME = "VP-3832.ecore";
+
+ private static final String REPRESENTATIONS_RESOURCE_NAME = "VP-3832.aird";
+
+ private static final String VSM = "tree.odesign";
+
+ private static final String PATH = "data/unit/VP-3832/";
+
+ private static final String REPRESENTATION_DESCRIPTION_NAME = "Entities";
+
+ private static final String TABLE_DESCRIPTION_NAME = "Classes";
+
+ private static final String REPRESENTATION_NAME = " package entities";
+
+ private static final String TABLE_NAME = "Classes in package";
+
+ private static final String TREE_NAME = "Tree";
+
+ private UIResource sessionAirdResource;
+
+ private SWTBot modelExplorerViewBot;
+
+ @Override
+ protected void onSetUpBeforeClosingWelcomePage() throws Exception {
+ copyFileToTestProject(Activator.PLUGIN_ID, PATH, SEMANTIC_RESOURCE_NAME, REPRESENTATIONS_RESOURCE_NAME, VSM);
+ }
+
+ @Override
+ protected void onSetUpAfterOpeningDesignerPerspective() throws Exception {
+ sessionAirdResource = new UIResource(designerProject, REPRESENTATIONS_RESOURCE_NAME);
+ localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true);
+
+ SWTBotView modelExplorerView = bot.viewById(IModelExplorerView.ID);
+ SWTBotUtils.waitAllUiEvents();
+ modelExplorerView.setFocus();
+ modelExplorerViewBot = modelExplorerView.bot();
+ }
+
+ /**
+ * Ensure that the "link with editor" feature works correctly in model
+ * explorer view by checking if the opened element is the selected one in
+ * model explorer view.
+ */
+ public void testLinkWithEditorFeatureWithModelExplorerView() {
+ SWTBotTreeItem projectTreeItemBot = modelExplorerViewBot.tree().expandNode(getProjectName(), true);
+ SWTBotTreeItem representationsResourceTreeItemBot = projectTreeItemBot.getNode(REPRESENTATIONS_RESOURCE_NAME);
+ SWTBotTreeItem viewpointTreeItemBot = representationsResourceTreeItemBot.getNode(0)
+ .getNode(EcoreModeler.DESIGN_VIEWPOINT_NAME);
+ SWTBotTreeItem representationDescriptionTreeItemBot = viewpointTreeItemBot.getNode(0);
+ SWTBotTreeItem representationTreeItemBot = representationDescriptionTreeItemBot.getNode(0);
+ SWTBotView modelExplorerView = bot.viewById(IModelExplorerView.ID);
+ boolean linkWithEditorInitialStatus = modelExplorerView.toolbarToggleButton("Link with Editor").isChecked();
+ try {
+ if (!linkWithEditorInitialStatus) {
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+ }
+ openDiagram(REPRESENTATION_NAME);
+ assertEquals("The opened representation should be selected in model explorer view",
+ representationTreeItemBot.isSelected(), true);
+ } finally {
+ // Reset to previous environment
+ if (linkWithEditorInitialStatus != modelExplorerView.toolbarToggleButton("Link with Editor").isChecked()) {
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+ }
+ }
+ }
+
+ /**
+ * Tests that the link with editor (editor toward model explorer) works
+ * properly when selecting a diagram element.
+ */
+ public void testLinkWithEditorWithDiagramElementSelection() {
+ final SWTBotView modelExplorerView = bot.viewById(IModelExplorerView.ID);
+ boolean linkWithEditorInitialStatus = modelExplorerView.toolbarToggleButton("Link with Editor").isChecked();
+ try {
+ if (!linkWithEditorInitialStatus) {
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+ }
+
+ // We open the representation...
+ openDiagram(REPRESENTATION_NAME);
+ SWTBotUtils.waitAllUiEvents();
+
+ // We next select the "newPackage1" package.
+ editor.click(NEW_PACKAGE1);
+ SWTBotUtils.waitAllUiEvents();
+
+ // We wait until it's actually selected in the model explorer view.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE1));
+
+ // We next select the "newPackage2" package.
+ editor.click(NEW_PACKAGE2);
+ SWTBotUtils.waitAllUiEvents();
+
+ // We wait until it's actually selected in the model explorer view.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE2));
+
+ // we deactivate the link with editor
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+
+ // We next select the "newPackage1" package.
+ editor.click(NEW_PACKAGE1);
+ SWTBotUtils.waitAllUiEvents();
+
+ // The NewPackage2 should still be selected.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE2));
+
+ } finally {
+ // Reset to previous environment
+ if (linkWithEditorInitialStatus != modelExplorerView.toolbarToggleButton("Link with Editor").isChecked()) {
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+ }
+ }
+ }
+
+ /**
+ * Tests that the link with editor (editor toward model explorer) is not
+ * activated when the action is not checked.
+ */
+ public void testLinkWithEditorDeactivate() {
+ final SWTBotView modelExplorerView = bot.viewById(IModelExplorerView.ID);
+ boolean linkWithEditorChecked = modelExplorerView.toolbarToggleButton("Link with Editor").isChecked();
+ assertFalse("The Link with Editor should be deactivated", linkWithEditorChecked);
+ // We open the representation...
+ openDiagram(REPRESENTATION_NAME);
+ SWTBotUtils.waitAllUiEvents();
+
+ // We next select the "newPackage1" package.
+ editor.click(NEW_PACKAGE1);
+ SWTBotUtils.waitAllUiEvents();
+
+ assertTrue("The model explorer view selection should not be modified.", isSelectionEmplty(modelExplorerView));
+
+ // We next select the "newPackage2" package.
+ editor.click(NEW_PACKAGE2);
+ SWTBotUtils.waitAllUiEvents();
+
+ assertTrue("The model explorer view selection should not be modified.", isSelectionEmplty(modelExplorerView));
+ }
+
+ /**
+ * Tests that the link with editor (editor toward model explorer) works
+ * properly when selecting a table element.
+ */
+ public void testLinkWithEditorWithTableElementSelection() {
+ final SWTBotView modelExplorerView = bot.viewById(IModelExplorerView.ID);
+ boolean linkWithEditorInitialStatus = modelExplorerView.toolbarToggleButton("Link with Editor").isChecked();
+ try {
+ if (!linkWithEditorInitialStatus) {
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+ }
+
+ // We open the representation...
+ SWTBotTree representation = openTable(TABLE_NAME);
+ SWTBotUtils.waitAllUiEvents();
+
+ // We next select the "newPackage1" package.
+ representation.getTreeItem(NEW_PACKAGE1).select();
+ SWTBotUtils.waitAllUiEvents();
+
+ // We wait until it's actually selected in the model explorer view.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE1));
+
+ // We next select the "newPackage2" package.
+ representation.getTreeItem(NEW_PACKAGE2).select();
+ SWTBotUtils.waitAllUiEvents();
+
+ // We wait until it's actually selected in the model explorer view.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE2));
+
+ // we deactivate the link with editor
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+
+ // We next select the "newPackage1" package.
+ representation.getTreeItem(NEW_PACKAGE1).select();
+ SWTBotUtils.waitAllUiEvents();
+
+ // The NewPackage2 should still be selected.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE2));
+
+ } finally {
+ if (linkWithEditorInitialStatus != modelExplorerView.toolbarToggleButton("Link with Editor").isChecked()) {
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+ }
+ }
+ }
+
+ /**
+ * Tests that the link with editor (editor toward model explorer) works
+ * properly when selecting a tree element.
+ */
+ public void testLinkWithEditorWithTreeElementSelection() {
+ final SWTBotView modelExplorerView = bot.viewById(IModelExplorerView.ID);
+ boolean linkWithEditorInitialStatus = modelExplorerView.toolbarToggleButton("Link with Editor").isChecked();
+ try {
+ if (!linkWithEditorInitialStatus) {
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+ }
+
+ // We open the representation...
+ SWTBotTree representation = openTree(TREE_NAME);
+ SWTBotUtils.waitAllUiEvents();
+
+ // We next select the "newPackage1" package.
+ representation.getTreeItem(NEW_PACKAGE1).select();
+ SWTBotUtils.waitAllUiEvents();
+
+ // We wait until it's actually selected in the model explorer view.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE1));
+
+ // We next select the "newPackage2" package.
+ representation.getTreeItem(NEW_PACKAGE2).select();
+ SWTBotUtils.waitAllUiEvents();
+
+ // We wait until it's actually selected in the model explorer view.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE2));
+
+ // we deactivate the link with editor
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+
+ // We next select the "newPackage1" package.
+ representation.getTreeItem(NEW_PACKAGE1).select();
+ SWTBotUtils.waitAllUiEvents();
+
+ // The NewPackage2 should still be selected.
+ bot.waitUntil(new ModelExplorerSelectionCondition(modelExplorerView, NEW_PACKAGE2));
+
+ } finally {
+ if (linkWithEditorInitialStatus != modelExplorerView.toolbarToggleButton("Link with Editor").isChecked()) {
+ modelExplorerView.toolbarToggleButton("Link with Editor").click();
+ }
+ }
+ }
+
+ private void openDiagram(String representationName) {
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(),
+ REPRESENTATION_DESCRIPTION_NAME, representationName, DDiagram.class);
+ }
+
+ private SWTBotTree openTable(String representationName) {
+ SWTBotEditor localEditor = openRepresentation(localSession.getOpenedSession(), TABLE_DESCRIPTION_NAME,
+ representationName, DTable.class);
+ return localEditor.bot().tree();
+
+ }
+
+ private SWTBotTree openTree(String representationName) {
+ SWTBotEditor localEditor = openRepresentation(localSession.getOpenedSession(), TREE_NAME, representationName,
+ DTree.class);
+ return localEditor.bot().tree();
+
+ }
+
+ private boolean isSelectionEmplty(SWTBotView modelExplorerView) {
+ ModelExplorerView explorerView = (ModelExplorerView) modelExplorerView.getViewReference().getView(false);
+ IStructuredSelection selection = (IStructuredSelection) explorerView.getCommonViewer().getSelection();
+ return selection.isEmpty();
+
+ }
+
+ private class ModelExplorerSelectionCondition extends DefaultCondition {
+
+ private SWTBotView modelExplorerView;
+ private String name;
+
+ public ModelExplorerSelectionCondition(SWTBotView modelExplorerView, String name) {
+ this.modelExplorerView = modelExplorerView;
+ this.name = name;
+ }
+
+ @Override
+ public boolean test() throws Exception {
+ ModelExplorerView explorerView = (ModelExplorerView) modelExplorerView.getViewReference().getView(false);
+ IStructuredSelection selection = (IStructuredSelection) explorerView.getCommonViewer().getSelection();
+ Object selectedElement = selection.getFirstElement();
+ return (selectedElement instanceof ENamedElement)
+ && ((ENamedElement) selectedElement).getName().equals(this.name);
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "The " + this.name + " should be selected in the Model Explorer View";
+ }
+ }
}

Back to the top