Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2011-09-16 14:24:37 +0000
committervlorenzo2011-09-16 14:24:37 +0000
commit36c5af0c86339ef6f95b2cf6627a4322dcd185c0 (patch)
tree1a070a7c6dd8c453eb5385b24d2cbf9731e52ea6 /extraplugins/diagramtemplate
parentf3d6ab67e502ec9fecaa956b4ce9b80b2802510f (diff)
downloadorg.eclipse.papyrus-36c5af0c86339ef6f95b2cf6627a4322dcd185c0.tar.gz
org.eclipse.papyrus-36c5af0c86339ef6f95b2cf6627a4322dcd185c0.tar.xz
org.eclipse.papyrus-36c5af0c86339ef6f95b2cf6627a4322dcd185c0.zip
Bug 330186 : these plugin were only on the branch 0.7.X and not available on the trunk.
Diffstat (limited to 'extraplugins/diagramtemplate')
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/.project22
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/META-INF/MANIFEST.MF6
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/OSGI-INF/l10n/bundle.properties3
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/build.properties5
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdfbin0 -> 632121 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptxbin0 -> 928095 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.classpath7
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.project28
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/META-INF/MANIFEST.MF15
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/about.html28
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/build.properties15
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/plugin.properties48
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/plugin.xml25
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/AbstractSelectionItemProvider.java236
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramDefinitionItemProvider.java317
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramTemplateEditPlugin.java92
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramTemplateItemProviderAdapterFactory.java273
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/SelectionItemProvider.java147
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/SelectionRefItemProvider.java139
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/TemplateItemProvider.java191
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.classpath7
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.project28
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF24
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/about.html28
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/build.properties15
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/DiagramTemplateModelFile.gifbin0 -> 604 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/add.gifbin0 -> 318 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/checked.gifbin0 -> 343 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/copy.gifbin0 -> 594 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/delete.gifbin0 -> 351 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/down.gifbin0 -> 326 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/execute.gifbin0 -> 1013 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/forAll.pngbin0 -> 770 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/forAllRef.pngbin0 -> 835 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/new.gifbin0 -> 374 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/specific.gifbin0 -> 360 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/specificRef.gifbin0 -> 378 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/unchecked.gifbin0 -> 251 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/up.gifbin0 -> 327 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/wizban/NewDiagramTemplate.gifbin0 -> 2630 bytes
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/plugin.properties55
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/plugin.xml36
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/com/swtdesigner/ResourceManager.java407
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/com/swtdesigner/SWTResourceManager.java440
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java446
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java1589
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java109
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java627
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java47
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java98
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java81
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java46
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java74
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java169
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java68
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java64
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java76
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java733
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java117
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/utils/Messages.java115
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/utils/messages.properties50
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.classpath7
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.project28
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/META-INF/MANIFEST.MF15
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/about.html28
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/build.properties15
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/model/diagramTemplate.ecore45
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/model/diagramTemplate.genmodel46
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/plugin.properties37
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/plugin.xml20
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/AbstractSelection.java156
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramDefinition.java207
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramTemplateFactory.java73
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramTemplatePackage.java851
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/Selection.java53
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/SelectionKind.java239
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/SelectionRef.java54
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/Template.java72
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/AbstractSelectionImpl.java391
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramDefinitionImpl.java498
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramTemplateFactoryImpl.java186
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramTemplatePackageImpl.java458
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/SelectionImpl.java163
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/SelectionRefImpl.java157
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/TemplateImpl.java214
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/util/DiagramTemplateAdapterFactory.java198
-rw-r--r--extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/util/DiagramTemplateSwitch.java220
90 files changed, 11601 insertions, 0 deletions
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/.project b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/.project
new file mode 100644
index 00000000000..2a7c07d2b60
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/.project
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.diagramtemplate.doc</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/META-INF/MANIFEST.MF b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..b91cb32772c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.diagramtemplate.doc; singleton:=true
+Bundle-Version: 0.7.3.qualifier
+Bundle-Vendor: %Bundle-Vendor
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/OSGI-INF/l10n/bundle.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..1f627cf5057
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.diagramtemplate.doc
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Papyrus Documention for diagram template (Incubation) \ No newline at end of file
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/build.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/build.properties
new file mode 100644
index 00000000000..1c847901b02
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/build.properties
@@ -0,0 +1,5 @@
+bin.includes = META-INF/,\
+ html/,\
+ *.xml,\
+ resources/,\
+ OSGI-INF/
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdf b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdf
new file mode 100644
index 00000000000..729c17aace5
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pdf
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptx b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptx
new file mode 100644
index 00000000000..bf447853259
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.doc/resources/template-diaGen.pptx
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.classpath b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.classpath
new file mode 100644
index 00000000000..efdacce142c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.project b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.project
new file mode 100644
index 00000000000..4bc238ec809
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.diagramtemplate.edit</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/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.settings/org.eclipse.jdt.core.prefs b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..48f1988145d
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Jan 28 11:26:09 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/META-INF/MANIFEST.MF b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ec782bc15b1
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.diagramtemplate.edit;singleton:=true
+Bundle-Version: 0.7.3.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.papyrus.diagramtemplate.provider.DiagramTemplateEditPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.diagramtemplate.provider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.diagramtemplate;visibility:=reexport,
+ org.eclipse.emf.edit;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/about.html b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</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> \ No newline at end of file
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/build.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/build.properties
new file mode 100644
index 00000000000..504a107c44c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/build.properties
@@ -0,0 +1,15 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/plugin.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/plugin.properties
new file mode 100644
index 00000000000..f350afbf702
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/plugin.properties
@@ -0,0 +1,48 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = DiagramTemplate Edit Support
+providerName = www.example.org
+
+_UI_CreateChild_text = {0}
+_UI_CreateChild_text2 = {1} {0}
+_UI_CreateChild_text3 = {1}
+_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
+_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
+_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
+
+_UI_PropertyDescriptor_description = The {0} of the {1}
+
+_UI_DiagramDefinition_type = Diagram Definition
+_UI_Selection_type = Selection
+_UI_SelectionRef_type = Selection Ref
+_UI_Template_type = Template
+_UI_AbstractSelection_type = Abstract Selection
+_UI_Unknown_type = Object
+
+_UI_Unknown_datatype= Value
+
+_UI_DiagramDefinition_description_feature = Description
+_UI_DiagramDefinition_fromRoot_feature = From Root
+_UI_DiagramDefinition_selection_feature = Selection
+_UI_DiagramDefinition_diagramKind_feature = Diagram Kind
+_UI_DiagramDefinition_layoutToApply_feature = Layout To Apply
+_UI_DiagramDefinition_name_feature = Name
+_UI_SelectionRef_eReference_feature = EReference
+_UI_Template_diagramDefinitions_feature = Diagram Definitions
+_UI_AbstractSelection_element_feature = Element
+_UI_AbstractSelection_kind_feature = Kind
+_UI_AbstractSelection_selectionRef_feature = Selection Ref
+_UI_AbstractSelection_recursively_feature = Recursively
+_UI_Unknown_feature = Unspecified
+
+_UI_SelectionKind_ForAll_literal = ForAll
+_UI_SelectionKind_Specific_literal = Specific
+_UI_SelectionKind_Query_literal = Query
+_UI_DiagramDefinition_prefix_feature = Prefix
+_UI_Selection_recursively_feature = Recursively
+_UI_Template_targetRoot_feature = Target Root
+_UI_AbstractSelection_subTypes_feature = Sub Types
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/plugin.xml b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/plugin.xml
new file mode 100644
index 00000000000..54c6ef82fb5
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/plugin.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ <copyright>
+ </copyright>
+
+ $Id$
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <factory
+ uri="http://www.eclipse.org/papyrus/diagramtemplate"
+ class="org.eclipse.papyrus.diagramtemplate.provider.DiagramTemplateItemProviderAdapterFactory"
+ supportedTypes=
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource"/>
+ </extension>
+
+</plugin>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/AbstractSelectionItemProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/AbstractSelectionItemProvider.java
new file mode 100644
index 00000000000..70106e71305
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/AbstractSelectionItemProvider.java
@@ -0,0 +1,236 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.AbstractSelection} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class AbstractSelectionItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AbstractSelectionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addElementPropertyDescriptor(object);
+ addKindPropertyDescriptor(object);
+ addSubTypesPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Element feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addElementPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AbstractSelection_element_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AbstractSelection_element_feature", "_UI_AbstractSelection_type"),
+ DiagramTemplatePackage.Literals.ABSTRACT_SELECTION__ELEMENT,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Kind feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addKindPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AbstractSelection_kind_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AbstractSelection_kind_feature", "_UI_AbstractSelection_type"),
+ DiagramTemplatePackage.Literals.ABSTRACT_SELECTION__KIND,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Sub Types feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addSubTypesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_AbstractSelection_subTypes_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_AbstractSelection_subTypes_feature", "_UI_AbstractSelection_type"),
+ DiagramTemplatePackage.Literals.ABSTRACT_SELECTION__SUB_TYPES,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(DiagramTemplatePackage.Literals.ABSTRACT_SELECTION__SELECTION_REF);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ SelectionKind labelValue = ((AbstractSelection)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ?
+ getString("_UI_AbstractSelection_type") :
+ getString("_UI_AbstractSelection_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(AbstractSelection.class)) {
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__KIND:
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SUB_TYPES:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SELECTION_REF:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (DiagramTemplatePackage.Literals.ABSTRACT_SELECTION__SELECTION_REF,
+ DiagramTemplateFactory.eINSTANCE.createSelectionRef()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DiagramTemplateEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramDefinitionItemProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramDefinitionItemProvider.java
new file mode 100644
index 00000000000..8676e5ab2ca
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramDefinitionItemProvider.java
@@ -0,0 +1,317 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.DiagramDefinition} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DiagramDefinitionItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramDefinitionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addDescriptionPropertyDescriptor(object);
+ addFromRootPropertyDescriptor(object);
+ addDiagramKindPropertyDescriptor(object);
+ addLayoutToApplyPropertyDescriptor(object);
+ addNamePropertyDescriptor(object);
+ addPrefixPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Description feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addDescriptionPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_DiagramDefinition_description_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_DiagramDefinition_description_feature", "_UI_DiagramDefinition_type"),
+ DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION__DESCRIPTION,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the From Root feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addFromRootPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_DiagramDefinition_fromRoot_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_DiagramDefinition_fromRoot_feature", "_UI_DiagramDefinition_type"),
+ DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION__FROM_ROOT,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Diagram Kind feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addDiagramKindPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_DiagramDefinition_diagramKind_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_DiagramDefinition_diagramKind_feature", "_UI_DiagramDefinition_type"),
+ DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION__DIAGRAM_KIND,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Layout To Apply feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addLayoutToApplyPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_DiagramDefinition_layoutToApply_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_DiagramDefinition_layoutToApply_feature", "_UI_DiagramDefinition_type"),
+ DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION__LAYOUT_TO_APPLY,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Name feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addNamePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_DiagramDefinition_name_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_DiagramDefinition_name_feature", "_UI_DiagramDefinition_type"),
+ DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION__NAME,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Prefix feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addPrefixPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_DiagramDefinition_prefix_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_DiagramDefinition_prefix_feature", "_UI_DiagramDefinition_type"),
+ DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION__PREFIX,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION__SELECTION);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns DiagramDefinition.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/DiagramDefinition"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((DiagramDefinition)object).getName();
+ return label == null || label.length() == 0 ?
+ getString("_UI_DiagramDefinition_type") :
+ getString("_UI_DiagramDefinition_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(DiagramDefinition.class)) {
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DESCRIPTION:
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DIAGRAM_KIND:
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__LAYOUT_TO_APPLY:
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__NAME:
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__PREFIX:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__SELECTION:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION__SELECTION,
+ DiagramTemplateFactory.eINSTANCE.createSelection()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DiagramTemplateEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramTemplateEditPlugin.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramTemplateEditPlugin.java
new file mode 100644
index 00000000000..0bb6c166afa
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramTemplateEditPlugin.java
@@ -0,0 +1,92 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.provider;
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.util.ResourceLocator;
+
+/**
+ * This is the central singleton for the DiagramTemplate edit plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class DiagramTemplateEditPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final DiagramTemplateEditPlugin INSTANCE = new DiagramTemplateEditPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramTemplateEditPlugin() {
+ super
+ (new ResourceLocator [] {
+ });
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipsePlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramTemplateItemProviderAdapterFactory.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramTemplateItemProviderAdapterFactory.java
new file mode 100644
index 00000000000..ff088c0c889
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/DiagramTemplateItemProviderAdapterFactory.java
@@ -0,0 +1,273 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.papyrus.diagramtemplate.util.DiagramTemplateAdapterFactory;
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DiagramTemplateItemProviderAdapterFactory extends DiagramTemplateAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<Object>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramTemplateItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.DiagramDefinition} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DiagramDefinitionItemProvider diagramDefinitionItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.DiagramDefinition}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createDiagramDefinitionAdapter() {
+ if (diagramDefinitionItemProvider == null) {
+ diagramDefinitionItemProvider = new DiagramDefinitionItemProvider(this);
+ }
+
+ return diagramDefinitionItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.Selection} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected SelectionItemProvider selectionItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.Selection}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createSelectionAdapter() {
+ if (selectionItemProvider == null) {
+ selectionItemProvider = new SelectionItemProvider(this);
+ }
+
+ return selectionItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.SelectionRef} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected SelectionRefItemProvider selectionRefItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.SelectionRef}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createSelectionRefAdapter() {
+ if (selectionRefItemProvider == null) {
+ selectionRefItemProvider = new SelectionRefItemProvider(this);
+ }
+
+ return selectionRefItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.Template} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TemplateItemProvider templateItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.Template}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createTemplateAdapter() {
+ if (templateItemProvider == null) {
+ templateItemProvider = new TemplateItemProvider(this);
+ }
+
+ return templateItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class<?>) || (((Class<?>)type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void dispose() {
+ if (diagramDefinitionItemProvider != null) diagramDefinitionItemProvider.dispose();
+ if (selectionItemProvider != null) selectionItemProvider.dispose();
+ if (selectionRefItemProvider != null) selectionRefItemProvider.dispose();
+ if (templateItemProvider != null) templateItemProvider.dispose();
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/SelectionItemProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/SelectionItemProvider.java
new file mode 100644
index 00000000000..b535187eccc
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/SelectionItemProvider.java
@@ -0,0 +1,147 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.Selection} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class SelectionItemProvider
+ extends AbstractSelectionItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SelectionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addRecursivelyPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Recursively feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addRecursivelyPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Selection_recursively_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Selection_recursively_feature", "_UI_Selection_type"),
+ DiagramTemplatePackage.Literals.SELECTION__RECURSIVELY,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns Selection.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Selection"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ SelectionKind labelValue = ((Selection)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ?
+ getString("_UI_Selection_type") :
+ getString("_UI_Selection_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Selection.class)) {
+ case DiagramTemplatePackage.SELECTION__RECURSIVELY:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/SelectionRefItemProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/SelectionRefItemProvider.java
new file mode 100644
index 00000000000..8003fea0ae8
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/SelectionRefItemProvider.java
@@ -0,0 +1,139 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.SelectionRef} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class SelectionRefItemProvider
+ extends AbstractSelectionItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SelectionRefItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addEReferencePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the EReference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addEReferencePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_SelectionRef_eReference_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_SelectionRef_eReference_feature", "_UI_SelectionRef_type"),
+ DiagramTemplatePackage.Literals.SELECTION_REF__EREFERENCE,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This returns SelectionRef.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/SelectionRef"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ SelectionKind labelValue = ((SelectionRef)object).getKind();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ?
+ getString("_UI_SelectionRef_type") :
+ getString("_UI_SelectionRef_type") + " " + label;
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/TemplateItemProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/TemplateItemProvider.java
new file mode 100644
index 00000000000..1f7a15729f3
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.edit/src/org/eclipse/papyrus/diagramtemplate/provider/TemplateItemProvider.java
@@ -0,0 +1,191 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Template;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.diagramtemplate.diagramtemplate.Template} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class TemplateItemProvider
+ extends ItemProviderAdapter
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public TemplateItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addTargetRootPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Target Root feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addTargetRootPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Template_targetRoot_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_Template_targetRoot_feature", "_UI_Template_type"),
+ DiagramTemplatePackage.Literals.TEMPLATE__TARGET_ROOT,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
+ * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
+ * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
+ if (childrenFeatures == null) {
+ super.getChildrenFeatures(object);
+ childrenFeatures.add(DiagramTemplatePackage.Literals.TEMPLATE__DIAGRAM_DEFINITIONS);
+ }
+ return childrenFeatures;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EStructuralFeature getChildFeature(Object object, Object child) {
+ // Check the type of the specified child object and return the proper feature to use for
+ // adding (see {@link AddCommand}) it as a child.
+
+ return super.getChildFeature(object, child);
+ }
+
+ /**
+ * This returns Template.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/Template"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_Template_type");
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(Template.class)) {
+ case DiagramTemplatePackage.TEMPLATE__DIAGRAM_DEFINITIONS:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+
+ newChildDescriptors.add
+ (createChildParameter
+ (DiagramTemplatePackage.Literals.TEMPLATE__DIAGRAM_DEFINITIONS,
+ DiagramTemplateFactory.eINSTANCE.createDiagramDefinition()));
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return DiagramTemplateEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.classpath b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.classpath
new file mode 100644
index 00000000000..efdacce142c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.project b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.project
new file mode 100644
index 00000000000..48f81085cd3
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.diagramtemplate.editor</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/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.settings/org.eclipse.jdt.core.prefs b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..c9a121f8f88
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Jan 28 11:26:19 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..08c94bcdc35
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.diagramtemplate.editor;singleton:=true
+Bundle-Version: 0.7.3.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.papyrus.diagramtemplate.editor.DiagramTemplateEditorPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.diagramtemplate.editor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.papyrus.diagramtemplate.edit;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.emf.edit.ui;visibility:=reexport,
+ org.eclipse.ui.ide;visibility:=reexport,
+ org.eclipse.uml2.uml;bundle-version="3.1.0",
+ org.eclipse.uml2.uml.edit;bundle-version="3.1.0",
+ org.eclipse.papyrus.core;bundle-version="0.7.1",
+ org.eclipse.papyrus.wizards;bundle-version="0.7.1",
+ org.eclipse.papyrus.editor;bundle-version="0.7.1",
+ org.eclipse.gmf.runtime.diagram.ui.actions;bundle-version="1.4.0"
+Bundle-ActivationPolicy: lazy
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/about.html b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</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> \ No newline at end of file
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/build.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/build.properties
new file mode 100644
index 00000000000..504a107c44c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/build.properties
@@ -0,0 +1,15 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/DiagramTemplateModelFile.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/DiagramTemplateModelFile.gif
new file mode 100644
index 00000000000..90ab9f3c68b
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/DiagramTemplateModelFile.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/add.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/add.gif
new file mode 100644
index 00000000000..252d7ebcb8c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/add.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/checked.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/checked.gif
new file mode 100644
index 00000000000..9cacb96dca9
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/checked.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/copy.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/copy.gif
new file mode 100644
index 00000000000..71d7c95aa8c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/copy.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/delete.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/delete.gif
new file mode 100644
index 00000000000..b6922ac11cf
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/delete.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/down.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/down.gif
new file mode 100644
index 00000000000..6fe8b89b687
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/down.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/execute.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/execute.gif
new file mode 100644
index 00000000000..d377af90dd5
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/execute.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/forAll.png b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/forAll.png
new file mode 100644
index 00000000000..c932759e7fa
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/forAll.png
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/forAllRef.png b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/forAllRef.png
new file mode 100644
index 00000000000..c064a44119f
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/forAllRef.png
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/new.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/new.gif
new file mode 100644
index 00000000000..3cc356093b2
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/new.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/specific.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/specific.gif
new file mode 100644
index 00000000000..e6f76c79d80
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/specific.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/specificRef.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/specificRef.gif
new file mode 100644
index 00000000000..029d01ea93a
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/specificRef.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/unchecked.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/unchecked.gif
new file mode 100644
index 00000000000..5f17b937e9f
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/unchecked.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/up.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/up.gif
new file mode 100644
index 00000000000..bd8edea5a4f
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/obj16/up.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/wizban/NewDiagramTemplate.gif b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/wizban/NewDiagramTemplate.gif
new file mode 100644
index 00000000000..909c38d9fdf
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/icons/full/wizban/NewDiagramTemplate.gif
Binary files differ
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/plugin.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/plugin.properties
new file mode 100644
index 00000000000..bf519e156d9
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/plugin.properties
@@ -0,0 +1,55 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = Papyrus DiagramTemplate Editor
+providerName = www.eclipse.org/papyrus
+
+_UI_DiagramTemplateEditor_menu = &Papyrus DiagramTemplate Editor
+
+_UI_CreateChild_menu_item = &New Child
+_UI_CreateSibling_menu_item = N&ew Sibling
+
+_UI_ShowPropertiesView_menu_item = Show &Properties View
+_UI_RefreshViewer_menu_item = &Refresh
+
+_UI_SelectionPage_label = Selection
+_UI_ParentPage_label = Parent
+_UI_ListPage_label = List
+_UI_TreePage_label = Tree
+_UI_TablePage_label = Table
+_UI_TreeWithColumnsPage_label = Tree with Columns
+_UI_ObjectColumn_label = Object
+_UI_SelfColumn_label = Self
+
+_UI_NoObjectSelected = Selected Nothing
+_UI_SingleObjectSelected = Selected Object: {0}
+_UI_MultiObjectSelected = Selected {0} Objects
+
+_UI_OpenEditorError_label = Open Editor
+
+_UI_CreateModelError_message = Problems encountered in file "{0}"
+
+_UI_DiagramTemplateModelWizard_label = Papyrus Diagram Template
+_UI_DiagramTemplateModelWizard_description = Create a new Papyrus DiagramTemplate model
+
+_UI_DiagramTemplateEditor_label = Papyrus DiagramTemplate Editor
+
+_UI_DiagramTemplateEditorFilenameDefaultBase = template
+_UI_DiagramTemplateEditorFilenameExtensions = diagramtemplate
+
+_UI_Wizard_label = New
+
+_WARN_FilenameExtension = The file name must end in ''.{0}''
+_WARN_FilenameExtensions = The file name must have one of the following extensions: {0}
+
+_UI_ModelObject = &Model Object
+_UI_XMLEncoding = &XML Encoding
+_UI_XMLEncodingChoices = UTF-8 ASCII UTF-16 UTF-16BE UTF-16LE ISO-8859-1
+_UI_Wizard_initial_object_description = Select a model object to create
+
+_UI_FileConflict_label = File Conflict
+_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor. Do you wish to discard this editor's changes?
+
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/plugin.xml b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/plugin.xml
new file mode 100644
index 00000000000..203ae6e7411
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/plugin.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ <copyright>
+ </copyright>
+
+ $Id$
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.papyrus.wizards.category"
+ class="org.eclipse.papyrus.diagramtemplate.editor.DiagramTemplateModelWizard"
+ finalPerspective="org.eclipse.papyrus.core.perspective"
+ icon="icons/full/obj16/DiagramTemplateModelFile.gif"
+ id="org.eclipse.papyrus.diagramtemplate.presentation.DiagramTemplateModelWizardID"
+ name="%_UI_DiagramTemplateModelWizard_label">
+ <description>%_UI_DiagramTemplateModelWizard_description</description>
+ <selection class="org.eclipse.core.resources.IResource"/>
+ </wizard>
+ </extension>
+
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ id="org.eclipse.papyrus.diagramtemplate.presentation.DiagramTemplateEditorID"
+ name="%_UI_DiagramTemplateEditor_label"
+ icon="icons/full/obj16/DiagramTemplateModelFile.gif"
+ extensions="diagramtemplate"
+ class="org.eclipse.papyrus.diagramtemplate.editor.DiagramTemplateEditor">
+ </editor>
+ </extension>
+
+</plugin>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/com/swtdesigner/ResourceManager.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/com/swtdesigner/ResourceManager.java
new file mode 100644
index 00000000000..1f509369c90
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/com/swtdesigner/ResourceManager.java
@@ -0,0 +1,407 @@
+package com.swtdesigner;
+
+import java.io.File;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.osgi.framework.Bundle;
+
+/**
+ * Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
+ * etc.
+ *
+ * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
+ * operating system resources managed by cached objects when those objects and OS resources are no longer
+ * needed (e.g. on application shutdown)
+ *
+ * This class may be freely distributed as part of any application or plugin.
+ * <p>
+ * Copyright (c) 2003 - 2007, Instantiations, Inc. <br>
+ * All Rights Reserved
+ *
+ * @author scheglov_ke
+ * @author Dan Rubel
+ */
+public class ResourceManager extends SWTResourceManager {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Image
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>();
+ /**
+ * Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified
+ * class.
+ *
+ * @param clazz
+ * the {@link Class} relative to which to find the image descriptor.
+ * @param path
+ * the path to the image file.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ */
+ public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) {
+ return ImageDescriptor.createFromFile(clazz, path);
+ }
+ /**
+ * Returns an {@link ImageDescriptor} stored in the file at the specified path.
+ *
+ * @param path
+ * the path to the image file.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ try {
+ return ImageDescriptor.createFromURL(new File(path).toURI().toURL());
+ } catch (MalformedURLException e) {
+ return null;
+ }
+ }
+ /**
+ * Returns an {@link Image} based on the specified {@link ImageDescriptor}.
+ *
+ * @param descriptor
+ * the {@link ImageDescriptor} for the {@link Image}.
+ * @return the {@link Image} based on the specified {@link ImageDescriptor}.
+ */
+ public static Image getImage(ImageDescriptor descriptor) {
+ if (descriptor == null) {
+ return null;
+ }
+ Image image = m_descriptorImageMap.get(descriptor);
+ if (image == null) {
+ image = descriptor.createImage();
+ m_descriptorImageMap.put(descriptor, image);
+ }
+ return image;
+ }
+ /**
+ * Maps images to decorated images.
+ */
+ @SuppressWarnings("unchecked")
+ private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated.
+ * @param decorator
+ * the {@link Image} to decorate the base image.
+ * @return {@link Image} The resulting decorated image.
+ */
+ public static Image decorateImage(Image baseImage, Image decorator) {
+ return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
+ }
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated.
+ * @param decorator
+ * the {@link Image} to decorate the base image.
+ * @param corner
+ * the corner to place decorator image.
+ * @return the resulting decorated {@link Image}.
+ */
+ public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
+ if (corner <= 0 || corner >= LAST_CORNER_KEY) {
+ throw new IllegalArgumentException("Wrong decorate corner");
+ }
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
+ if (cornerDecoratedImageMap == null) {
+ cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
+ m_decoratedImageMap[corner] = cornerDecoratedImageMap;
+ }
+ Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
+ if (decoratedMap == null) {
+ decoratedMap = new HashMap<Image, Image>();
+ cornerDecoratedImageMap.put(baseImage, decoratedMap);
+ }
+ //
+ Image result = decoratedMap.get(decorator);
+ if (result == null) {
+ final Rectangle bib = baseImage.getBounds();
+ final Rectangle dib = decorator.getBounds();
+ final Point baseImageSize = new Point(bib.width, bib.height);
+ CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() {
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ drawImage(baseImage.getImageData(), 0, 0);
+ if (corner == TOP_LEFT) {
+ drawImage(decorator.getImageData(), 0, 0);
+ } else if (corner == TOP_RIGHT) {
+ drawImage(decorator.getImageData(), bib.width - dib.width, 0);
+ } else if (corner == BOTTOM_LEFT) {
+ drawImage(decorator.getImageData(), 0, bib.height - dib.height);
+ } else if (corner == BOTTOM_RIGHT) {
+ drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height);
+ }
+ }
+ @Override
+ protected Point getSize() {
+ return baseImageSize;
+ }
+ };
+ //
+ result = compositImageDesc.createImage();
+ decoratedMap.put(decorator, result);
+ }
+ return result;
+ }
+ /**
+ * Dispose all of the cached images.
+ */
+ public static void disposeImages() {
+ SWTResourceManager.disposeImages();
+ // dispose ImageDescriptor images
+ {
+ for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) {
+ I.next().dispose();
+ }
+ m_descriptorImageMap.clear();
+ }
+ // dispose decorated images
+ for (int i = 0; i < m_decoratedImageMap.length; i++) {
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
+ if (cornerDecoratedImageMap != null) {
+ for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
+ for (Image image : decoratedMap.values()) {
+ image.dispose();
+ }
+ decoratedMap.clear();
+ }
+ cornerDecoratedImageMap.clear();
+ }
+ }
+ // dispose plugin images
+ {
+ for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) {
+ I.next().dispose();
+ }
+ m_URLImageMap.clear();
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Plugin images support
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps URL to images.
+ */
+ private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>();
+ /**
+ * Provider for plugin resources, used by WindowBuilder at design time.
+ */
+ public interface PluginResourceProvider {
+ URL getEntry(String symbolicName, String path);
+ }
+ /**
+ * Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time.
+ */
+ private static PluginResourceProvider m_designTimePluginResourceProvider = null;
+ /**
+ * Returns an {@link Image} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the image
+ * @param name
+ * the path to the image within the plugin
+ * @return the {@link Image} stored in the file at the specified path
+ *
+ * @deprecated Use {@link #getPluginImage(String, String)} instead.
+ */
+ @Deprecated
+ public static Image getPluginImage(Object plugin, String name) {
+ try {
+ URL url = getPluginImageURL(plugin, name);
+ if (url != null) {
+ return getPluginImageFromUrl(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link Image} based on a {@link Bundle} and resource entry path.
+ *
+ * @param symbolicName
+ * the symbolic name of the {@link Bundle}.
+ * @param path
+ * the path of the resource entry.
+ * @return the {@link Image} stored in the file at the specified path.
+ */
+ public static Image getPluginImage(String symbolicName, String path) {
+ try {
+ URL url = getPluginImageURL(symbolicName, path);
+ if (url != null) {
+ return getPluginImageFromUrl(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link Image} based on given {@link URL}.
+ */
+ private static Image getPluginImageFromUrl(URL url) {
+ try {
+ try {
+ String key = url.toExternalForm();
+ Image image = m_URLImageMap.get(key);
+ if (image == null) {
+ InputStream stream = url.openStream();
+ try {
+ image = getImage(stream);
+ m_URLImageMap.put(key, image);
+ } finally {
+ stream.close();
+ }
+ }
+ return image;
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link ImageDescriptor} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the image.
+ * @param name
+ * the path to th eimage within the plugin.
+ * @return the {@link ImageDescriptor} stored in the file at the specified path.
+ *
+ * @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead.
+ */
+ @Deprecated
+ public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) {
+ try {
+ try {
+ URL url = getPluginImageURL(plugin, name);
+ return ImageDescriptor.createFromURL(url);
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path.
+ *
+ * @param symbolicName
+ * the symbolic name of the {@link Bundle}.
+ * @param path
+ * the path of the resource entry.
+ * @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path.
+ */
+ public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) {
+ try {
+ URL url = getPluginImageURL(symbolicName, path);
+ if (url != null) {
+ return ImageDescriptor.createFromURL(url);
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ return null;
+ }
+ /**
+ * Returns an {@link URL} based on a {@link Bundle} and resource entry path.
+ */
+ private static URL getPluginImageURL(String symbolicName, String path) {
+ // try runtime plugins
+ {
+ Bundle bundle = Platform.getBundle(symbolicName);
+ if (bundle != null) {
+ return bundle.getEntry(path);
+ }
+ }
+ // try design time provider
+ if (m_designTimePluginResourceProvider != null) {
+ return m_designTimePluginResourceProvider.getEntry(symbolicName, path);
+ }
+ // no such resource
+ return null;
+ }
+ /**
+ * Returns an {@link URL} based on a plugin and file path.
+ *
+ * @param plugin
+ * the plugin {@link Object} containing the file path.
+ * @param name
+ * the file path.
+ * @return the {@link URL} representing the file at the specified path.
+ * @throws Exception
+ */
+ private static URL getPluginImageURL(Object plugin, String name) throws Exception {
+ // try to work with 'plugin' as with OSGI BundleContext
+ try {
+ Class<?> BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$
+ Class<?> BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$
+ if (BundleContextClass.isAssignableFrom(plugin.getClass())) {
+ Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$
+ Object bundle = getBundleMethod.invoke(plugin, new Object[0]);
+ //
+ Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$
+ Constructor<?> pathConstructor = PathClass.getConstructor(new Class[]{String.class});
+ Object path = pathConstructor.newInstance(new Object[]{name});
+ //
+ Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$
+ Class<?> PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$
+ Method findMethod = PlatformClass.getMethod("find", new Class[]{BundleClass, IPathClass}); //$NON-NLS-1$
+ return (URL) findMethod.invoke(null, new Object[]{bundle, path});
+ }
+ } catch (Throwable e) {
+ // Ignore any exceptions
+ }
+ // else work with 'plugin' as with usual Eclipse plugin
+ {
+ Class<?> PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$
+ if (PluginClass.isAssignableFrom(plugin.getClass())) {
+ //
+ Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$
+ Constructor<?> pathConstructor = PathClass.getConstructor(new Class[]{String.class});
+ Object path = pathConstructor.newInstance(new Object[]{name});
+ //
+ Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$
+ Method findMethod = PluginClass.getMethod("find", new Class[]{IPathClass}); //$NON-NLS-1$
+ return (URL) findMethod.invoke(plugin, new Object[]{path});
+ }
+ }
+ return null;
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // General
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
+ * objects are no longer needed (e.g. on application shutdown).
+ */
+ public static void dispose() {
+ disposeColors();
+ disposeFonts();
+ disposeImages();
+ }
+} \ No newline at end of file
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/com/swtdesigner/SWTResourceManager.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/com/swtdesigner/SWTResourceManager.java
new file mode 100644
index 00000000000..0cf20cb0699
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/com/swtdesigner/SWTResourceManager.java
@@ -0,0 +1,440 @@
+package com.swtdesigner;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
+ * <p>
+ * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
+ * operating system resources managed by cached objects when those objects and OS resources are no longer
+ * needed (e.g. on application shutdown)
+ * <p>
+ * This class may be freely distributed as part of any application or plugin.
+ * <p>
+ * Copyright (c) 2003 - 2007, Instantiations, Inc. <br>
+ * All Rights Reserved
+ *
+ * @author scheglov_ke
+ * @author Dan Rubel
+ */
+public class SWTResourceManager {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Color
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ private static Map<RGB, Color> m_colorMap = new HashMap<RGB, Color>();
+ /**
+ * Returns the system {@link Color} matching the specific ID.
+ *
+ * @param systemColorID
+ * the ID value for the color
+ * @return the system {@link Color} matching the specific ID
+ */
+ public static Color getColor(int systemColorID) {
+ Display display = Display.getCurrent();
+ return display.getSystemColor(systemColorID);
+ }
+ /**
+ * Returns a {@link Color} given its red, green and blue component values.
+ *
+ * @param r
+ * the red component of the color
+ * @param g
+ * the green component of the color
+ * @param b
+ * the blue component of the color
+ * @return the {@link Color} matching the given red, green and blue component values
+ */
+ public static Color getColor(int r, int g, int b) {
+ return getColor(new RGB(r, g, b));
+ }
+ /**
+ * Returns a {@link Color} given its RGB value.
+ *
+ * @param rgb
+ * the {@link RGB} value of the color
+ * @return the {@link Color} matching the RGB value
+ */
+ public static Color getColor(RGB rgb) {
+ Color color = m_colorMap.get(rgb);
+ if (color == null) {
+ Display display = Display.getCurrent();
+ color = new Color(display, rgb);
+ m_colorMap.put(rgb, color);
+ }
+ return color;
+ }
+ /**
+ * Dispose of all the cached {@link Color}'s.
+ */
+ public static void disposeColors() {
+ for (Color color : m_colorMap.values()) {
+ color.dispose();
+ }
+ m_colorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Image
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps image paths to images.
+ */
+ private static Map<String, Image> m_imageMap = new HashMap<String, Image>();
+ /**
+ * Returns an {@link Image} encoded by the specified {@link InputStream}.
+ *
+ * @param stream
+ * the {@link InputStream} encoding the image data
+ * @return the {@link Image} encoded by the specified input stream
+ */
+ protected static Image getImage(InputStream stream) throws IOException {
+ try {
+ Display display = Display.getCurrent();
+ ImageData data = new ImageData(stream);
+ if (data.transparentPixel > 0) {
+ return new Image(display, data, data.getTransparencyMask());
+ }
+ return new Image(display, data);
+ } finally {
+ stream.close();
+ }
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path.
+ *
+ * @param path
+ * the path to the image file
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(String path) {
+ Image image = m_imageMap.get(path);
+ if (image == null) {
+ try {
+ image = getImage(new FileInputStream(path));
+ m_imageMap.put(path, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(path, image);
+ }
+ }
+ return image;
+ }
+ /**
+ * Returns an {@link Image} stored in the file at the specified path relative to the specified class.
+ *
+ * @param clazz
+ * the {@link Class} relative to which to find the image
+ * @param path
+ * the path to the image file, if starts with <code>'/'</code>
+ * @return the {@link Image} stored in the file at the specified path
+ */
+ public static Image getImage(Class<?> clazz, String path) {
+ String key = clazz.getName() + '|' + path;
+ Image image = m_imageMap.get(key);
+ if (image == null) {
+ try {
+ image = getImage(clazz.getResourceAsStream(path));
+ m_imageMap.put(key, image);
+ } catch (Exception e) {
+ image = getMissingImage();
+ m_imageMap.put(key, image);
+ }
+ }
+ return image;
+ }
+ private static final int MISSING_IMAGE_SIZE = 10;
+ /**
+ * @return the small {@link Image} that can be used as placeholder for missing image.
+ */
+ private static Image getMissingImage() {
+ Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ //
+ GC gc = new GC(image);
+ gc.setBackground(getColor(SWT.COLOR_RED));
+ gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
+ gc.dispose();
+ //
+ return image;
+ }
+ /**
+ * Style constant for placing decorator image in top left corner of base image.
+ */
+ public static final int TOP_LEFT = 1;
+ /**
+ * Style constant for placing decorator image in top right corner of base image.
+ */
+ public static final int TOP_RIGHT = 2;
+ /**
+ * Style constant for placing decorator image in bottom left corner of base image.
+ */
+ public static final int BOTTOM_LEFT = 3;
+ /**
+ * Style constant for placing decorator image in bottom right corner of base image.
+ */
+ public static final int BOTTOM_RIGHT = 4;
+ /**
+ * Internal value.
+ */
+ protected static final int LAST_CORNER_KEY = 5;
+ /**
+ * Maps images to decorated images.
+ */
+ @SuppressWarnings("unchecked")
+ private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @return {@link Image} The resulting decorated image
+ */
+ public static Image decorateImage(Image baseImage, Image decorator) {
+ return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
+ }
+ /**
+ * Returns an {@link Image} composed of a base image decorated by another image.
+ *
+ * @param baseImage
+ * the base {@link Image} that should be decorated
+ * @param decorator
+ * the {@link Image} to decorate the base image
+ * @param corner
+ * the corner to place decorator image
+ * @return the resulting decorated {@link Image}
+ */
+ public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
+ if (corner <= 0 || corner >= LAST_CORNER_KEY) {
+ throw new IllegalArgumentException("Wrong decorate corner");
+ }
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
+ if (cornerDecoratedImageMap == null) {
+ cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
+ m_decoratedImageMap[corner] = cornerDecoratedImageMap;
+ }
+ Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
+ if (decoratedMap == null) {
+ decoratedMap = new HashMap<Image, Image>();
+ cornerDecoratedImageMap.put(baseImage, decoratedMap);
+ }
+ //
+ Image result = decoratedMap.get(decorator);
+ if (result == null) {
+ Rectangle bib = baseImage.getBounds();
+ Rectangle dib = decorator.getBounds();
+ //
+ result = new Image(Display.getCurrent(), bib.width, bib.height);
+ //
+ GC gc = new GC(result);
+ gc.drawImage(baseImage, 0, 0);
+ if (corner == TOP_LEFT) {
+ gc.drawImage(decorator, 0, 0);
+ } else if (corner == TOP_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, 0);
+ } else if (corner == BOTTOM_LEFT) {
+ gc.drawImage(decorator, 0, bib.height - dib.height);
+ } else if (corner == BOTTOM_RIGHT) {
+ gc.drawImage(decorator, bib.width - dib.width, bib.height - dib.height);
+ }
+ gc.dispose();
+ //
+ decoratedMap.put(decorator, result);
+ }
+ return result;
+ }
+ /**
+ * Dispose all of the cached {@link Image}'s.
+ */
+ public static void disposeImages() {
+ // dispose loaded images
+ {
+ for (Image image : m_imageMap.values()) {
+ image.dispose();
+ }
+ m_imageMap.clear();
+ }
+ // dispose decorated images
+ for (int i = 0; i < m_decoratedImageMap.length; i++) {
+ Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
+ if (cornerDecoratedImageMap != null) {
+ for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
+ for (Image image : decoratedMap.values()) {
+ image.dispose();
+ }
+ decoratedMap.clear();
+ }
+ cornerDecoratedImageMap.clear();
+ }
+ }
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Font
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps font names to fonts.
+ */
+ private static Map<String, Font> m_fontMap = new HashMap<String, Font>();
+ /**
+ * Maps fonts to their bold versions.
+ */
+ private static Map<Font, Font> m_fontToBoldFontMap = new HashMap<Font, Font>();
+ /**
+ * Returns a {@link Font} based on its name, height and style.
+ *
+ * @param name
+ * the name of the font
+ * @param height
+ * the height of the font
+ * @param style
+ * the style of the font
+ * @return {@link Font} The font matching the name, height and style
+ */
+ public static Font getFont(String name, int height, int style) {
+ return getFont(name, height, style, false, false);
+ }
+ /**
+ * Returns a {@link Font} based on its name, height and style. Windows-specific strikeout and underline
+ * flags are also supported.
+ *
+ * @param name
+ * the name of the font
+ * @param size
+ * the size of the font
+ * @param style
+ * the style of the font
+ * @param strikeout
+ * the strikeout flag (warning: Windows only)
+ * @param underline
+ * the underline flag (warning: Windows only)
+ * @return {@link Font} The font matching the name, height, style, strikeout and underline
+ */
+ public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) {
+ String fontName = name + '|' + size + '|' + style + '|' + strikeout + '|' + underline;
+ Font font = m_fontMap.get(fontName);
+ if (font == null) {
+ FontData fontData = new FontData(name, size, style);
+ if (strikeout || underline) {
+ try {
+ Class<?> logFontClass = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); //$NON-NLS-1$
+ Object logFont = FontData.class.getField("data").get(fontData); //$NON-NLS-1$
+ if (logFont != null && logFontClass != null) {
+ if (strikeout) {
+ logFontClass.getField("lfStrikeOut").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ if (underline) {
+ logFontClass.getField("lfUnderline").set(logFont, Byte.valueOf((byte) 1)); //$NON-NLS-1$
+ }
+ }
+ } catch (Throwable e) {
+ System.err.println("Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ font = new Font(Display.getCurrent(), fontData);
+ m_fontMap.put(fontName, font);
+ }
+ return font;
+ }
+ /**
+ * Returns a bold version of the given {@link Font}.
+ *
+ * @param baseFont
+ * the {@link Font} for which a bold version is desired
+ * @return the bold version of the given {@link Font}
+ */
+ public static Font getBoldFont(Font baseFont) {
+ Font font = m_fontToBoldFontMap.get(baseFont);
+ if (font == null) {
+ FontData fontDatas[] = baseFont.getFontData();
+ FontData data = fontDatas[0];
+ font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD);
+ m_fontToBoldFontMap.put(baseFont, font);
+ }
+ return font;
+ }
+ /**
+ * Dispose all of the cached {@link Font}'s.
+ */
+ public static void disposeFonts() {
+ // clear fonts
+ for (Font font : m_fontMap.values()) {
+ font.dispose();
+ }
+ m_fontMap.clear();
+ // clear bold fonts
+ for (Font font : m_fontToBoldFontMap.values()) {
+ font.dispose();
+ }
+ m_fontToBoldFontMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Cursor
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Maps IDs to cursors.
+ */
+ private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>();
+ /**
+ * Returns the system cursor matching the specific ID.
+ *
+ * @param id
+ * int The ID value for the cursor
+ * @return Cursor The system cursor matching the specific ID
+ */
+ public static Cursor getCursor(int id) {
+ Integer key = Integer.valueOf(id);
+ Cursor cursor = m_idToCursorMap.get(key);
+ if (cursor == null) {
+ cursor = new Cursor(Display.getDefault(), id);
+ m_idToCursorMap.put(key, cursor);
+ }
+ return cursor;
+ }
+ /**
+ * Dispose all of the cached cursors.
+ */
+ public static void disposeCursors() {
+ for (Cursor cursor : m_idToCursorMap.values()) {
+ cursor.dispose();
+ }
+ m_idToCursorMap.clear();
+ }
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // General
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ /**
+ * Dispose of cached objects and their underlying OS resources. This should only be called when the cached
+ * objects are no longer needed (e.g. on application shutdown).
+ */
+ public static void dispose() {
+ disposeColors();
+ disposeImages();
+ disposeFonts();
+ disposeCursors();
+ }
+} \ No newline at end of file
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java
new file mode 100644
index 00000000000..da8b9d8db2e
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateActionBarContributor.java
@@ -0,0 +1,446 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.edit.ui.action.ControlAction;
+import org.eclipse.emf.edit.ui.action.CreateChildAction;
+import org.eclipse.emf.edit.ui.action.CreateSiblingAction;
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.emf.edit.ui.action.ValidateAction;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IContributionManager;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.SubContributionItem;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * This is the action bar contributor for the DiagramTemplate model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class DiagramTemplateActionBarContributor extends EditingDomainActionBarContributor implements ISelectionChangedListener {
+
+ /**
+ * This keeps track of the active editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IEditorPart activeEditorPart;
+
+ /**
+ * This keeps track of the current selection provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected ISelectionProvider selectionProvider;
+
+ /**
+ * This action opens the Properties view.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IAction showPropertiesViewAction = new Action(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
+
+ @Override
+ public void run() {
+ try {
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
+ } catch (PartInitException exception) {
+ DiagramTemplateEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * This action refreshes the viewer of the current editor if the editor
+ * implements {@link org.eclipse.emf.common.ui.viewer.IViewerProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IAction refreshViewerAction = new Action(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_RefreshViewer_menu_item")) {
+
+ @Override
+ public boolean isEnabled() {
+ return activeEditorPart instanceof IViewerProvider;
+ }
+
+ @Override
+ public void run() {
+ if(activeEditorPart instanceof IViewerProvider) {
+ Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer();
+ if(viewer != null) {
+ viewer.refresh();
+ }
+ }
+ }
+ };
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateChildAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<IAction> createChildActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateChild actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IMenuManager createChildMenuManager;
+
+ /**
+ * This will contain one {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} corresponding to each descriptor
+ * generated for the current selection by the item provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<IAction> createSiblingActions;
+
+ /**
+ * This is the menu manager into which menu contribution items should be added for CreateSibling actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IMenuManager createSiblingMenuManager;
+
+ /**
+ * This creates an instance of the contributor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public DiagramTemplateActionBarContributor() {
+ super(ADDITIONS_LAST_STYLE);
+ loadResourceAction = new LoadResourceAction();
+ validateAction = new ValidateAction();
+ controlAction = new ControlAction();
+ }
+
+ /**
+ * This adds Separators for editor additions to the tool bar.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ toolBarManager.add(new Separator("diagramtemplate-settings"));
+ toolBarManager.add(new Separator("diagramtemplate-additions"));
+ }
+
+ /**
+ * This adds to the menu bar a menu and some separators for editor additions,
+ * as well as the sub-menus for object creation items.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void contributeToMenu(IMenuManager menuManager) {
+ super.contributeToMenu(menuManager);
+
+ IMenuManager submenuManager = new MenuManager(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_DiagramTemplateEditor_menu"), "org.eclipse.papyrus.diagramtemplate.diagramtemplateMenuID");
+ menuManager.insertAfter("additions", submenuManager);
+ submenuManager.add(new Separator("settings"));
+ submenuManager.add(new Separator("actions"));
+ submenuManager.add(new Separator("additions"));
+ submenuManager.add(new Separator("additions-end"));
+
+ // Prepare for CreateChild item addition or removal.
+ //
+ createChildMenuManager = new MenuManager(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ submenuManager.insertBefore("additions", createChildMenuManager);
+
+ // Prepare for CreateSibling item addition or removal.
+ //
+ createSiblingMenuManager = new MenuManager(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ submenuManager.insertBefore("additions", createSiblingMenuManager);
+
+ // Force an update because Eclipse hides empty menus now.
+ //
+ submenuManager.addMenuListener(new IMenuListener() {
+
+ public void menuAboutToShow(IMenuManager menuManager) {
+ menuManager.updateAll(true);
+ }
+ });
+
+ addGlobalActions(submenuManager);
+ }
+
+ /**
+ * When the active editor changes, this remembers the change and registers with it as a selection provider.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void setActiveEditor(IEditorPart part) {
+ super.setActiveEditor(part);
+ activeEditorPart = part;
+
+ // Switch to the new selection provider.
+ //
+ if(selectionProvider != null) {
+ selectionProvider.removeSelectionChangedListener(this);
+ }
+ if(part == null) {
+ selectionProvider = null;
+ } else {
+ selectionProvider = part.getSite().getSelectionProvider();
+ selectionProvider.addSelectionChangedListener(this);
+
+ // Fake a selection changed event to update the menus.
+ //
+ if(selectionProvider.getSelection() != null) {
+ selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
+ }
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionChangedListener},
+ * handling {@link org.eclipse.jface.viewers.SelectionChangedEvent}s by querying for the children and siblings
+ * that can be added to the selected object and updating the menus accordingly.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ // Remove any menu items for old selection.
+ //
+ if(createChildMenuManager != null) {
+ depopulateManager(createChildMenuManager, createChildActions);
+ }
+ if(createSiblingMenuManager != null) {
+ depopulateManager(createSiblingMenuManager, createSiblingActions);
+ }
+
+ // Query the new selection for appropriate new child/sibling descriptors
+ //
+ Collection<?> newChildDescriptors = null;
+ Collection<?> newSiblingDescriptors = null;
+
+ ISelection selection = event.getSelection();
+ if(selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
+ Object object = ((IStructuredSelection)selection).getFirstElement();
+
+ EditingDomain domain = ((IEditingDomainProvider)activeEditorPart).getEditingDomain();
+
+ newChildDescriptors = domain.getNewChildDescriptors(object, null);
+ newSiblingDescriptors = domain.getNewChildDescriptors(null, object);
+ }
+
+ // Generate actions for selection; populate and redraw the menus.
+ //
+ createChildActions = generateCreateChildActions(newChildDescriptors, selection);
+ createSiblingActions = generateCreateSiblingActions(newSiblingDescriptors, selection);
+
+ if(createChildMenuManager != null) {
+ populateManager(createChildMenuManager, createChildActions, null);
+ createChildMenuManager.update(true);
+ }
+ if(createSiblingMenuManager != null) {
+ populateManager(createSiblingMenuManager, createSiblingActions, null);
+ createSiblingMenuManager.update(true);
+ }
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if(descriptors != null) {
+ for(Object descriptor : descriptors) {
+ actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>,
+ * and returns the collection of these actions.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
+ Collection<IAction> actions = new ArrayList<IAction>();
+ if(descriptors != null) {
+ for(Object descriptor : descriptors) {
+ actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
+ }
+ }
+ return actions;
+ }
+
+ /**
+ * This populates the specified <code>manager</code> with {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection,
+ * by inserting them before the specified contribution item <code>contributionID</code>.
+ * If <code>contributionID</code> is <code>null</code>, they are simply added.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID) {
+ if(actions != null) {
+ for(IAction action : actions) {
+ if(contributionID != null) {
+ manager.insertBefore(contributionID, action);
+ } else {
+ manager.add(action);
+ }
+ }
+ }
+ }
+
+ /**
+ * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s
+ * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions) {
+ if(actions != null) {
+ IContributionItem[] items = manager.getItems();
+ for(int i = 0; i < items.length; i++) {
+ // Look into SubContributionItems
+ //
+ IContributionItem contributionItem = items[i];
+ while(contributionItem instanceof SubContributionItem) {
+ contributionItem = ((SubContributionItem)contributionItem).getInnerItem();
+ }
+
+ // Delete the ActionContributionItems with matching action.
+ //
+ if(contributionItem instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem)contributionItem).getAction();
+ if(actions.contains(action)) {
+ manager.remove(contributionItem);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This populates the pop-up menu before it appears.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public void menuAboutToShow(IMenuManager menuManager) {
+ super.menuAboutToShow(menuManager);
+ MenuManager submenuManager = null;
+
+ submenuManager = new MenuManager(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ populateManager(submenuManager, createChildActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+
+ submenuManager = new MenuManager(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
+ populateManager(submenuManager, createSiblingActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+ }
+
+ /**
+ * This inserts global actions before the "additions-end" separator.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected void addGlobalActions(IMenuManager menuManager) {
+ menuManager.insertAfter("additions-end", new Separator("ui-actions"));
+ menuManager.insertAfter("ui-actions", showPropertiesViewAction);
+
+ refreshViewerAction.setEnabled(refreshViewerAction.isEnabled());
+ menuManager.insertAfter("ui-actions", refreshViewerAction);
+
+ super.addGlobalActions(menuManager);
+ }
+
+ /**
+ * This ensures that a delete action will clean up all references to deleted objects.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected boolean removeAllReferencesOnDelete() {
+ return true;
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java
new file mode 100644
index 00000000000..d700f9e0b80
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditor.java
@@ -0,0 +1,1589 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.EventObject;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+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.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.MoveCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxCellEditor;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.EditingSupport;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ICheckStateProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.TreeViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.papyrus.core.extension.commands.CreationCommandDescriptor;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+import org.eclipse.papyrus.diagramtemplate.Template;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.DiagramDefinitionContentProvider;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.DiagramDefinitionLabelProvider;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.DiagramKindContentProvider;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.ElementsAvailableContentProvider;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.ForContentProvider;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.ForLabelProvider;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.TypesAvailableFromEReferenceContentProvider;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.TypesContentProvider;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.WhatContentProvider;
+import org.eclipse.papyrus.diagramtemplate.launcher.DiagramTemplateLauncher;
+import org.eclipse.papyrus.diagramtemplate.provider.DiagramTemplateItemProviderAdapterFactory;
+import org.eclipse.papyrus.diagramtemplate.utils.Messages;
+import org.eclipse.papyrus.wizards.category.DiagramCategoryDescriptor;
+import org.eclipse.papyrus.wizards.category.DiagramCategoryRegistry;
+import org.eclipse.papyrus.wizards.kind.DiagramKindLabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.CheckedTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ElementTreeSelectionDialog;
+import org.eclipse.ui.dialogs.ListSelectionDialog;
+import org.eclipse.ui.model.BaseWorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.part.EditorPart;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
+import org.eclipse.uml2.uml.resource.UMLResource;
+
+import com.swtdesigner.ResourceManager;
+
+
+/**
+ * The template model editor.
+ *
+ */
+public class DiagramTemplateEditor extends EditorPart {
+
+
+ private static final String DEFAULT_NAME = Messages.DiagramTemplateEditor_0;
+
+ private static final String DEFAULT_PREFIX = Messages.DiagramTemplateEditor_1;
+
+ /**
+ * Text widget to show the target model's path
+ */
+ private Text targetModelPathText;
+
+ /**
+ * Table widget to edit the diagram definitions
+ */
+ private Table diagramDefinitionTable;
+
+ /**
+ * TableViewer widget to edit the diagram definitions
+ */
+ private TableViewer diagramDefinitionTableViewer;
+
+ /**
+ * Text widget to edit the diagram definition's name
+ */
+ private Text nameText;
+
+ /**
+ * Text widget to edit the prefix used to generate the diagram name
+ */
+ private Text prefixText;
+
+ /**
+ * Text widget to edit the root to start the search from
+ */
+ private Text rootText;
+
+ /**
+ * Text widget to edit the diagram definition's description
+ */
+ private Text descriptionText;
+
+ /**
+ * Table widget to select the diagram kind to generate
+ */
+ private Table diagramTable;
+
+ /**
+ * CheckboxTableViewer widget to select the diagram kind to generate
+ */
+ private CheckboxTableViewer diagramCheckboxTableViewer;
+
+ /**
+ * Table widget to edit the diagram definition's selection
+ */
+ private Table whatTable;
+
+ /**
+ * TableViewer widget to edit the diagram definition's selection
+ */
+ private TableViewer whatTableViewer;
+
+ /**
+ * Tree widget to edit the diagram definition's selection
+ */
+ private Tree forTree;
+
+ /**
+ * TreeViewer widget to edit the diagram definition's selection
+ */
+ private TreeViewer forTreeViewer;
+
+ /**
+ * Button widget to add a diagram definition
+ */
+ private Button addDiagramDefinitionButton;
+
+ /**
+ * Button widget to select the root of the diagram definition
+ */
+ private Button selectRootButton;
+
+ /**
+ * Button widget to add a specificFor selection
+ */
+ private Button specificForButton;
+
+ /**
+ * Button widget to add a specificWhat selection
+ */
+ private Button specificWhatButton;
+
+ /**
+ * Button widget to load a target model
+ */
+ private Button loadModelButton;
+
+ /**
+ * Button widget to execute the template
+ */
+ private Button executeButton;
+
+ /**
+ * List of diagram categories to consider
+ */
+ List<String> diagramCategories = new ArrayList<String>();
+
+ /**
+ * The IFile object corresponding to the model to process
+ */
+ private IFile modelFile;
+
+ /**
+ * The ResourceSet object corresponding to the model to process
+ */
+ private ResourceSet targetModelResourceSet;
+
+ /**
+ * The Resource object corresponding to the model to process
+ */
+ private Resource targetModelResource = null;
+
+ /**
+ * This is the one adapter factory used for providing views of the model.
+ */
+ protected ComposedAdapterFactory adapterFactory;
+
+ /**
+ * This keeps track of the editing domain that is used to track all changes to the model.
+ *
+ * @generated
+ */
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ /**
+ * Map to store the diagnostic associated with a resource.
+ *
+ * @generated
+ */
+ protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
+
+ /**
+ * The diagram definition under edition
+ */
+ private DiagramDefinition currentDiagramDefinition;
+
+ /**
+ * The resource for the template
+ */
+ private Resource templateResource;
+
+ /**
+ * The template
+ */
+ private Template template;
+
+ private DiagramTemplateFactory diagramtemplateFactory;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public DiagramTemplateEditor() {
+ super();
+ initializeEditingDomain();
+
+ initializeDiagramCategories();
+
+ DiagramTemplatePackage diagramtemplatePackage = DiagramTemplatePackage.eINSTANCE;
+ diagramtemplateFactory = diagramtemplatePackage.getDiagramTemplateFactory();
+ }
+
+ /**
+ * This looks up a string in plugin.properties, making a substitution.
+ *
+ * @generated
+ */
+ private static String getString(String key, Object s1) {
+ return DiagramTemplateEditorPlugin.INSTANCE.getString(key, new Object[]{ s1 });
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
+ *
+ * @generated NOT
+ */
+ protected boolean createModel() {
+ URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ Exception exception = null;
+
+ try {
+ // Load the resource through the editing domain.
+ templateResource = editingDomain.getResourceSet().getResource(resourceURI, true);
+ } catch (Exception e) {
+ exception = e;
+ templateResource = editingDomain.getResourceSet().getResource(resourceURI, false);
+ }
+
+ Diagnostic diagnostic = analyzeResourceProblems(templateResource, exception);
+ if(diagnostic.getSeverity() != Diagnostic.OK) {
+ //Failed to load
+ MessageDialog.openError(getSite().getShell(), Messages.DiagramTemplateEditor_2, Messages.DiagramTemplateEditor_3);
+ return false;
+ } else {
+
+ if(templateResource.getContents().isEmpty()) {
+ //Create the template
+ template = diagramtemplateFactory.createTemplate();
+ templateResource.getContents().add(template);
+ } else {
+ //Load the template
+ template = (Template)templateResource.getContents().get(0);
+ if(template.getTargetRoot() != null) {
+ Resource res = template.getTargetRoot().eResource();
+ if(res != null) {
+ targetModelResource = res;
+ } else {
+ MessageDialog.openError(getSite().getShell(), Messages.DiagramTemplateEditor_4, Messages.DiagramTemplateEditor_5);
+ }
+ }
+ }
+
+ }
+ return true;
+ }
+
+ /**
+ * Helper method to load a model
+ *
+ * @param resourceSet
+ * the resourceSet to load the model in
+ * @param file
+ * the file corresponding to the model to load
+ * @return the resource corresponding to the model
+ */
+ protected Resource loadModel(ResourceSet resourceSet, IFile file) {
+
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.Factory.Registry.DEFAULT_EXTENSION, UMLResource.Factory.INSTANCE);
+
+ return resourceSet.getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true);
+ }
+
+ /**
+ * Helper method to update rootText widget
+ */
+ protected void updateRootText() {
+ if(currentDiagramDefinition.getFromRoot() instanceof NamedElement) {
+ rootText.setText(((NamedElement)currentDiagramDefinition.getFromRoot()).getQualifiedName());
+ } else {
+ rootText.setText(currentDiagramDefinition.getFromRoot().toString());
+ }
+ }
+
+ /**
+ * Helper method to update the UI
+ */
+ protected void updateUI() {
+ diagramDefinitionTableViewer.refresh();
+ forTreeViewer.setInput(currentDiagramDefinition.getSelection());
+ forTreeViewer.refresh();
+ whatTableViewer.refresh();
+ diagramCheckboxTableViewer.refresh();
+
+ nameText.setText(currentDiagramDefinition.getName());
+ descriptionText.setText(currentDiagramDefinition.getDescription());
+ prefixText.setText(currentDiagramDefinition.getPrefix());
+ if(currentDiagramDefinition.getFromRoot() != null) {
+ updateRootText();
+ } else {
+ rootText.setText(""); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Helper method to initialize the diagram categories (kinds)
+ */
+ protected void initializeDiagramCategories() {
+ for(DiagramCategoryDescriptor diagramCategoryDescriptor : DiagramCategoryRegistry.getInstance().getDiagramCategories()) {
+ diagramCategories.add(diagramCategoryDescriptor.getLabel());
+ }
+ }
+
+ /**
+ * Helper method used to check if the element is already defined
+ *
+ * @param object
+ * the element to find
+ * @param list
+ * the list to search in
+ * @return
+ * true if found false else
+ */
+ protected boolean containsElement(EObject object, List<?> list) {
+ if(list != null) {
+ for(Object selection : list) {
+ if(((AbstractSelection)selection).getElement() == object) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Helper method to clear the template of specific information
+ */
+ protected void clearTemplate() {
+ TreeIterator<EObject> it = template.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = (EObject)it.next();
+ if(eObject instanceof DiagramDefinition) {
+ ((DiagramDefinition)eObject).setFromRoot(null);
+ } else if(eObject instanceof Selection) {
+ if(((AbstractSelection)eObject).getKind() != SelectionKind.FOR_ALL) {
+ RemoveCommand command = new RemoveCommand(editingDomain, ((Selection)eObject).eContainer(), ((Selection)eObject).eContainer().eClass().getEStructuralFeature("selection"), eObject); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ it = template.eAllContents();
+ }
+ } else if(eObject instanceof SelectionRef) {
+ if(((AbstractSelection)eObject).getKind() != SelectionKind.FOR_ALL) {
+ RemoveCommand command = new RemoveCommand(editingDomain, ((SelectionRef)eObject).eContainer(), ((SelectionRef)eObject).eContainer().eClass().getEStructuralFeature("selectionRef"), eObject); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ it = template.eAllContents();
+ }
+ }
+
+
+
+ }
+
+ SetCommand command = new SetCommand(editingDomain, template, template.eClass().getEStructuralFeature("targetRoot"), null); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+
+
+ modelFile = null;
+ targetModelPathText.setText(""); //$NON-NLS-1$
+ targetModelResourceSet = null;
+ targetModelResource = null;
+
+ loadModelButton.setEnabled(true);
+ selectRootButton.setEnabled(false);
+ executeButton.setEnabled(false);
+ specificForButton.setEnabled(false);
+
+ updateUI();
+ }
+
+ /**
+ * Helper method to create a new diagram definition
+ */
+ protected void createNewDiagramDefinition() {
+ currentDiagramDefinition = diagramtemplateFactory.createDiagramDefinition();
+ currentDiagramDefinition.setName(DEFAULT_NAME);
+ currentDiagramDefinition.setDescription(""); //$NON-NLS-1$
+ currentDiagramDefinition.setPrefix(DEFAULT_PREFIX);
+
+ if(targetModelResource != null) {
+ currentDiagramDefinition.setFromRoot(targetModelResource.getContents().get(0));
+ }
+
+ //Update UI
+ updateUI();
+
+ addDiagramDefinitionButton.setEnabled(true);
+ }
+
+ /**
+ * Returns a diagnostic describing the errors and warnings listed in the resource
+ * and the specified exception (if any).
+ *
+ * @generated
+ */
+ public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
+ if(!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.papyrus.diagramtemplate.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[]{ exception == null ? (Object)resource : exception }); //$NON-NLS-1$ //$NON-NLS-2$
+ basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
+ return basicDiagnostic;
+ } else if(exception != null) {
+ return new BasicDiagnostic(Diagnostic.ERROR, "org.eclipse.papyrus.diagramtemplate.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[]{ exception }); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ return Diagnostic.OK_INSTANCE;
+ }
+ }
+
+
+ /**
+ * This sets up the editing domain for the model editor.
+ *
+ * @generated
+ */
+ protected void initializeEditingDomain() {
+ // Create an adapter factory that yields item providers.
+ adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+
+ adapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new DiagramTemplateItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new UMLItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+
+ // Create the command stack that will notify this editor as commands are executed.
+ BasicCommandStack commandStack = new BasicCommandStack();
+
+ // Add a listener to set the most recent command's affected objects to be the selection of the viewer with focus.
+ commandStack.addCommandStackListener(new CommandStackListener() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void commandStackChanged(EventObject event) {
+ updateUI();
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ });
+
+ // Create the editing domain with a special command stack.
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
+ }
+
+ /**
+ * This returns whether something has been persisted to the URI of the specified resource.
+ * The implementation uses the URI converter from the editor's resource set to try to open an input stream.
+ *
+ * @generated
+ */
+ protected boolean isPersisted(Resource resource) {
+ boolean result = false;
+ try {
+ InputStream stream = editingDomain.getResourceSet().getURIConverter().createInputStream(resource.getURI());
+ if(stream != null) {
+ result = true;
+ stream.close();
+ }
+ } catch (IOException e) {
+ // Ignore
+ }
+ return result;
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ // Save only resources that have actually changed.
+ //
+ final Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+
+ // Do the work within an operation because this is a long running activity that modifies the workbench.
+ //
+ WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
+
+ // This is the method that gets invoked when the operation runs.
+ //
+ @Override
+ public void execute(IProgressMonitor monitor) {
+ // Save the resources to the file system.
+ //
+ boolean first = true;
+ for(Resource resource : editingDomain.getResourceSet().getResources()) {
+ if((first || !resource.getContents().isEmpty() || isPersisted(resource)) && !editingDomain.isReadOnly(resource)) {
+ try {
+ resource.save(saveOptions);
+ } catch (Exception exception) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ first = false;
+ }
+ }
+ }
+ };
+
+ try {
+
+ new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
+
+ ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ } catch (Exception exception) {
+ // Something went wrong that shouldn't.
+ //
+ DiagramTemplateEditorPlugin.INSTANCE.log(exception);
+ }
+
+ }
+
+ @Override
+ public void doSaveAs() {
+
+ }
+
+ @Override
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ setSite(site);
+ setInputWithNotify(input);
+ setPartName(input.getName());
+ }
+
+ @Override
+ public boolean isDirty() {
+ return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ private void createloadPart(Composite parent) {
+
+ Composite loadComposite = new Composite(parent, SWT.NONE);
+ loadComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ loadComposite.setLayout(new GridLayout(5, false));
+
+ executeButton = new Button(loadComposite, SWT.NONE);
+ executeButton.setText(Messages.DiagramTemplateEditor_15);
+ executeButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/execute.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ executeButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ if(targetModelResource != null) {
+ DiagramTemplateLauncher launcher = DiagramTemplateLauncher.getInstance();
+ launcher.execute(template);
+ } else {
+ MessageDialog.openInformation(getSite().getShell(), Messages.DiagramTemplateEditor_18, Messages.DiagramTemplateEditor_19);
+ }
+ }
+ });
+ executeButton.setEnabled(false);
+
+ Label loadLabel = new Label(loadComposite, SWT.NONE);
+ loadLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ loadLabel.setText(Messages.DiagramTemplateEditor_20);
+
+ targetModelPathText = new Text(loadComposite, SWT.BORDER);
+ targetModelPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ targetModelPathText.setEditable(false);
+
+ loadModelButton = new Button(loadComposite, SWT.NONE);
+ loadModelButton.setText(Messages.DiagramTemplateEditor_21);
+ loadModelButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getSite().getShell(), new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
+ dialog.addFilter(new ViewerFilter() {
+
+ //Show only element with UML extension
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if(element instanceof IContainer) {
+ return true;
+ } else {
+ if(((IFile)element).getFileExtension().compareToIgnoreCase("uml") == 0) { //$NON-NLS-1$
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ }
+ });
+ dialog.setAllowMultiple(false);
+ dialog.setTitle(Messages.DiagramTemplateEditor_23);
+ dialog.setMessage(Messages.DiagramTemplateEditor_24);
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.open();
+
+ Object result = dialog.getFirstResult();
+ if(result instanceof IFile) {
+ modelFile = (IFile)dialog.getFirstResult();
+ targetModelResourceSet = new ResourceSetImpl();
+ targetModelResource = loadModel(targetModelResourceSet, modelFile);
+ targetModelPathText.setText(targetModelResource.getURI().toString());
+
+ SetCommand command = new SetCommand(editingDomain, template, template.eClass().getEStructuralFeature("targetRoot"), targetModelResource.getContents().get(0)); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+
+ //Set fromRoots automatically
+ for(DiagramDefinition diagramDefinition : template.getDiagramDefinitions()) {
+ diagramDefinition.setFromRoot(targetModelResource.getContents().get(0));
+ }
+
+ selectRootButton.setEnabled(true);
+ loadModelButton.setEnabled(false);
+ specificForButton.setEnabled(true);
+ executeButton.setEnabled(true);
+
+ updateUI();
+ }
+ }
+ });
+
+ Button clearButton = new Button(loadComposite, SWT.NONE);
+ clearButton.setText(Messages.DiagramTemplateEditor_26);
+ clearButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ if(MessageDialog.openConfirm(getSite().getShell(), Messages.DiagramTemplateEditor_27, Messages.DiagramTemplateEditor_28)) {
+ clearTemplate();
+ }
+ }
+ });
+ }
+
+ private void createDiagramDefinitionPart(Composite parent) {
+ Composite diagramDefinitionPartComposite = new Composite(parent, SWT.NONE);
+ diagramDefinitionPartComposite.setLayout(new GridLayout(1, false));
+
+ Composite diagramDefinitionButtonsComposite = new Composite(diagramDefinitionPartComposite, SWT.NONE);
+ GridLayout gl_diagramDefinitionButtonsComposite = new GridLayout(6, false);
+ gl_diagramDefinitionButtonsComposite.horizontalSpacing = 0;
+ gl_diagramDefinitionButtonsComposite.verticalSpacing = 1;
+ gl_diagramDefinitionButtonsComposite.marginWidth = 0;
+ gl_diagramDefinitionButtonsComposite.marginHeight = 0;
+ diagramDefinitionButtonsComposite.setLayout(gl_diagramDefinitionButtonsComposite);
+ diagramDefinitionButtonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
+
+ Button newDiagramDefinitionButton = new Button(diagramDefinitionButtonsComposite, SWT.NONE);
+ newDiagramDefinitionButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/new.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ newDiagramDefinitionButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ createNewDiagramDefinition();
+ addDiagramDefinitionButton.setEnabled(true);
+ }
+ });
+
+ addDiagramDefinitionButton = new Button(diagramDefinitionButtonsComposite, SWT.NONE);
+ addDiagramDefinitionButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/add.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ addDiagramDefinitionButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ if(currentDiagramDefinition.getDiagramKind() != null) {
+ if(template != null) {
+ AddCommand command = new AddCommand(editingDomain, template, template.eClass().getEStructuralFeature("diagramDefinitions"), currentDiagramDefinition); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ createNewDiagramDefinition();
+ } else {
+ MessageDialog.openWarning(getSite().getShell(), Messages.DiagramTemplateEditor_34, Messages.DiagramTemplateEditor_35);
+ }
+ }
+ });
+
+ Button removeDiagramDefinitionButton = new Button(diagramDefinitionButtonsComposite, SWT.NONE);
+ removeDiagramDefinitionButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/delete.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ removeDiagramDefinitionButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = diagramDefinitionTableViewer.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ Iterator it = ((IStructuredSelection)selection).iterator();
+ while(it.hasNext()) {
+ Object object = (Object)it.next();
+
+ RemoveCommand command = new RemoveCommand(editingDomain, template, template.eClass().getEStructuralFeature("diagramDefinitions"), object); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+
+ }
+
+ diagramDefinitionTableViewer.refresh();
+ createNewDiagramDefinition();
+ }
+ }
+ });
+
+ Button moveUpDiagramDefinitionButton = new Button(diagramDefinitionButtonsComposite, SWT.NONE);
+ moveUpDiagramDefinitionButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/up.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ moveUpDiagramDefinitionButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = diagramDefinitionTableViewer.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ DiagramDefinition diagramDefinition = (DiagramDefinition)((IStructuredSelection)selection).getFirstElement();
+ MoveCommand command = new MoveCommand(editingDomain, template, template.eClass().getEStructuralFeature("diagramDefinitions"), diagramDefinition, template.getDiagramDefinitions().indexOf(diagramDefinition) - 1); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+
+ diagramDefinitionTableViewer.refresh();
+ }
+ }
+ });
+
+ Button moveDownDiagramDefinitionButton = new Button(diagramDefinitionButtonsComposite, SWT.NONE);
+ moveDownDiagramDefinitionButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/down.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ moveDownDiagramDefinitionButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = diagramDefinitionTableViewer.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ DiagramDefinition diagramDefinition = (DiagramDefinition)((IStructuredSelection)selection).getFirstElement();
+ MoveCommand command = new MoveCommand(editingDomain, template, template.eClass().getEStructuralFeature("diagramDefinitions"), diagramDefinition, template.getDiagramDefinitions().indexOf(diagramDefinition) + 1); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+
+ diagramDefinitionTableViewer.refresh();
+ }
+ }
+ });
+
+ Button copyDiagramDefinitionButton = new Button(diagramDefinitionButtonsComposite, SWT.NONE);
+ copyDiagramDefinitionButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/copy.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ copyDiagramDefinitionButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = diagramDefinitionTableViewer.getSelection();
+
+ if(selection != null && !selection.isEmpty()) {
+ if(selection instanceof IStructuredSelection) {
+ DiagramDefinition diagramDefinition = (DiagramDefinition)((IStructuredSelection)selection).getFirstElement();
+
+ Copier copier = new Copier();
+ DiagramDefinition diagramDefinitionCopy = (DiagramDefinition)copier.copy(diagramDefinition);
+ copier.copyReferences();
+
+ diagramDefinitionCopy.setName(Messages.DiagramTemplateEditor_47 + diagramDefinitionCopy.getName());
+
+ if(template != null) {
+ AddCommand command = new AddCommand(editingDomain, template, template.eClass().getEStructuralFeature("diagramDefinitions"), diagramDefinitionCopy); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ createNewDiagramDefinition();
+ }
+ }
+ }
+ });
+
+ diagramDefinitionTableViewer = new TableViewer(diagramDefinitionPartComposite, SWT.BORDER | SWT.FULL_SELECTION);
+ diagramDefinitionTable = diagramDefinitionTableViewer.getTable();
+ diagramDefinitionTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
+ diagramDefinitionTableViewer.setContentProvider(new DiagramDefinitionContentProvider());
+ diagramDefinitionTableViewer.setLabelProvider(new DiagramDefinitionLabelProvider());
+ diagramDefinitionTableViewer.setInput(template.getDiagramDefinitions());
+ diagramDefinitionTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ if(event.getSelection() instanceof IStructuredSelection && !event.getSelection().isEmpty()) {
+
+ currentDiagramDefinition = (DiagramDefinition)((IStructuredSelection)event.getSelection()).getFirstElement();
+
+ //Update UI
+ updateUI();
+
+ //We are under edition of an existing diagram definition: we cannot add
+ addDiagramDefinitionButton.setEnabled(false);
+ }
+ }
+ });
+
+
+ }
+
+ private void createDiagramInformationPart(Composite parent) {
+ Composite diagramInformationComposite = new Composite(parent, SWT.NONE);
+ diagramInformationComposite.setLayout(new GridLayout(5, false));
+
+ Label nameLabel = new Label(diagramInformationComposite, SWT.NONE);
+ nameLabel.setText(Messages.DiagramTemplateEditor_49);
+
+ nameText = new Text(diagramInformationComposite, SWT.BORDER);
+ nameText.addFocusListener(new FocusAdapter() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ SetCommand command = new SetCommand(editingDomain, currentDiagramDefinition, currentDiagramDefinition.eClass().getEStructuralFeature("name"), nameText.getText()); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ });
+ nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+
+ Label descriptionLabel = new Label(diagramInformationComposite, SWT.NONE);
+ descriptionLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 3));
+ descriptionLabel.setText(Messages.DiagramTemplateEditor_51);
+
+ descriptionText = new Text(diagramInformationComposite, SWT.BORDER | SWT.MULTI);
+ descriptionText.addFocusListener(new FocusAdapter() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ SetCommand command = new SetCommand(editingDomain, currentDiagramDefinition, currentDiagramDefinition.eClass().getEStructuralFeature("description"), descriptionText.getText()); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ });
+ descriptionText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 3));
+
+ Label prefixLabel = new Label(diagramInformationComposite, SWT.NONE);
+ prefixLabel.setText(Messages.DiagramTemplateEditor_53);
+
+ prefixText = new Text(diagramInformationComposite, SWT.BORDER);
+ prefixText.addFocusListener(new FocusAdapter() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ SetCommand command = new SetCommand(editingDomain, currentDiagramDefinition, currentDiagramDefinition.eClass().getEStructuralFeature("prefix"), prefixText.getText()); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ });
+ prefixText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+
+ Label rootLabel = new Label(diagramInformationComposite, SWT.NONE);
+ rootLabel.setText(Messages.DiagramTemplateEditor_55);
+
+ rootText = new Text(diagramInformationComposite, SWT.BORDER);
+ rootText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ rootText.setEditable(false);
+
+ selectRootButton = new Button(diagramInformationComposite, SWT.NONE);
+ selectRootButton.setText(Messages.DiagramTemplateEditor_56);
+ selectRootButton.setEnabled(false);
+ selectRootButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+
+ ElementTreeSelectionDialog dlg = new ElementTreeSelectionDialog(getSite().getShell(), new AdapterFactoryLabelProvider(adapterFactory), new AdapterFactoryContentProvider(adapterFactory));
+ dlg.addFilter(new ViewerFilter() {
+
+ //Show only eObject element
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if(element instanceof EObject) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ });
+ dlg.setAllowMultiple(false);
+ dlg.setTitle(Messages.DiagramTemplateEditor_57);
+ dlg.setMessage(Messages.DiagramTemplateEditor_58);
+ dlg.setInput(targetModelResource);
+ dlg.open();
+
+ Object result = dlg.getFirstResult();
+ if(result instanceof EObject) {
+ SetCommand command = new SetCommand(editingDomain, currentDiagramDefinition, currentDiagramDefinition.eClass().getEStructuralFeature("fromRoot"), result); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+
+ updateRootText();
+ }
+
+ }
+
+ });
+
+ Label diagramLabel = new Label(diagramInformationComposite, SWT.NONE);
+ diagramLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 5, 1));
+ diagramLabel.setText(Messages.DiagramTemplateEditor_60);
+
+ diagramCheckboxTableViewer = CheckboxTableViewer.newCheckList(diagramInformationComposite, SWT.BORDER | SWT.FULL_SELECTION);
+ diagramTable = diagramCheckboxTableViewer.getTable();
+ diagramTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));
+ diagramCheckboxTableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ Object element = event.getElement();
+ if(element instanceof CreationCommandDescriptor) {
+ SetCommand command = new SetCommand(editingDomain, currentDiagramDefinition, currentDiagramDefinition.eClass().getEStructuralFeature("diagramKind"), ((CreationCommandDescriptor)element).getCommandId()); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+
+ diagramCheckboxTableViewer.setCheckedElements(new Object[0]);
+ diagramCheckboxTableViewer.setChecked(element, true);
+ }
+ });
+ diagramCheckboxTableViewer.setContentProvider(new DiagramKindContentProvider());
+ diagramCheckboxTableViewer.setLabelProvider(new DiagramKindLabelProvider());
+ diagramCheckboxTableViewer.setInput(diagramCategories);
+
+ diagramCheckboxTableViewer.setCheckStateProvider(new ICheckStateProvider() {
+
+ public boolean isGrayed(Object element) {
+ return false;
+ }
+
+ public boolean isChecked(Object element) {
+ if(currentDiagramDefinition != null) {
+ if(element instanceof CreationCommandDescriptor && currentDiagramDefinition.getDiagramKind() != null) {
+ return ((CreationCommandDescriptor)element).getCommandId().equals(currentDiagramDefinition.getDiagramKind());
+ }
+ }
+ return false;
+ }
+ });
+ }
+
+ private void createSelectionPart(Composite parent) {
+ SashForm selectionPartSashForm = new SashForm(parent, SWT.NONE);
+
+ Composite forPartComposite = new Composite(selectionPartSashForm, SWT.NONE);
+ forPartComposite.setLayout(new GridLayout(1, false));
+
+ Composite forButtonsComposite = new Composite(forPartComposite, SWT.NONE);
+ GridLayout gl_forButtonsComposite = new GridLayout(6, false);
+ gl_forButtonsComposite.verticalSpacing = 0;
+ gl_forButtonsComposite.horizontalSpacing = 0;
+ gl_forButtonsComposite.marginHeight = 0;
+ gl_forButtonsComposite.marginWidth = 0;
+ forButtonsComposite.setLayout(gl_forButtonsComposite);
+ forButtonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+
+ Label forLabel = new Label(forButtonsComposite, SWT.NONE);
+ forLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
+ forLabel.setText(Messages.DiagramTemplateEditor_64);
+
+ Button allForButton = new Button(forButtonsComposite, SWT.NONE);
+ allForButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/forAll.png")); //$NON-NLS-1$ //$NON-NLS-2$
+ allForButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+
+ List<EObject> listOfTypes = new ArrayList<EObject>();
+ UMLPackage umlPackage = UMLPackage.eINSTANCE;
+ TreeIterator<EObject> it = umlPackage.eAllContents();
+ while(it.hasNext()) {
+ EObject typeInUML = (EObject)it.next();
+ if(typeInUML instanceof EClass) {
+ if(targetModelResource != null) {
+ if(!targetModelResource.getContents().isEmpty()) {
+ //If the element is a type available in the model
+ TreeIterator<EObject> itTarget = targetModelResource.getAllContents();
+ while(itTarget.hasNext()) {
+ EObject elementInTargetModel = (EObject)itTarget.next();
+
+ if(typeInUML == elementInTargetModel.eClass() && !listOfTypes.contains(typeInUML)) {
+ listOfTypes.add(typeInUML);
+ }
+ }
+ }
+ } else {
+ listOfTypes.add(typeInUML);
+ }
+ }
+ }
+
+ ListSelectionDialog dlg = new ListSelectionDialog(getSite().getShell(), listOfTypes, new TypesContentProvider(), new AdapterFactoryLabelProvider(adapterFactory), Messages.DiagramTemplateEditor_67);
+ dlg.setTitle(Messages.DiagramTemplateEditor_68);
+ dlg.open();
+
+ Object[] results = dlg.getResult();
+ if(results != null) {
+ for(Object object : results) {
+ if(object instanceof EClass) {
+
+ if(!containsElement((EClass)object, currentDiagramDefinition.getSelection())) {
+
+ Selection selection = diagramtemplateFactory.createSelection();
+ selection.setKind(SelectionKind.FOR_ALL);
+ selection.setRecursively(false);
+ selection.setSubTypes(false);
+ selection.setStereotypedBy(""); //$NON-NLS-1$
+ selection.setElement((EClass)object);
+
+ AddCommand command = new AddCommand(editingDomain, currentDiagramDefinition, currentDiagramDefinition.eClass().getEStructuralFeature("selection"), selection); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+
+
+ }
+ }
+ }
+ forTreeViewer.refresh();
+ }
+ }
+
+ });
+ allForButton.setText(Messages.DiagramTemplateEditor_71);
+
+ specificForButton = new Button(forButtonsComposite, SWT.NONE);
+ specificForButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/specific.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ specificForButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ if(targetModelResource != null) {
+ CheckedTreeSelectionDialog dlg = new CheckedTreeSelectionDialog(getSite().getShell(), new AdapterFactoryLabelProvider(adapterFactory), new AdapterFactoryContentProvider(adapterFactory));
+ dlg.setInput(targetModelResource);
+ dlg.setTitle(Messages.DiagramTemplateEditor_74);
+ dlg.open();
+
+ Object[] results = dlg.getResult();
+ if(results != null) {
+ for(Object object : results) {
+ if(object instanceof EObject) {
+
+ if(!containsElement((EObject)object, currentDiagramDefinition.getSelection())) {
+ Selection selection = diagramtemplateFactory.createSelection();
+ selection.setKind(SelectionKind.SPECIFIC);
+ selection.setRecursively(false);
+ selection.setSubTypes(false);
+ selection.setStereotypedBy(""); //$NON-NLS-1$
+ selection.setElement((EObject)object);
+
+ // currentDiagramDefinition.getSelection().add(selection);
+ AddCommand command = new AddCommand(editingDomain, currentDiagramDefinition, currentDiagramDefinition.eClass().getEStructuralFeature("selection"), selection); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ }
+ }
+ forTreeViewer.refresh();
+ }
+ }
+ }
+
+ });
+ specificForButton.setText(Messages.DiagramTemplateEditor_77);
+ specificForButton.setEnabled(false);
+
+ Button removeForButton = new Button(forButtonsComposite, SWT.NONE);
+ removeForButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = forTreeViewer.getSelection();
+ if(selection != null && selection instanceof ITreeSelection) {
+ Iterator it = ((ITreeSelection)selection).iterator();
+ while(it.hasNext()) {
+ Object object = (Object)it.next();
+ // removeSelection((AbstractSelection)object);
+ if(object instanceof Selection) {
+ RemoveCommand command = new RemoveCommand(editingDomain, ((Selection)object).eContainer(), ((Selection)object).eContainer().eClass().getEStructuralFeature("selection"), object); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ } else if(object instanceof SelectionRef) {
+ RemoveCommand command = new RemoveCommand(editingDomain, ((SelectionRef)object).eContainer(), ((SelectionRef)object).eContainer().eClass().getEStructuralFeature("selectionRef"), object); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ }
+ forTreeViewer.refresh();
+ }
+ }
+ });
+ removeForButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/delete.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+
+
+ Button moveUpForButton = new Button(forButtonsComposite, SWT.NONE);
+ moveUpForButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = forTreeViewer.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ AbstractSelection abstractSelection = (AbstractSelection)((IStructuredSelection)selection).getFirstElement();
+ if(abstractSelection instanceof Selection) {
+ MoveCommand command = new MoveCommand(editingDomain, abstractSelection.eContainer(), abstractSelection.eContainer().eClass().getEStructuralFeature("selection"), abstractSelection, ((DiagramDefinition)abstractSelection.eContainer()).getSelection().indexOf(abstractSelection) - 1); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ } else if(abstractSelection instanceof SelectionRef) {
+ MoveCommand command = new MoveCommand(editingDomain, abstractSelection.eContainer(), abstractSelection.eContainer().eClass().getEStructuralFeature("selectionRef"), abstractSelection, ((AbstractSelection)abstractSelection.eContainer()).getSelectionRef().indexOf(abstractSelection) - 1); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ forTreeViewer.refresh();
+ }
+ }
+ });
+ moveUpForButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/up.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ Button moveDownForButton = new Button(forButtonsComposite, SWT.NONE);
+ moveDownForButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = forTreeViewer.getSelection();
+ if(selection instanceof IStructuredSelection) {
+ AbstractSelection abstractSelection = (AbstractSelection)((IStructuredSelection)selection).getFirstElement();
+ if(abstractSelection instanceof Selection) {
+ MoveCommand command = new MoveCommand(editingDomain, abstractSelection.eContainer(), abstractSelection.eContainer().eClass().getEStructuralFeature("selection"), abstractSelection, ((DiagramDefinition)abstractSelection.eContainer()).getSelection().indexOf(abstractSelection) + 1); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ } else if(abstractSelection instanceof SelectionRef) {
+ MoveCommand command = new MoveCommand(editingDomain, abstractSelection.eContainer(), abstractSelection.eContainer().eClass().getEStructuralFeature("selectionRef"), abstractSelection, ((AbstractSelection)abstractSelection.eContainer()).getSelectionRef().indexOf(abstractSelection) + 1); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ forTreeViewer.refresh();
+ }
+ }
+ });
+ moveDownForButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/down.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ forTreeViewer = new TreeViewer(forPartComposite, SWT.BORDER | SWT.FULL_SELECTION);
+ forTree = forTreeViewer.getTree();
+ forTree.setHeaderVisible(true);
+ forTreeViewer.setAutoExpandLevel(TreeViewer.ALL_LEVELS);
+ forTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ TreeViewerColumn selectionTreeViewerColumn = new TreeViewerColumn(forTreeViewer, SWT.NONE);
+ TreeColumn selectionTreeColumn = selectionTreeViewerColumn.getColumn();
+ selectionTreeColumn.setWidth(200);
+ selectionTreeColumn.setText(Messages.DiagramTemplateEditor_90);
+
+ TreeViewerColumn recursivelyTreeViewerColumn = new TreeViewerColumn(forTreeViewer, SWT.NONE);
+ TreeColumn recursivelyTreeColumn = recursivelyTreeViewerColumn.getColumn();
+ recursivelyTreeColumn.setWidth(70);
+ recursivelyTreeColumn.setText(Messages.DiagramTemplateEditor_91);
+ recursivelyTreeViewerColumn.setEditingSupport(new EditingSupport(forTreeViewer) {
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ if(element instanceof Selection) {
+ SetCommand command = new SetCommand(editingDomain, (Selection)element, ((Selection)element).eClass().getEStructuralFeature("recursively"), (Boolean)value); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ // ((AbstractSelection)element).setRecursively((Boolean)value);
+ getViewer().update(element, null);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ if(element instanceof Selection) {
+ return Boolean.valueOf(((Selection)element).isRecursively());
+ }
+ return null;
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ if(element instanceof Selection) {
+ if(((Selection)element).getKind() == SelectionKind.FOR_ALL) {
+ return new CheckboxCellEditor(forTree);
+ }
+ }
+
+ return null;
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+ });
+
+ TreeViewerColumn subTypesTreeViewerColumn = new TreeViewerColumn(forTreeViewer, SWT.NONE);
+ TreeColumn subTypesTreeColumn = subTypesTreeViewerColumn.getColumn();
+ subTypesTreeColumn.setWidth(70);
+ subTypesTreeColumn.setText(Messages.DiagramTemplateEditor_93);
+ subTypesTreeViewerColumn.setEditingSupport(new EditingSupport(forTreeViewer) {
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ if(element instanceof AbstractSelection) {
+ SetCommand command = new SetCommand(editingDomain, (AbstractSelection)element, ((AbstractSelection)element).eClass().getEStructuralFeature("subTypes"), (Boolean)value); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ // ((AbstractSelection)element).setSubTypes((Boolean)value);
+ getViewer().update(element, null);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ if(element instanceof AbstractSelection) {
+ return Boolean.valueOf(((AbstractSelection)element).isSubTypes());
+ }
+ return null;
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ if(element instanceof AbstractSelection) {
+ if(((AbstractSelection)element).getKind() == SelectionKind.FOR_ALL) {
+ return new CheckboxCellEditor(forTree);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+ });
+
+ TreeViewerColumn stereotypeTreeViewerColumn = new TreeViewerColumn(forTreeViewer, SWT.NONE);
+ TreeColumn stereotypeTreeColumn = stereotypeTreeViewerColumn.getColumn();
+ stereotypeTreeColumn.setWidth(200);
+ stereotypeTreeColumn.setText(Messages.DiagramTemplateEditor_95);
+ stereotypeTreeViewerColumn.setEditingSupport(new EditingSupport(forTreeViewer) {
+
+
+
+ @Override
+ protected void setValue(Object element, Object value) {
+ if(element instanceof AbstractSelection) {
+ SetCommand command = new SetCommand(editingDomain, (AbstractSelection)element, ((AbstractSelection)element).eClass().getEStructuralFeature("stereotypedBy"), (String)value); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ getViewer().update(element, null);
+ }
+ }
+
+ @Override
+ protected Object getValue(Object element) {
+ if(element instanceof AbstractSelection) {
+ if(((AbstractSelection)element).getStereotypedBy() == null) {
+ return ""; //$NON-NLS-1$
+ } else {
+ return ((AbstractSelection)element).getStereotypedBy();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected CellEditor getCellEditor(Object element) {
+ if(element instanceof AbstractSelection) {
+ if(((AbstractSelection)element).getKind() == SelectionKind.FOR_ALL) {
+ return new TextCellEditor(forTree);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected boolean canEdit(Object element) {
+ return true;
+ }
+ });
+
+ forTreeViewer.setContentProvider(new ForContentProvider());
+ forTreeViewer.setLabelProvider(new ForLabelProvider());
+ forTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ if(selection != null && !selection.isEmpty()) {
+ whatTableViewer.setInput(selection);
+ whatTableViewer.refresh();
+
+ if(selection instanceof IStructuredSelection) {
+ Object selectionItem = ((IStructuredSelection)selection).getFirstElement();
+ if(selectionItem instanceof AbstractSelection) {
+ if(((AbstractSelection)selectionItem).getKind() == SelectionKind.FOR_ALL) {
+ specificWhatButton.setEnabled(false);
+ } else if(((AbstractSelection)selectionItem).getKind() == SelectionKind.SPECIFIC) {
+ specificWhatButton.setEnabled(true);
+ }
+ }
+ }
+ }
+ }
+ });
+
+ Composite whatPartComposite = new Composite(selectionPartSashForm, SWT.NONE);
+ whatPartComposite.setLayout(new GridLayout(1, false));
+
+ Composite whatButtonsComposite = new Composite(whatPartComposite, SWT.NONE);
+ GridLayout gl_whatButtonsComposite = new GridLayout(3, false);
+ gl_whatButtonsComposite.marginHeight = 0;
+ gl_whatButtonsComposite.marginWidth = 0;
+ gl_whatButtonsComposite.verticalSpacing = 0;
+ gl_whatButtonsComposite.horizontalSpacing = 0;
+ whatButtonsComposite.setLayout(gl_whatButtonsComposite);
+ whatButtonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ whatButtonsComposite.setBounds(0, 0, 64, 64);
+
+ Label whatLabel = new Label(whatButtonsComposite, SWT.NONE);
+ whatLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
+ whatLabel.setText(Messages.DiagramTemplateEditor_98);
+
+ Button allWhatButton = new Button(whatButtonsComposite, SWT.NONE);
+ allWhatButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = whatTableViewer.getSelection();
+ if(selection != null) {
+ if(selection instanceof IStructuredSelection && !selection.isEmpty()) {
+
+ EReference eReference = (EReference)((IStructuredSelection)selection).getFirstElement();
+
+ ListSelectionDialog dlg = new ListSelectionDialog(getSite().getShell(), eReference, new TypesAvailableFromEReferenceContentProvider(), new AdapterFactoryLabelProvider(adapterFactory), Messages.DiagramTemplateEditor_99);
+ dlg.setTitle(Messages.DiagramTemplateEditor_100);
+ dlg.open();
+
+ ISelection forSelection = forTreeViewer.getSelection();
+ if(forSelection != null) {
+ if(forSelection instanceof ITreeSelection) {
+
+ AbstractSelection selectionItem = (AbstractSelection)((ITreeSelection)forSelection).getFirstElement();
+ if(selectionItem != null) {
+
+ Object[] results = dlg.getResult();
+ if(results != null) {
+
+ for(Object object : results) {
+ if(object instanceof EClass) {
+
+ if(!containsElement((EClass)object, selectionItem.getSelectionRef())) {
+ SelectionRef selectionRef = diagramtemplateFactory.createSelectionRef();
+
+ selectionRef.setKind(SelectionKind.FOR_ALL);
+ selectionRef.setElement((EClass)object);
+ selectionRef.setSubTypes(false);
+ selectionRef.setStereotypedBy(""); //$NON-NLS-1$
+ selectionRef.setEReference(eReference);
+
+ AddCommand command = new AddCommand(editingDomain, selectionItem, selectionItem.eClass().getEStructuralFeature("selectionRef"), selectionRef); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+
+ }
+
+ }
+ }
+ }
+ }
+
+ }
+
+ forTreeViewer.refresh();
+
+ }
+ }
+ }
+ }
+ });
+ allWhatButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/forAllRef.png")); //$NON-NLS-1$ //$NON-NLS-2$
+ allWhatButton.setText(Messages.DiagramTemplateEditor_105);
+
+ specificWhatButton = new Button(whatButtonsComposite, SWT.NONE);
+ specificWhatButton.setImage(ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/specificRef.gif")); //$NON-NLS-1$ //$NON-NLS-2$
+ specificWhatButton.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ ISelection selection = whatTableViewer.getSelection();
+ if(selection != null) {
+ if(selection instanceof IStructuredSelection && !selection.isEmpty()) {
+
+ ISelection forSelection = forTreeViewer.getSelection();
+ if(forSelection != null) {
+ if(forSelection instanceof ITreeSelection) {
+
+ AbstractSelection selectionItem = (AbstractSelection)((ITreeSelection)forSelection).getFirstElement();
+ if(selectionItem != null) {
+
+ EReference eReference = (EReference)((IStructuredSelection)selection).getFirstElement();
+
+ Object value = selectionItem.getElement().eGet(eReference);
+
+ List<EObject> valueToShow = new ArrayList<EObject>();
+ if(value instanceof List) {
+ valueToShow.addAll((Collection<? extends EObject>)value);
+ } else if(value instanceof EObject) {
+ valueToShow.add((EObject)value);
+ }
+
+ ListSelectionDialog dlg = new ListSelectionDialog(getSite().getShell(), valueToShow, new ElementsAvailableContentProvider(), new AdapterFactoryLabelProvider(adapterFactory), Messages.DiagramTemplateEditor_108);
+ dlg.setTitle(Messages.DiagramTemplateEditor_109);
+ dlg.open();
+
+ Object[] results = dlg.getResult();
+ if(results != null) {
+
+ for(Object object : results) {
+ if(object instanceof EObject) {
+
+ if(!containsElement((EObject)object, selectionItem.getSelectionRef())) {
+ SelectionRef selectionRef = diagramtemplateFactory.createSelectionRef();
+
+ selectionRef.setKind(SelectionKind.SPECIFIC);
+ selectionRef.setElement((EObject)object);
+ selectionRef.setEReference(eReference);
+ selectionRef.setStereotypedBy(""); //$NON-NLS-1$
+ selectionRef.setSubTypes(false);
+
+ AddCommand command = new AddCommand(editingDomain, selectionItem, selectionItem.eClass().getEStructuralFeature("selectionRef"), selectionRef); //$NON-NLS-1$
+ editingDomain.getCommandStack().execute(command);
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ forTreeViewer.refresh();
+
+ }
+ }
+ }
+ }
+
+ });
+ specificWhatButton.setText(Messages.DiagramTemplateEditor_112);
+ specificWhatButton.setEnabled(false);
+
+ whatTableViewer = new TableViewer(whatPartComposite, SWT.BORDER | SWT.FULL_SELECTION);
+ whatTable = whatTableViewer.getTable();
+ whatTableViewer.setContentProvider(new WhatContentProvider());
+ whatTableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ whatTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ //Balance the sashForm
+ selectionPartSashForm.setWeights(new int[]{ 1, 1 });
+ }
+
+ private void createEditionPart(Composite parent) {
+ SashForm editionPartSashForm = new SashForm(parent, SWT.VERTICAL);
+
+ createDiagramInformationPart(editionPartSashForm);
+ createSelectionPart(editionPartSashForm);
+
+ //Balance the sashForm
+ editionPartSashForm.setWeights(new int[]{ 1, 1 });
+ }
+
+ private void createTemplatePart(Composite parent) {
+ SashForm templatePartSashForm = new SashForm(parent, SWT.NONE);
+ templatePartSashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+
+ createDiagramDefinitionPart(templatePartSashForm);
+ createEditionPart(templatePartSashForm);
+
+ //Balance the sashForm
+ templatePartSashForm.setWeights(new int[]{ 140, 808 });
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+
+ if(createModel()) {
+
+ parent.setLayout(new GridLayout(1, false));
+
+ createloadPart(parent);
+ createTemplatePart(parent);
+
+ //Create the initial diagram definition
+ createNewDiagramDefinition();
+
+ if(targetModelResource != null) {
+ targetModelPathText.setText(targetModelResource.getURI().toString());
+ selectRootButton.setEnabled(true);
+ loadModelButton.setEnabled(false);
+ specificForButton.setEnabled(true);
+ executeButton.setEnabled(true);
+ } else {
+ clearTemplate();
+ }
+ }
+ }
+
+ @Override
+ public void setFocus() {
+ }
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java
new file mode 100644
index 00000000000..459715e1ba1
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateEditorPlugin.java
@@ -0,0 +1,109 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor;
+
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.common.ui.EclipseUIPlugin;
+import org.eclipse.emf.common.util.ResourceLocator;
+
+/**
+ * This is the central singleton for the DiagramTemplate editor plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public final class DiagramTemplateEditorPlugin extends EMFPlugin {
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final DiagramTemplateEditorPlugin INSTANCE = new DiagramTemplateEditorPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public DiagramTemplateEditorPlugin() {
+ super(new ResourceLocator[]{});
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static class Implementation extends EclipseUIPlugin {
+
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java
new file mode 100644
index 00000000000..2baf3d1cf51
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/DiagramTemplateModelWizard.java
@@ -0,0 +1,627 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor;
+
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+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.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.CommonPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+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.ecore.xmi.XMLResource;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+
+
+/**
+ * This is a simple wizard for creating a new model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class DiagramTemplateModelWizard extends Wizard implements INewWizard {
+
+ /**
+ * The supported extensions for created files.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final List<String> FILE_EXTENSIONS = Collections.unmodifiableList(Arrays.asList(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_DiagramTemplateEditorFilenameExtensions").split("\\s*,\\s*")));
+
+ /**
+ * A formatted list of supported file extensions, suitable for display.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static final String FORMATTED_FILE_EXTENSIONS = DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_DiagramTemplateEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
+
+ /**
+ * This caches an instance of the model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected DiagramTemplatePackage diagramtemplatePackage = DiagramTemplatePackage.eINSTANCE;
+
+ /**
+ * This caches an instance of the model factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected DiagramTemplateFactory diagramtemplateFactory = diagramtemplatePackage.getDiagramTemplateFactory();
+
+ /**
+ * This is the file creation page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected DiagramTemplateModelWizardNewFileCreationPage newFileCreationPage;
+
+ // /**
+ // * This is the initial object creation page.
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // protected DiagramTemplateModelWizardInitialObjectCreationPage initialObjectCreationPage;
+
+ /**
+ * Remember the selection during initialization for populating the default container.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * Remember the workbench during initialization.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected IWorkbench workbench;
+
+ /**
+ * Caches the names of the types that can be created as the root object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected List<String> initialObjectNames;
+
+ /**
+ * This just records the information.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_Wizard_label"));
+ setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(DiagramTemplateEditorPlugin.INSTANCE.getImage("full/wizban/NewDiagramTemplate")));
+ }
+
+ /**
+ * Returns the names of the types that can be created as the root object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ protected Collection<String> getInitialObjectNames() {
+ if(initialObjectNames == null) {
+ initialObjectNames = new ArrayList<String>();
+ for(EClassifier eClassifier : diagramtemplatePackage.getEClassifiers()) {
+ if(eClassifier instanceof EClass) {
+ EClass eClass = (EClass)eClassifier;
+ if(!eClass.isAbstract()) {
+ initialObjectNames.add(eClass.getName());
+ }
+ }
+ }
+ Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
+ }
+ return initialObjectNames;
+ }
+
+ /**
+ * Create a new model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ protected EObject createInitialModel() {
+ EClass eClass = (EClass)diagramtemplatePackage.getTemplate();
+ EObject rootObject = diagramtemplateFactory.create(eClass);
+ return rootObject;
+ }
+
+ /**
+ * Do the work after everything is specified.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public boolean performFinish() {
+ try {
+ // Remember the file.
+ //
+ final IFile modelFile = getModelFile();
+
+ // Do the work within an operation.
+ //
+ WorkspaceModifyOperation operation = new WorkspaceModifyOperation() {
+
+ @Override
+ protected void execute(IProgressMonitor progressMonitor) {
+ try {
+ // Create a resource set
+ //
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ // Get the URI of the model file.
+ //
+ URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true);
+
+ // Create a resource for this file.
+ //
+ Resource resource = resourceSet.createResource(fileURI);
+
+ // Add the initial model object to the contents.
+ //
+ EObject rootObject = createInitialModel();
+ if(rootObject != null) {
+ resource.getContents().add(rootObject);
+ }
+
+ // Save the contents of the resource to the file system.
+ //
+ Map<Object, Object> options = new HashMap<Object, Object>();
+ options.put(XMLResource.OPTION_ENCODING, "UTF-8");
+ resource.save(options);
+ } catch (Exception exception) {
+ DiagramTemplateEditorPlugin.INSTANCE.log(exception);
+ } finally {
+ progressMonitor.done();
+ }
+ }
+ };
+
+ getContainer().run(false, false, operation);
+
+ // Select the new file resource in the current view.
+ //
+ IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage page = workbenchWindow.getActivePage();
+ final IWorkbenchPart activePart = page.getActivePart();
+ if(activePart instanceof ISetSelectionTarget) {
+ final ISelection targetSelection = new StructuredSelection(modelFile);
+ getShell().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ ((ISetSelectionTarget)activePart).selectReveal(targetSelection);
+ }
+ });
+ }
+
+ // Open an editor on the new file.
+ //
+ try {
+ page.openEditor(new FileEditorInput(modelFile), workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId());
+ } catch (PartInitException exception) {
+ MessageDialog.openError(workbenchWindow.getShell(), DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
+ return false;
+ }
+
+ return true;
+ } catch (Exception exception) {
+ DiagramTemplateEditorPlugin.INSTANCE.log(exception);
+ return false;
+ }
+ }
+
+ /**
+ * This is the one page of the wizard.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public class DiagramTemplateModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
+
+ /**
+ * Pass in the selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public DiagramTemplateModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) {
+ super(pageId, selection);
+ }
+
+ /**
+ * The framework calls this to see if the file is correct.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ protected boolean validatePage() {
+ if(super.validatePage()) {
+ String extension = new Path(getFileName()).getFileExtension();
+ if(extension == null || !FILE_EXTENSIONS.contains(extension)) {
+ String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
+ setErrorMessage(DiagramTemplateEditorPlugin.INSTANCE.getString(key, new Object[]{ FORMATTED_FILE_EXTENSIONS }));
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IFile getModelFile() {
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName()));
+ }
+ }
+
+ // /**
+ // * This is the page where the type of object to create is selected.
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // public class DiagramTemplateModelWizardInitialObjectCreationPage extends WizardPage {
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // protected Combo initialObjectField;
+ //
+ // /**
+ // * @generated
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // */
+ // protected List<String> encodings;
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // protected Combo encodingField;
+ //
+ // /**
+ // * Pass in the selection.
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // public DiagramTemplateModelWizardInitialObjectCreationPage(String pageId) {
+ // super(pageId);
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // public void createControl(Composite parent) {
+ // Composite composite = new Composite(parent, SWT.NONE);
+ // {
+ // GridLayout layout = new GridLayout();
+ // layout.numColumns = 1;
+ // layout.verticalSpacing = 12;
+ // composite.setLayout(layout);
+ //
+ // GridData data = new GridData();
+ // data.verticalAlignment = GridData.FILL;
+ // data.grabExcessVerticalSpace = true;
+ // data.horizontalAlignment = GridData.FILL;
+ // composite.setLayoutData(data);
+ // }
+ //
+ // Label containerLabel = new Label(composite, SWT.LEFT);
+ // {
+ // containerLabel.setText(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_ModelObject"));
+ //
+ // GridData data = new GridData();
+ // data.horizontalAlignment = GridData.FILL;
+ // containerLabel.setLayoutData(data);
+ // }
+ //
+ // initialObjectField = new Combo(composite, SWT.BORDER);
+ // {
+ // GridData data = new GridData();
+ // data.horizontalAlignment = GridData.FILL;
+ // data.grabExcessHorizontalSpace = true;
+ // initialObjectField.setLayoutData(data);
+ // }
+ //
+ // for(String objectName : getInitialObjectNames()) {
+ // initialObjectField.add(getLabel(objectName));
+ // }
+ //
+ // if(initialObjectField.getItemCount() == 1) {
+ // initialObjectField.select(0);
+ // }
+ // initialObjectField.addModifyListener(validator);
+ //
+ // Label encodingLabel = new Label(composite, SWT.LEFT);
+ // {
+ // encodingLabel.setText(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_XMLEncoding"));
+ //
+ // GridData data = new GridData();
+ // data.horizontalAlignment = GridData.FILL;
+ // encodingLabel.setLayoutData(data);
+ // }
+ // encodingField = new Combo(composite, SWT.BORDER);
+ // {
+ // GridData data = new GridData();
+ // data.horizontalAlignment = GridData.FILL;
+ // data.grabExcessHorizontalSpace = true;
+ // encodingField.setLayoutData(data);
+ // }
+ //
+ // for(String encoding : getEncodings()) {
+ // encodingField.add(encoding);
+ // }
+ //
+ // encodingField.select(0);
+ // encodingField.addModifyListener(validator);
+ //
+ // setPageComplete(validatePage());
+ // setControl(composite);
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // protected ModifyListener validator = new ModifyListener() {
+ //
+ // public void modifyText(ModifyEvent e) {
+ // setPageComplete(validatePage());
+ // }
+ // };
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // protected boolean validatePage() {
+ // return getInitialObjectName() != null && getEncodings().contains(encodingField.getText());
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // @Override
+ // public void setVisible(boolean visible) {
+ // super.setVisible(visible);
+ // if(visible) {
+ // if(initialObjectField.getItemCount() == 1) {
+ // initialObjectField.clearSelection();
+ // encodingField.setFocus();
+ // } else {
+ // encodingField.clearSelection();
+ // initialObjectField.setFocus();
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // public String getInitialObjectName() {
+ // String label = initialObjectField.getText();
+ //
+ // for(String name : getInitialObjectNames()) {
+ // if(getLabel(name).equals(label)) {
+ // return name;
+ // }
+ // }
+ // return null;
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // public String getEncoding() {
+ // return encodingField.getText();
+ // }
+ //
+ // /**
+ // * Returns the label for the specified type name.
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // protected String getLabel(String typeName) {
+ // try {
+ // return DiagramTemplateEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
+ // } catch (MissingResourceException mre) {
+ // DiagramTemplateEditorPlugin.INSTANCE.log(mre);
+ // }
+ // return typeName;
+ // }
+ //
+ // /**
+ // * <!-- begin-user-doc -->
+ // * <!-- end-user-doc -->
+ // *
+ // * @generated
+ // */
+ // protected Collection<String> getEncodings() {
+ // if(encodings == null) {
+ // encodings = new ArrayList<String>();
+ // for(StringTokenizer stringTokenizer = new StringTokenizer(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens();) {
+ // encodings.add(stringTokenizer.nextToken());
+ // }
+ // }
+ // return encodings;
+ // }
+ // }
+
+ /**
+ * The framework calls this to create the contents of the wizard.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated NOT
+ */
+ @Override
+ public void addPages() {
+ // Create a page, set the title, and the initial model file name.
+ //
+ newFileCreationPage = new DiagramTemplateModelWizardNewFileCreationPage("Whatever", selection);
+ newFileCreationPage.setTitle(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_DiagramTemplateModelWizard_label"));
+ newFileCreationPage.setDescription(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_DiagramTemplateModelWizard_description"));
+ newFileCreationPage.setFileName(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_DiagramTemplateEditorFilenameDefaultBase") + "." + FILE_EXTENSIONS.get(0));
+ addPage(newFileCreationPage);
+
+ // Try and get the resource selection to determine a current directory for the file dialog.
+ //
+ if(selection != null && !selection.isEmpty()) {
+ // Get the resource...
+ //
+ Object selectedElement = selection.iterator().next();
+ if(selectedElement instanceof IResource) {
+ // Get the resource parent, if its a file.
+ //
+ IResource selectedResource = (IResource)selectedElement;
+ if(selectedResource.getType() == IResource.FILE) {
+ selectedResource = selectedResource.getParent();
+ }
+
+ // This gives us a directory...
+ //
+ if(selectedResource instanceof IFolder || selectedResource instanceof IProject) {
+ // Set this for the container.
+ //
+ newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
+
+ // Make up a unique new name here.
+ //
+ String defaultModelBaseFilename = DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_DiagramTemplateEditorFilenameDefaultBase");
+ String defaultModelFilenameExtension = FILE_EXTENSIONS.get(0);
+ String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
+ for(int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
+ modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
+ }
+ newFileCreationPage.setFileName(modelFilename);
+ }
+ }
+ }
+ // initialObjectCreationPage = new DiagramTemplateModelWizardInitialObjectCreationPage("Whatever2");
+ // initialObjectCreationPage.setTitle(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_DiagramTemplateModelWizard_label"));
+ // initialObjectCreationPage.setDescription(DiagramTemplateEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
+ // addPage(initialObjectCreationPage);
+ }
+
+ /**
+ * Get the file from the page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public IFile getModelFile() {
+ return newFileCreationPage.getModelFile();
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java
new file mode 100644
index 00000000000..e1ceb6dc213
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionContentProvider.java
@@ -0,0 +1,47 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ *
+ * Content provider for the diagram definition
+ *
+ */
+public class DiagramDefinitionContentProvider implements IStructuredContentProvider {
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object[] getElements(Object inputElement) {
+
+ if(inputElement instanceof List<?>) {
+ return ((List)inputElement).toArray();
+ }
+
+ return null;
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java
new file mode 100644
index 00000000000..7c9a21753fe
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramDefinitionLabelProvider.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.core.extension.commands.CreationCommandDescriptor;
+import org.eclipse.papyrus.core.extension.commands.CreationCommandRegistry;
+import org.eclipse.papyrus.core.extension.commands.ICreationCommandRegistry;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ *
+ * Label provider for the diagram definition
+ *
+ */
+public class DiagramDefinitionLabelProvider implements ILabelProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Image getImage(Object element) {
+ if(element instanceof DiagramDefinition) {
+ DiagramDefinition diagramDefinition = (DiagramDefinition)element;
+
+ for(CreationCommandDescriptor desc : getCreationCommandRegistry().getCommandDescriptors()) {
+ if(diagramDefinition != null && diagramDefinition.getDiagramKind().equalsIgnoreCase(desc.getCommandId())) {
+ return desc.getIcon().createImage();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText(Object element) {
+ if(element instanceof DiagramDefinition) {
+ return ((DiagramDefinition)element).getName();
+ }
+ return null;
+ }
+
+ /**
+ * Gets the creation command registry.
+ *
+ * @return the creation command registry
+ */
+ private ICreationCommandRegistry getCreationCommandRegistry() {
+ return CreationCommandRegistry.getInstance(org.eclipse.papyrus.core.Activator.PLUGIN_ID);
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java
new file mode 100644
index 00000000000..861d9e2bba4
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/DiagramKindContentProvider.java
@@ -0,0 +1,81 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.core.extension.commands.CreationCommandDescriptor;
+import org.eclipse.papyrus.core.extension.commands.CreationCommandRegistry;
+import org.eclipse.papyrus.core.extension.commands.ICreationCommandRegistry;
+
+/**
+ *
+ * Content provider for the diagram kinds
+ *
+ */
+public class DiagramKindContentProvider implements IStructuredContentProvider {
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ *
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ *
+ * @param viewer
+ * @param oldInput
+ * @param newInput
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+ *
+ * @param inputElement
+ */
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof List) {
+ List<String> categories = (List<String>)inputElement;
+
+ List<CreationCommandDescriptor> result = new ArrayList<CreationCommandDescriptor>();
+ for(CreationCommandDescriptor desc : getCreationCommandRegistry().getCommandDescriptors()) {
+ for(String category : categories) {
+ if(category.equalsIgnoreCase(desc.getLanguage())) {
+ result.add(desc);
+ break;
+ }
+ }
+ }
+
+ return result.toArray();
+ }
+ return null;
+ }
+
+ /**
+ * Gets the creation command registry.
+ *
+ * @return the creation command registry
+ */
+ private ICreationCommandRegistry getCreationCommandRegistry() {
+ return CreationCommandRegistry.getInstance(org.eclipse.papyrus.core.Activator.PLUGIN_ID);
+ }
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java
new file mode 100644
index 00000000000..9af233e2af7
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ElementsAvailableContentProvider.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ *
+ * Content provider for the elements available
+ *
+ */
+public class ElementsAvailableContentProvider implements IStructuredContentProvider {
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof List<?>) {
+ return ((List)inputElement).toArray();
+ }
+
+ return null;
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java
new file mode 100644
index 00000000000..a588ddbbf06
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForContentProvider.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+
+/**
+ *
+ * Content provider for the For selection
+ *
+ */
+public class ForContentProvider implements ITreeContentProvider {
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof List<?>) {
+ return ((List<Selection>)inputElement).toArray();
+ }
+
+ return null;
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if(parentElement instanceof AbstractSelection) {
+ List<SelectionRef> itemRefList = ((AbstractSelection)parentElement).getSelectionRef();
+ if(!itemRefList.isEmpty()) {
+ return itemRefList.toArray();
+ }
+ }
+
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if(element instanceof AbstractSelection) {
+ List<SelectionRef> itemRefList = ((AbstractSelection)element).getSelectionRef();
+ return !itemRefList.isEmpty();
+ }
+
+ return false;
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java
new file mode 100644
index 00000000000..4926478ddb5
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/ForLabelProvider.java
@@ -0,0 +1,169 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.uml2.uml.NamedElement;
+
+import com.swtdesigner.ResourceManager;
+
+/**
+ *
+ * Label provider for the For selection
+ *
+ */
+public class ForLabelProvider implements ITableLabelProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Image getColumnImage(Object element, int columnIndex) {
+ switch(columnIndex) {
+ case 0:
+ if(element instanceof SelectionRef) {
+
+ if(((SelectionRef)element).getKind() == SelectionKind.FOR_ALL) {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/forAllRef.png");
+ } else if(((SelectionRef)element).getKind() == SelectionKind.SPECIFIC) {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/specificRef.gif");
+ }
+ } else {
+ if(((Selection)element).getKind() == SelectionKind.FOR_ALL) {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/forAll.png");
+ } else if(((Selection)element).getKind() == SelectionKind.SPECIFIC) {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/specific.gif");
+ }
+ }
+ break;
+
+ case 1:
+ if(element instanceof Selection) {
+ if(((Selection)element).getKind() == SelectionKind.FOR_ALL) {
+ if(((Selection)element).isRecursively()) {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/checked.gif");
+ } else {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/unchecked.gif");
+ }
+ }
+ }
+ break;
+
+ case 2:
+ if(element instanceof AbstractSelection) {
+ if(((AbstractSelection)element).getKind() == SelectionKind.FOR_ALL) {
+ if(((AbstractSelection)element).isSubTypes()) {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/checked.gif");
+ } else {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/unchecked.gif");
+ }
+ }
+ }
+ break;
+ case 3:
+
+ break;
+
+ default:
+ break;
+ }
+
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getColumnText(Object element, int columnIndex) {
+ switch(columnIndex) {
+ case 0:
+ if(element instanceof SelectionRef) {
+ EObject rootType = ((SelectionRef)element).getElement();
+ if(rootType instanceof EClass) {
+ return ((EClass)rootType).getName() + " - " + ((EReference)((SelectionRef)element).getEReference()).getName();
+ } else if(rootType instanceof NamedElement) {
+ return ((NamedElement)rootType).getName() + " (" + rootType.eClass().getName() + ") - " + ((EReference)((SelectionRef)element).getEReference()).getName();
+ }
+ } else if(element instanceof Selection) {
+ EObject rootType = ((Selection)element).getElement();
+ if(rootType instanceof EClass) {
+ return ((EClass)rootType).getName();
+ } else if(rootType instanceof NamedElement) {
+ return ((NamedElement)rootType).getName() + " (" + rootType.eClass().getName() + ")";
+ }
+ }
+
+ break;
+ case 1:
+
+ break;
+ case 2:
+
+ break;
+ case 3:
+ if(element instanceof AbstractSelection) {
+ if(((AbstractSelection)element).getKind() == SelectionKind.FOR_ALL) {
+ return ((AbstractSelection)element).getStereotypedBy();
+ }
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java
new file mode 100644
index 00000000000..adadfdeb090
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesAvailableFromEReferenceContentProvider.java
@@ -0,0 +1,68 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ *
+ * Content provider for the types available from a EReference
+ *
+ */
+public class TypesAvailableFromEReferenceContentProvider implements IStructuredContentProvider {
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof EReference) {
+
+ List<EObject> results = new ArrayList<EObject>();
+
+ results.add(((EReference)inputElement).getEReferenceType());
+
+ TreeIterator<EObject> it = ((EReference)inputElement).eResource().getAllContents();
+ while(it.hasNext()) {
+ EObject eObject = (EObject)it.next();
+ if(eObject instanceof EClass) {
+ List<EClass> superTypes = ((EClass)eObject).getEAllSuperTypes();
+ if(superTypes.contains(((EReference)inputElement).getEReferenceType())) {
+
+ results.add(eObject);
+ }
+ }
+ }
+
+ return results.toArray();
+
+ }
+ return null;
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java
new file mode 100644
index 00000000000..eaaa973fc2b
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/TypesContentProvider.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ *
+ * Content provider for the types available
+ *
+ */
+public class TypesContentProvider implements ITreeContentProvider {
+
+ public Object[] getElements(Object inputElement) {
+
+ if(inputElement instanceof List) {
+ return ((List<EObject>)inputElement).toArray();
+ }
+
+ return null;
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object[] getChildren(Object parentElement) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean hasChildren(Object element) {
+ return false;
+ }
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java
new file mode 100644
index 00000000000..1232575847f
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/editor/provider/WhatContentProvider.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.editor.provider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+
+/**
+ *
+ * Content provider for the What selection
+ *
+ */
+public class WhatContentProvider implements IStructuredContentProvider {
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object[] getElements(Object inputElement) {
+ List<EReference> refsToShow = new ArrayList<EReference>();
+ if(inputElement instanceof ITreeSelection) {
+
+
+ Object firstElement = ((ITreeSelection)inputElement).getFirstElement();
+
+ if(firstElement instanceof AbstractSelection) {
+ List<EReference> refs = null;
+
+ if(((AbstractSelection)firstElement).getKind() == SelectionKind.FOR_ALL) {
+ refs = ((EClass)((AbstractSelection)firstElement).getElement()).getEAllReferences();
+ } else if(((AbstractSelection)firstElement).getKind() == SelectionKind.SPECIFIC) {
+ refs = ((AbstractSelection)firstElement).getElement().eClass().getEAllReferences();
+ }
+
+ if(refs != null) {
+ for(EReference eReference : refs) {
+ if(!eReference.isDerived() && eReference.isContainment()) {
+
+ refsToShow.add(eReference);
+
+ }
+ }
+ }
+
+ return refsToShow.toArray();
+ }
+ }
+
+ return refsToShow.toArray();
+ }
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java
new file mode 100644
index 00000000000..de106aade3f
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncher.java
@@ -0,0 +1,733 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.launcher;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.requests.ArrangeRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.papyrus.core.editor.BackboneException;
+import org.eclipse.papyrus.core.extension.commands.CreationCommandDescriptor;
+import org.eclipse.papyrus.core.services.ServiceException;
+import org.eclipse.papyrus.core.services.ServicesRegistry;
+import org.eclipse.papyrus.core.utils.DiResourceSet;
+import org.eclipse.papyrus.core.utils.EditorUtils;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+import org.eclipse.papyrus.diagramtemplate.Template;
+import org.eclipse.papyrus.diagramtemplate.editor.provider.DiagramKindContentProvider;
+import org.eclipse.papyrus.diagramtemplate.utils.Messages;
+import org.eclipse.papyrus.editor.PapyrusMultiDiagramEditor;
+import org.eclipse.papyrus.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.wizards.category.DiagramCategoryDescriptor;
+import org.eclipse.papyrus.wizards.category.DiagramCategoryRegistry;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
+
+
+
+/**
+ * The template launcher class
+ *
+ */
+public class DiagramTemplateLauncher {
+
+ /**
+ * The instance used for the singleton pattern
+ */
+ private static DiagramTemplateLauncher instance = null;
+
+ /**
+ * Enum used to report on diagram creation
+ *
+ */
+ public enum CreationReportKind {
+ SUCCESS, FAIL
+ };
+
+ /**
+ * The creation report information
+ */
+ protected HashMap<EObject, CreationReportKind> creationReport;
+
+ /**
+ * The diagram added in the first part of the execution
+ */
+ protected HashMap<String, AbstractSelection> diagramsCreated;
+
+ /**
+ * The view of the elements added
+ */
+ protected List<View> elementProcessed = new ArrayList<View>();
+
+ /**
+ * Used to store the list of diagrams already present in the resource
+ */
+ protected List<String> diagramsInResource;
+
+ /**
+ * Constructor.
+ * Private constructor for the singleton pattern
+ */
+ private DiagramTemplateLauncher() {
+ }
+
+ /**
+ * Get the singleton
+ *
+ * @return
+ * the DiagramTemplateLauncher singleton
+ */
+ public final synchronized static DiagramTemplateLauncher getInstance() {
+ if(instance == null) {
+ instance = new DiagramTemplateLauncher();
+ }
+ return instance;
+ }
+
+ /**
+ * List of diagram categories to consider
+ */
+ protected List<String> diagramCategories;
+
+ protected void initializeDiagramCategories() {
+ diagramCategories = new ArrayList<String>();
+ for(DiagramCategoryDescriptor diagramCategoryDescriptor : DiagramCategoryRegistry.getInstance().getDiagramCategories()) {
+ diagramCategories.add(diagramCategoryDescriptor.getLabel());
+ }
+ }
+
+ /**
+ * Util method to get the CreationCommandDescriptor corresponding to a commandID
+ *
+ * @param commandID
+ * the commandID to find
+ * @return
+ * the corresponding CreationCommandDescriptor
+ */
+ protected CreationCommandDescriptor getCreation(String commandID) {
+ DiagramKindContentProvider provider = new DiagramKindContentProvider();
+ List<Object> diagramsKindlist = Arrays.asList(provider.getElements(diagramCategories));
+
+ for(Object object : diagramsKindlist) {
+ CreationCommandDescriptor command = (CreationCommandDescriptor)object;
+
+ if(command.getCommandId().compareTo(commandID) == 0) {
+ return command;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Used to recursively process the template definition. It identifies the newly create editpart and recurses on it
+ *
+ * @param actualEditPart
+ * the editpart elements was added to. It is used to find the newly create editpart
+ * @param elementToShow
+ * the semantic element added
+ * @param selectionRef
+ * the corresponding selectionRed
+ * @param activeEditor
+ * the editor used
+ */
+ protected void processRecursively(EditPart actualEditPart, EObject elementToShow, SelectionRef selectionRef, DiagramEditor activeEditor) {
+
+ //Guess which of the View is the new one
+ EditPartViewer viewer = actualEditPart.getViewer();
+ Map map = viewer.getEditPartRegistry();
+
+ //We must have a copy since map may change during the loop
+ Map mapCopy = new HashMap<Object, Object>(map);
+ Iterator it = mapCopy.keySet().iterator();
+ boolean found = false;
+ while(it.hasNext() && !found) {
+ Object view = (Object)it.next();
+
+ Object value = mapCopy.get(view);
+ if(value instanceof GraphicalEditPart) {
+
+
+ GraphicalEditPart editPart = (GraphicalEditPart)value;
+
+
+ // The element of the editPart and the element we just added must match
+ String editPartSemanticElementID = editPart.resolveSemanticElement().eResource().getURIFragment(editPart.resolveSemanticElement());
+ String elementToShowID = elementToShow.eResource().getURIFragment(elementToShow);
+ if(editPartSemanticElementID.equals(elementToShowID)) {
+
+ //The view should be the editpart whose parent's element is not the elementToShow
+ boolean foundParentWithElementToShowAsElement = false;
+
+ EditPart elementToProcess = editPart.getParent();
+ while(elementToProcess != null && !foundParentWithElementToShowAsElement) {
+
+ if(elementToProcess instanceof GraphicalEditPart) {
+ String elementToProcessSemanticElementID = ((GraphicalEditPart)elementToProcess).resolveSemanticElement().eResource().getURIFragment(((GraphicalEditPart)elementToProcess).resolveSemanticElement());
+ if(elementToProcessSemanticElementID.equals(elementToShowID)) {
+ foundParentWithElementToShowAsElement = true;
+ }
+ }
+
+ elementToProcess = elementToProcess.getParent();
+ }
+
+ if(!foundParentWithElementToShowAsElement) {
+ //Last we must be sure that it is really new one
+ if(!elementProcessed.contains(view)) {
+ //We can process it
+ addElementsFor(selectionRef.getSelectionRef(), elementToShow, activeEditor, editPart);
+
+ // FIXME we may need to add all new elements as processed
+ //Record that it is processed
+ elementProcessed.add((View)view);
+
+ found = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Find the element to show depending on a list and try to add them to a specific editPart
+ *
+ * @param selectionList
+ * The selection list of elements to add to the editPart
+ * @param root
+ * The root to search the elements from
+ * @param activeEditor
+ * the editor corresponding to the editPart
+ * @param editPartToShowIn
+ * the editPart to show elements in
+ */
+ protected void addElementsFor(List selectionList, EObject root, DiagramEditor activeEditor, EditPart editPartToShowIn) {
+ // Go through the SelectionRef
+ for(Object object : selectionList) {
+ if(object instanceof SelectionRef) {
+ SelectionRef selectionRef = (SelectionRef)object;
+
+ // Retrieve the values
+ Object result = root.eGet((EStructuralFeature)selectionRef.getEReference());
+ List<EObject> resultsToProcess = new ArrayList<EObject>();
+
+ if(result instanceof List) {
+ resultsToProcess.addAll((Collection<? extends EObject>)result);
+ } else {
+ resultsToProcess.add((EObject)result);
+ }
+
+ if(selectionRef.getKind() == SelectionKind.FOR_ALL) {
+
+
+ List<EObject> resultsToShow = new ArrayList<EObject>();
+ //Try to match constraints
+ for(EObject elementToMatch : resultsToProcess) {
+ if(matchStereotypedBy(elementToMatch, selectionRef.getStereotypedBy())) {
+ if(selectionRef.isSubTypes()) {
+ //Consider all subtypes
+ if(elementToMatch.eClass().getEAllSuperTypes().contains(selectionRef.getElement()) || elementToMatch.eClass() == selectionRef.getElement()) {
+ // It matches
+ resultsToShow.add(elementToMatch);
+ }
+ } else {
+ if(elementToMatch.eClass() == selectionRef.getElement()) {
+ // It matches
+ resultsToShow.add(elementToMatch);
+ }
+ }
+ }
+ }
+
+ // Process them all
+ int i = 0;
+ for(EObject elementToShow : resultsToShow) {
+
+ EditPart actualEditPart = showElementIn(elementToShow, (DiagramEditor)activeEditor, editPartToShowIn, i);
+ processRecursively(actualEditPart, elementToShow, selectionRef, activeEditor);
+ i++;
+ }
+
+ } else {
+ // FIXME Kind of very dirty
+ for(EObject eObject : resultsToProcess) {
+ String eObjectID = eObject.eResource().getURIFragment(eObject);
+ String elementID = selectionRef.getElement().eResource().getURIFragment(selectionRef.getElement());
+ if(eObjectID.equals(elementID)) {
+ // if(eObject == selectionRef.getElement()) {
+ EditPart actualEditPart = showElementIn(eObject, (DiagramEditor)activeEditor, editPartToShowIn, 0);
+ processRecursively(actualEditPart, eObject, selectionRef, activeEditor);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Util method used to find all the children of a certain editpart
+ *
+ * @param list
+ * the children found recursively
+ * @param root
+ * the root editpart to start the search from
+ */
+ protected void findAllChildren(List<EditPart> list, EditPart root) {
+ list.addAll(root.getChildren());
+ for(Object editPart : root.getChildren()) {
+ if(editPart instanceof EditPart) {
+ findAllChildren(list, (EditPart)editPart);
+ }
+ }
+ }
+
+ /**
+ * Try to show an element in an editPart (or its children)
+ *
+ * @param elementToShow
+ * the element to show
+ * @param activeEditor
+ * the editor corresponding to the editPart
+ * @param editPart
+ * the editPart to show the element in
+ * @param position
+ * position is used to try to distribute the drop
+ * @return
+ * the editPart in which the element has been actually added
+ */
+ protected EditPart showElementIn(EObject elementToShow, DiagramEditor activeEditor, EditPart editPart, int position) {
+
+
+ EditPart returnEditPart = null;
+
+ if(elementToShow instanceof Element) {
+
+ DropObjectsRequest dropObjectsRequest = new DropObjectsRequest();
+ ArrayList<Element> list = new ArrayList<Element>();
+ list.add((Element)elementToShow);
+ dropObjectsRequest.setObjects(list);
+ dropObjectsRequest.setLocation(new Point(20, 100 * position));
+ Command commandDrop = editPart.getCommand(dropObjectsRequest);
+
+ boolean processChildren = false;
+ if(commandDrop == null) {
+ processChildren = true;
+ } else {
+ if(commandDrop.canExecute()) {
+ ((DiagramEditor)activeEditor).getDiagramEditDomain().getDiagramCommandStack().execute(commandDrop);
+ returnEditPart = editPart;
+ creationReport.put(elementToShow, CreationReportKind.SUCCESS);
+ } else {
+ processChildren = true;
+ }
+ }
+
+ if(processChildren) {
+ //try to add to one of its children
+ boolean found = false;
+
+ ArrayList<EditPart> childrenList = new ArrayList<EditPart>();
+ findAllChildren(childrenList, editPart);
+ for(Object child : childrenList) {
+ if(child instanceof EditPart) {
+ Command commandDropChild = ((EditPart)child).getCommand(dropObjectsRequest);
+ if(commandDropChild != null) {
+ if(commandDropChild.canExecute()) {
+ ((DiagramEditor)activeEditor).getDiagramEditDomain().getDiagramCommandStack().execute(commandDropChild);
+ found = true;
+ returnEditPart = (EditPart)child;
+ creationReport.put(elementToShow, CreationReportKind.SUCCESS);
+ break;
+ }
+ }
+ }
+ }
+ if(!found) {
+ creationReport.put(elementToShow, CreationReportKind.FAIL);
+ returnEditPart = editPart;
+ }
+ }
+ }
+
+ return returnEditPart;
+ }
+
+ /**
+ * Utils method that determine whether an element is stereotypedBy a certain stereotype qualiedName
+ *
+ * @param element
+ * the element to test
+ * @param stereotypedBy
+ * the qulifiedName of the stereotype to match
+ * @return
+ * true if matches false else.
+ */
+ protected boolean matchStereotypedBy(EObject element, String stereotypedBy) {
+ if(element instanceof Element) {
+ //Read stereotypedBy
+ stereotypedBy = stereotypedBy.replaceAll(" ", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ String[] stereotypes = stereotypedBy.split(","); //$NON-NLS-1$
+
+ boolean matchStereotypes = true;
+ for(String stereo : stereotypes) {
+ if(stereo != null && stereo.length() > 0) {
+ if(((Element)element).getAppliedStereotype(stereo) != null) {
+ matchStereotypes = true;
+ } else {
+ matchStereotypes = false;
+ break;
+ }
+ }
+ }
+
+ return matchStereotypes;
+ }
+
+ return false;
+ }
+
+ /**
+ * Creates the diagrams in a specified Papyrus resource
+ *
+ * @param selectionList
+ * The selection for which we must create diagrams corresponding to the diagram definition
+ * @param diagramDefinition
+ * The diagram definition to create
+ * @param diResourceSet
+ * The Papyrus resource to create the diagrams in
+ */
+ protected void createDiagramFor(List selectionList, DiagramDefinition diagramDefinition, DiResourceSet diResourceSet) {
+ //Go through the selection and try to find elements in the target model that match
+ for(Object object : selectionList) {
+
+ if(object instanceof AbstractSelection) {
+ AbstractSelection selection = (AbstractSelection)object;
+ CreationCommandDescriptor creationCommandDescriptor = getCreation(diagramDefinition.getDiagramKind());
+ if(creationCommandDescriptor != null) {
+
+
+ EObject root;
+
+ //If the template is under specified, try to guess
+ if(diagramDefinition.getFromRoot() == null) {
+ root = ((Template)diagramDefinition.eContainer()).getTargetRoot();
+ } else {
+ root = diagramDefinition.getFromRoot();
+ }
+
+ if(root != null) {
+ if(selection.getKind() == SelectionKind.FOR_ALL) {
+
+ // Find elements that match
+ List<EObject> content = new ArrayList<EObject>();
+ if(selection instanceof Selection) {
+ if(((Selection)selection).isRecursively()) {
+ //Go through all recursively
+ TreeIterator<EObject> it = root.eAllContents();
+ while(it.hasNext()) {
+ EObject eObject = (EObject)it.next();
+ content.add(eObject);
+ }
+ } else {
+ content.addAll(root.eContents());
+ }
+ content.add(root);
+ } else {
+ MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.DiagramTemplateLauncher_3, Messages.DiagramTemplateLauncher_4);
+ }
+
+
+ for(EObject eObject : content) {
+ if(matchStereotypedBy(eObject, selection.getStereotypedBy())) {
+ String name = diagramDefinition.getPrefix();
+ if(eObject instanceof NamedElement) {
+ name += ((NamedElement)eObject).getName();
+ } else {
+ name += eObject.toString();
+ }
+
+
+ if(selection.isSubTypes()) {
+ //Consider all subtypes
+ if(eObject.eClass().getEAllSuperTypes().contains(selection.getElement()) || eObject.eClass() == selection.getElement()) {
+ // System.err.println("FoundForAll Sub: " + diagramDefinition.getName());
+ // It matches: create a diagram
+ try {
+ creationCommandDescriptor.getCommand().createDiagram(diResourceSet, eObject, name);
+
+ //Identify the new diagram
+ TreeIterator<EObject> it = diResourceSet.getNotationResource().getAllContents();
+ while(it.hasNext()) {
+ EObject diagram = (EObject)it.next();
+ if(diagram instanceof Diagram) {
+ if(!diagramsInResource.contains(diagram.eResource().getURIFragment(diagram))) {
+ diagramsCreated.put(diagram.eResource().getURIFragment(diagram), selection);
+ diagramsInResource.add(diagram.eResource().getURIFragment(diagram));
+
+ creationReport.put(eObject, CreationReportKind.SUCCESS);
+ }
+ }
+ }
+
+ } catch (BackboneException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ } else {
+ if(eObject.eClass() == selection.getElement()) {
+ // System.err.println("FoundForAll Strict: " + diagramDefinition.getName());
+ // It matches: create a diagram
+
+ try {
+ creationCommandDescriptor.getCommand().createDiagram(diResourceSet, eObject, name);
+
+ //Identify the new diagram
+ TreeIterator<EObject> it = diResourceSet.getNotationResource().getAllContents();
+ while(it.hasNext()) {
+ EObject diagram = (EObject)it.next();
+ if(diagram instanceof Diagram) {
+ if(!diagramsInResource.contains(diagram.eResource().getURIFragment(diagram))) {
+ diagramsCreated.put(diagram.eResource().getURIFragment(diagram), selection);
+ diagramsInResource.add(diagram.eResource().getURIFragment(diagram));
+
+ creationReport.put(eObject, CreationReportKind.SUCCESS);
+ }
+ }
+ }
+
+ } catch (BackboneException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ } else if(selection.getKind() == SelectionKind.SPECIFIC) {
+
+ // System.err.println("FoundSpecific");
+ String name = diagramDefinition.getPrefix();
+ if(selection.getElement() instanceof NamedElement) {
+ name += ((NamedElement)selection.getElement()).getName();
+ } else {
+ name += selection.getElement().toString();
+ }
+
+ try {
+ creationCommandDescriptor.getCommand().createDiagram(diResourceSet, selection.getElement(), name);
+
+ //Identify the new diagram
+ TreeIterator<EObject> it = diResourceSet.getNotationResource().getAllContents();
+ while(it.hasNext()) {
+ EObject diagram = (EObject)it.next();
+ if(diagram instanceof Diagram) {
+ if(!diagramsInResource.contains(diagram.eResource().getURIFragment(diagram))) {
+ diagramsCreated.put(diagram.eResource().getURIFragment(diagram), selection);
+ diagramsInResource.add(diagram.eResource().getURIFragment(diagram));
+
+ creationReport.put(selection.getElement(), CreationReportKind.SUCCESS);
+ }
+ }
+ }
+ } catch (BackboneException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Helper method used to arrange recursively editparts
+ *
+ * @param editpart
+ * the editpart to process
+ */
+ protected void arrangeRecursively(EditPart editpart) {
+ //ArrangeRequest request = new ArrangeRequest(ActionIds.ACTION_ARRANGE_ALL, LayoutType.DEFAULT);
+ ArrangeRequest request = new ArrangeRequest(RequestConstants.REQ_ARRANGE_DEFERRED);
+ List<EditPart> listToArrange = new ArrayList<EditPart>();
+ listToArrange.addAll(editpart.getChildren());
+
+ if(!listToArrange.isEmpty()) {
+ for(Object element : editpart.getChildren()) {
+ if(element instanceof EditPart) {
+ arrangeRecursively((EditPart)element);
+ }
+ }
+
+ request.setViewAdaptersToArrange(listToArrange);
+
+ Command command = editpart.getCommand(request);
+ command.execute();
+ }
+ }
+
+ /**
+ * This is the main method for the template launcher. Executes the template
+ *
+ * @param template
+ * The template to execute
+ */
+ public void execute(Template template) {
+ initializeDiagramCategories();
+ diagramsInResource = new ArrayList<String>();
+ diagramsCreated = new HashMap<String, AbstractSelection>();
+ creationReport = new HashMap<EObject, CreationReportKind>();
+
+ if(template != null) {
+ DiResourceSet diResourceSet = new DiResourceSet();
+
+ if(template.getTargetRoot().eResource() != null) {
+ String targetModelLocation = template.getTargetRoot().eResource().getURI().toPlatformString(false);
+ IFile targetModelfile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(targetModelLocation));
+
+ IFile file = IDEWorkbenchPlugin.getPluginWorkspace().getRoot().getFile(new Path(targetModelfile.getFullPath().removeFileExtension().toString() + ".di")); //$NON-NLS-1$
+
+ if(file.exists()) {
+
+ diResourceSet.loadResources(file);
+
+ //Identify already available diagrams
+ TreeIterator<EObject> it = diResourceSet.getNotationResource().getAllContents();
+ while(it.hasNext()) {
+ EObject diagram = (EObject)it.next();
+ if(diagram instanceof Diagram) {
+ diagramsInResource.add(diagram.eResource().getURIFragment(diagram));
+ }
+ }
+
+ // Create diagrams
+ if(!template.getDiagramDefinitions().isEmpty()) {
+ for(DiagramDefinition diagramDefinition : template.getDiagramDefinitions()) {
+ createDiagramFor(diagramDefinition.getSelection(), diagramDefinition, diResourceSet);
+ }
+ } else {
+ // Create empty diagrams
+ EditorUtils.getTransactionalIPageMngr(diResourceSet.getDiResource(), diResourceSet.getTransactionalEditingDomain());
+ }
+
+ // Save the resource
+ try {
+ diResourceSet.save(new NullProgressMonitor());
+ } catch (IOException e) {
+ e.printStackTrace();
+ // return false;
+ }
+
+
+ // Open the editor
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ if(page != null) {
+ try {
+ IEditorPart editor = IDE.openEditor(page, file, true);
+
+ if(editor instanceof PapyrusMultiDiagramEditor) {
+ ServicesRegistry services = ((PapyrusMultiDiagramEditor)editor).getServicesRegistry();
+ IPageMngr pageMngr = services.getService(IPageMngr.class);
+
+ pageMngr.closeAllOpenedPages();
+
+ // Go through the diagrams available in the resource
+ for(Object pageDiagram : pageMngr.allPages()) {
+
+ if(pageDiagram instanceof Diagram) {
+ String pageID = ((Diagram)pageDiagram).eResource().getURIFragment((Diagram)pageDiagram);
+
+ if(diagramsCreated.containsKey(pageID)) {
+ pageMngr.openPage(pageDiagram);
+ IEditorPart activeEditor = ((PapyrusMultiDiagramEditor)editor).getActiveEditor();
+
+ if(activeEditor instanceof DiagramEditor) {
+ // Get the GraphicalViewer for this diagram
+ Object result = activeEditor.getAdapter(GraphicalViewer.class);
+ if(result != null && result instanceof GraphicalViewer) {
+ DiagramEditPart diagramEditPart = (DiagramEditPart)((GraphicalViewer)result).getEditPartRegistry().get(pageDiagram);
+
+ // Retrieve the selection to show for this diagram
+ AbstractSelection selection = diagramsCreated.get(pageID);
+
+ addElementsFor(selection.getSelectionRef(), ((Diagram)pageDiagram).getElement(), (DiagramEditor)activeEditor, diagramEditPart);
+
+ //Arrange all recursively
+ arrangeRecursively(diagramEditPart);
+ }
+
+ // This page is processed now (may be not necessary)
+ diagramsCreated.remove(pageID);
+ }
+ }
+ }
+ }
+ }
+
+ //Report
+ DiagramTemplateLauncherReport.getInstance().showReport(creationReport);
+
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ } catch (ServiceException e) {
+ e.printStackTrace();
+ }
+ }
+
+ } else {
+ MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.DiagramTemplateLauncher_6, Messages.DiagramTemplateLauncher_7);
+ }
+ }
+ }
+ }
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java
new file mode 100644
index 00000000000..32bf1d17b28
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/launcher/DiagramTemplateLauncherReport.java
@@ -0,0 +1,117 @@
+/*****************************************************************************
+ * Copyright (c) 2010 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:
+ * Florian Noyrit - florian.noyrit@cea.fr (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.diagramtemplate.launcher;
+
+import java.util.HashMap;
+import java.util.Map.Entry;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.papyrus.diagramtemplate.launcher.DiagramTemplateLauncher.CreationReportKind;
+import org.eclipse.papyrus.diagramtemplate.utils.Messages;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+import org.eclipse.uml2.uml.NamedElement;
+
+import com.swtdesigner.ResourceManager;
+
+
+
+
+public class DiagramTemplateLauncherReport {
+
+ class DiagramTemplateLauncherReportLabelProvider implements ILabelProvider {
+
+ /**
+ * {@inheritDoc}
+ */
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void dispose() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Image getImage(Object element) {
+ if(element instanceof Entry) {
+ if(((Entry)element).getValue() == CreationReportKind.SUCCESS) {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/add.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else if(((Entry)element).getValue() == CreationReportKind.FAIL) {
+ return ResourceManager.getPluginImage("org.eclipse.papyrus.diagramtemplate.editor", "icons/full/obj16/delete.gif"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getText(Object element) {
+ if(element instanceof Entry) {
+ Object key = ((Entry)element).getKey();
+ String result = ((EObject)key).eResource().getURIFragment((EObject)key);
+ if(key instanceof NamedElement) {
+ result = ((NamedElement)key).getQualifiedName() + " (" + result + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return result;
+ }
+ return null;
+ }
+
+ }
+
+ private static DiagramTemplateLauncherReport instance = null;
+
+ private DiagramTemplateLauncherReport() {
+ }
+
+ public static final synchronized DiagramTemplateLauncherReport getInstance() {
+ if(instance == null) {
+ instance = new DiagramTemplateLauncherReport();
+ }
+
+ return instance;
+ // return null;
+ }
+
+ public void showReport(HashMap<EObject, CreationReportKind> report) {
+ // ListSelectionDialog dlg = new ListSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite().getShell(), report, new DiagramTemplateLauncherReportContentProvider(), new DiagramTemplateLauncherReportLabelProvider(), "Report");
+ // dlg.open();
+ ElementListSelectionDialog dlg = new ElementListSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite().getShell(), new DiagramTemplateLauncherReportLabelProvider());
+ dlg.setElements(report.entrySet().toArray());
+ dlg.setTitle(Messages.DiagramTemplateLauncherReport_6);
+ dlg.open();
+ }
+
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/utils/Messages.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/utils/Messages.java
new file mode 100644
index 00000000000..cc4a1436df1
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/utils/Messages.java
@@ -0,0 +1,115 @@
+package org.eclipse.papyrus.diagramtemplate.utils;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.diagramtemplate.utils.messages"; //$NON-NLS-1$
+
+ public static String DiagramTemplateEditor_0;
+
+ public static String DiagramTemplateEditor_1;
+
+ public static String DiagramTemplateEditor_100;
+
+ public static String DiagramTemplateEditor_105;
+
+ public static String DiagramTemplateEditor_108;
+
+ public static String DiagramTemplateEditor_109;
+
+ public static String DiagramTemplateEditor_112;
+
+ public static String DiagramTemplateEditor_15;
+
+ public static String DiagramTemplateEditor_18;
+
+ public static String DiagramTemplateEditor_19;
+
+ public static String DiagramTemplateEditor_2;
+
+ public static String DiagramTemplateEditor_20;
+
+ public static String DiagramTemplateEditor_21;
+
+ public static String DiagramTemplateEditor_23;
+
+ public static String DiagramTemplateEditor_24;
+
+ public static String DiagramTemplateEditor_26;
+
+ public static String DiagramTemplateEditor_27;
+
+ public static String DiagramTemplateEditor_28;
+
+ public static String DiagramTemplateEditor_3;
+
+ public static String DiagramTemplateEditor_34;
+
+ public static String DiagramTemplateEditor_35;
+
+ public static String DiagramTemplateEditor_4;
+
+ public static String DiagramTemplateEditor_47;
+
+ public static String DiagramTemplateEditor_49;
+
+ public static String DiagramTemplateEditor_5;
+
+ public static String DiagramTemplateEditor_51;
+
+ public static String DiagramTemplateEditor_53;
+
+ public static String DiagramTemplateEditor_55;
+
+ public static String DiagramTemplateEditor_56;
+
+ public static String DiagramTemplateEditor_57;
+
+ public static String DiagramTemplateEditor_58;
+
+ public static String DiagramTemplateEditor_60;
+
+ public static String DiagramTemplateEditor_62;
+
+ public static String DiagramTemplateEditor_64;
+
+ public static String DiagramTemplateEditor_67;
+
+ public static String DiagramTemplateEditor_68;
+
+ public static String DiagramTemplateEditor_71;
+
+ public static String DiagramTemplateEditor_74;
+
+ public static String DiagramTemplateEditor_77;
+
+ public static String DiagramTemplateEditor_90;
+
+ public static String DiagramTemplateEditor_91;
+
+ public static String DiagramTemplateEditor_93;
+
+ public static String DiagramTemplateEditor_95;
+
+ public static String DiagramTemplateEditor_98;
+
+ public static String DiagramTemplateEditor_99;
+
+ public static String DiagramTemplateLauncher_3;
+
+ public static String DiagramTemplateLauncher_4;
+
+ public static String DiagramTemplateLauncher_6;
+
+ public static String DiagramTemplateLauncher_7;
+
+ public static String DiagramTemplateLauncherReport_6;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/utils/messages.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/utils/messages.properties
new file mode 100644
index 00000000000..a3218b8d42c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate.editor/src/org/eclipse/papyrus/diagramtemplate/utils/messages.properties
@@ -0,0 +1,50 @@
+DiagramTemplateEditor_0=DiagramDefinition
+DiagramTemplateEditor_1=Diagram-
+DiagramTemplateEditor_100=Select types to process
+DiagramTemplateEditor_105=All
+DiagramTemplateEditor_108=Select the elements:
+DiagramTemplateEditor_109=Select elements to process
+DiagramTemplateEditor_112=Specific
+DiagramTemplateEditor_15=Execute
+DiagramTemplateEditor_18=Select a target model
+DiagramTemplateEditor_19=You must select a target model to execute the template
+DiagramTemplateEditor_2=Fail to load template
+DiagramTemplateEditor_20=Model:
+DiagramTemplateEditor_21=Load from workspace...
+DiagramTemplateEditor_23=Select a UML model
+DiagramTemplateEditor_24=Select the UML model you want to create the diagram for:
+DiagramTemplateEditor_26=Clear
+DiagramTemplateEditor_27=Confirm you want to clear
+DiagramTemplateEditor_28=By clearing, all specific information related to the model contained in the template will be removed. This will lead to a generic template. The operation not undoable. Are you sure?
+DiagramTemplateEditor_3=An error occured while loading the template.
+DiagramTemplateEditor_34=Cannot add the diagram definition
+DiagramTemplateEditor_35=You must select a diagram kind
+DiagramTemplateEditor_4=Fail to load target model
+DiagramTemplateEditor_47=Copy-
+DiagramTemplateEditor_49=Name:
+DiagramTemplateEditor_5=An error occured while loading the target model.
+DiagramTemplateEditor_51=Description:
+DiagramTemplateEditor_53=Prefix:
+DiagramTemplateEditor_55=Root:
+DiagramTemplateEditor_56=Select root
+DiagramTemplateEditor_57=Select a root
+DiagramTemplateEditor_58=Select the root to start from:
+DiagramTemplateEditor_60=Diagram kind:
+DiagramTemplateEditor_62=Layout:
+DiagramTemplateEditor_64=For:
+DiagramTemplateEditor_67=Select the type:
+DiagramTemplateEditor_68=Select a type to process
+DiagramTemplateEditor_71=All
+DiagramTemplateEditor_74=Select an element to process
+DiagramTemplateEditor_77=Specific
+DiagramTemplateEditor_90=Selection
+DiagramTemplateEditor_91=Recursively
+DiagramTemplateEditor_93=SubTypes
+DiagramTemplateEditor_95=Stereotyped by
+DiagramTemplateEditor_98=What:
+DiagramTemplateEditor_99=Select the types:
+DiagramTemplateLauncher_3=Problem occured during execution
+DiagramTemplateLauncher_4=The template is ill-formed
+DiagramTemplateLauncher_6=Papyrus diagram resource must exist
+DiagramTemplateLauncher_7=Please create the Papyrus diagram resource first
+DiagramTemplateLauncherReport_6=Report
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.classpath b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.classpath
new file mode 100644
index 00000000000..efdacce142c
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.project b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.project
new file mode 100644
index 00000000000..9ab95a46b77
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.diagramtemplate</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/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.settings/org.eclipse.jdt.core.prefs b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..7750f4012a5
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Jan 28 11:25:58 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/META-INF/MANIFEST.MF b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..42904a455d7
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.diagramtemplate;singleton:=true
+Bundle-Version: 0.7.3.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.diagramtemplate,
+ org.eclipse.papyrus.diagramtemplate.impl,
+ org.eclipse.papyrus.diagramtemplate.util
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/about.html b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/about.html
new file mode 100644
index 00000000000..209103075a7
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</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> \ No newline at end of file
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/build.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/build.properties
new file mode 100644
index 00000000000..d8548418d3b
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/build.properties
@@ -0,0 +1,15 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/model/diagramTemplate.ecore b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/model/diagramTemplate.ecore
new file mode 100644
index 00000000000..04010743e3e
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/model/diagramTemplate.ecore
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="diagramtemplate"
+ nsURI="http://www.eclipse.org/papyrus/diagramtemplate" nsPrefix="diagramtemplate">
+ <eClassifiers xsi:type="ecore:EClass" name="DiagramDefinition">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="fromRoot" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="selection" upperBound="-1"
+ eType="#//Selection" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="diagramKind" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="layoutToApply" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="prefix" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Selection" eSuperTypes="#//AbstractSelection">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="recursively" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SelectionRef" eSuperTypes="#//AbstractSelection">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="eReference" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EEnum" name="SelectionKind">
+ <eLiterals name="ForAll"/>
+ <eLiterals name="Specific" value="1"/>
+ <eLiterals name="Query" value="2"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Template">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="diagramDefinitions" upperBound="-1"
+ eType="#//DiagramDefinition" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="targetRoot" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="AbstractSelection" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="element" eType="ecore:EClass http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="kind" lowerBound="1" eType="#//SelectionKind"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="selectionRef" upperBound="-1"
+ eType="#//SelectionRef" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="subTypes" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="stereotypedBy" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/model/diagramTemplate.genmodel b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/model/diagramTemplate.genmodel
new file mode 100644
index 00000000000..bfcc3bb3eca
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/model/diagramTemplate.genmodel
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.papyrus.diagramtemplate/src"
+ editDirectory="/org.eclipse.papyrus.diagramtemplate.edit/src" editorDirectory="/org.eclipse.papyrus.diagramtemplate.editor/src"
+ modelPluginID="org.eclipse.papyrus.diagramtemplate" modelName="DiagramTemplate"
+ editPluginClass="org.eclipse.papyrus.diagramtemplate.provider.DiagramTemplateEditPlugin"
+ editorPluginClass="org.eclipse.papyrus.diagramtemplate.presentation.DiagramTemplateEditorPlugin"
+ testSuiteClass="org.eclipse.papyrus.diagramtemplate.tests.DiagramTemplateAllTests"
+ importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false">
+ <foreignModel>diagramTemplate.ecore</foreignModel>
+ <genPackages prefix="DiagramTemplate" basePackage="org.eclipse.papyrus" disposableProviderFactory="true"
+ ecorePackage="diagramTemplate.ecore#/">
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="diagramTemplate.ecore#//SelectionKind">
+ <genEnumLiterals ecoreEnumLiteral="diagramTemplate.ecore#//SelectionKind/ForAll"/>
+ <genEnumLiterals ecoreEnumLiteral="diagramTemplate.ecore#//SelectionKind/Specific"/>
+ <genEnumLiterals ecoreEnumLiteral="diagramTemplate.ecore#//SelectionKind/Query"/>
+ </genEnums>
+ <genClasses ecoreClass="diagramTemplate.ecore#//DiagramDefinition">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//DiagramDefinition/description"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference diagramTemplate.ecore#//DiagramDefinition/fromRoot"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference diagramTemplate.ecore#//DiagramDefinition/selection"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//DiagramDefinition/diagramKind"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//DiagramDefinition/layoutToApply"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//DiagramDefinition/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//DiagramDefinition/prefix"/>
+ </genClasses>
+ <genClasses ecoreClass="diagramTemplate.ecore#//Selection">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//Selection/recursively"/>
+ </genClasses>
+ <genClasses ecoreClass="diagramTemplate.ecore#//SelectionRef">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference diagramTemplate.ecore#//SelectionRef/eReference"/>
+ </genClasses>
+ <genClasses ecoreClass="diagramTemplate.ecore#//Template">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference diagramTemplate.ecore#//Template/diagramDefinitions"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference diagramTemplate.ecore#//Template/targetRoot"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="diagramTemplate.ecore#//AbstractSelection">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference diagramTemplate.ecore#//AbstractSelection/element"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//AbstractSelection/kind"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference diagramTemplate.ecore#//AbstractSelection/selectionRef"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//AbstractSelection/subTypes"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagramTemplate.ecore#//AbstractSelection/stereotypedBy"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/plugin.properties b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/plugin.properties
new file mode 100644
index 00000000000..9a36b8742b1
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/plugin.properties
@@ -0,0 +1,37 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = DiagramTemplate Model
+providerName = www.example.org
+_UI_CreateChild_text = {0}
+_UI_CreateChild_text2 = {1} {0}
+_UI_CreateChild_text3 = {1}
+_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
+_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
+_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
+ _UI_PropertyDescriptor_description = The {0} of the {1}
+ _UI_DiagramDefinition_type = Diagram Definition
+_UI_Selection_type = Selection
+_UI_SelectionRef_type = Selection Ref
+_UI_Template_type = Template
+_UI_Unknown_type = Object
+ _UI_Unknown_datatype= Value
+ _UI_DiagramDefinition_description_feature = Description
+_UI_DiagramDefinition_fromRoot_feature = From Root
+_UI_DiagramDefinition_selection_feature = Selection
+_UI_DiagramDefinition_diagramKind_feature = Diagram Kind
+_UI_DiagramDefinition_layoutToApply_feature = Layout To Apply
+_UI_DiagramDefinition_name_feature = Name
+_UI_Selection_element_feature = Element
+_UI_Selection_kind_feature = Kind
+_UI_Selection_selectionRef_feature = Selection Ref
+_UI_Selection_recursively_feature = Recursively
+_UI_SelectionRef_eReference_feature = EReference
+_UI_Template_diagramDefinitions_feature = Diagram Definitions
+_UI_Unknown_feature = Unspecified
+ _UI_SelectionKind_ForAll_literal = ForAll
+_UI_SelectionKind_Specific_literal = Specific
+_UI_SelectionKind_Query_literal = Query
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/plugin.xml b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/plugin.xml
new file mode 100644
index 00000000000..3bc3db07672
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/plugin.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ <copyright>
+ </copyright>
+
+ $Id$
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <package
+ uri="http://www.eclipse.org/papyrus/diagramtemplate"
+ class="org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage"
+ genModel="model/diagramtemplate.genmodel"/>
+ </extension>
+
+</plugin>
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/AbstractSelection.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/AbstractSelection.java
new file mode 100644
index 00000000000..b79c522e4b7
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/AbstractSelection.java
@@ -0,0 +1,156 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Abstract Selection</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getElement <em>Element</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getKind <em>Kind</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getSelectionRef <em>Selection Ref</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#isSubTypes <em>Sub Types</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getStereotypedBy <em>Stereotyped By</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getAbstractSelection()
+ * @model abstract="true"
+ * @generated
+ */
+public interface AbstractSelection extends EObject {
+ /**
+ * Returns the value of the '<em><b>Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Element</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Element</em>' reference.
+ * @see #setElement(EObject)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getAbstractSelection_Element()
+ * @model
+ * @generated
+ */
+ EObject getElement();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getElement <em>Element</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Element</em>' reference.
+ * @see #getElement()
+ * @generated
+ */
+ void setElement(EObject value);
+
+ /**
+ * Returns the value of the '<em><b>Kind</b></em>' attribute.
+ * The literals are from the enumeration {@link org.eclipse.papyrus.diagramtemplate.SelectionKind}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Kind</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Kind</em>' attribute.
+ * @see org.eclipse.papyrus.diagramtemplate.SelectionKind
+ * @see #setKind(SelectionKind)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getAbstractSelection_Kind()
+ * @model required="true"
+ * @generated
+ */
+ SelectionKind getKind();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getKind <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Kind</em>' attribute.
+ * @see org.eclipse.papyrus.diagramtemplate.SelectionKind
+ * @see #getKind()
+ * @generated
+ */
+ void setKind(SelectionKind value);
+
+ /**
+ * Returns the value of the '<em><b>Selection Ref</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.papyrus.diagramtemplate.SelectionRef}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Selection Ref</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Selection Ref</em>' containment reference list.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getAbstractSelection_SelectionRef()
+ * @model containment="true"
+ * @generated
+ */
+ EList<SelectionRef> getSelectionRef();
+
+ /**
+ * Returns the value of the '<em><b>Sub Types</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Sub Types</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Sub Types</em>' attribute.
+ * @see #setSubTypes(boolean)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getAbstractSelection_SubTypes()
+ * @model required="true"
+ * @generated
+ */
+ boolean isSubTypes();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#isSubTypes <em>Sub Types</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Sub Types</em>' attribute.
+ * @see #isSubTypes()
+ * @generated
+ */
+ void setSubTypes(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Stereotyped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Stereotyped By</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Stereotyped By</em>' attribute.
+ * @see #setStereotypedBy(String)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getAbstractSelection_StereotypedBy()
+ * @model required="true"
+ * @generated
+ */
+ String getStereotypedBy();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getStereotypedBy <em>Stereotyped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Stereotyped By</em>' attribute.
+ * @see #getStereotypedBy()
+ * @generated
+ */
+ void setStereotypedBy(String value);
+
+} // AbstractSelection
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramDefinition.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramDefinition.java
new file mode 100644
index 00000000000..a3cb21d2a5d
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramDefinition.java
@@ -0,0 +1,207 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Diagram Definition</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getFromRoot <em>From Root</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getSelection <em>Selection</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getDiagramKind <em>Diagram Kind</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getLayoutToApply <em>Layout To Apply</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getPrefix <em>Prefix</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getDiagramDefinition()
+ * @model
+ * @generated
+ */
+public interface DiagramDefinition extends EObject {
+ /**
+ * Returns the value of the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Description</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Description</em>' attribute.
+ * @see #setDescription(String)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getDiagramDefinition_Description()
+ * @model required="true"
+ * @generated
+ */
+ String getDescription();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getDescription <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Description</em>' attribute.
+ * @see #getDescription()
+ * @generated
+ */
+ void setDescription(String value);
+
+ /**
+ * Returns the value of the '<em><b>From Root</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>From Root</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>From Root</em>' reference.
+ * @see #setFromRoot(EObject)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getDiagramDefinition_FromRoot()
+ * @model
+ * @generated
+ */
+ EObject getFromRoot();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getFromRoot <em>From Root</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>From Root</em>' reference.
+ * @see #getFromRoot()
+ * @generated
+ */
+ void setFromRoot(EObject value);
+
+ /**
+ * Returns the value of the '<em><b>Selection</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.papyrus.diagramtemplate.Selection}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Selection</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Selection</em>' containment reference list.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getDiagramDefinition_Selection()
+ * @model containment="true"
+ * @generated
+ */
+ EList<Selection> getSelection();
+
+ /**
+ * Returns the value of the '<em><b>Diagram Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Diagram Kind</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Diagram Kind</em>' attribute.
+ * @see #setDiagramKind(String)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getDiagramDefinition_DiagramKind()
+ * @model
+ * @generated
+ */
+ String getDiagramKind();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getDiagramKind <em>Diagram Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Diagram Kind</em>' attribute.
+ * @see #getDiagramKind()
+ * @generated
+ */
+ void setDiagramKind(String value);
+
+ /**
+ * Returns the value of the '<em><b>Layout To Apply</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Layout To Apply</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Layout To Apply</em>' attribute.
+ * @see #setLayoutToApply(String)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getDiagramDefinition_LayoutToApply()
+ * @model
+ * @generated
+ */
+ String getLayoutToApply();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getLayoutToApply <em>Layout To Apply</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Layout To Apply</em>' attribute.
+ * @see #getLayoutToApply()
+ * @generated
+ */
+ void setLayoutToApply(String value);
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getDiagramDefinition_Name()
+ * @model required="true"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Prefix</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Prefix</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Prefix</em>' attribute.
+ * @see #setPrefix(String)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getDiagramDefinition_Prefix()
+ * @model required="true"
+ * @generated
+ */
+ String getPrefix();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getPrefix <em>Prefix</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Prefix</em>' attribute.
+ * @see #getPrefix()
+ * @generated
+ */
+ void setPrefix(String value);
+
+} // DiagramDefinition
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramTemplateFactory.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramTemplateFactory.java
new file mode 100644
index 00000000000..34d5f702eeb
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramTemplateFactory.java
@@ -0,0 +1,73 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage
+ * @generated
+ */
+public interface DiagramTemplateFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ DiagramTemplateFactory eINSTANCE = org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplateFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Diagram Definition</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Diagram Definition</em>'.
+ * @generated
+ */
+ DiagramDefinition createDiagramDefinition();
+
+ /**
+ * Returns a new object of class '<em>Selection</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Selection</em>'.
+ * @generated
+ */
+ Selection createSelection();
+
+ /**
+ * Returns a new object of class '<em>Selection Ref</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Selection Ref</em>'.
+ * @generated
+ */
+ SelectionRef createSelectionRef();
+
+ /**
+ * Returns a new object of class '<em>Template</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Template</em>'.
+ * @generated
+ */
+ Template createTemplate();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ DiagramTemplatePackage getDiagramTemplatePackage();
+
+} //DiagramTemplateFactory
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramTemplatePackage.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramTemplatePackage.java
new file mode 100644
index 00000000000..0530e201a61
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/DiagramTemplatePackage.java
@@ -0,0 +1,851 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface DiagramTemplatePackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "diagramtemplate";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/papyrus/diagramtemplate";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "diagramtemplate";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ DiagramTemplatePackage eINSTANCE = org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl <em>Diagram Definition</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getDiagramDefinition()
+ * @generated
+ */
+ int DIAGRAM_DEFINITION = 0;
+
+ /**
+ * The feature id for the '<em><b>Description</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DEFINITION__DESCRIPTION = 0;
+
+ /**
+ * The feature id for the '<em><b>From Root</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DEFINITION__FROM_ROOT = 1;
+
+ /**
+ * The feature id for the '<em><b>Selection</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DEFINITION__SELECTION = 2;
+
+ /**
+ * The feature id for the '<em><b>Diagram Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DEFINITION__DIAGRAM_KIND = 3;
+
+ /**
+ * The feature id for the '<em><b>Layout To Apply</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DEFINITION__LAYOUT_TO_APPLY = 4;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DEFINITION__NAME = 5;
+
+ /**
+ * The feature id for the '<em><b>Prefix</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DEFINITION__PREFIX = 6;
+
+ /**
+ * The number of structural features of the '<em>Diagram Definition</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int DIAGRAM_DEFINITION_FEATURE_COUNT = 7;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl <em>Abstract Selection</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getAbstractSelection()
+ * @generated
+ */
+ int ABSTRACT_SELECTION = 4;
+
+ /**
+ * The feature id for the '<em><b>Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_SELECTION__ELEMENT = 0;
+
+ /**
+ * The feature id for the '<em><b>Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_SELECTION__KIND = 1;
+
+ /**
+ * The feature id for the '<em><b>Selection Ref</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_SELECTION__SELECTION_REF = 2;
+
+ /**
+ * The feature id for the '<em><b>Sub Types</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_SELECTION__SUB_TYPES = 3;
+
+ /**
+ * The feature id for the '<em><b>Stereotyped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_SELECTION__STEREOTYPED_BY = 4;
+
+ /**
+ * The number of structural features of the '<em>Abstract Selection</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int ABSTRACT_SELECTION_FEATURE_COUNT = 5;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.diagramtemplate.impl.SelectionImpl <em>Selection</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.SelectionImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getSelection()
+ * @generated
+ */
+ int SELECTION = 1;
+
+ /**
+ * The feature id for the '<em><b>Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION__ELEMENT = ABSTRACT_SELECTION__ELEMENT;
+
+ /**
+ * The feature id for the '<em><b>Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION__KIND = ABSTRACT_SELECTION__KIND;
+
+ /**
+ * The feature id for the '<em><b>Selection Ref</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION__SELECTION_REF = ABSTRACT_SELECTION__SELECTION_REF;
+
+ /**
+ * The feature id for the '<em><b>Sub Types</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION__SUB_TYPES = ABSTRACT_SELECTION__SUB_TYPES;
+
+ /**
+ * The feature id for the '<em><b>Stereotyped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION__STEREOTYPED_BY = ABSTRACT_SELECTION__STEREOTYPED_BY;
+
+ /**
+ * The feature id for the '<em><b>Recursively</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION__RECURSIVELY = ABSTRACT_SELECTION_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Selection</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION_FEATURE_COUNT = ABSTRACT_SELECTION_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.diagramtemplate.impl.SelectionRefImpl <em>Selection Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.SelectionRefImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getSelectionRef()
+ * @generated
+ */
+ int SELECTION_REF = 2;
+
+ /**
+ * The feature id for the '<em><b>Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION_REF__ELEMENT = ABSTRACT_SELECTION__ELEMENT;
+
+ /**
+ * The feature id for the '<em><b>Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION_REF__KIND = ABSTRACT_SELECTION__KIND;
+
+ /**
+ * The feature id for the '<em><b>Selection Ref</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION_REF__SELECTION_REF = ABSTRACT_SELECTION__SELECTION_REF;
+
+ /**
+ * The feature id for the '<em><b>Sub Types</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION_REF__SUB_TYPES = ABSTRACT_SELECTION__SUB_TYPES;
+
+ /**
+ * The feature id for the '<em><b>Stereotyped By</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION_REF__STEREOTYPED_BY = ABSTRACT_SELECTION__STEREOTYPED_BY;
+
+ /**
+ * The feature id for the '<em><b>EReference</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION_REF__EREFERENCE = ABSTRACT_SELECTION_FEATURE_COUNT + 0;
+
+ /**
+ * The number of structural features of the '<em>Selection Ref</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int SELECTION_REF_FEATURE_COUNT = ABSTRACT_SELECTION_FEATURE_COUNT + 1;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.diagramtemplate.impl.TemplateImpl <em>Template</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.TemplateImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getTemplate()
+ * @generated
+ */
+ int TEMPLATE = 3;
+
+ /**
+ * The feature id for the '<em><b>Diagram Definitions</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TEMPLATE__DIAGRAM_DEFINITIONS = 0;
+
+ /**
+ * The feature id for the '<em><b>Target Root</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TEMPLATE__TARGET_ROOT = 1;
+
+ /**
+ * The number of structural features of the '<em>Template</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int TEMPLATE_FEATURE_COUNT = 2;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.diagramtemplate.SelectionKind <em>Selection Kind</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.SelectionKind
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getSelectionKind()
+ * @generated
+ */
+ int SELECTION_KIND = 5;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition <em>Diagram Definition</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Diagram Definition</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition
+ * @generated
+ */
+ EClass getDiagramDefinition();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getDescription <em>Description</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Description</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getDescription()
+ * @see #getDiagramDefinition()
+ * @generated
+ */
+ EAttribute getDiagramDefinition_Description();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getFromRoot <em>From Root</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>From Root</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getFromRoot()
+ * @see #getDiagramDefinition()
+ * @generated
+ */
+ EReference getDiagramDefinition_FromRoot();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getSelection <em>Selection</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Selection</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getSelection()
+ * @see #getDiagramDefinition()
+ * @generated
+ */
+ EReference getDiagramDefinition_Selection();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getDiagramKind <em>Diagram Kind</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Diagram Kind</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getDiagramKind()
+ * @see #getDiagramDefinition()
+ * @generated
+ */
+ EAttribute getDiagramDefinition_DiagramKind();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getLayoutToApply <em>Layout To Apply</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Layout To Apply</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getLayoutToApply()
+ * @see #getDiagramDefinition()
+ * @generated
+ */
+ EAttribute getDiagramDefinition_LayoutToApply();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getName()
+ * @see #getDiagramDefinition()
+ * @generated
+ */
+ EAttribute getDiagramDefinition_Name();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getPrefix <em>Prefix</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Prefix</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition#getPrefix()
+ * @see #getDiagramDefinition()
+ * @generated
+ */
+ EAttribute getDiagramDefinition_Prefix();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.diagramtemplate.Selection <em>Selection</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Selection</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.Selection
+ * @generated
+ */
+ EClass getSelection();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.Selection#isRecursively <em>Recursively</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Recursively</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.Selection#isRecursively()
+ * @see #getSelection()
+ * @generated
+ */
+ EAttribute getSelection_Recursively();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.diagramtemplate.SelectionRef <em>Selection Ref</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Selection Ref</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.SelectionRef
+ * @generated
+ */
+ EClass getSelectionRef();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.diagramtemplate.SelectionRef#getEReference <em>EReference</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>EReference</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.SelectionRef#getEReference()
+ * @see #getSelectionRef()
+ * @generated
+ */
+ EReference getSelectionRef_EReference();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.diagramtemplate.Template <em>Template</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Template</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.Template
+ * @generated
+ */
+ EClass getTemplate();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.diagramtemplate.Template#getDiagramDefinitions <em>Diagram Definitions</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Diagram Definitions</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.Template#getDiagramDefinitions()
+ * @see #getTemplate()
+ * @generated
+ */
+ EReference getTemplate_DiagramDefinitions();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.diagramtemplate.Template#getTargetRoot <em>Target Root</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Target Root</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.Template#getTargetRoot()
+ * @see #getTemplate()
+ * @generated
+ */
+ EReference getTemplate_TargetRoot();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection <em>Abstract Selection</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Abstract Selection</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.AbstractSelection
+ * @generated
+ */
+ EClass getAbstractSelection();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getElement <em>Element</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Element</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.AbstractSelection#getElement()
+ * @see #getAbstractSelection()
+ * @generated
+ */
+ EReference getAbstractSelection_Element();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getKind <em>Kind</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Kind</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.AbstractSelection#getKind()
+ * @see #getAbstractSelection()
+ * @generated
+ */
+ EAttribute getAbstractSelection_Kind();
+
+ /**
+ * Returns the meta object for the containment reference list '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getSelectionRef <em>Selection Ref</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the containment reference list '<em>Selection Ref</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.AbstractSelection#getSelectionRef()
+ * @see #getAbstractSelection()
+ * @generated
+ */
+ EReference getAbstractSelection_SelectionRef();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#isSubTypes <em>Sub Types</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Sub Types</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.AbstractSelection#isSubTypes()
+ * @see #getAbstractSelection()
+ * @generated
+ */
+ EAttribute getAbstractSelection_SubTypes();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection#getStereotypedBy <em>Stereotyped By</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Stereotyped By</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.AbstractSelection#getStereotypedBy()
+ * @see #getAbstractSelection()
+ * @generated
+ */
+ EAttribute getAbstractSelection_StereotypedBy();
+
+ /**
+ * Returns the meta object for enum '{@link org.eclipse.papyrus.diagramtemplate.SelectionKind <em>Selection Kind</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for enum '<em>Selection Kind</em>'.
+ * @see org.eclipse.papyrus.diagramtemplate.SelectionKind
+ * @generated
+ */
+ EEnum getSelectionKind();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ DiagramTemplateFactory getDiagramTemplateFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl <em>Diagram Definition</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getDiagramDefinition()
+ * @generated
+ */
+ EClass DIAGRAM_DEFINITION = eINSTANCE.getDiagramDefinition();
+
+ /**
+ * The meta object literal for the '<em><b>Description</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute DIAGRAM_DEFINITION__DESCRIPTION = eINSTANCE.getDiagramDefinition_Description();
+
+ /**
+ * The meta object literal for the '<em><b>From Root</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference DIAGRAM_DEFINITION__FROM_ROOT = eINSTANCE.getDiagramDefinition_FromRoot();
+
+ /**
+ * The meta object literal for the '<em><b>Selection</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference DIAGRAM_DEFINITION__SELECTION = eINSTANCE.getDiagramDefinition_Selection();
+
+ /**
+ * The meta object literal for the '<em><b>Diagram Kind</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute DIAGRAM_DEFINITION__DIAGRAM_KIND = eINSTANCE.getDiagramDefinition_DiagramKind();
+
+ /**
+ * The meta object literal for the '<em><b>Layout To Apply</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute DIAGRAM_DEFINITION__LAYOUT_TO_APPLY = eINSTANCE.getDiagramDefinition_LayoutToApply();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute DIAGRAM_DEFINITION__NAME = eINSTANCE.getDiagramDefinition_Name();
+
+ /**
+ * The meta object literal for the '<em><b>Prefix</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute DIAGRAM_DEFINITION__PREFIX = eINSTANCE.getDiagramDefinition_Prefix();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.diagramtemplate.impl.SelectionImpl <em>Selection</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.SelectionImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getSelection()
+ * @generated
+ */
+ EClass SELECTION = eINSTANCE.getSelection();
+
+ /**
+ * The meta object literal for the '<em><b>Recursively</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute SELECTION__RECURSIVELY = eINSTANCE.getSelection_Recursively();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.diagramtemplate.impl.SelectionRefImpl <em>Selection Ref</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.SelectionRefImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getSelectionRef()
+ * @generated
+ */
+ EClass SELECTION_REF = eINSTANCE.getSelectionRef();
+
+ /**
+ * The meta object literal for the '<em><b>EReference</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference SELECTION_REF__EREFERENCE = eINSTANCE.getSelectionRef_EReference();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.diagramtemplate.impl.TemplateImpl <em>Template</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.TemplateImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getTemplate()
+ * @generated
+ */
+ EClass TEMPLATE = eINSTANCE.getTemplate();
+
+ /**
+ * The meta object literal for the '<em><b>Diagram Definitions</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference TEMPLATE__DIAGRAM_DEFINITIONS = eINSTANCE.getTemplate_DiagramDefinitions();
+
+ /**
+ * The meta object literal for the '<em><b>Target Root</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference TEMPLATE__TARGET_ROOT = eINSTANCE.getTemplate_TargetRoot();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl <em>Abstract Selection</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getAbstractSelection()
+ * @generated
+ */
+ EClass ABSTRACT_SELECTION = eINSTANCE.getAbstractSelection();
+
+ /**
+ * The meta object literal for the '<em><b>Element</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference ABSTRACT_SELECTION__ELEMENT = eINSTANCE.getAbstractSelection_Element();
+
+ /**
+ * The meta object literal for the '<em><b>Kind</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ABSTRACT_SELECTION__KIND = eINSTANCE.getAbstractSelection_Kind();
+
+ /**
+ * The meta object literal for the '<em><b>Selection Ref</b></em>' containment reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference ABSTRACT_SELECTION__SELECTION_REF = eINSTANCE.getAbstractSelection_SelectionRef();
+
+ /**
+ * The meta object literal for the '<em><b>Sub Types</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ABSTRACT_SELECTION__SUB_TYPES = eINSTANCE.getAbstractSelection_SubTypes();
+
+ /**
+ * The meta object literal for the '<em><b>Stereotyped By</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute ABSTRACT_SELECTION__STEREOTYPED_BY = eINSTANCE.getAbstractSelection_StereotypedBy();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.diagramtemplate.SelectionKind <em>Selection Kind</em>}' enum.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.SelectionKind
+ * @see org.eclipse.papyrus.diagramtemplate.impl.DiagramTemplatePackageImpl#getSelectionKind()
+ * @generated
+ */
+ EEnum SELECTION_KIND = eINSTANCE.getSelectionKind();
+
+ }
+
+} //DiagramTemplatePackage
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/Selection.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/Selection.java
new file mode 100644
index 00000000000..fa1b6286f4b
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/Selection.java
@@ -0,0 +1,53 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Selection</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.Selection#isRecursively <em>Recursively</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getSelection()
+ * @model
+ * @generated
+ */
+public interface Selection extends AbstractSelection {
+ /**
+ * Returns the value of the '<em><b>Recursively</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Recursively</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Recursively</em>' attribute.
+ * @see #setRecursively(boolean)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getSelection_Recursively()
+ * @model required="true"
+ * @generated
+ */
+ boolean isRecursively();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.Selection#isRecursively <em>Recursively</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Recursively</em>' attribute.
+ * @see #isRecursively()
+ * @generated
+ */
+ void setRecursively(boolean value);
+
+} // Selection
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/SelectionKind.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/SelectionKind.java
new file mode 100644
index 00000000000..be902715263
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/SelectionKind.java
@@ -0,0 +1,239 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Selection Kind</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getSelectionKind()
+ * @model
+ * @generated
+ */
+public enum SelectionKind implements Enumerator {
+ /**
+ * The '<em><b>For All</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #FOR_ALL_VALUE
+ * @generated
+ * @ordered
+ */
+ FOR_ALL(0, "ForAll", "ForAll"),
+
+ /**
+ * The '<em><b>Specific</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #SPECIFIC_VALUE
+ * @generated
+ * @ordered
+ */
+ SPECIFIC(1, "Specific", "Specific"),
+
+ /**
+ * The '<em><b>Query</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #QUERY_VALUE
+ * @generated
+ * @ordered
+ */
+ QUERY(2, "Query", "Query");
+
+ /**
+ * The '<em><b>For All</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>For All</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #FOR_ALL
+ * @model name="ForAll"
+ * @generated
+ * @ordered
+ */
+ public static final int FOR_ALL_VALUE = 0;
+
+ /**
+ * The '<em><b>Specific</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>Specific</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #SPECIFIC
+ * @model name="Specific"
+ * @generated
+ * @ordered
+ */
+ public static final int SPECIFIC_VALUE = 1;
+
+ /**
+ * The '<em><b>Query</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>Query</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #QUERY
+ * @model name="Query"
+ * @generated
+ * @ordered
+ */
+ public static final int QUERY_VALUE = 2;
+
+ /**
+ * An array of all the '<em><b>Selection Kind</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final SelectionKind[] VALUES_ARRAY =
+ new SelectionKind[] {
+ FOR_ALL,
+ SPECIFIC,
+ QUERY,
+ };
+
+ /**
+ * A public read-only list of all the '<em><b>Selection Kind</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<SelectionKind> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Selection Kind</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SelectionKind get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ SelectionKind result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Selection Kind</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SelectionKind getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ SelectionKind result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Selection Kind</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static SelectionKind get(int value) {
+ switch (value) {
+ case FOR_ALL_VALUE: return FOR_ALL;
+ case SPECIFIC_VALUE: return SPECIFIC;
+ case QUERY_VALUE: return QUERY;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private SelectionKind(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //SelectionKind
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/SelectionRef.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/SelectionRef.java
new file mode 100644
index 00000000000..49f20832620
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/SelectionRef.java
@@ -0,0 +1,54 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Selection Ref</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.SelectionRef#getEReference <em>EReference</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getSelectionRef()
+ * @model
+ * @generated
+ */
+public interface SelectionRef extends AbstractSelection {
+ /**
+ * Returns the value of the '<em><b>EReference</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>EReference</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>EReference</em>' reference.
+ * @see #setEReference(EObject)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getSelectionRef_EReference()
+ * @model
+ * @generated
+ */
+ EObject getEReference();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.SelectionRef#getEReference <em>EReference</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>EReference</em>' reference.
+ * @see #getEReference()
+ * @generated
+ */
+ void setEReference(EObject value);
+
+} // SelectionRef
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/Template.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/Template.java
new file mode 100644
index 00000000000..ee440dc0c8f
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/Template.java
@@ -0,0 +1,72 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Template</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.Template#getDiagramDefinitions <em>Diagram Definitions</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.Template#getTargetRoot <em>Target Root</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getTemplate()
+ * @model
+ * @generated
+ */
+public interface Template extends EObject {
+ /**
+ * Returns the value of the '<em><b>Diagram Definitions</b></em>' containment reference list.
+ * The list contents are of type {@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Diagram Definitions</em>' containment reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Diagram Definitions</em>' containment reference list.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getTemplate_DiagramDefinitions()
+ * @model containment="true"
+ * @generated
+ */
+ EList<DiagramDefinition> getDiagramDefinitions();
+
+ /**
+ * Returns the value of the '<em><b>Target Root</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Target Root</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Target Root</em>' reference.
+ * @see #setTargetRoot(EObject)
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#getTemplate_TargetRoot()
+ * @model
+ * @generated
+ */
+ EObject getTargetRoot();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.diagramtemplate.Template#getTargetRoot <em>Target Root</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Target Root</em>' reference.
+ * @see #getTargetRoot()
+ * @generated
+ */
+ void setTargetRoot(EObject value);
+
+} // Template
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/AbstractSelectionImpl.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/AbstractSelectionImpl.java
new file mode 100644
index 00000000000..442b3adc42b
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/AbstractSelectionImpl.java
@@ -0,0 +1,391 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Abstract Selection</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl#getElement <em>Element</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl#getKind <em>Kind</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl#getSelectionRef <em>Selection Ref</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl#isSubTypes <em>Sub Types</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.AbstractSelectionImpl#getStereotypedBy <em>Stereotyped By</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public abstract class AbstractSelectionImpl extends EObjectImpl implements AbstractSelection {
+ /**
+ * The cached value of the '{@link #getElement() <em>Element</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getElement()
+ * @generated
+ * @ordered
+ */
+ protected EObject element;
+
+ /**
+ * The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected static final SelectionKind KIND_EDEFAULT = SelectionKind.FOR_ALL;
+
+ /**
+ * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected SelectionKind kind = KIND_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getSelectionRef() <em>Selection Ref</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSelectionRef()
+ * @generated
+ * @ordered
+ */
+ protected EList<SelectionRef> selectionRef;
+
+ /**
+ * The default value of the '{@link #isSubTypes() <em>Sub Types</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSubTypes()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean SUB_TYPES_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isSubTypes() <em>Sub Types</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSubTypes()
+ * @generated
+ * @ordered
+ */
+ protected boolean subTypes = SUB_TYPES_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getStereotypedBy() <em>Stereotyped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStereotypedBy()
+ * @generated
+ * @ordered
+ */
+ protected static final String STEREOTYPED_BY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getStereotypedBy() <em>Stereotyped By</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getStereotypedBy()
+ * @generated
+ * @ordered
+ */
+ protected String stereotypedBy = STEREOTYPED_BY_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AbstractSelectionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DiagramTemplatePackage.Literals.ABSTRACT_SELECTION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getElement() {
+ if (element != null && element.eIsProxy()) {
+ InternalEObject oldElement = (InternalEObject)element;
+ element = eResolveProxy(oldElement);
+ if (element != oldElement) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiagramTemplatePackage.ABSTRACT_SELECTION__ELEMENT, oldElement, element));
+ }
+ }
+ return element;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetElement() {
+ return element;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setElement(EObject newElement) {
+ EObject oldElement = element;
+ element = newElement;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.ABSTRACT_SELECTION__ELEMENT, oldElement, element));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SelectionKind getKind() {
+ return kind;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setKind(SelectionKind newKind) {
+ SelectionKind oldKind = kind;
+ kind = newKind == null ? KIND_EDEFAULT : newKind;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.ABSTRACT_SELECTION__KIND, oldKind, kind));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<SelectionRef> getSelectionRef() {
+ if (selectionRef == null) {
+ selectionRef = new EObjectContainmentEList<SelectionRef>(SelectionRef.class, this, DiagramTemplatePackage.ABSTRACT_SELECTION__SELECTION_REF);
+ }
+ return selectionRef;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isSubTypes() {
+ return subTypes;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSubTypes(boolean newSubTypes) {
+ boolean oldSubTypes = subTypes;
+ subTypes = newSubTypes;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.ABSTRACT_SELECTION__SUB_TYPES, oldSubTypes, subTypes));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getStereotypedBy() {
+ return stereotypedBy;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setStereotypedBy(String newStereotypedBy) {
+ String oldStereotypedBy = stereotypedBy;
+ stereotypedBy = newStereotypedBy;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.ABSTRACT_SELECTION__STEREOTYPED_BY, oldStereotypedBy, stereotypedBy));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SELECTION_REF:
+ return ((InternalEList<?>)getSelectionRef()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__ELEMENT:
+ if (resolve) return getElement();
+ return basicGetElement();
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__KIND:
+ return getKind();
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SELECTION_REF:
+ return getSelectionRef();
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SUB_TYPES:
+ return isSubTypes();
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__STEREOTYPED_BY:
+ return getStereotypedBy();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__ELEMENT:
+ setElement((EObject)newValue);
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__KIND:
+ setKind((SelectionKind)newValue);
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SELECTION_REF:
+ getSelectionRef().clear();
+ getSelectionRef().addAll((Collection<? extends SelectionRef>)newValue);
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SUB_TYPES:
+ setSubTypes((Boolean)newValue);
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__STEREOTYPED_BY:
+ setStereotypedBy((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__ELEMENT:
+ setElement((EObject)null);
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__KIND:
+ setKind(KIND_EDEFAULT);
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SELECTION_REF:
+ getSelectionRef().clear();
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SUB_TYPES:
+ setSubTypes(SUB_TYPES_EDEFAULT);
+ return;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__STEREOTYPED_BY:
+ setStereotypedBy(STEREOTYPED_BY_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__ELEMENT:
+ return element != null;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__KIND:
+ return kind != KIND_EDEFAULT;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SELECTION_REF:
+ return selectionRef != null && !selectionRef.isEmpty();
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__SUB_TYPES:
+ return subTypes != SUB_TYPES_EDEFAULT;
+ case DiagramTemplatePackage.ABSTRACT_SELECTION__STEREOTYPED_BY:
+ return STEREOTYPED_BY_EDEFAULT == null ? stereotypedBy != null : !STEREOTYPED_BY_EDEFAULT.equals(stereotypedBy);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (kind: ");
+ result.append(kind);
+ result.append(", subTypes: ");
+ result.append(subTypes);
+ result.append(", stereotypedBy: ");
+ result.append(stereotypedBy);
+ result.append(')');
+ return result.toString();
+ }
+
+} //AbstractSelectionImpl
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramDefinitionImpl.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramDefinitionImpl.java
new file mode 100644
index 00000000000..872f9e224e9
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramDefinitionImpl.java
@@ -0,0 +1,498 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Diagram Definition</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl#getDescription <em>Description</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl#getFromRoot <em>From Root</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl#getSelection <em>Selection</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl#getDiagramKind <em>Diagram Kind</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl#getLayoutToApply <em>Layout To Apply</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl#getName <em>Name</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.DiagramDefinitionImpl#getPrefix <em>Prefix</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class DiagramDefinitionImpl extends EObjectImpl implements DiagramDefinition {
+ /**
+ * The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDescription()
+ * @generated
+ * @ordered
+ */
+ protected static final String DESCRIPTION_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDescription()
+ * @generated
+ * @ordered
+ */
+ protected String description = DESCRIPTION_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getFromRoot() <em>From Root</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getFromRoot()
+ * @generated
+ * @ordered
+ */
+ protected EObject fromRoot;
+
+ /**
+ * The cached value of the '{@link #getSelection() <em>Selection</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSelection()
+ * @generated
+ * @ordered
+ */
+ protected EList<Selection> selection;
+
+ /**
+ * The default value of the '{@link #getDiagramKind() <em>Diagram Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiagramKind()
+ * @generated
+ * @ordered
+ */
+ protected static final String DIAGRAM_KIND_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getDiagramKind() <em>Diagram Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiagramKind()
+ * @generated
+ * @ordered
+ */
+ protected String diagramKind = DIAGRAM_KIND_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getLayoutToApply() <em>Layout To Apply</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLayoutToApply()
+ * @generated
+ * @ordered
+ */
+ protected static final String LAYOUT_TO_APPLY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getLayoutToApply() <em>Layout To Apply</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLayoutToApply()
+ * @generated
+ * @ordered
+ */
+ protected String layoutToApply = LAYOUT_TO_APPLY_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected String name = NAME_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrefix()
+ * @generated
+ * @ordered
+ */
+ protected static final String PREFIX_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getPrefix() <em>Prefix</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getPrefix()
+ * @generated
+ * @ordered
+ */
+ protected String prefix = PREFIX_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DiagramDefinitionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DiagramTemplatePackage.Literals.DIAGRAM_DEFINITION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setDescription(String newDescription) {
+ String oldDescription = description;
+ description = newDescription;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.DIAGRAM_DEFINITION__DESCRIPTION, oldDescription, description));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getFromRoot() {
+ if (fromRoot != null && fromRoot.eIsProxy()) {
+ InternalEObject oldFromRoot = (InternalEObject)fromRoot;
+ fromRoot = eResolveProxy(oldFromRoot);
+ if (fromRoot != oldFromRoot) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiagramTemplatePackage.DIAGRAM_DEFINITION__FROM_ROOT, oldFromRoot, fromRoot));
+ }
+ }
+ return fromRoot;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetFromRoot() {
+ return fromRoot;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setFromRoot(EObject newFromRoot) {
+ EObject oldFromRoot = fromRoot;
+ fromRoot = newFromRoot;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.DIAGRAM_DEFINITION__FROM_ROOT, oldFromRoot, fromRoot));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<Selection> getSelection() {
+ if (selection == null) {
+ selection = new EObjectContainmentEList<Selection>(Selection.class, this, DiagramTemplatePackage.DIAGRAM_DEFINITION__SELECTION);
+ }
+ return selection;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getDiagramKind() {
+ return diagramKind;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setDiagramKind(String newDiagramKind) {
+ String oldDiagramKind = diagramKind;
+ diagramKind = newDiagramKind;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.DIAGRAM_DEFINITION__DIAGRAM_KIND, oldDiagramKind, diagramKind));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLayoutToApply() {
+ return layoutToApply;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLayoutToApply(String newLayoutToApply) {
+ String oldLayoutToApply = layoutToApply;
+ layoutToApply = newLayoutToApply;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.DIAGRAM_DEFINITION__LAYOUT_TO_APPLY, oldLayoutToApply, layoutToApply));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setName(String newName) {
+ String oldName = name;
+ name = newName;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.DIAGRAM_DEFINITION__NAME, oldName, name));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getPrefix() {
+ return prefix;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setPrefix(String newPrefix) {
+ String oldPrefix = prefix;
+ prefix = newPrefix;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.DIAGRAM_DEFINITION__PREFIX, oldPrefix, prefix));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__SELECTION:
+ return ((InternalEList<?>)getSelection()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DESCRIPTION:
+ return getDescription();
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__FROM_ROOT:
+ if (resolve) return getFromRoot();
+ return basicGetFromRoot();
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__SELECTION:
+ return getSelection();
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DIAGRAM_KIND:
+ return getDiagramKind();
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__LAYOUT_TO_APPLY:
+ return getLayoutToApply();
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__NAME:
+ return getName();
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__PREFIX:
+ return getPrefix();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DESCRIPTION:
+ setDescription((String)newValue);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__FROM_ROOT:
+ setFromRoot((EObject)newValue);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__SELECTION:
+ getSelection().clear();
+ getSelection().addAll((Collection<? extends Selection>)newValue);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DIAGRAM_KIND:
+ setDiagramKind((String)newValue);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__LAYOUT_TO_APPLY:
+ setLayoutToApply((String)newValue);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__NAME:
+ setName((String)newValue);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__PREFIX:
+ setPrefix((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DESCRIPTION:
+ setDescription(DESCRIPTION_EDEFAULT);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__FROM_ROOT:
+ setFromRoot((EObject)null);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__SELECTION:
+ getSelection().clear();
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DIAGRAM_KIND:
+ setDiagramKind(DIAGRAM_KIND_EDEFAULT);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__LAYOUT_TO_APPLY:
+ setLayoutToApply(LAYOUT_TO_APPLY_EDEFAULT);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__NAME:
+ setName(NAME_EDEFAULT);
+ return;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__PREFIX:
+ setPrefix(PREFIX_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DESCRIPTION:
+ return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__FROM_ROOT:
+ return fromRoot != null;
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__SELECTION:
+ return selection != null && !selection.isEmpty();
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__DIAGRAM_KIND:
+ return DIAGRAM_KIND_EDEFAULT == null ? diagramKind != null : !DIAGRAM_KIND_EDEFAULT.equals(diagramKind);
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__LAYOUT_TO_APPLY:
+ return LAYOUT_TO_APPLY_EDEFAULT == null ? layoutToApply != null : !LAYOUT_TO_APPLY_EDEFAULT.equals(layoutToApply);
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__NAME:
+ return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION__PREFIX:
+ return PREFIX_EDEFAULT == null ? prefix != null : !PREFIX_EDEFAULT.equals(prefix);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (description: ");
+ result.append(description);
+ result.append(", diagramKind: ");
+ result.append(diagramKind);
+ result.append(", layoutToApply: ");
+ result.append(layoutToApply);
+ result.append(", name: ");
+ result.append(name);
+ result.append(", prefix: ");
+ result.append(prefix);
+ result.append(')');
+ return result.toString();
+ }
+
+} //DiagramDefinitionImpl
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramTemplateFactoryImpl.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramTemplateFactoryImpl.java
new file mode 100644
index 00000000000..4a6bfec6a0a
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramTemplateFactoryImpl.java
@@ -0,0 +1,186 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+import org.eclipse.papyrus.diagramtemplate.Template;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DiagramTemplateFactoryImpl extends EFactoryImpl implements DiagramTemplateFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static DiagramTemplateFactory init() {
+ try {
+ DiagramTemplateFactory theDiagramTemplateFactory = (DiagramTemplateFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/diagramtemplate");
+ if (theDiagramTemplateFactory != null) {
+ return theDiagramTemplateFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new DiagramTemplateFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramTemplateFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION: return createDiagramDefinition();
+ case DiagramTemplatePackage.SELECTION: return createSelection();
+ case DiagramTemplatePackage.SELECTION_REF: return createSelectionRef();
+ case DiagramTemplatePackage.TEMPLATE: return createTemplate();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object createFromString(EDataType eDataType, String initialValue) {
+ switch (eDataType.getClassifierID()) {
+ case DiagramTemplatePackage.SELECTION_KIND:
+ return createSelectionKindFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String convertToString(EDataType eDataType, Object instanceValue) {
+ switch (eDataType.getClassifierID()) {
+ case DiagramTemplatePackage.SELECTION_KIND:
+ return convertSelectionKindToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramDefinition createDiagramDefinition() {
+ DiagramDefinitionImpl diagramDefinition = new DiagramDefinitionImpl();
+ return diagramDefinition;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Selection createSelection() {
+ SelectionImpl selection = new SelectionImpl();
+ return selection;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SelectionRef createSelectionRef() {
+ SelectionRefImpl selectionRef = new SelectionRefImpl();
+ return selectionRef;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Template createTemplate() {
+ TemplateImpl template = new TemplateImpl();
+ return template;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SelectionKind createSelectionKindFromString(EDataType eDataType, String initialValue) {
+ SelectionKind result = SelectionKind.get(initialValue);
+ if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String convertSelectionKindToString(EDataType eDataType, Object instanceValue) {
+ return instanceValue == null ? null : instanceValue.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramTemplatePackage getDiagramTemplatePackage() {
+ return (DiagramTemplatePackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static DiagramTemplatePackage getPackage() {
+ return DiagramTemplatePackage.eINSTANCE;
+ }
+
+} //DiagramTemplateFactoryImpl
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramTemplatePackageImpl.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramTemplatePackageImpl.java
new file mode 100644
index 00000000000..95900e7b7fc
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/DiagramTemplatePackageImpl.java
@@ -0,0 +1,458 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplateFactory;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionKind;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+import org.eclipse.papyrus.diagramtemplate.Template;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DiagramTemplatePackageImpl extends EPackageImpl implements DiagramTemplatePackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass diagramDefinitionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass selectionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass selectionRefEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass templateEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass abstractSelectionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EEnum selectionKindEEnum = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private DiagramTemplatePackageImpl() {
+ super(eNS_URI, DiagramTemplateFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link DiagramTemplatePackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static DiagramTemplatePackage init() {
+ if (isInited) return (DiagramTemplatePackage)EPackage.Registry.INSTANCE.getEPackage(DiagramTemplatePackage.eNS_URI);
+
+ // Obtain or create and register package
+ DiagramTemplatePackageImpl theDiagramTemplatePackage = (DiagramTemplatePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof DiagramTemplatePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new DiagramTemplatePackageImpl());
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theDiagramTemplatePackage.createPackageContents();
+
+ // Initialize created meta-data
+ theDiagramTemplatePackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theDiagramTemplatePackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(DiagramTemplatePackage.eNS_URI, theDiagramTemplatePackage);
+ return theDiagramTemplatePackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getDiagramDefinition() {
+ return diagramDefinitionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDiagramDefinition_Description() {
+ return (EAttribute)diagramDefinitionEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getDiagramDefinition_FromRoot() {
+ return (EReference)diagramDefinitionEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getDiagramDefinition_Selection() {
+ return (EReference)diagramDefinitionEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDiagramDefinition_DiagramKind() {
+ return (EAttribute)diagramDefinitionEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDiagramDefinition_LayoutToApply() {
+ return (EAttribute)diagramDefinitionEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDiagramDefinition_Name() {
+ return (EAttribute)diagramDefinitionEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDiagramDefinition_Prefix() {
+ return (EAttribute)diagramDefinitionEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getSelection() {
+ return selectionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getSelection_Recursively() {
+ return (EAttribute)selectionEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getSelectionRef() {
+ return selectionRefEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getSelectionRef_EReference() {
+ return (EReference)selectionRefEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getTemplate() {
+ return templateEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getTemplate_DiagramDefinitions() {
+ return (EReference)templateEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getTemplate_TargetRoot() {
+ return (EReference)templateEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getAbstractSelection() {
+ return abstractSelectionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAbstractSelection_Element() {
+ return (EReference)abstractSelectionEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAbstractSelection_Kind() {
+ return (EAttribute)abstractSelectionEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getAbstractSelection_SelectionRef() {
+ return (EReference)abstractSelectionEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAbstractSelection_SubTypes() {
+ return (EAttribute)abstractSelectionEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getAbstractSelection_StereotypedBy() {
+ return (EAttribute)abstractSelectionEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EEnum getSelectionKind() {
+ return selectionKindEEnum;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramTemplateFactory getDiagramTemplateFactory() {
+ return (DiagramTemplateFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ diagramDefinitionEClass = createEClass(DIAGRAM_DEFINITION);
+ createEAttribute(diagramDefinitionEClass, DIAGRAM_DEFINITION__DESCRIPTION);
+ createEReference(diagramDefinitionEClass, DIAGRAM_DEFINITION__FROM_ROOT);
+ createEReference(diagramDefinitionEClass, DIAGRAM_DEFINITION__SELECTION);
+ createEAttribute(diagramDefinitionEClass, DIAGRAM_DEFINITION__DIAGRAM_KIND);
+ createEAttribute(diagramDefinitionEClass, DIAGRAM_DEFINITION__LAYOUT_TO_APPLY);
+ createEAttribute(diagramDefinitionEClass, DIAGRAM_DEFINITION__NAME);
+ createEAttribute(diagramDefinitionEClass, DIAGRAM_DEFINITION__PREFIX);
+
+ selectionEClass = createEClass(SELECTION);
+ createEAttribute(selectionEClass, SELECTION__RECURSIVELY);
+
+ selectionRefEClass = createEClass(SELECTION_REF);
+ createEReference(selectionRefEClass, SELECTION_REF__EREFERENCE);
+
+ templateEClass = createEClass(TEMPLATE);
+ createEReference(templateEClass, TEMPLATE__DIAGRAM_DEFINITIONS);
+ createEReference(templateEClass, TEMPLATE__TARGET_ROOT);
+
+ abstractSelectionEClass = createEClass(ABSTRACT_SELECTION);
+ createEReference(abstractSelectionEClass, ABSTRACT_SELECTION__ELEMENT);
+ createEAttribute(abstractSelectionEClass, ABSTRACT_SELECTION__KIND);
+ createEReference(abstractSelectionEClass, ABSTRACT_SELECTION__SELECTION_REF);
+ createEAttribute(abstractSelectionEClass, ABSTRACT_SELECTION__SUB_TYPES);
+ createEAttribute(abstractSelectionEClass, ABSTRACT_SELECTION__STEREOTYPED_BY);
+
+ // Create enums
+ selectionKindEEnum = createEEnum(SELECTION_KIND);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ selectionEClass.getESuperTypes().add(this.getAbstractSelection());
+ selectionRefEClass.getESuperTypes().add(this.getAbstractSelection());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(diagramDefinitionEClass, DiagramDefinition.class, "DiagramDefinition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getDiagramDefinition_Description(), ecorePackage.getEString(), "description", null, 1, 1, DiagramDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getDiagramDefinition_FromRoot(), ecorePackage.getEObject(), null, "fromRoot", null, 0, 1, DiagramDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getDiagramDefinition_Selection(), this.getSelection(), null, "selection", null, 0, -1, DiagramDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDiagramDefinition_DiagramKind(), ecorePackage.getEString(), "diagramKind", null, 0, 1, DiagramDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDiagramDefinition_LayoutToApply(), ecorePackage.getEString(), "layoutToApply", null, 0, 1, DiagramDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDiagramDefinition_Name(), ecorePackage.getEString(), "name", null, 1, 1, DiagramDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDiagramDefinition_Prefix(), ecorePackage.getEString(), "prefix", null, 1, 1, DiagramDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(selectionEClass, Selection.class, "Selection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getSelection_Recursively(), ecorePackage.getEBoolean(), "recursively", null, 1, 1, Selection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(selectionRefEClass, SelectionRef.class, "SelectionRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getSelectionRef_EReference(), ecorePackage.getEObject(), null, "eReference", null, 0, 1, SelectionRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(templateEClass, Template.class, "Template", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getTemplate_DiagramDefinitions(), this.getDiagramDefinition(), null, "diagramDefinitions", null, 0, -1, Template.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getTemplate_TargetRoot(), ecorePackage.getEObject(), null, "targetRoot", null, 0, 1, Template.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(abstractSelectionEClass, AbstractSelection.class, "AbstractSelection", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getAbstractSelection_Element(), ecorePackage.getEObject(), null, "element", null, 0, 1, AbstractSelection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractSelection_Kind(), this.getSelectionKind(), "kind", null, 1, 1, AbstractSelection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getAbstractSelection_SelectionRef(), this.getSelectionRef(), null, "selectionRef", null, 0, -1, AbstractSelection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractSelection_SubTypes(), ecorePackage.getEBoolean(), "subTypes", null, 1, 1, AbstractSelection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getAbstractSelection_StereotypedBy(), ecorePackage.getEString(), "stereotypedBy", null, 1, 1, AbstractSelection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Initialize enums and add enum literals
+ initEEnum(selectionKindEEnum, SelectionKind.class, "SelectionKind");
+ addEEnumLiteral(selectionKindEEnum, SelectionKind.FOR_ALL);
+ addEEnumLiteral(selectionKindEEnum, SelectionKind.SPECIFIC);
+ addEEnumLiteral(selectionKindEEnum, SelectionKind.QUERY);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //DiagramTemplatePackageImpl
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/SelectionImpl.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/SelectionImpl.java
new file mode 100644
index 00000000000..5a92456ddb4
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/SelectionImpl.java
@@ -0,0 +1,163 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Selection</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.SelectionImpl#isRecursively <em>Recursively</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class SelectionImpl extends AbstractSelectionImpl implements Selection {
+ /**
+ * The default value of the '{@link #isRecursively() <em>Recursively</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isRecursively()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean RECURSIVELY_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isRecursively() <em>Recursively</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isRecursively()
+ * @generated
+ * @ordered
+ */
+ protected boolean recursively = RECURSIVELY_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected SelectionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DiagramTemplatePackage.Literals.SELECTION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isRecursively() {
+ return recursively;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setRecursively(boolean newRecursively) {
+ boolean oldRecursively = recursively;
+ recursively = newRecursively;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.SELECTION__RECURSIVELY, oldRecursively, recursively));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case DiagramTemplatePackage.SELECTION__RECURSIVELY:
+ return isRecursively();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case DiagramTemplatePackage.SELECTION__RECURSIVELY:
+ setRecursively((Boolean)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.SELECTION__RECURSIVELY:
+ setRecursively(RECURSIVELY_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.SELECTION__RECURSIVELY:
+ return recursively != RECURSIVELY_EDEFAULT;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (recursively: ");
+ result.append(recursively);
+ result.append(')');
+ return result.toString();
+ }
+
+} //SelectionImpl
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/SelectionRefImpl.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/SelectionRefImpl.java
new file mode 100644
index 00000000000..ecf334a5f69
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/SelectionRefImpl.java
@@ -0,0 +1,157 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Selection Ref</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.SelectionRefImpl#getEReference <em>EReference</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class SelectionRefImpl extends AbstractSelectionImpl implements SelectionRef {
+ /**
+ * The cached value of the '{@link #getEReference() <em>EReference</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEReference()
+ * @generated
+ * @ordered
+ */
+ protected EObject eReference;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected SelectionRefImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DiagramTemplatePackage.Literals.SELECTION_REF;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getEReference() {
+ if (eReference != null && eReference.eIsProxy()) {
+ InternalEObject oldEReference = (InternalEObject)eReference;
+ eReference = eResolveProxy(oldEReference);
+ if (eReference != oldEReference) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiagramTemplatePackage.SELECTION_REF__EREFERENCE, oldEReference, eReference));
+ }
+ }
+ return eReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetEReference() {
+ return eReference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setEReference(EObject newEReference) {
+ EObject oldEReference = eReference;
+ eReference = newEReference;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.SELECTION_REF__EREFERENCE, oldEReference, eReference));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case DiagramTemplatePackage.SELECTION_REF__EREFERENCE:
+ if (resolve) return getEReference();
+ return basicGetEReference();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case DiagramTemplatePackage.SELECTION_REF__EREFERENCE:
+ setEReference((EObject)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.SELECTION_REF__EREFERENCE:
+ setEReference((EObject)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.SELECTION_REF__EREFERENCE:
+ return eReference != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //SelectionRefImpl
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/TemplateImpl.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/TemplateImpl.java
new file mode 100644
index 00000000000..bbcaf63012b
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/impl/TemplateImpl.java
@@ -0,0 +1,214 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Template;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Template</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.TemplateImpl#getDiagramDefinitions <em>Diagram Definitions</em>}</li>
+ * <li>{@link org.eclipse.papyrus.diagramtemplate.impl.TemplateImpl#getTargetRoot <em>Target Root</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class TemplateImpl extends EObjectImpl implements Template {
+ /**
+ * The cached value of the '{@link #getDiagramDefinitions() <em>Diagram Definitions</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getDiagramDefinitions()
+ * @generated
+ * @ordered
+ */
+ protected EList<DiagramDefinition> diagramDefinitions;
+
+ /**
+ * The cached value of the '{@link #getTargetRoot() <em>Target Root</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getTargetRoot()
+ * @generated
+ * @ordered
+ */
+ protected EObject targetRoot;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TemplateImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return DiagramTemplatePackage.Literals.TEMPLATE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<DiagramDefinition> getDiagramDefinitions() {
+ if (diagramDefinitions == null) {
+ diagramDefinitions = new EObjectContainmentEList<DiagramDefinition>(DiagramDefinition.class, this, DiagramTemplatePackage.TEMPLATE__DIAGRAM_DEFINITIONS);
+ }
+ return diagramDefinitions;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getTargetRoot() {
+ if (targetRoot != null && targetRoot.eIsProxy()) {
+ InternalEObject oldTargetRoot = (InternalEObject)targetRoot;
+ targetRoot = eResolveProxy(oldTargetRoot);
+ if (targetRoot != oldTargetRoot) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiagramTemplatePackage.TEMPLATE__TARGET_ROOT, oldTargetRoot, targetRoot));
+ }
+ }
+ return targetRoot;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetTargetRoot() {
+ return targetRoot;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setTargetRoot(EObject newTargetRoot) {
+ EObject oldTargetRoot = targetRoot;
+ targetRoot = newTargetRoot;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, DiagramTemplatePackage.TEMPLATE__TARGET_ROOT, oldTargetRoot, targetRoot));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case DiagramTemplatePackage.TEMPLATE__DIAGRAM_DEFINITIONS:
+ return ((InternalEList<?>)getDiagramDefinitions()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case DiagramTemplatePackage.TEMPLATE__DIAGRAM_DEFINITIONS:
+ return getDiagramDefinitions();
+ case DiagramTemplatePackage.TEMPLATE__TARGET_ROOT:
+ if (resolve) return getTargetRoot();
+ return basicGetTargetRoot();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case DiagramTemplatePackage.TEMPLATE__DIAGRAM_DEFINITIONS:
+ getDiagramDefinitions().clear();
+ getDiagramDefinitions().addAll((Collection<? extends DiagramDefinition>)newValue);
+ return;
+ case DiagramTemplatePackage.TEMPLATE__TARGET_ROOT:
+ setTargetRoot((EObject)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.TEMPLATE__DIAGRAM_DEFINITIONS:
+ getDiagramDefinitions().clear();
+ return;
+ case DiagramTemplatePackage.TEMPLATE__TARGET_ROOT:
+ setTargetRoot((EObject)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case DiagramTemplatePackage.TEMPLATE__DIAGRAM_DEFINITIONS:
+ return diagramDefinitions != null && !diagramDefinitions.isEmpty();
+ case DiagramTemplatePackage.TEMPLATE__TARGET_ROOT:
+ return targetRoot != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //TemplateImpl
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/util/DiagramTemplateAdapterFactory.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/util/DiagramTemplateAdapterFactory.java
new file mode 100644
index 00000000000..76b16813156
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/util/DiagramTemplateAdapterFactory.java
@@ -0,0 +1,198 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+import org.eclipse.papyrus.diagramtemplate.Template;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage
+ * @generated
+ */
+public class DiagramTemplateAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static DiagramTemplatePackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramTemplateAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = DiagramTemplatePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DiagramTemplateSwitch<Adapter> modelSwitch =
+ new DiagramTemplateSwitch<Adapter>() {
+ @Override
+ public Adapter caseDiagramDefinition(DiagramDefinition object) {
+ return createDiagramDefinitionAdapter();
+ }
+ @Override
+ public Adapter caseSelection(Selection object) {
+ return createSelectionAdapter();
+ }
+ @Override
+ public Adapter caseSelectionRef(SelectionRef object) {
+ return createSelectionRefAdapter();
+ }
+ @Override
+ public Adapter caseTemplate(Template object) {
+ return createTemplateAdapter();
+ }
+ @Override
+ public Adapter caseAbstractSelection(AbstractSelection object) {
+ return createAbstractSelectionAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.diagramtemplate.DiagramDefinition <em>Diagram Definition</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramDefinition
+ * @generated
+ */
+ public Adapter createDiagramDefinitionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.diagramtemplate.Selection <em>Selection</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.diagramtemplate.Selection
+ * @generated
+ */
+ public Adapter createSelectionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.diagramtemplate.SelectionRef <em>Selection Ref</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.diagramtemplate.SelectionRef
+ * @generated
+ */
+ public Adapter createSelectionRefAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.diagramtemplate.Template <em>Template</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.diagramtemplate.Template
+ * @generated
+ */
+ public Adapter createTemplateAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.diagramtemplate.AbstractSelection <em>Abstract Selection</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.diagramtemplate.AbstractSelection
+ * @generated
+ */
+ public Adapter createAbstractSelectionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //DiagramTemplateAdapterFactory
diff --git a/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/util/DiagramTemplateSwitch.java b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/util/DiagramTemplateSwitch.java
new file mode 100644
index 00000000000..6d93594220e
--- /dev/null
+++ b/extraplugins/diagramtemplate/org.eclipse.papyrus.diagramtemplate/src/org/eclipse/papyrus/diagramtemplate/util/DiagramTemplateSwitch.java
@@ -0,0 +1,220 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.diagramtemplate.util;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.diagramtemplate.AbstractSelection;
+import org.eclipse.papyrus.diagramtemplate.DiagramDefinition;
+import org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage;
+import org.eclipse.papyrus.diagramtemplate.Selection;
+import org.eclipse.papyrus.diagramtemplate.SelectionRef;
+import org.eclipse.papyrus.diagramtemplate.Template;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.diagramtemplate.DiagramTemplatePackage
+ * @generated
+ */
+public class DiagramTemplateSwitch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static DiagramTemplatePackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DiagramTemplateSwitch() {
+ if (modelPackage == null) {
+ modelPackage = DiagramTemplatePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ public T doSwitch(EObject theEObject) {
+ return doSwitch(theEObject.eClass(), theEObject);
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(EClass theEClass, EObject theEObject) {
+ if (theEClass.eContainer() == modelPackage) {
+ return doSwitch(theEClass.getClassifierID(), theEObject);
+ }
+ else {
+ List<EClass> eSuperTypes = theEClass.getESuperTypes();
+ return
+ eSuperTypes.isEmpty() ?
+ defaultCase(theEObject) :
+ doSwitch(eSuperTypes.get(0), theEObject);
+ }
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case DiagramTemplatePackage.DIAGRAM_DEFINITION: {
+ DiagramDefinition diagramDefinition = (DiagramDefinition)theEObject;
+ T result = caseDiagramDefinition(diagramDefinition);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DiagramTemplatePackage.SELECTION: {
+ Selection selection = (Selection)theEObject;
+ T result = caseSelection(selection);
+ if (result == null) result = caseAbstractSelection(selection);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DiagramTemplatePackage.SELECTION_REF: {
+ SelectionRef selectionRef = (SelectionRef)theEObject;
+ T result = caseSelectionRef(selectionRef);
+ if (result == null) result = caseAbstractSelection(selectionRef);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DiagramTemplatePackage.TEMPLATE: {
+ Template template = (Template)theEObject;
+ T result = caseTemplate(template);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case DiagramTemplatePackage.ABSTRACT_SELECTION: {
+ AbstractSelection abstractSelection = (AbstractSelection)theEObject;
+ T result = caseAbstractSelection(abstractSelection);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Diagram Definition</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Diagram Definition</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseDiagramDefinition(DiagramDefinition object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Selection</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Selection</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSelection(Selection object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Selection Ref</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Selection Ref</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseSelectionRef(SelectionRef object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Template</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Template</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseTemplate(Template object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Abstract Selection</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Abstract Selection</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAbstractSelection(AbstractSelection object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //DiagramTemplateSwitch

Back to the top