Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Porhel2015-07-30 10:08:53 +0000
committerMaxime Porhel2015-08-03 15:19:40 +0000
commitb55fd604e38ef864d8cb7676ca6b68526382a1fe (patch)
tree208a5fc91fd9f6bef5ccca16de56f9cec794dd4d
parent814bb278e6aa174611e2f183643f80bf6f434890 (diff)
downloadorg.eclipse.sirius-b55fd604e38ef864d8cb7676ca6b68526382a1fe.tar.gz
org.eclipse.sirius-b55fd604e38ef864d8cb7676ca6b68526382a1fe.tar.xz
org.eclipse.sirius-b55fd604e38ef864d8cb7676ca6b68526382a1fe.zip
[473943] Test
Correct and add the existing test on dialect editor closer to the suite. Also correct and add ShowTypeActionButtonTest Bug: 473943 Change-Id: Ibd00f3661bb8ef7d6643ce0e2f8f24fcf83a69ad Signed-off-by: Maxime Porhel <maxime.porhel@obeo.fr>
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.aird63
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.odesign22
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ShowTypeActionButtonTest.java26
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SpecificClosedOrNotClosedEditorTest.java285
-rw-r--r--plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/suite/AllTestSuite.java13
5 files changed, 337 insertions, 72 deletions
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.aird b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.aird
index 25bdb0964e..a927c60c30 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.aird
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.aird
@@ -1,5 +1,5 @@
<?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="_b55WMEaEEeCF5Jfq2eAAHg" selectedViews="_cbxUMEaEEeCF5Jfq2eAAHg" version="8.0.0">
+<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/tree/description/1.0.0" xmlns:description_3="http://www.eclipse.org/sirius/table/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: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/tree/description/1.0.0 http://www.eclipse.org/sirius/tree/1.0.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/diagram/description/style/1.1.0 http://www.eclipse.org/sirius/diagram/1.1.0#//description/style" xmi:id="_b55WMEaEEeCF5Jfq2eAAHg" selectedViews="_cbxUMEaEEeCF5Jfq2eAAHg" version="8.1.1">
<models xmi:type="ecore:EPackage" href="My.ecore#/"/>
<ownedViews xmi:type="viewpoint:DRepresentationContainer" xmi:id="_cbxUMEaEEeCF5Jfq2eAAHg" initialized="true">
<ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_m6R6cEaEEeCF5Jfq2eAAHg" name="new diag1">
@@ -49,38 +49,38 @@
<semanticElements xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
<ownedStyle xmi:type="diagram:Square" xmi:id="_3VlwYNh-EeCxiN3ZLK48lg">
<labelColor xmi:type="viewpoint:RGBValues" xmi:id="_3VlwYdh-EeCxiN3ZLK48lg"/>
- <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']/@style"/>
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']/@style"/>
<borderColor xmi:type="viewpoint:RGBValues" xmi:id="_3VlwYth-EeCxiN3ZLK48lg"/>
<color xmi:type="viewpoint:RGBValues" xmi:id="_3VlwY9h-EeCxiN3ZLK48lg" red="136" green="136" blue="136"/>
</ownedStyle>
- <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']"/>
+ <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_3VlwZNh-EeCxiN3ZLK48lg" name="BBB" incomingEdges="_3V5SYNh-EeCxiN3ZLK48lg" width="3" height="3">
<target xmi:type="ecore:EClass" href="My.ecore#//BBB"/>
<semanticElements xmi:type="ecore:EClass" href="My.ecore#//BBB"/>
<ownedStyle xmi:type="diagram:Square" xmi:id="_3VmXcNh-EeCxiN3ZLK48lg">
<labelColor xmi:type="viewpoint:RGBValues" xmi:id="_3VmXcdh-EeCxiN3ZLK48lg"/>
- <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']/@style"/>
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']/@style"/>
<borderColor xmi:type="viewpoint:RGBValues" xmi:id="_3VmXcth-EeCxiN3ZLK48lg"/>
<color xmi:type="viewpoint:RGBValues" xmi:id="_3VmXc9h-EeCxiN3ZLK48lg" red="136" green="136" blue="136"/>
</ownedStyle>
- <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']"/>
+ <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DEdge" xmi:id="_3V5SYNh-EeCxiN3ZLK48lg" sourceNode="_3VlJUNh-EeCxiN3ZLK48lg" targetNode="_3VlwZNh-EeCxiN3ZLK48lg">
<target xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
<semanticElements xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
<ownedStyle xmi:type="diagram:EdgeStyle" xmi:id="_NY6f4dLoEeC8B54yvhXdAw" size="2">
- <description xmi:type="style:EdgeStyleDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@edgeMappings[name='inheritance']/@style"/>
+ <description xmi:type="style:EdgeStyleDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@edgeMappings[name='inheritance']/@style"/>
<strokeColor xmi:type="viewpoint:RGBValues" xmi:id="_NY6f49LoEeC8B54yvhXdAw" red="136" green="136" blue="136"/>
<centerLabelStyle xmi:type="diagram:CenterLabelStyle" xmi:id="_3LcV4Nh-EeCxiN3ZLK48lg">
<labelColor xmi:type="viewpoint:RGBValues" xmi:id="_3LcV4dh-EeCxiN3ZLK48lg"/>
</centerLabelStyle>
</ownedStyle>
- <actualMapping xmi:type="description_1:EdgeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@edgeMappings[name='inheritance']"/>
+ <actualMapping xmi:type="description_1:EdgeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@edgeMappings[name='inheritance']"/>
</ownedDiagramElements>
- <description xmi:type="description_1:DiagramDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']"/>
+ <description xmi:type="description_1:DiagramDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']"/>
<filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_m6R6cUaEEeCF5Jfq2eAAHg"/>
- <activatedLayers xmi:type="description_1:Layer" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer"/>
+ <activatedLayers xmi:type="description_1:Layer" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer"/>
<target xmi:type="ecore:EPackage" href="My.ecore#/"/>
</ownedRepresentations>
<ownedRepresentations xmi:type="diagram:DSemanticDiagram" xmi:id="_oEMI0EaEEeCF5Jfq2eAAHg" name="new diag2">
@@ -116,28 +116,59 @@
<semanticElements xmi:type="ecore:EAttribute" href="My.ecore#//AAA/att1"/>
<ownedStyle xmi:type="diagram:Square" xmi:id="_3WAnINh-EeCxiN3ZLK48lg">
<labelColor xmi:type="viewpoint:RGBValues" xmi:id="_3WAnIdh-EeCxiN3ZLK48lg"/>
- <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag2']/@defaultLayer/@nodeMappings[name='attribute']/@style"/>
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag2']/@defaultLayer/@nodeMappings[name='attribute']/@style"/>
<borderColor xmi:type="viewpoint:RGBValues" xmi:id="_3WAnIth-EeCxiN3ZLK48lg"/>
<color xmi:type="viewpoint:RGBValues" xmi:id="_3WAnI9h-EeCxiN3ZLK48lg" red="136" green="136" blue="136"/>
</ownedStyle>
- <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag2']/@defaultLayer/@nodeMappings[name='attribute']"/>
+ <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag2']/@defaultLayer/@nodeMappings[name='attribute']"/>
</ownedDiagramElements>
<ownedDiagramElements xmi:type="diagram:DNode" xmi:id="_3WBOMNh-EeCxiN3ZLK48lg" name="att2" width="3" height="3">
<target xmi:type="ecore:EAttribute" href="My.ecore#//AAA/att2"/>
<semanticElements xmi:type="ecore:EAttribute" href="My.ecore#//AAA/att2"/>
<ownedStyle xmi:type="diagram:Square" xmi:id="_3WBOMdh-EeCxiN3ZLK48lg">
<labelColor xmi:type="viewpoint:RGBValues" xmi:id="_3WBOMth-EeCxiN3ZLK48lg"/>
- <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag2']/@defaultLayer/@nodeMappings[name='attribute']/@style"/>
+ <description xmi:type="style:SquareDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag2']/@defaultLayer/@nodeMappings[name='attribute']/@style"/>
<borderColor xmi:type="viewpoint:RGBValues" xmi:id="_3WBOM9h-EeCxiN3ZLK48lg"/>
<color xmi:type="viewpoint:RGBValues" xmi:id="_3WBONNh-EeCxiN3ZLK48lg" red="136" green="136" blue="136"/>
</ownedStyle>
- <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag2']/@defaultLayer/@nodeMappings[name='attribute']"/>
+ <actualMapping xmi:type="description_1:NodeMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag2']/@defaultLayer/@nodeMappings[name='attribute']"/>
</ownedDiagramElements>
- <description xmi:type="description_1:DiagramDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag2']"/>
+ <description xmi:type="description_1:DiagramDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag2']"/>
<filterVariableHistory xmi:type="diagram:FilterVariableHistory" xmi:id="_oEMI0UaEEeCF5Jfq2eAAHg"/>
- <activatedLayers xmi:type="description_1:Layer" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag2']/@defaultLayer"/>
+ <activatedLayers xmi:type="description_1:Layer" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag2']/@defaultLayer"/>
<target xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
</ownedRepresentations>
- <viewpoint xmi:type="description:Viewpoint" href="My.odesign#//@ownedViewpoints[name='testclosingotherdiagram']"/>
+ <ownedRepresentations xmi:type="tree:DTree" xmi:id="_zbWwcDadEeWdd9gkeser_Q" name="new tree">
+ <target xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <ownedTreeItems xmi:type="tree:DTreeItem" xmi:id="_zbXXgDadEeWdd9gkeser_Q" name="AAA">
+ <target xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <semanticElements xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <ownedStyle xmi:type="tree:TreeItemStyle" xmi:id="_zbXXgTadEeWdd9gkeser_Q">
+ <labelColor xmi:type="viewpoint:RGBValues" xmi:id="_zbXXgjadEeWdd9gkeser_Q"/>
+ <backgroundColor xmi:type="viewpoint:RGBValues" xmi:id="_zbXXgzadEeWdd9gkeser_Q" red="255" green="255" blue="255"/>
+ </ownedStyle>
+ <actualMapping xmi:type="description_2:TreeItemMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='tree']/@subItemMappings[name='treeElement']"/>
+ </ownedTreeItems>
+ <description xmi:type="description_2:TreeDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='tree']"/>
+ </ownedRepresentations>
+ <ownedRepresentations xmi:type="table:DTable" xmi:id="_0GGWkDadEeWdd9gkeser_Q" name="new crossTable" headerColumnWidth="115">
+ <target xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <lines xmi:type="table:DLine" xmi:id="_0GGWkTadEeWdd9gkeser_Q" label="AAA -> BBB">
+ <target xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <semanticElements xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <originMapping xmi:type="description_3:LineMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='crossTable']/@ownedLineMappings[name='crossLine']"/>
+ </lines>
+ <description xmi:type="description_3:CrossTableDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='crossTable']"/>
+ </ownedRepresentations>
+ <ownedRepresentations xmi:type="table:DTable" xmi:id="_0wFHsDadEeWdd9gkeser_Q" name="new editionTable" headerColumnWidth="115">
+ <target xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <lines xmi:type="table:DLine" xmi:id="_0wFHsTadEeWdd9gkeser_Q" label="AAA -> BBB">
+ <target xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <semanticElements xmi:type="ecore:EClass" href="My.ecore#//AAA"/>
+ <originMapping xmi:type="description_3:LineMapping" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='editionTable']/@ownedLineMappings[name='editionLine']"/>
+ </lines>
+ <description xmi:type="description_3:EditionTableDescription" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='editionTable']"/>
+ </ownedRepresentations>
+ <viewpoint xmi:type="description:Viewpoint" href="My.odesign#//@ownedViewpoints[name='testclosingotherrepresentation']"/>
</ownedViews>
</viewpoint:DAnalysis>
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.odesign b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.odesign
index 2706eb3437..c6d7c290c2 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.odesign
+++ b/plugins/org.eclipse.sirius.tests.swtbot/data/unit/closeEditorSpecificTest/My.odesign
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="ASCII"?>
-<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/diagram/description/1.1.0" xmlns:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/diagram/description/tool/1.1.0" xmlns:tool_1="http://www.eclipse.org/sirius/description/tool/1.1.0" name="My" version="8.0.0">
- <ownedViewpoints name="testclosingotherdiagram">
+<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/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:style="http://www.eclipse.org/sirius/diagram/description/style/1.1.0" xmlns:tool="http://www.eclipse.org/sirius/diagram/description/tool/1.1.0" xmlns:tool_1="http://www.eclipse.org/sirius/description/tool/1.1.0" name="My" version="8.1.0">
+ <ownedViewpoints name="testclosingotherrepresentation">
<ownedRepresentations xsi:type="description_1:DiagramDescription" name="diag1" domainClass="EPackage">
<defaultLayer name="Default">
<nodeMappings name="class" semanticCandidatesExpression="feature:eContents" domainClass="EClass">
@@ -10,7 +10,7 @@
<color xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
</style>
</nodeMappings>
- <edgeMappings name="inheritance" deletionDescription="//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@toolSections.0/@ownedTools[name='']" semanticCandidatesExpression="feature:eAllContents" sourceMapping="//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']" targetMapping="//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']" targetFinderExpression="&lt;%eSuperTypes%>">
+ <edgeMappings name="inheritance" deletionDescription="//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@toolSections.0/@ownedTools[name='']" semanticCandidatesExpression="feature:eAllContents" sourceMapping="//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']" targetMapping="//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@nodeMappings[name='class']" targetFinderExpression="&lt;%eSuperTypes%>">
<style sizeComputationExpression="2">
<strokeColor xsi:type="description:SystemColor" href="environment:/viewpoint#//@systemColors/@entries[name='gray']"/>
<centerLabelStyleDescription>
@@ -29,7 +29,7 @@
</firstModelOperations>
</initialOperation>
</ownedTools>
- <ownedTools xsi:type="tool:EdgeCreationDescription" name="Inheritance" edgeMappings="//@ownedViewpoints[name='testclosingotherdiagram']/@ownedRepresentations[name='diag1']/@defaultLayer/@edgeMappings[name='inheritance']">
+ <ownedTools xsi:type="tool:EdgeCreationDescription" name="Inheritance" edgeMappings="//@ownedViewpoints[name='testclosingotherrepresentation']/@ownedRepresentations[name='diag1']/@defaultLayer/@edgeMappings[name='inheritance']">
<sourceVariable name="source"/>
<targetVariable name="target"/>
<sourceViewVariable name="sourceView"/>
@@ -54,5 +54,19 @@
</nodeMappings>
</defaultLayer>
</ownedRepresentations>
+ <ownedRepresentations xsi:type="description_2:CrossTableDescription" name="crossTable" domainClass="EClass">
+ <ownedLineMappings name="crossLine" domainClass="EClass" semanticCandidatesExpression="var:self"/>
+ </ownedRepresentations>
+ <ownedRepresentations xsi:type="description_2:EditionTableDescription" name="editionTable" domainClass="EClass">
+ <ownedLineMappings name="editionLine" domainClass="EClass" semanticCandidatesExpression="var:self"/>
+ </ownedRepresentations>
+ <ownedRepresentations xsi:type="description_3:TreeDescription" name="tree" domainClass="EClass">
+ <subItemMappings name="treeElement" domainClass="EClass" semanticCandidatesExpression="var:self">
+ <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/ShowTypeActionButtonTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ShowTypeActionButtonTest.java
index 34ece8a042..552c28ea69 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ShowTypeActionButtonTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/ShowTypeActionButtonTest.java
@@ -16,7 +16,6 @@ import org.eclipse.sirius.tests.swtbot.support.api.AbstractSiriusSwtBotGefTestCa
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.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
/**
@@ -29,7 +28,7 @@ public class ShowTypeActionButtonTest extends AbstractSiriusSwtBotGefTestCase {
private static final String VIEWPOINT_NAME = "Design";
- private static final String TYPED_VIEWPOINT_NAME = "<Sirius> Design";
+ private static final String TYPED_VIEWPOINT_NAME = "<Viewpoint> Design";
private static final String VSM_FILE = "ecore.odesign";
@@ -54,19 +53,16 @@ public class ShowTypeActionButtonTest extends AbstractSiriusSwtBotGefTestCase {
openVSM();
SWTBotEditor activeEditor = bot.activeEditor();
activeEditor.setFocus();
- try {
- SWTBotMenu contextualMenu = activeEditor.bot().tree().expandNode("platform:/resource/" + getProjectName() + "/" + VSM_FILE).expandNode(GROUP).expandNode(VIEWPOINT_NAME)
- .expandNode(REPRESENTATION_NAME).contextMenu(SHOW_TYPE);
- contextualMenu.click();
- contextualMenu = activeEditor.bot().tree().expandNode("platform:/resource/" + getProjectName() + "/" + VSM_FILE).expandNode(TYPED_GROUP).expandNode(TYPED_VIEWPOINT_NAME)
- .expandNode(TYPED_REPRESENTATION_NAME).contextMenu(HIDE_TYPE);
- contextualMenu.click();
- contextualMenu = activeEditor.bot().tree().expandNode("platform:/resource/" + getProjectName() + "/" + VSM_FILE).expandNode(GROUP).expandNode(VIEWPOINT_NAME)
- .expandNode(REPRESENTATION_NAME).contextMenu(SHOW_TYPE);
- } catch (WidgetNotFoundException wnfe) {
- fail("There is a problem with show/hide type Action. The Elements are not named correctly");
- }
-
+
+ //Active the
+ SWTBotMenu contextualMenu = activeEditor.bot().tree().expandNode("platform:/resource/" + getProjectName() + "/" + VSM_FILE).expandNode(GROUP).expandNode(VIEWPOINT_NAME)
+ .expandNode(REPRESENTATION_NAME).contextMenu(SHOW_TYPE);
+ contextualMenu.click();
+ contextualMenu = activeEditor.bot().tree().expandNode("platform:/resource/" + getProjectName() + "/" + VSM_FILE).expandNode(TYPED_GROUP).expandNode(TYPED_VIEWPOINT_NAME)
+ .expandNode(TYPED_REPRESENTATION_NAME).contextMenu(HIDE_TYPE);
+ contextualMenu.click();
+ contextualMenu = activeEditor.bot().tree().expandNode("platform:/resource/" + getProjectName() + "/" + VSM_FILE).expandNode(GROUP).expandNode(VIEWPOINT_NAME).expandNode(REPRESENTATION_NAME)
+ .contextMenu(SHOW_TYPE);
}
/**
diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SpecificClosedOrNotClosedEditorTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SpecificClosedOrNotClosedEditorTest.java
index 5ae7319121..01fe646086 100644
--- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SpecificClosedOrNotClosedEditorTest.java
+++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/SpecificClosedOrNotClosedEditorTest.java
@@ -10,7 +10,21 @@
*******************************************************************************/
package org.eclipse.sirius.tests.swtbot;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.sirius.business.api.preferences.SiriusPreferencesKeys;
import org.eclipse.sirius.diagram.DDiagram;
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractDiagramEdgeEditPart;
@@ -18,12 +32,33 @@ import org.eclipse.sirius.diagram.ui.internal.edit.parts.DDiagramEditPart;
import org.eclipse.sirius.diagram.ui.internal.edit.parts.DEdgeEditPart;
import org.eclipse.sirius.diagram.ui.internal.edit.parts.DNodeContainerEditPart;
import org.eclipse.sirius.diagram.ui.internal.edit.parts.DNodeEditPart;
+import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor;
+import org.eclipse.sirius.ecore.extender.tool.api.ModelUtils;
+import org.eclipse.sirius.table.metamodel.table.DTable;
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.UIResource;
+import org.eclipse.sirius.tests.swtbot.support.api.condition.OperationDoneCondition;
import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusDiagramEditor;
+import org.eclipse.sirius.tests.swtbot.support.api.editor.SWTBotSiriusHelper;
+import org.eclipse.sirius.tree.DTree;
+import org.eclipse.sirius.ui.business.api.dialect.DefaultDialectEditorDialogFactory;
+import org.eclipse.sirius.ui.business.api.dialect.DialectEditor;
+import org.eclipse.sirius.ui.business.api.session.IEditingSession;
+import org.eclipse.sirius.ui.business.api.session.SessionUIManager;
+import org.eclipse.sirius.viewpoint.DRepresentation;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+import com.google.common.collect.Lists;
/**
* Test that if deleted target element present in other representation opened,
@@ -33,10 +68,6 @@ import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
*/
public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGefTestCase {
- private static final String VIEWPOINT_NAME = "testclosingotherdiagram";
-
- private static final String VIEWPOINT_NAME_1854 = "VP-1854";
-
private static final String REPRESENTATION_INSTANCE_NAME_1854_1 = "p1 package entities";
private static final String REPRESENTATION_INSTANCE_NAME_1854_2 = "new VP-1854";
@@ -45,7 +76,11 @@ public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGef
private static final String REPRESENTATION_INSTANCE_NAME2 = "new diag2";
- private static final String EDITOR_NAME_2 = REPRESENTATION_INSTANCE_NAME2 + "(EClass AAA)";
+ private static final String REPRESENTATION_INSTANCE_NAME3 = "new tree";
+
+ private static final String REPRESENTATION_INSTANCE_NAME4 = "new editionTable";
+
+ private static final String REPRESENTATION_INSTANCE_NAME5 = "new crossTable";
private static final String REPRESENTATION_NAME_1854_1 = "Entities";
@@ -55,6 +90,12 @@ public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGef
private static final String REPRESENTATION_NAME2 = "diag2";
+ private static final String REPRESENTATION_NAME3 = "tree";
+
+ private static final String REPRESENTATION_NAME4 = "editionTable";
+
+ private static final String REPRESENTATION_NAME5 = "crossTable";
+
private static final String MODEL = "My.ecore";
private static final String VSM = "My.odesign";
@@ -73,14 +114,6 @@ public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGef
private SWTBotSiriusDiagramEditor editor;
- private UIResource sessionAirdResource;
-
- private UIResource sessionAirdResource1854;
-
- private UILocalSession localSession;
-
- private UILocalSession localSession1854;
-
@Override
protected void onSetUpBeforeClosingWelcomePage() throws Exception {
copyFileToTestProject(Activator.PLUGIN_ID, DATA_UNIT_DIR, MODEL, MODEL_1854, SESSION_FILE, SESSION_FILE_1854, VSM, VSM_1854);
@@ -88,10 +121,8 @@ public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGef
@Override
protected void onSetUpAfterOpeningDesignerPerspective() throws Exception {
- sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE);
- sessionAirdResource1854 = new UIResource(designerProject, FILE_DIR, SESSION_FILE_1854);
+ UIResource sessionAirdResource = new UIResource(designerProject, FILE_DIR, SESSION_FILE);
localSession = designerPerspective.openSessionFromFile(sessionAirdResource, true);
- localSession1854 = designerPerspective.openSessionFromFile(sessionAirdResource1854, true);
}
/**
@@ -100,8 +131,8 @@ public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGef
*/
public void testSpecificNotCloseEditor() {
// Open the 2 representations
- openDiagram(localSession, VIEWPOINT_NAME, REPRESENTATION_NAME2, REPRESENTATION_INSTANCE_NAME2);
- openDiagram(localSession, VIEWPOINT_NAME, REPRESENTATION_NAME1, REPRESENTATION_INSTANCE_NAME1);
+ openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME2, REPRESENTATION_INSTANCE_NAME2, DDiagram.class);
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME1, REPRESENTATION_INSTANCE_NAME1, DDiagram.class);
// Selected the edge to remove
SWTBotGefEditPart selectedElement = selectAndCheckEditPart("", AbstractDiagramEdgeEditPart.class);
@@ -114,7 +145,7 @@ public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGef
// Check that edge was removed.
assertTrue("The edge is not deleted", ((DNodeEditPart) ((DDiagramEditPart) editor.rootEditPart().part().getChildren().get(0)).getChildren().get(0)).getSourceConnections().size() == 0);
// Check that the second editor is always open.
- assertEquals("The second editor was closed", EDITOR_NAME_2, ((SWTBotEditor) bot.editors().get(0)).getReference().getPartName());
+ assertEquals("The second editor was closed", REPRESENTATION_INSTANCE_NAME2, ((SWTBotEditor) bot.editors().get(0)).getReference().getPartName());
}
/**
@@ -123,43 +154,218 @@ public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGef
*/
public void testSpecificCloseEditor() {
// Open the 2 representations
- openDiagram(localSession, VIEWPOINT_NAME, REPRESENTATION_NAME2, REPRESENTATION_INSTANCE_NAME2);
- openDiagram(localSession, VIEWPOINT_NAME, REPRESENTATION_NAME1, REPRESENTATION_INSTANCE_NAME1);
+ openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME2, REPRESENTATION_INSTANCE_NAME2, DDiagram.class);
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME1, REPRESENTATION_INSTANCE_NAME1, DDiagram.class);
// Selected the node to remove
SWTBotGefEditPart selectedElement = selectAndCheckEditPart("AAA", DNodeEditPart.class);
DNodeEditPart nodeSelected = (DNodeEditPart) selectedElement.part();
- assertEquals("The selected edge is not correct", (((DDiagramEditPart) editor.rootEditPart().part().getChildren().get(0)).getChildren().get(0)), nodeSelected);
+ assertEquals("The selected node is not correct", (((DDiagramEditPart) editor.rootEditPart().part().getChildren().get(0)).getChildren().get(0)), nodeSelected);
editor.select(selectedElement);
// Remove the node
editor.clickContextMenu("Delete from Model");
// Check that node was removed.
assertTrue("The node is not deleted", ((DDiagramEditPart) editor.rootEditPart().part().getChildren().get(0)).getChildren().size() == 1);
+ // Check and close the popup.
+ bot.waitUntil(Conditions.shellIsActive(DefaultDialectEditorDialogFactory.ELEMENT_HAS_BEEN_DELETED_TITLE));
+ SWTBotShell editorWillClosePopup = bot.activeShell();
+ bot.button("OK").click();
+ bot.waitUntil(Conditions.shellCloses(editorWillClosePopup));
// Check that the second editor is closed.
assertTrue("The second editor was not closed", bot.editors().size() == 1);
}
/**
+ * Test the deleted target element on representation, not closed other
+ * editor.
+ */
+ public void testSpecificCloseEditorsFromSemanticDeleteAfterReload() throws Exception {
+ doTestSpecificCloseEditorsAfterReload(true);
+ }
+
+ /**
+ * Test the deleted target element on representation, not closed other
+ * editor.
+ */
+ public void testSpecificCloseEditorsFromRepresentationDeleteAfterReload() throws Exception {
+ doTestSpecificCloseEditorsAfterReload(false);
+ }
+
+ /**
+ * Open several representations, reload the aird and then delete them
+ * programmatically or delete their common semantic target to test the
+ * dialect editor closer.
+ *
+ * @param deleteSemantic
+ * true to delete the semantic element, false to delete each
+ * representation.
+ */
+ private void doTestSpecificCloseEditorsAfterReload(boolean deleteSemantic) throws Exception {
+ boolean oldPref = ResourcesPlugin.getPlugin().getPluginPreferences().getBoolean(ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH);
+ ResourcesPlugin.getPlugin().getPluginPreferences().setValue(ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, true);
+ try {
+ // Open the 2 representations
+ openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME2, REPRESENTATION_INSTANCE_NAME2, DDiagram.class);
+ openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME3, REPRESENTATION_INSTANCE_NAME3, DTree.class);
+ openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME4, REPRESENTATION_INSTANCE_NAME4, DTable.class);
+ openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME5, REPRESENTATION_INSTANCE_NAME5, DTable.class);
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME1, REPRESENTATION_INSTANCE_NAME1, DDiagram.class);
+ localSession.save();
+
+ final EditorWillBeClosedInformationDialogCallerDetector editorWillCloseDetector = new EditorWillBeClosedInformationDialogCallerDetector();
+ final Collection<DRepresentation> openedRepresentations = Lists.newArrayList();
+ IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(localSession.getOpenedSession());
+ for (DialectEditor ed : uiSession.getEditors()) {
+ DRepresentation representation = ed.getRepresentation();
+ openedRepresentations.add(representation);
+ assertFalse(representation.eIsProxy());
+ ed.setDialogFactory(editorWillCloseDetector);
+ }
+
+ // Reload the aird
+ forceReloadFromExternalFileModification(localSession.getOpenedSession().getSessionResource());
+
+ // Check that all previous DRepresentation objects have been
+ // proxified.
+ for (DRepresentation representation : openedRepresentations) {
+ assertTrue(representation.eIsProxy());
+ }
+ openedRepresentations.clear();
+
+ // Check that editors are able to resolve their proxy model element.
+ for (DialectEditor ed : Lists.newArrayList(uiSession.getEditors())) {
+ SWTBotSiriusHelper.getSiriusEditor(ed.getTitle()).show();
+ DRepresentation representation = ed.getRepresentation();
+ assertFalse(representation.eIsProxy());
+ openedRepresentations.add(representation);
+ }
+
+ // Show the editor shown before the editor checks.
+ editor.show();
+
+ if (deleteSemantic) {
+ // Selected the node to remove
+ SWTBotGefEditPart selectedElement = selectAndCheckEditPart("AAA", DNodeEditPart.class);
+ DNodeEditPart nodeSelected = (DNodeEditPart) selectedElement.part();
+ assertEquals("The selected node is not correct", (((DDiagramEditPart) editor.rootEditPart().part().getChildren().get(0)).getChildren().get(0)), nodeSelected);
+ editor.select(selectedElement);
+ // Remove the node
+ editor.clickContextMenu("Delete from Model");
+ // Check that node was removed.
+ assertTrue("The node is not deleted", ((DDiagramEditPart) editor.rootEditPart().part().getChildren().get(0)).getChildren().size() == 1);
+ } else {
+ openedRepresentations.remove(editor.getDiagramEditPart().resolveSemanticElement());
+ final ModelAccessor modelAccessor = localSession.getOpenedSession().getModelAccessor();
+ TransactionalEditingDomain transactionalEditingDomain = localSession.getOpenedSession().getTransactionalEditingDomain();
+ transactionalEditingDomain.getCommandStack().execute(new RecordingCommand(transactionalEditingDomain) {
+ @Override
+ protected void doExecute() {
+ for (DRepresentation rep : openedRepresentations) {
+ modelAccessor.eDelete(rep, null);
+ }
+ }
+ });
+ }
+
+ // FIXME after reload the dialect editor closer of diagrams still
+ // point
+ // to the previous element which is a proxy and is not notified any
+ // more.
+ final int dialectEditorCloserExpectedDetections = deleteSemantic ? 4 : 3;
+ // Check and close the popups.
+ bot.waitUntil(new DefaultCondition() {
+ @Override
+ public boolean test() throws Exception {
+ return dialectEditorCloserExpectedDetections == editorWillCloseDetector.getNotifiedEditors();
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "Some editors were not asked to infor the user that they will be closed due to root element deletion.";
+ }
+ });
+ // Check that the other editors are closed.
+ // FIXME after reload the dialect editor closer of diagrams still
+ // point
+ // to the previous element which is a proxy and is not notified any
+ // more.
+ assertEquals("Some editors should have been closed.", 5 - dialectEditorCloserExpectedDetections, bot.editors().size());
+ } finally {
+ ResourcesPlugin.getPlugin().getPluginPreferences().setValue(ResourcesPlugin.PREF_LIGHTWEIGHT_AUTO_REFRESH, oldPref);
+ }
+ }
+
+ /**
+ * Edit the semantic model and save resource.
+ */
+ private void forceReloadFromExternalFileModification(final Resource res) throws Exception {
+ final EObject rootToReload = res.getContents().get(0);
+ ICondition reload = new DefaultCondition() {
+
+ @Override
+ public boolean test() throws Exception {
+ return rootToReload.eIsProxy();
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "The resource has not been reloaded";
+ }
+ };
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ @Override
+ public void run() {
+ try {
+ final Shell activeShell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+ new ProgressMonitorDialog(activeShell).run(false, false, new WorkspaceModifyOperation() {
+ @Override
+ public void execute(IProgressMonitor monitor) {
+ ResourceSet set = new ResourceSetImpl();
+ try {
+ final EObject root = ModelUtils.load(res.getURI(), set);
+ root.eResource().save(Collections.EMPTY_MAP);
+ } catch (IOException e) {
+ fail("Problem when saving the resource in another resourceSet : " + e.getMessage());
+ }
+ }
+ });
+ } catch (InvocationTargetException e) {
+ fail("Cannot launch control/uncontrol");
+ } catch (InterruptedException e) {
+ fail("Cannot launch control/uncontrol");
+ }
+ }
+ });
+ bot.waitUntil(reload);
+ }
+
+ /**
* Test that UnGroup packages working properly and that the second editor is
* closed because the package p1 was deleted.
*/
public void testUnGroupPackages() {
+ localSession.close(false);
+ UIResource sessionAirdResource1854 = new UIResource(designerProject, FILE_DIR, SESSION_FILE_1854);
+ localSession = designerPerspective.openSessionFromFile(sessionAirdResource1854, true);
changeSiriusPreference(SiriusPreferencesKeys.PREF_AUTO_REFRESH.name(), true);
// Open the 2 representations
- openDiagram(localSession1854, "Design", REPRESENTATION_NAME_1854_1, REPRESENTATION_INSTANCE_NAME_1854_1);
- openDiagram(localSession1854, VIEWPOINT_NAME_1854, REPRESENTATION_NAME_1854_2, REPRESENTATION_INSTANCE_NAME_1854_2);
+ openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME_1854_1, REPRESENTATION_INSTANCE_NAME_1854_1, DDiagram.class);
+ editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), REPRESENTATION_NAME_1854_2, REPRESENTATION_INSTANCE_NAME_1854_2, DDiagram.class);
// Selected the package
SWTBotGefEditPart selectedElement = selectAndCheckEditPart("p1", DNodeContainerEditPart.class);
DNodeContainerEditPart containerSelected = (DNodeContainerEditPart) selectedElement.part();
assertEquals("The selected container is not correct", (((DDiagramEditPart) editor.rootEditPart().part().getChildren().get(0)).getChildren().get(2)), containerSelected);
editor.select(selectedElement);
// UnGroup the package (move class in p1 to root and remove p1)
+ ICondition done = new OperationDoneCondition();
editor.clickContextMenu("Ungroup classes");
- // The refresh is not effective, that why we select the diagram for
- // refresh manually
- editor.click(200, 200);
- editor.refresh();
+ bot.waitUntil(done);
// Check that package was removed.
assertTrue("The package is not deleted", ((DDiagramEditPart) editor.rootEditPart().part().getChildren().get(0)).getChildren().size() == 4);
+ // Check and close the popup.
+ bot.waitUntil(Conditions.shellIsActive(DefaultDialectEditorDialogFactory.ELEMENT_HAS_BEEN_DELETED_TITLE));
+ SWTBotShell editorWillClosePopup = bot.activeShell();
+ bot.button("OK").click();
+ bot.waitUntil(Conditions.shellCloses(editorWillClosePopup));
// Check that the second editor is closed.
assertEquals("The second editor is always opened", 1, bot.editors().size());
}
@@ -180,7 +386,24 @@ public class SpecificClosedOrNotClosedEditorTest extends AbstractSiriusSwtBotGef
return botPart;
}
- private void openDiagram(UILocalSession localSession, String viewpointName, String representationName, String representationInstanceName) {
- editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), representationName, representationInstanceName, DDiagram.class);
+ // Specific dialect editor dialog factory to detect the close without root
+ // element detected popup.
+ private class EditorWillBeClosedInformationDialogCallerDetector extends DefaultDialectEditorDialogFactory {
+
+ int notifiedEditors = 0;
+
+ @Override
+ public void editorWillBeClosedInformationDialog(Shell parent) {
+ notifiedEditors++;
+ }
+
+ /**
+ * @return the notifiedEditors
+ */
+ public int getNotifiedEditors() {
+ return notifiedEditors;
+ }
+
}
+
}
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 ca887f1207..3e5f8d7f1f 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
@@ -10,6 +10,11 @@
*******************************************************************************/
package org.eclipse.sirius.tests.swtbot.suite;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.resource.Resource;
@@ -59,11 +64,6 @@ import org.eclipse.sirius.tests.swtbot.uml.CopyPasteLayoutOfPortsWithConflictWit
import org.eclipse.sirius.tests.swtbot.uml.PortLocationAfterDragAndDropOnDiagramTest;
import org.eclipse.sirius.tests.swtbot.uml.PortLocationAfterDragAndDropTest;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import junit.textui.TestRunner;
-
/**
* All SWTBot tests.
*
@@ -132,7 +132,8 @@ public class AllTestSuite extends TestCase {
suite.addTestSuite(DragAndDropDifferentElementsTest.class);
suite.addTestSuite(CellEditorExtensionTest.class);
suite.addTestSuite(RefreshWithCustomizedStyleTests.class);
-
+ suite.addTestSuite(ShowTypeActionButtonTest.class);
+ suite.addTestSuite(SpecificClosedOrNotClosedEditorTest.class);
}
/**

Back to the top