Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.classpath8
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.project28
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/META-INF/MANIFEST.MF18
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/about.html28
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/build.properties6
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.di63
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.notation147
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.uml7
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/plugin.properties12
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/src/org/eclipse/papyrus/layers/integrationtests/LayersStateAfterReloadTest.java275
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.runtime/META-INF/MANIFEST.MF1
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/DerivedViewLayerSynchronizer.java36
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/notifier/AbstractDerivedViewLayerNotifier.java2
-rw-r--r--extraplugins/layers/org.eclipse.papyrus.layers.ui/plugin.xml6
-rw-r--r--plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/BadArgumentExcetion.java79
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java32
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF1
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.di17
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.notation37
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.uml4
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java216
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java134
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java109
-rw-r--r--tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java62
25 files changed, 1279 insertions, 60 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.classpath b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.classpath
new file mode 100644
index 00000000000..561fae51867
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="test"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.project b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.project
new file mode 100644
index 00000000000..ecf82fb2afc
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.layers.integrationtests</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.settings/org.eclipse.jdt.core.prefs b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..54e493c07c9
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/META-INF/MANIFEST.MF b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..40a84844ace
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.layers.integrationtests
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: integrationtests.jar,
+ eclipse-43-R-modeling-kepler/eclipse/plugins/org.eclipse.gmf.runtime.notation_1.7.0.201306101425.jar
+Export-Package: org.eclipse.papyrus.layers.integrationtests
+Bundle-Vendor: %providerName
+Require-Bundle: org.eclipse.papyrus.layers.runtime;bundle-version="0.10.0",
+ org.eclipse.papyrus.layers.stackmodel;bundle-version="0.10.0",
+ org.junit,
+ org.eclipse.emf;bundle-version="2.6.0",
+ org.eclipse.emf.common;bundle-version="2.9.1",
+ org.eclipse.papyrus.integrationtests.editor,
+ org.eclipse.emf.ecore;bundle-version="2.10.0",
+ org.eclipse.papyrus.infra.core,
+ org.eclipse.papyrus.infra.gmfdiag.common
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/about.html b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/about.html
new file mode 100644
index 00000000000..d35d5aed64c
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/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>June 5, 2007</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 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</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/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/build.properties b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/build.properties
new file mode 100644
index 00000000000..84cb6c70e18
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/build.properties
@@ -0,0 +1,6 @@
+source.integrationtests.jar = src/,\
+ test/
+bin.includes = META-INF/,\
+ eclipse-43-R-modeling-kepler/eclipse/plugins/org.eclipse.gmf.runtime.notation_1.7.0.201306101425.jar,\
+ integrationtests.jar,\
+ models/
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.di b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.di
new file mode 100644
index 00000000000..40ea5f38492
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.di
@@ -0,0 +1,63 @@
+<?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:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmlns:org.eclipse.papyrus.layers.stackmodel.layers="org.eclipse.papyrus.layers.0.10">
+ <di:SashWindowsMngr>
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="modeltestReload.notation#_U7710H_HEeOcKbF7eArARg"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="modeltestReload.notation#_NIWn0IFTEeOzaYZM9B1O8A"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="modeltestReload.notation#_bmNYgIFTEeOzaYZM9B1O8A"/>
+ </availablePage>
+ <availablePage>
+ <emfPageIdentifier href="modeltestReload.notation#_FbHH8IFWEeOVd594nsh1bA"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="/0/@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="modeltestReload.notation#_U7710H_HEeOcKbF7eArARg"/>
+ </children>
+ <children>
+ <emfPageIdentifier href="modeltestReload.notation#_NIWn0IFTEeOzaYZM9B1O8A"/>
+ </children>
+ <children>
+ <emfPageIdentifier href="modeltestReload.notation#_bmNYgIFTEeOzaYZM9B1O8A"/>
+ </children>
+ <children>
+ <emfPageIdentifier href="modeltestReload.notation#_FbHH8IFWEeOVd594nsh1bA"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+ </di:SashWindowsMngr>
+ <org.eclipse.papyrus.layers.stackmodel.layers:LayersStackApplication>
+ <layersStacks>
+ <layers xsi:type="org.eclipse.papyrus.layers.stackmodel.layers:TopLayerOperator" application="/1" name="Top Layer" owningLayersStack="/1/@layersStacks.0">
+ <layers xsi:type="org.eclipse.papyrus.layers.stackmodel.layers:Layer" application="/1" name="layer0" owningLayersStack="/1/@layersStacks.0"/>
+ </layers>
+ <diagram href="modeltestReload.notation#_U7710H_HEeOcKbF7eArARg"/>
+ </layersStacks>
+ <layersStacks>
+ <layers xsi:type="org.eclipse.papyrus.layers.stackmodel.layers:TopLayerOperator" application="/1" name="Top Layer" owningLayersStack="/1/@layersStacks.1">
+ <layers xsi:type="org.eclipse.papyrus.layers.stackmodel.layers:RegExpLayer" application="/1" name="layer0" owningLayersStack="/1/@layersStacks.1"/>
+ </layers>
+ <diagram href="modeltestReload.notation#_NIWn0IFTEeOzaYZM9B1O8A"/>
+ </layersStacks>
+ <layersStacks>
+ <layers xsi:type="org.eclipse.papyrus.layers.stackmodel.layers:TopLayerOperator" application="/1" name="Top Layer" owningLayersStack="/1/@layersStacks.2">
+ <layers xsi:type="org.eclipse.papyrus.layers.stackmodel.layers:TopLayerOperator" application="/1" name="layer1"/>
+ </layers>
+ <diagram href="modeltestReload.notation#_bmNYgIFTEeOzaYZM9B1O8A"/>
+ </layersStacks>
+ <layersStacks>
+ <layers xsi:type="org.eclipse.papyrus.layers.stackmodel.layers:TopLayerOperator" application="/1" name="Top Layer" owningLayersStack="/1/@layersStacks.3">
+ <layers xsi:type="org.eclipse.papyrus.layers.stackmodel.layers:StackedLayerOperator" application="/1" name="layer0" owningLayersStack="/1/@layersStacks.3" layerOperatorDescriptorName="stackedLayersOperator"/>
+ </layers>
+ <diagram href="modeltestReload.notation#_FbHH8IFWEeOVd594nsh1bA"/>
+ </layersStacks>
+ </org.eclipse.papyrus.layers.stackmodel.layers:LayersStackApplication>
+</xmi:XMI>
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.notation b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.notation
new file mode 100644
index 00000000000..ee4d6a1ae9f
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.notation
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML">
+ <notation:Diagram xmi:id="_U7710H_HEeOcKbF7eArARg" type="PapyrusUMLClassDiagram" name="diagram1" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_V9uC8H_HEeOcKbF7eArARg" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_V9uC8n_HEeOcKbF7eArARg" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_V9uC83_HEeOcKbF7eArARg" type="7017">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_V9uDAn_HEeOcKbF7eArARg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_V9uDA3_HEeOcKbF7eArARg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_V9uC9H_HEeOcKbF7eArARg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_V9uC9X_HEeOcKbF7eArARg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_V9uC9n_HEeOcKbF7eArARg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_V9uC93_HEeOcKbF7eArARg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_V9uC-H_HEeOcKbF7eArARg" type="7018">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_V9uDBH_HEeOcKbF7eArARg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_V9uDBX_HEeOcKbF7eArARg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_V9uC-X_HEeOcKbF7eArARg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_V9uC-n_HEeOcKbF7eArARg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_V9uC-3_HEeOcKbF7eArARg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_V9uC_H_HEeOcKbF7eArARg"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_V9uC_X_HEeOcKbF7eArARg" type="7019">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_V9uDBn_HEeOcKbF7eArARg" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_V9uDB3_HEeOcKbF7eArARg" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_V9uC_n_HEeOcKbF7eArARg"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_V9uC_3_HEeOcKbF7eArARg"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_V9uDAH_HEeOcKbF7eArARg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_V9uDAX_HEeOcKbF7eArARg"/>
+ </children>
+ <element xmi:type="uml:Class" href="modeltestReload.uml#_V8q6EH_HEeOcKbF7eArARg"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_V9uC8X_HEeOcKbF7eArARg" x="134" y="136"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_U7710X_HEeOcKbF7eArARg"/>
+ <element xmi:type="uml:Model" href="modeltestReload.uml#_U7o64H_HEeOcKbF7eArARg"/>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_NIWn0IFTEeOzaYZM9B1O8A" type="PapyrusUMLClassDiagram" name="diagram2" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_N6z_gIFTEeOzaYZM9B1O8A" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_N6z_goFTEeOzaYZM9B1O8A" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_N6z_g4FTEeOzaYZM9B1O8A" type="7017">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_N66GIIFTEeOzaYZM9B1O8A" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_N66GIYFTEeOzaYZM9B1O8A" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_N6z_hIFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_N6z_hYFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_N6z_hoFTEeOzaYZM9B1O8A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_N6z_h4FTEeOzaYZM9B1O8A"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_N6z_iIFTEeOzaYZM9B1O8A" type="7018">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_N66GIoFTEeOzaYZM9B1O8A" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_N66GI4FTEeOzaYZM9B1O8A" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_N6z_iYFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_N6z_ioFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_N6z_i4FTEeOzaYZM9B1O8A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_N6z_jIFTEeOzaYZM9B1O8A"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_N6z_jYFTEeOzaYZM9B1O8A" type="7019">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_N66GJIFTEeOzaYZM9B1O8A" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_N66GJYFTEeOzaYZM9B1O8A" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_N6z_joFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_N6z_j4FTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_N6z_kIFTEeOzaYZM9B1O8A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_N6z_kYFTEeOzaYZM9B1O8A"/>
+ </children>
+ <element xmi:type="uml:Class" href="modeltestReload.uml#_N6blAIFTEeOzaYZM9B1O8A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_N6z_gYFTEeOzaYZM9B1O8A" x="230" y="134"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_NIWn0YFTEeOzaYZM9B1O8A"/>
+ <element xmi:type="uml:Model" href="modeltestReload.uml#_U7o64H_HEeOcKbF7eArARg"/>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_bmNYgIFTEeOzaYZM9B1O8A" type="PapyrusUMLClassDiagram" name="diagram3" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_cBNScIFTEeOzaYZM9B1O8A" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_cBNScoFTEeOzaYZM9B1O8A" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cBNSc4FTEeOzaYZM9B1O8A" type="7017">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_cBNSgoFTEeOzaYZM9B1O8A" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cBNSg4FTEeOzaYZM9B1O8A" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cBNSdIFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_cBNSdYFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_cBNSdoFTEeOzaYZM9B1O8A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cBNSd4FTEeOzaYZM9B1O8A"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cBNSeIFTEeOzaYZM9B1O8A" type="7018">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_cBNShIFTEeOzaYZM9B1O8A" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cBNShYFTEeOzaYZM9B1O8A" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cBNSeYFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_cBNSeoFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_cBNSe4FTEeOzaYZM9B1O8A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cBNSfIFTEeOzaYZM9B1O8A"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_cBNSfYFTEeOzaYZM9B1O8A" type="7019">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_cBNShoFTEeOzaYZM9B1O8A" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_cBNSh4FTEeOzaYZM9B1O8A" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_cBNSfoFTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_cBNSf4FTEeOzaYZM9B1O8A"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_cBNSgIFTEeOzaYZM9B1O8A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cBNSgYFTEeOzaYZM9B1O8A"/>
+ </children>
+ <element xmi:type="uml:Class" href="modeltestReload.uml#_cBHL0IFTEeOzaYZM9B1O8A"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_cBNScYFTEeOzaYZM9B1O8A" x="233" y="186"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_bmNYgYFTEeOzaYZM9B1O8A"/>
+ <element xmi:type="uml:Model" href="modeltestReload.uml#_U7o64H_HEeOcKbF7eArARg"/>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_FbHH8IFWEeOVd594nsh1bA" type="PapyrusUMLClassDiagram" name="diagram4" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_GXaYIIFWEeOVd594nsh1bA" type="2008">
+ <children xmi:type="notation:DecorationNode" xmi:id="_GXaYIoFWEeOVd594nsh1bA" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_GXaYI4FWEeOVd594nsh1bA" type="7017">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_GXaYMoFWEeOVd594nsh1bA" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_GXaYM4FWEeOVd594nsh1bA" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_GXaYJIFWEeOVd594nsh1bA"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_GXaYJYFWEeOVd594nsh1bA"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_GXaYJoFWEeOVd594nsh1bA"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GXaYJ4FWEeOVd594nsh1bA"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_GXaYKIFWEeOVd594nsh1bA" type="7018">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_GXaYNIFWEeOVd594nsh1bA" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_GXaYNYFWEeOVd594nsh1bA" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_GXaYKYFWEeOVd594nsh1bA"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_GXaYKoFWEeOVd594nsh1bA"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_GXaYK4FWEeOVd594nsh1bA"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GXaYLIFWEeOVd594nsh1bA"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_GXaYLYFWEeOVd594nsh1bA" type="7019">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_GXaYNoFWEeOVd594nsh1bA" source="PapyrusCSSForceValue">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_GXaYN4FWEeOVd594nsh1bA" key="showTitle" value="true"/>
+ </eAnnotations>
+ <styles xmi:type="notation:TitleStyle" xmi:id="_GXaYLoFWEeOVd594nsh1bA"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_GXaYL4FWEeOVd594nsh1bA"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_GXaYMIFWEeOVd594nsh1bA"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GXaYMYFWEeOVd594nsh1bA"/>
+ </children>
+ <element xmi:type="uml:Class" href="modeltestReload.uml#_GXB9oIFWEeOVd594nsh1bA"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_GXaYIYFWEeOVd594nsh1bA" x="314" y="98"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_FbHH8YFWEeOVd594nsh1bA"/>
+ <element xmi:type="uml:Model" href="modeltestReload.uml#_U7o64H_HEeOcKbF7eArARg"/>
+ </notation:Diagram>
+</xmi:XMI>
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.uml b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.uml
new file mode 100644
index 00000000000..6229e12ea71
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/models/modeltestReload.uml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_U7o64H_HEeOcKbF7eArARg" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_V8q6EH_HEeOcKbF7eArARg" name="Class1"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_N6blAIFTEeOzaYZM9B1O8A" name="Class2"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_cBHL0IFTEeOzaYZM9B1O8A" name="Class3"/>
+ <packagedElement xmi:type="uml:Class" xmi:id="_GXB9oIFWEeOVd594nsh1bA" name="Class4"/>
+</uml:Model>
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/plugin.properties b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/plugin.properties
new file mode 100644
index 00000000000..c2ffb7cbb40
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/plugin.properties
@@ -0,0 +1,12 @@
+#################################################################################
+# Copyright (c) 2014 CEA LIST.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+##################################################################################
+pluginName=Layers Integration Tests (Incubation)
+providerName=Eclipse Modeling Project
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/src/org/eclipse/papyrus/layers/integrationtests/LayersStateAfterReloadTest.java b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/src/org/eclipse/papyrus/layers/integrationtests/LayersStateAfterReloadTest.java
new file mode 100644
index 00000000000..3f7512616af
--- /dev/null
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/src/org/eclipse/papyrus/layers/integrationtests/LayersStateAfterReloadTest.java
@@ -0,0 +1,275 @@
+/*****************************************************************************
+ * Copyright (c) 2014 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.layers.integrationtests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.papyrus.infra.core.resource.BadArgumentExcetion;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
+import org.eclipse.papyrus.integrationtests.editor.DiagramCreator;
+import org.eclipse.papyrus.integrationtests.editor.EclipseProject;
+import org.eclipse.papyrus.integrationtests.editor.ExecutionException;
+import org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor;
+import org.eclipse.papyrus.layers.runtime.model.LayersModel;
+import org.eclipse.papyrus.layers.stackmodel.LayersException;
+import org.eclipse.papyrus.layers.stackmodel.layers.AbstractLayerOperator;
+import org.eclipse.papyrus.layers.stackmodel.layers.Layer;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperator;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerOperatorDescriptor;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayerState;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersContainer;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactory;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersFactoryForStack;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersStack;
+import org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication;
+import org.eclipse.papyrus.layers.stackmodel.layers.RegExpLayer;
+import org.eclipse.papyrus.layers.stackmodel.layers.StackedLayerOperator;
+import org.eclipse.papyrus.layers.stackmodel.layers.TopLayerOperator;
+import org.eclipse.papyrus.layers.stackmodel.layers.impl.LayersFactoryForStackImpl;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+/**
+ * Tests checking the states of the layers after a reload of the model.
+ * The state should normally be "ATTACHED".
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class LayersStateAfterReloadTest {
+
+ /**
+ * Name of the plugin that is created.
+ */
+ final protected String PLUGIN_PROJECT_NAME = "org.eclipse.papyrus.layers.integrationtests.tests";
+
+ /**
+ * Name of the bundle containing resources to copied.
+ */
+ final protected String BUNDLE_NAME = "org.eclipse.papyrus.layers.integrationtests";
+
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayersFactoryForStackImpl#createLayer(org.eclipse.papyrus.layers.stackmodel.layers.LayersContainer, org.eclipse.papyrus.layers.stackmodel.layers.LayersStack, org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication)}.
+ * @throws LayersException
+ * @throws ServiceException
+ * @throws BadArgumentExcetion
+ * @throws NotFoundException
+ * @throws ExecutionException
+ */
+ @Test
+ public void testReloadLayer() throws LayersException, ServiceException, NotFoundException, BadArgumentExcetion, ExecutionException {
+ // Create requested objects
+ // Create Editor
+ String modelName = "models/modeltestReload";
+ String diagramName = "diagram1";
+
+
+ EclipseProject eclipseProject = new EclipseProject(PLUGIN_PROJECT_NAME);
+ eclipseProject.copyResources(BUNDLE_NAME, modelName+".di", modelName+".notation", modelName+".uml" );
+
+ ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor(eclipseProject, modelName);
+ DiagramCreator diagramCreator = new DiagramCreator(editorHandler);
+
+
+ // Get the diagram:
+ // First the ModelSet, then the NotationModel, then the diagram by its name
+ ModelSet modelSet = editorHandler.getServiceRegistry().getService(ModelSet.class);
+ NotationModel notationModel = NotationUtils.getNotationModel(modelSet);
+ Diagram diagram = notationModel.getDiagram(diagramName );
+
+ // Get the LayerStack for the Layer
+ LayersModel layersModel = (LayersModel)modelSet.getModel(LayersModel.MODEL_ID);
+ LayersStackApplication application = layersModel.getLayerStackApplication();
+ LayersStack owningStack = application.lookupLayersStackFor(diagram);
+
+ // Recover tree
+ TopLayerOperator rootLayer = (TopLayerOperator)owningStack.getLayers();
+ Layer layer1 = (Layer)rootLayer.getLayers().get(0);
+
+ // Assert
+ assertNotNull("stack found in diagram", owningStack);
+ assertSame("state attached", LayerState.ATTACHED, owningStack.getState() );
+
+ assertNotNull("Layer created", layer1);
+ assertSame("state attached", LayerState.ATTACHED, layer1.getState() );
+ assertSame("application set", application, layer1.getApplication() );
+ assertSame("owningStack set", owningStack, layer1.getOwningLayersStack() );
+ assertSame("parent set", rootLayer, layer1.eContainer() );
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayersFactoryForStackImpl#createRegExpLayer(org.eclipse.papyrus.layers.stackmodel.layers.LayersContainer, org.eclipse.papyrus.layers.stackmodel.layers.LayersStack, org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication)}.
+ * @throws LayersException
+ * @throws ExecutionException
+ * @throws ServiceException
+ * @throws BadArgumentExcetion
+ * @throws NotFoundException
+ */
+ @Test
+ public void testReloadRegExpLayer() throws LayersException, ExecutionException, ServiceException, NotFoundException, BadArgumentExcetion {
+ // Create requested objects
+ // Create Editor
+ String modelName = "models/modeltestReload";
+ String diagramName = "diagram2";
+
+
+ EclipseProject eclipseProject = new EclipseProject(PLUGIN_PROJECT_NAME);
+ eclipseProject.copyResources(BUNDLE_NAME, modelName+".di", modelName+".notation", modelName+".uml" );
+
+ ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor(eclipseProject, modelName);
+
+ // Get the diagram:
+ // First the ModelSet, then the NotationModel, then the diagram by its name
+ ModelSet modelSet = editorHandler.getServiceRegistry().getService(ModelSet.class);
+ NotationModel notationModel = NotationUtils.getNotationModel(modelSet);
+ Diagram diagram = notationModel.getDiagram(diagramName );
+
+ // Get the LayerStack for the Layer
+ LayersModel layersModel = (LayersModel)modelSet.getModel(LayersModel.MODEL_ID);
+ LayersStackApplication application = layersModel.getLayerStackApplication();
+ LayersStack owningStack = application.lookupLayersStackFor(diagram);
+
+ // Recover tree
+ TopLayerOperator rootLayer = (TopLayerOperator)owningStack.getLayers();
+ RegExpLayer layer1 = (RegExpLayer)rootLayer.getLayers().get(0);
+
+ // asserts
+ assertNotNull("Layer created", layer1);
+ assertSame("state attached", LayerState.ATTACHED, layer1.getState() );
+ assertSame("application set", application, layer1.getApplication() );
+ assertSame("owningStack set", owningStack, layer1.getOwningLayersStack() );
+ assertSame("parent set", rootLayer, layer1.eContainer() );
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayersFactoryForStackImpl#createTopLayerOperator(org.eclipse.papyrus.layers.stackmodel.layers.LayersContainer, org.eclipse.papyrus.layers.stackmodel.layers.LayersStack, org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication)}.
+ * @throws LayersException
+ * @throws ServiceException
+ * @throws ExecutionException
+ * @throws BadArgumentExcetion
+ * @throws NotFoundException
+ */
+ @Test
+ public void testReloadTopLayerOperator() throws LayersException, ServiceException, ExecutionException, NotFoundException, BadArgumentExcetion {
+ // Create requested objects
+ // Create Editor
+ String modelName = "models/modeltestReload";
+ String diagramName = "diagram3";
+
+
+ EclipseProject eclipseProject = new EclipseProject(PLUGIN_PROJECT_NAME);
+ eclipseProject.copyResources(BUNDLE_NAME, modelName+".di", modelName+".notation", modelName+".uml" );
+
+ ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor(eclipseProject, modelName);
+
+ // Get the diagram:
+ // First the ModelSet, then the NotationModel, then the diagram by its name
+ ModelSet modelSet = editorHandler.getServiceRegistry().getService(ModelSet.class);
+ NotationModel notationModel = NotationUtils.getNotationModel(modelSet);
+ Diagram diagram = notationModel.getDiagram(diagramName );
+
+ // Get the LayerStack for the Layer
+ LayersModel layersModel = (LayersModel)modelSet.getModel(LayersModel.MODEL_ID);
+ LayersStackApplication application = layersModel.getLayerStackApplication();
+ LayersStack owningStack = application.lookupLayersStackFor(diagram);
+
+ // Recover tree
+ TopLayerOperator rootLayer = (TopLayerOperator)owningStack.getLayers();
+ TopLayerOperator layer1 = (TopLayerOperator)rootLayer.getLayers().get(0);
+
+ // asserts
+ assertNotNull("Layer created", layer1);
+ assertSame("state attached", LayerState.ATTACHED, layer1.getState() );
+ assertSame("application set", application, layer1.getApplication() );
+ assertSame("owningStack set", owningStack, layer1.getOwningLayersStack() );
+ assertSame("parent set", rootLayer, layer1.eContainer() );
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.layers.stackmodel.layers.impl.LayersFactoryForStackImpl#createStackedLayerOperator(org.eclipse.papyrus.layers.stackmodel.layers.LayersContainer, org.eclipse.papyrus.layers.stackmodel.layers.LayersStack, org.eclipse.papyrus.layers.stackmodel.layers.LayersStackApplication)}.
+ * @throws LayersException
+ * @throws ExecutionException
+ * @throws ServiceException
+ * @throws BadArgumentExcetion
+ * @throws NotFoundException
+ */
+ @Test
+ public void testCreateStackedLayerOperator() throws LayersException, ExecutionException, ServiceException, NotFoundException, BadArgumentExcetion {
+ // Create requested objects
+ // Create Editor
+ String modelName = "models/modeltestReload";
+ String diagramName = "diagram4";
+
+
+ EclipseProject eclipseProject = new EclipseProject(PLUGIN_PROJECT_NAME);
+ eclipseProject.copyResources(BUNDLE_NAME, modelName+".di", modelName+".notation", modelName+".uml" );
+
+ ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor(eclipseProject, modelName);
+
+ // Get the diagram:
+ // First the ModelSet, then the NotationModel, then the diagram by its name
+ ModelSet modelSet = editorHandler.getServiceRegistry().getService(ModelSet.class);
+ NotationModel notationModel = NotationUtils.getNotationModel(modelSet);
+ Diagram diagram = notationModel.getDiagram(diagramName );
+
+ // Get the LayerStack for the Layer
+ LayersModel layersModel = (LayersModel)modelSet.getModel(LayersModel.MODEL_ID);
+ LayersStackApplication application = layersModel.getLayerStackApplication();
+ LayersStack owningStack = application.lookupLayersStackFor(diagram);
+
+ // Recover tree
+ TopLayerOperator rootLayer = (TopLayerOperator)owningStack.getLayers();
+ StackedLayerOperator layer1 = (StackedLayerOperator)rootLayer.getLayers().get(0);
+
+ // asserts
+ assertNotNull("Layer created", layer1);
+ assertSame("state attached", LayerState.ATTACHED, layer1.getState() );
+ assertSame("application set", application, layer1.getApplication() );
+ assertSame("owningStack set", owningStack, layer1.getOwningLayersStack() );
+ assertSame("parent set", rootLayer, layer1.eContainer() );
+ }
+
+
+}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.runtime/META-INF/MANIFEST.MF b/extraplugins/layers/org.eclipse.papyrus.layers.runtime/META-INF/MANIFEST.MF
index 279aeeab522..138acc74bcd 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.runtime/META-INF/MANIFEST.MF
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.runtime/META-INF/MANIFEST.MF
@@ -17,4 +17,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.layers.runtime,
org.eclipse.papyrus.layers.runtime.model,
+ org.eclipse.papyrus.layers.runtime.service,
org.eclipse.papyrus.layers.runtime.utils
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/DerivedViewLayerSynchronizer.java b/extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/DerivedViewLayerSynchronizer.java
index 7956d700ae6..db5bd1e3124 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/DerivedViewLayerSynchronizer.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/DerivedViewLayerSynchronizer.java
@@ -165,8 +165,8 @@ public class DerivedViewLayerSynchronizer {
// TODO implements this:
// with a visitor ?
// with getAllContents ?
- EcoreUtil.getObjectsByType(layersStack.e, type)
- getLayersStack().
+// EcoreUtil.getObjectsByType(layersStack.e, type)
+// getLayersStack().
// TODO Auto-generated method stub
return null;
}
@@ -178,22 +178,22 @@ public class DerivedViewLayerSynchronizer {
*/
private void registerDerivedLayer(RegExpLayer layer) {
- if(layer.isAnyDomainChangedEventDependant() ) {
- if( layer.domainChangedEventLevel == 1) {
- domainChangedLevel1Notifier.addListener(layer);
- } else {
- // All level
- domainChangedAllLevelNotifier.addListener(layer);
- }
- }
- if(layer.isAnyDiagramChangedEventDependant() ) {
- if( layer.diagramChangedEventLevel == 1) {
- diagramChangedLevel1Notifier.addListener(layer);
- } else {
- // All level
- diagramChangedAllLevelNotifier.addListener(layer);
- }
- }
+// if(layer.isAnyDomainChangedEventDependant() ) {
+// if( layer.domainChangedEventLevel == 1) {
+// domainChangedLevel1Notifier.addListener(layer);
+// } else {
+// // All level
+// domainChangedAllLevelNotifier.addListener(layer);
+// }
+// }
+// if(layer.isAnyDiagramChangedEventDependant() ) {
+// if( layer.diagramChangedEventLevel == 1) {
+// diagramChangedLevel1Notifier.addListener(layer);
+// } else {
+// // All level
+// diagramChangedAllLevelNotifier.addListener(layer);
+// }
+// }
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/notifier/AbstractDerivedViewLayerNotifier.java b/extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/notifier/AbstractDerivedViewLayerNotifier.java
index fcc5e54754c..a71a7afb2c0 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/notifier/AbstractDerivedViewLayerNotifier.java
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.runtime/src/org/eclipse/papyrus/layers/runtime/notifier/AbstractDerivedViewLayerNotifier.java
@@ -103,7 +103,7 @@ public abstract class AbstractDerivedViewLayerNotifier {
*/
public void fireEvent( ) {
for( RegExpLayer listener : listeners) {
- listener.evaluateExpr();
+// listener.evaluateExpr();
}
}
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.ui/plugin.xml b/extraplugins/layers/org.eclipse.papyrus.layers.ui/plugin.xml
index 7ab5faeace5..dcb592311f6 100644
--- a/extraplugins/layers/org.eclipse.papyrus.layers.ui/plugin.xml
+++ b/extraplugins/layers/org.eclipse.papyrus.layers.ui/plugin.xml
@@ -216,6 +216,12 @@
</parameter>
</command>
<command
+ commandId="org.eclipse.papyrus.layers.ui.commands.createtoplayeroperator"
+ label="Create Top Layers"
+ style="push"
+ tooltip="Create a new Top Layers Operator">
+ </command>
+ <command
commandId="org.eclipse.papyrus.layers.ui.commands.createLayerOperator"
label="Create Minimum Stacked Layers"
style="push"
diff --git a/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/BadArgumentExcetion.java b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/BadArgumentExcetion.java
new file mode 100644
index 00000000000..d866e0d7176
--- /dev/null
+++ b/plugins/infra/core/org.eclipse.papyrus.infra.core/src/org/eclipse/papyrus/infra/core/resource/BadArgumentExcetion.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * Copyright (c) 2014 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.core.resource;
+
+
+/**
+ * Exception thrown when an argument is invalid.
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class BadArgumentExcetion extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor.
+ *
+ */
+ public BadArgumentExcetion() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ */
+ public BadArgumentExcetion(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param cause
+ */
+ public BadArgumentExcetion(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * @param cause
+ */
+ public BadArgumentExcetion(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param message
+ * @param cause
+ * @param enableSuppression
+ * @param writableStackTrace
+ */
+ public BadArgumentExcetion(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+}
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java
index bf4c1426cf2..9ded7d4ec8a 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/model/NotationModel.java
@@ -3,9 +3,12 @@
*/
package org.eclipse.papyrus.infra.gmfdiag.common.model;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
+import org.eclipse.papyrus.infra.core.resource.BadArgumentExcetion;
import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
/**
* @author dumoulin
@@ -65,4 +68,33 @@ public class NotationModel extends AbstractBaseModel implements IModel {
public void addDiagram(Diagram newDiagram) {
getResource().getContents().add(newDiagram);
}
+
+ /**
+ * Get a diagram by its name.
+ *
+ * @param diagramName Name of the diagram. This is the name set by the user.
+ * @return
+ * @throws NotFoundException
+ * @throws BadArgumentExcetion
+ */
+ public Diagram getDiagram(String diagramName) throws NotFoundException, BadArgumentExcetion {
+
+ if( diagramName == null || diagramName.length() == 0) {
+ throw new BadArgumentExcetion("Diagram name should not be null and size should be >0.");
+ }
+
+ for( EObject element : getResource().getContents()) {
+ if( element instanceof Diagram) {
+ Diagram diagram = (Diagram)element;
+
+ if( diagramName.equals(diagram.getName())) {
+ // Found
+ return diagram;
+
+ }
+ }
+ }
+ // not found
+ throw new NotFoundException("No Diagram named '" + diagramName + "' can be found in Model.");
+ }
}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF
index f848ee13106..2fa9f53fae9 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/META-INF/MANIFEST.MF
@@ -24,4 +24,5 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %providerName
+Export-Package: org.eclipse.papyrus.integrationtests.editor
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.di b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.di
new file mode 100644
index 00000000000..3628d4d1db8
--- /dev/null
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.di
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi">
+ <pageList>
+ <availablePage>
+ <emfPageIdentifier href="modelTestLoadModel.notation#_cW2QoH71EeOkT5h268q24w"/>
+ </availablePage>
+ </pageList>
+ <sashModel currentSelection="//@sashModel/@windows.0/@children.0">
+ <windows>
+ <children xsi:type="di:TabFolder">
+ <children>
+ <emfPageIdentifier href="modelTestLoadModel.notation#_cW2QoH71EeOkT5h268q24w"/>
+ </children>
+ </children>
+ </windows>
+ </sashModel>
+</di:SashWindowsMngr>
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.notation b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.notation
new file mode 100644
index 00000000000..856d89e4d76
--- /dev/null
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.notation
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_cW2QoH71EeOkT5h268q24w" type="PapyrusUMLClassDiagram" name="diagram1" measurementUnit="Pixel">
+ <children xmi:type="notation:Shape" xmi:id="_c9YsMH71EeOkT5h268q24w" type="2008" fontName="Segoe UI" lineColor="0">
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c9YsMn71EeOkT5h268q24w" source="ShadowFigure">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_c9YsM371EeOkT5h268q24w" key="ShadowFigure_Value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c9YsNH71EeOkT5h268q24w" source="displayNameLabelIcon">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_c9YsNX71EeOkT5h268q24w" key="displayNameLabelIcon_value" value="false"/>
+ </eAnnotations>
+ <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_c9YsNn71EeOkT5h268q24w" source="QualifiedName">
+ <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_c9YsN371EeOkT5h268q24w" key="QualifiedNameDepth" value="1000"/>
+ </eAnnotations>
+ <children xmi:type="notation:DecorationNode" xmi:id="_c9YsOH71EeOkT5h268q24w" type="5029"/>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_c9YsOX71EeOkT5h268q24w" type="7017">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_c9YsOn71EeOkT5h268q24w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_c9YsO371EeOkT5h268q24w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_c9YsPH71EeOkT5h268q24w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_c9YsPX71EeOkT5h268q24w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_c9YsPn71EeOkT5h268q24w" type="7018">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_c9YsP371EeOkT5h268q24w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_c9YsQH71EeOkT5h268q24w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_c9YsQX71EeOkT5h268q24w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_c9YsQn71EeOkT5h268q24w"/>
+ </children>
+ <children xmi:type="notation:BasicCompartment" xmi:id="_c9YsQ371EeOkT5h268q24w" type="7019">
+ <styles xmi:type="notation:TitleStyle" xmi:id="_c9YsRH71EeOkT5h268q24w"/>
+ <styles xmi:type="notation:SortingStyle" xmi:id="_c9YsRX71EeOkT5h268q24w"/>
+ <styles xmi:type="notation:FilteringStyle" xmi:id="_c9YsRn71EeOkT5h268q24w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_c9YsR371EeOkT5h268q24w"/>
+ </children>
+ <element xmi:type="uml:Class" href="modelTestLoadModel.uml#_c8pFUH71EeOkT5h268q24w"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_c9YsMX71EeOkT5h268q24w" x="156" y="167"/>
+ </children>
+ <styles xmi:type="notation:DiagramStyle" xmi:id="_cW2QoX71EeOkT5h268q24w"/>
+ <element xmi:type="uml:Model" href="modelTestLoadModel.uml#_cWjVsH71EeOkT5h268q24w"/>
+</notation:Diagram>
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.uml b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.uml
new file mode 100644
index 00000000000..a0c1c0d789b
--- /dev/null
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/models/modelTestLoadModel.uml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20110701" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:id="_cWjVsH71EeOkT5h268q24w" name="model">
+ <packagedElement xmi:type="uml:Class" xmi:id="_c8pFUH71EeOkT5h268q24w" name="Class1"/>
+</uml:Model>
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java
new file mode 100644
index 00000000000..1dcf703c148
--- /dev/null
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/EclipseProject.java
@@ -0,0 +1,216 @@
+/*****************************************************************************
+ * Copyright (c) 2014 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.integrationtests.editor;
+
+import java.net.URL;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+
+
+/**
+ * This class allows to create or load an Eclipse Project.
+ * This is the projects found in the project explorer.
+ * This class is mainly used in tests.
+ *
+ * @author cedric dumoulin
+ *
+ */
+public class EclipseProject {
+
+ /**
+ * The underlying Eclipse project.
+ *
+ */
+ protected IProject project;
+
+ protected IProgressMonitor monitor = new NullProgressMonitor();
+
+ /**
+ * Constructor.
+ * Create or load the specified project.
+ * @throws ExecutionException
+ */
+ public EclipseProject( String projectName ) throws ExecutionException {
+ // Create the project
+ initProject(projectName);
+ }
+
+ /**
+ * Create or load the project.
+ *
+ * @param projectName
+ * @throws ExecutionException
+ */
+ protected void initProject(String projectName ) throws ExecutionException {
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+
+ if( project == null) {
+ throw new ExecutionException("Can't get project '" + projectName + "' from workspace.");
+ }
+
+ if(project != null && !project.exists()) {
+// IProgressMonitor monitor = new NullProgressMonitor();
+ try {
+ project.create(monitor);
+ } catch (CoreException e) {
+ throw new ExecutionException("Can't create project '" + projectName + "'.", e);
+ }
+ }
+
+ if(!project.isOpen()) {
+ try {
+ project.open(null);
+ } catch (CoreException e) {
+ throw new ExecutionException("Can't open project '" + projectName + "'.", e);
+ }
+ }
+
+
+
+ }
+
+
+ /**
+ * @return the project
+ */
+ public IProject getProject() {
+ return project;
+ }
+
+ /**
+ *
+ * @param fromBundle
+ * @param fromResourceName
+ * @param toResourceName
+ * @return
+ * @throws ExecutionException
+ */
+ public IFile copyResource( String fromBundle, String fromResourceName, String toResourceName) throws ExecutionException {
+
+ try {
+ Path toURL = new Path(toResourceName);
+ System.out.println(toURL);
+
+ IFile file = project.getFile(toResourceName);
+ // link all the models resources
+ if(!file.exists()) {
+ // Create intermediate folders
+ ensureFolders(file);
+
+ URL url = FileLocator.find(Platform.getBundle(fromBundle), new Path(fromResourceName), null);
+ URL newFile = FileLocator.resolve(url);
+
+ // encode the URI for spaces in the path
+ // And then create a link to the file
+ file.createLink(new URL(newFile.toString().replaceAll(" ", "%20")).toURI(), IResource.REPLACE, monitor);
+ }
+ return file;
+ } catch (Exception e) {
+ throw new ExecutionException("Can't copy resource '" + toResourceName + "'.", e);
+ }
+ }
+
+ /**
+ * Copy the specified resource from the specified bundle to this project.
+ * Use the same path in src and target.
+ *
+ * @param fromBundle
+ * @param fromResourceName
+ * @return
+ * @throws ExecutionException
+ */
+ public IFile copyResource( String fromBundle, String fromResourceName) throws ExecutionException {
+
+ return copyResource(fromBundle, fromResourceName, fromResourceName);
+ }
+
+ /**
+ *
+ * @param fromBundle
+ * @param fromResourceNames
+ * @throws ExecutionException
+ */
+ public void copyResources(String fromBundle, String ...fromResourceNames) throws ExecutionException {
+
+ for(String fromResourceName : fromResourceNames) {
+ copyResource(fromBundle, fromResourceName);
+ }
+ }
+
+ /**
+ * Ensure that the intermediates folders exist in the project.
+ *
+ * @param project
+ * @param name
+ * @throws CoreException
+ */
+ protected void ensureFolders(IFile file) throws CoreException {
+
+ IPath path = file.getProjectRelativePath();
+ IPath folderPath = path.removeLastSegments(1);
+
+ String[] segments = folderPath.segments();
+
+ for( int i = segments.length-1; i>=0; i--) {
+ IPath curFolderPath = folderPath.removeLastSegments(i);
+ createFolder(curFolderPath);
+ }
+
+
+ }
+
+ /**
+ *
+ * @param folderPath
+ * @throws CoreException
+ */
+ private void createFolder(IPath folderPath) throws CoreException {
+ IFolder parent = project.getFolder(folderPath);
+ if(!parent.exists()) {
+ parent.create(true, true, monitor);
+ }
+ assert (parent.exists()); }
+
+ /**
+ * Creates all the folders that are needed to contains the resource.
+ *
+ * @param modelName
+ * @throws ExecutionException
+ */
+ public void createFolders(String modelName) throws ExecutionException {
+ try {
+ IFile file = project.getFile(modelName);
+ // link all the models resources
+ if(!file.exists()) {
+ // Create intermediate folders
+ ensureFolders(file);
+ }
+ } catch (CoreException e) {
+ throw new ExecutionException("Can't create intermediate folders for '" + modelName + ". ", e);
+ }
+ }
+
+}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java
index a80da31ea8a..fdb5e5ca498 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/src/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditor.java
@@ -19,10 +19,6 @@ import java.io.IOException;
import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
@@ -50,13 +46,13 @@ import org.eclipse.ui.part.FileEditorInput;
*/
public class ProgramaticPapyrusEditor {
- protected static final String DEFAULT_PROJECT_NAME = "org.eclipse.org.infra.core.defaultproject.integration";
+ protected static final String DEFAULT_PROJECT_NAME = "org.eclipse.papyrus.integrationtests.editor";
protected static final String DEFAULT_MODEL_NAME = "papyrusModelForIntegration";
/**
* Name of the project that will contains Model
*/
- protected String projectName = DEFAULT_PROJECT_NAME;
+// protected String projectName = DEFAULT_PROJECT_NAME;
/**
* Name of the model to create.
@@ -67,7 +63,7 @@ public class ProgramaticPapyrusEditor {
// protected ModelSet modelSet;
/** The file. */
- protected IFile file;
+// protected IFile file;
/** The page. */
protected IWorkbenchPage page;
@@ -76,10 +72,16 @@ public class ProgramaticPapyrusEditor {
protected IMultiDiagramEditor papyrusEditor;
/** The project. */
- protected IProject project;
+// protected IProject project;
+
+ /**
+ * An object representing an EclipseProject.
+ */
+ protected EclipseProject eclipseProject;
+
/** The root. */
- protected IWorkspaceRoot root;
+// protected IWorkspaceRoot root;
/**
@@ -89,10 +91,35 @@ public class ProgramaticPapyrusEditor {
* @param modelName
* @throws EditorCreationException If the creation fails.
*/
- public ProgramaticPapyrusEditor(String projectName, String modelName) throws EditorCreationException {
- this.projectName = projectName;
+ public ProgramaticPapyrusEditor(String projectName, String modelName) throws ExecutionException {
+ this.modelName = modelName;
+
+ // Create an Eclipse project
+ eclipseProject = new EclipseProject(projectName);
+ // Create a suitable EclipseProject
+ initResources(false);
+
+ // Create editor
+ createEditor();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param projectName
+ * @param modelName
+ * @throws EditorCreationException If the creation fails.
+ */
+ public ProgramaticPapyrusEditor(EclipseProject eclipseProject, String modelName) throws ExecutionException {
this.modelName = modelName;
+ if( eclipseProject == null ) {
+ throw new ExecutionException("The argument 'EclipseProject' should be initialized.");
+ }
+ this.eclipseProject = eclipseProject;
+ // Create a suitable EclipseProject
+ initResources(false);
+
// Create editor
createEditor();
}
@@ -104,13 +131,48 @@ public class ProgramaticPapyrusEditor {
* @throws EditorCreationException If the creation fails.
*
*/
- public ProgramaticPapyrusEditor() throws EditorCreationException {
+ public ProgramaticPapyrusEditor() throws ExecutionException {
+
+ // Create an Eclipse project
+ eclipseProject = new EclipseProject(DEFAULT_PROJECT_NAME);
+ // Create a suitable EclipseProject
+ initResources(true);
+
// Create editor
createEditor();
}
/**
+ * Init the resources.
+ * The {@link #eclipseProject} should be initialized.
+ *
+ * @throws ExecutionException
+ * @throws CoreException
+ * @throws IOException
+ */
+ private void initResources(boolean deleteFileIfExists) throws ExecutionException {
+ try {
+ // Ensure path to specified resource
+ eclipseProject.createFolders(modelName);
+
+ // delete existing files, and then create a new model
+ IFile file = eclipseProject.getProject().getFile(modelName + ".di");
+ if(deleteFileIfExists && file.exists()) {
+ file.delete(true, new NullProgressMonitor());
+ }
+
+ if(!file.exists()) {
+ // Create the model
+ createModel(file);
+ }
+ } catch (Exception e) {
+ throw new ExecutionException("Can't init Project and Resources" , e );
+ }
+ }
+
+
+ /**
* Create a model suitable for Papyrus uml.
* Save it in the provided file.
* @param file
@@ -141,29 +203,29 @@ public class ProgramaticPapyrusEditor {
* @throws EditorCreationException
*/
protected IMultiDiagramEditor createEditor() throws EditorCreationException {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- root = workspace.getRoot();
- project = root.getProject(projectName);
- file = project.getFile(modelName + ".di");
+// IWorkspace workspace = ResourcesPlugin.getWorkspace();
+// root = workspace.getRoot();
+// project = root.getProject(projectName);
+ IFile file = eclipseProject.getProject().getFile(modelName + ".di");
try {
- //at this point, no resources have been created
- if(!project.exists()) {
- project.create(null);
- }
- if(!project.isOpen()) {
- project.open(null);
- }
-
- if(file.exists()) {
- file.delete(true, new NullProgressMonitor());
- }
-
- if(!file.exists()) {
- // Create the model
- createModel(file);
- }
-
+// //at this point, no resources have been created
+// if(!project.exists()) {
+// project.create(null);
+// }
+// if(!project.isOpen()) {
+// project.open(null);
+// }
+//
+// if(file.exists()) {
+// file.delete(true, new NullProgressMonitor());
+// }
+//
+// if(!file.exists()) {
+// // Create the model
+// createModel(file);
+// }
+//
// Create the editor
page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
@@ -174,8 +236,8 @@ public class ProgramaticPapyrusEditor {
throw new EditorCreationException("Can't create editor", e);
} catch (CoreException e) {
throw new EditorCreationException("Can't create editor", e);
- } catch (IOException e) {
- throw new EditorCreationException("Can't create editor", e);
+// } catch (IOException e) {
+// throw new EditorCreationException("Can't create editor", e);
}
}
@@ -197,7 +259,7 @@ public class ProgramaticPapyrusEditor {
// papyrusEditor.dispose();
page.closeAllEditors(true);
try {
- project.delete(true, new NullProgressMonitor());
+ eclipseProject.getProject().delete(true, new NullProgressMonitor());
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java
new file mode 100644
index 00000000000..39a4cd54e4c
--- /dev/null
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/EclipseProjectTest.java
@@ -0,0 +1,109 @@
+/*****************************************************************************
+ * Copyright (c) 2014 Cedric Dumoulin.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Cedric Dumoulin Cedric.dumoulin@lifl.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.integrationtests.editor;
+
+import static org.junit.Assert.*;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+
+/**
+ * @author cedric dumoulin
+ *
+ */
+public class EclipseProjectTest {
+
+ private static final String PROJECT_NAME = "org.eclipse.papyrus.integrationtests.editor.project";
+ private static final String FROM_BUNDLE_NAME = "org.eclipse.papyrus.integrationtests.editor";
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.integrationtests.editor.EclipseProject#EclipseProject(java.lang.String)}.
+ * @throws ExecutionException
+ */
+ @Test
+ public void testEclipseProject() throws ExecutionException {
+ EclipseProject project = new EclipseProject(PROJECT_NAME);
+
+ assertNotNull( "object created", project);
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.integrationtests.editor.EclipseProject#getProject()}.
+ * @throws ExecutionException
+ */
+ @Test
+ public void testGetProject() throws ExecutionException {
+ EclipseProject project = new EclipseProject(PROJECT_NAME);
+
+ assertNotNull( "object created", project.getProject());
+
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.integrationtests.editor.EclipseProject#copyResource(java.lang.String, java.lang.String, java.lang.String)}.
+ * @throws ExecutionException
+ */
+ @Test
+ public void testCopyResource() throws ExecutionException {
+
+ String fromFile = "META-INF/MANIFEST.MF";
+ String toFile = "a/b/META-INF/MANIFEST.MF";
+
+ EclipseProject project = new EclipseProject(PROJECT_NAME);
+
+ project.copyResource(FROM_BUNDLE_NAME, fromFile, toFile);
+
+ assertNotNull( "file copied", project.getProject().findMember(toFile));
+ }
+
+ /**
+ * Test method for {@link org.eclipse.papyrus.integrationtests.editor.EclipseProject#copyResource(java.lang.String, java.lang.String, java.lang.String)}.
+ * @throws ExecutionException
+ */
+ @Test
+ public void testCopyResources() throws ExecutionException {
+
+ String fromFile1 = "META-INF/MANIFEST.MF";
+ String fromFile2 = "about.html";
+
+ EclipseProject project = new EclipseProject(PROJECT_NAME);
+
+ assertNull( "file copied", project.getProject().findMember(fromFile1));
+ assertNull( "file copied", project.getProject().findMember(fromFile2));
+
+ project.copyResources(FROM_BUNDLE_NAME, fromFile1, fromFile2);
+
+ assertNotNull( "file copied", project.getProject().findMember(fromFile1));
+ assertNotNull( "file copied", project.getProject().findMember(fromFile2));
+ }
+
+
+}
diff --git a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java
index 6b4595a53fc..96702f3b28f 100644
--- a/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java
+++ b/tests/integration/plugins/org.eclipse.papyrus.integrationtests.editor/test/org/eclipse/papyrus/integrationtests/editor/ProgramaticPapyrusEditorTest.java
@@ -16,8 +16,14 @@ package org.eclipse.papyrus.integrationtests.editor;
import static org.junit.Assert.*;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.resource.BadArgumentExcetion;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -32,6 +38,17 @@ import org.junit.Test;
public class ProgramaticPapyrusEditorTest {
/**
+ * Name of the plugin that is created.
+ */
+ final protected String PLUGIN_PROJECT_NAME = "org.eclipse.papyrus.integrationtests.editor.tests";
+
+ /**
+ * Name of the bundle containing resources to copied.
+ */
+ final protected String BUNDLE_NAME = "org.eclipse.papyrus.integrationtests.editor";
+
+
+ /**
* @throws java.lang.Exception
*/
@Before
@@ -47,10 +64,10 @@ public class ProgramaticPapyrusEditorTest {
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#createEditor()}.
- * @throws EditorCreationException
+ * @throws ExecutionException
*/
@Test
- public void testCreateEditor() throws EditorCreationException {
+ public void testCreateEditor() throws ExecutionException {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
IMultiDiagramEditor editor = editorHandler.getEditor();
@@ -60,9 +77,10 @@ public class ProgramaticPapyrusEditorTest {
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#dispose()}.
+ * @throws ExecutionException
*/
@Test
- public void testDispose() throws EditorCreationException {
+ public void testDispose() throws ExecutionException {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
IMultiDiagramEditor editor = editorHandler.getEditor();
@@ -74,9 +92,10 @@ public class ProgramaticPapyrusEditorTest {
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#getEditor()}.
+ * @throws ExecutionException
*/
@Test
- public void testGetEditor() throws EditorCreationException {
+ public void testGetEditor() throws ExecutionException {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
IMultiDiagramEditor editor = editorHandler.getEditor();
@@ -87,9 +106,10 @@ public class ProgramaticPapyrusEditorTest {
/**
* Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#getServiceRegistry()}.
+ * @throws ExecutionException
*/
@Test
- public void testGetServiceRegistry() throws EditorCreationException {
+ public void testGetServiceRegistry() throws ExecutionException {
ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor();
IMultiDiagramEditor editor = editorHandler.getEditor();
@@ -102,4 +122,36 @@ public class ProgramaticPapyrusEditorTest {
editorHandler.dispose();
}
+ /**
+ * Test method for {@link org.eclipse.papyrus.integrationtests.editor.ProgramaticPapyrusEditor#getEditor()}.
+ * @throws ServiceException
+ * @throws BadArgumentExcetion
+ * @throws NotFoundException
+ * @throws ExecutionException
+ */
+ @Test
+ public void testGetEditorAndLoadModel() throws ServiceException, NotFoundException, BadArgumentExcetion, ExecutionException {
+
+ String modelName = "models/modelTestLoadModel";
+// String modelName = "modelTestLoadModel";
+ String diagramName = "diagram1";
+ EclipseProject eclipseProject = new EclipseProject(PLUGIN_PROJECT_NAME);
+ eclipseProject.copyResources(BUNDLE_NAME, modelName+".di", modelName+".notation", modelName+".uml" );
+
+ ProgramaticPapyrusEditor editorHandler = new ProgramaticPapyrusEditor(eclipseProject, modelName);
+ IMultiDiagramEditor editor = editorHandler.getEditor();
+
+ assertNotNull("editor created", editor);
+
+ NotationModel notationModel = (NotationModel)editorHandler.getModelSet().getModel(NotationModel.MODEL_ID);
+ assertNotNull("notation model loaded", notationModel);
+
+ // If the following assertion is false, this means that the model is not loaded from file (it has been created)
+ Diagram diagram = notationModel.getDiagram(diagramName);
+ assertNotNull("diagram loaded", diagram);
+
+ editorHandler.dispose();
+ }
+
+
}

Back to the top