Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/.classpath7
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/.project28
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/META-INF/MANIFEST.MF19
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/build.properties14
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/icons/full/obj16/ProfileToFacetsConfiguration.gifbin0 -> 129 bytes
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/plugin.properties32
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/plugin.xml25
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetConfigurationModelEditPlugin.java99
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetsConfigurationItemProvider.java256
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetsConfigurationItemProviderAdapterFactory.java203
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/.classpath7
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/.project28
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/META-INF/MANIFEST.MF20
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/build.properties14
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/full/obj16/ProfileToFacetsConfigurationModelFile.gifbin0 -> 346 bytes
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/full/wizban/NewProfileToFacetsConfiguration.gifbin0 -> 2462 bytes
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/profileToFacets.pngbin0 -> 323 bytes
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/plugin.properties57
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/plugin.xml55
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetConfigurationModelEditorPlugin.java101
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationActionBarContributor.java427
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationEditor.java1822
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationModelWizard.java632
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/.classpath7
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/.project28
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/META-INF/MANIFEST.MF17
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/build.properties14
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/model/profileToFacetConfigurationModel.ecore18
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/model/profileToFacetConfigurationModel.genmodel17
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/plugin.properties8
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/plugin.xml26
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfiguration.java166
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfigurationFactory.java46
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfigurationPackage.java266
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationFactoryImpl.java99
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationImpl.java392
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationPackageImpl.java236
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationAdapterFactory.java124
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationResourceFactoryImpl.java56
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationResourceImpl.java32
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationSwitch.java114
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationXMLProcessor.java54
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.classpath7
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.project28
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/META-INF/MANIFEST.MF29
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/about.html28
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/build.properties5
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/icons/profileToFacets.pngbin0 -> 323 bytes
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/plugin.xml71
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/Activator.java67
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/FacetGenerator.java296
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/GenerateFacetsHandler.java655
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/tester/HandlerPropertyTester.java45
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/Messages.java38
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/messages.properties5
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.classpath7
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.project34
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/META-INF/MANIFEST.MF21
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/build.acceleo24
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/build.properties5
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/buildstandalone.xml79
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/pom.xml265
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/Activator.java66
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/Generate.java420
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/HasStereotypeQuery.java59
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/generate.mtl181
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation/.classpath7
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation/.project43
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation/META-INF/MANIFEST.MF9
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation/build.properties2
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation/src/org/eclipse/papyrus/profile/facets/generation/postgeneration/FacetSetSplitter.java59
-rw-r--r--sandbox/org.eclipse.papyrus.profile.facets.generation/transforms/ProfileToFacetSet.qvto156
76 files changed, 8302 insertions, 0 deletions
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/.classpath b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/.project b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/.project
new file mode 100644
index 00000000000..5331f84c200
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.profile.facets.configuration.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/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..0dd07fd9535
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/META-INF/MANIFEST.MF
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.profile.facets.configuration.edit;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.provider.ProfileToFacetConfigurationModelEditPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.provider
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.papyrus.profile.facets.configuration;visibility:=reexport,
+ org.eclipse.emf.edit;visibility:=reexport,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.uml2.uml;visibility:=reexport,
+ org.eclipse.uml2.uml.edit;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/build.properties b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/build.properties
new file mode 100644
index 00000000000..400b20ae286
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/build.properties
@@ -0,0 +1,14 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/icons/full/obj16/ProfileToFacetsConfiguration.gif b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/icons/full/obj16/ProfileToFacetsConfiguration.gif
new file mode 100644
index 00000000000..5a9bc7514fa
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/icons/full/obj16/ProfileToFacetsConfiguration.gif
Binary files differ
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/plugin.properties b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/plugin.properties
new file mode 100644
index 00000000000..4189920a7aa
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/plugin.properties
@@ -0,0 +1,32 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = ProfileToFacetConfigurationModel 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_ProfileToFacetsConfiguration_type = Profile To Facets Configuration
+_UI_Unknown_type = Object
+
+_UI_Unknown_datatype= Value
+
+_UI_ProfileToFacetsConfiguration_header_feature = Header
+_UI_ProfileToFacetsConfiguration_profile_feature = Profile
+_UI_ProfileToFacetsConfiguration_basePackage_feature = Base Package
+_UI_Unknown_feature = Unspecified
+
+_UI_ProfileToFacetsConfiguration_headerFilePath_feature = Header File Path
+_UI_ProfileToFacetsConfiguration_javaSourceFolderName_feature = Java Source Folder Name
+_UI_ProfileToFacetsConfiguration_modelFolder_feature = Model Folder
+_UI_ProfileToFacetsConfiguration_javaFolder_feature = Java Folder
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/plugin.xml b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/plugin.xml
new file mode 100644
index 00000000000..9a8766a2ed9
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.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/profileToFacetsConfiguration"
+ class="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.provider.ProfileToFacetsConfigurationItemProviderAdapterFactory"
+ 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/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetConfigurationModelEditPlugin.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetConfigurationModelEditPlugin.java
new file mode 100644
index 00000000000..93929203cf9
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetConfigurationModelEditPlugin.java
@@ -0,0 +1,99 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.provider;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+
+import org.eclipse.uml2.uml.edit.UMLEditPlugin;
+
+/**
+ * This is the central singleton for the ProfileToFacetConfigurationModel edit plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class ProfileToFacetConfigurationModelEditPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final ProfileToFacetConfigurationModelEditPlugin INSTANCE = new ProfileToFacetConfigurationModelEditPlugin();
+
+ /**
+ * 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 ProfileToFacetConfigurationModelEditPlugin() {
+ super
+ (new ResourceLocator [] {
+ EcoreEditPlugin.INSTANCE,
+ UMLEditPlugin.INSTANCE,
+ });
+ }
+
+ /**
+ * 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/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetsConfigurationItemProvider.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetsConfigurationItemProvider.java
new file mode 100644
index 00000000000..2c28aed7994
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetsConfigurationItemProvider.java
@@ -0,0 +1,256 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.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.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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration;
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ProfileToFacetsConfigurationItemProvider
+ 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 ProfileToFacetsConfigurationItemProvider(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);
+
+ addProfilePropertyDescriptor(object);
+ addBasePackagePropertyDescriptor(object);
+ addHeaderPropertyDescriptor(object);
+ addJavaFolderPropertyDescriptor(object);
+ addModelFolderPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Profile feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addProfilePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ProfileToFacetsConfiguration_profile_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ProfileToFacetsConfiguration_profile_feature", "_UI_ProfileToFacetsConfiguration_type"),
+ ProfileToFacetsConfigurationPackage.Literals.PROFILE_TO_FACETS_CONFIGURATION__PROFILE,
+ true,
+ false,
+ true,
+ null,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Base Package feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addBasePackagePropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ProfileToFacetsConfiguration_basePackage_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ProfileToFacetsConfiguration_basePackage_feature", "_UI_ProfileToFacetsConfiguration_type"),
+ ProfileToFacetsConfigurationPackage.Literals.PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Header feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addHeaderPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ProfileToFacetsConfiguration_header_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ProfileToFacetsConfiguration_header_feature", "_UI_ProfileToFacetsConfiguration_type"),
+ ProfileToFacetsConfigurationPackage.Literals.PROFILE_TO_FACETS_CONFIGURATION__HEADER,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Java Folder feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addJavaFolderPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ProfileToFacetsConfiguration_javaFolder_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ProfileToFacetsConfiguration_javaFolder_feature", "_UI_ProfileToFacetsConfiguration_type"),
+ ProfileToFacetsConfigurationPackage.Literals.PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Model Folder feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addModelFolderPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_ProfileToFacetsConfiguration_modelFolder_feature"),
+ getString("_UI_PropertyDescriptor_description", "_UI_ProfileToFacetsConfiguration_modelFolder_feature", "_UI_ProfileToFacetsConfiguration_type"),
+ ProfileToFacetsConfigurationPackage.Literals.PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns ProfileToFacetsConfiguration.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/ProfileToFacetsConfiguration"));
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((ProfileToFacetsConfiguration)object).getBasePackage();
+ return label == null || label.length() == 0 ?
+ getString("_UI_ProfileToFacetsConfiguration_type") :
+ getString("_UI_ProfileToFacetsConfiguration_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(ProfileToFacetsConfiguration.class)) {
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE:
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__HEADER:
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER:
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER:
+ 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);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return ProfileToFacetConfigurationModelEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetsConfigurationItemProviderAdapterFactory.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetsConfigurationItemProviderAdapterFactory.java
new file mode 100644
index 00000000000..f1c18fb9cbd
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.edit/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/provider/ProfileToFacetsConfigurationItemProviderAdapterFactory.java
@@ -0,0 +1,203 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.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.profile.facets.configuration.profileToFacetsConfiguration.util.ProfileToFacetsConfigurationAdapterFactory;
+
+/**
+ * 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 ProfileToFacetsConfigurationItemProviderAdapterFactory extends ProfileToFacetsConfigurationAdapterFactory 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 ProfileToFacetsConfigurationItemProviderAdapterFactory() {
+ 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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ProfileToFacetsConfigurationItemProvider profileToFacetsConfigurationItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createProfileToFacetsConfigurationAdapter() {
+ if (profileToFacetsConfigurationItemProvider == null) {
+ profileToFacetsConfigurationItemProvider = new ProfileToFacetsConfigurationItemProvider(this);
+ }
+
+ return profileToFacetsConfigurationItemProvider;
+ }
+
+ /**
+ * 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 (profileToFacetsConfigurationItemProvider != null) profileToFacetsConfigurationItemProvider.dispose();
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/.classpath b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.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.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/.project b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/.project
new file mode 100644
index 00000000000..19612dc0967
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.profile.facets.configuration.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/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..79c8dce2c1b
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.profile.facets.configuration.editor;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation.ProfileToFacetConfigurationModelEditorPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;visibility:=reexport,
+ org.eclipse.papyrus.profile.facets.configuration.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.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.uml2.uml.edit;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/build.properties b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/build.properties
new file mode 100644
index 00000000000..db715c27319
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/build.properties
@@ -0,0 +1,14 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/full/obj16/ProfileToFacetsConfigurationModelFile.gif b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/full/obj16/ProfileToFacetsConfigurationModelFile.gif
new file mode 100644
index 00000000000..f33d349a793
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/full/obj16/ProfileToFacetsConfigurationModelFile.gif
Binary files differ
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/full/wizban/NewProfileToFacetsConfiguration.gif b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/full/wizban/NewProfileToFacetsConfiguration.gif
new file mode 100644
index 00000000000..0ff8c5d5fca
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/full/wizban/NewProfileToFacetsConfiguration.gif
Binary files differ
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/profileToFacets.png b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/profileToFacets.png
new file mode 100644
index 00000000000..2f45b451b59
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/icons/profileToFacets.png
Binary files differ
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/plugin.properties b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/plugin.properties
new file mode 100644
index 00000000000..dfd6f1f2185
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/plugin.properties
@@ -0,0 +1,57 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = ProfileToFacetConfigurationModel Editor
+providerName = www.example.org
+
+_UI_ProfileToFacetsConfigurationEditor_menu = &ProfileToFacetsConfiguration 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_Wizard_category = Example EMF Model Creation Wizards
+
+_UI_CreateModelError_message = Problems encountered in file "{0}"
+
+_UI_ProfileToFacetsConfigurationModelWizard_label = ProfileToFacetsConfiguration Model
+_UI_ProfileToFacetsConfigurationModelWizard_description = Create a new ProfileToFacetsConfiguration model
+
+_UI_ProfileToFacetsConfigurationEditor_label = ProfileToFacetsConfiguration Model Editor
+
+_UI_ProfileToFacetsConfigurationEditorFilenameDefaultBase = My
+_UI_ProfileToFacetsConfigurationEditorFilenameExtensions = profiletofacetsconfiguration
+
+_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/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/plugin.xml b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/plugin.xml
new file mode 100644
index 00000000000..4a4569567f0
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/plugin.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+ <copyright>
+ </copyright>
+
+ $Id$
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <category
+ id="org.eclipse.emf.ecore.Wizard.category.ID"
+ name="%_UI_Wizard_category"/>
+ <wizard
+ id="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation.ProfileToFacetsConfigurationModelWizardID"
+ name="%_UI_ProfileToFacetsConfigurationModelWizard_label"
+ class="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation.ProfileToFacetsConfigurationModelWizard"
+ category="org.eclipse.emf.ecore.Wizard.category.ID"
+ icon="icons/profileToFacets.png">
+ <description>%_UI_ProfileToFacetsConfigurationModelWizard_description</description>
+ <selection class="org.eclipse.core.resources.IResource"/>
+ </wizard>
+ </extension>
+
+ <extension point="org.eclipse.ui.editors">
+ <editor
+ id="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation.ProfileToFacetsConfigurationEditorID"
+ name="%_UI_ProfileToFacetsConfigurationEditor_label"
+ icon="icons/profileToFacets.png"
+ extensions="profiletofacetsconfiguration"
+ class="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation.ProfileToFacetsConfigurationEditor"
+ contributorClass="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation.ProfileToFacetsConfigurationActionBarContributor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.papyrus.wizards.category"
+ class="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation.ProfileToFacetsConfigurationModelWizard"
+ icon="icons/profileToFacets.png"
+ id="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation.ProfileToFacetsConfigurationModelWizardID"
+ name="%_UI_ProfileToFacetsConfigurationModelWizard_label">
+ <description>
+ %_UI_ProfileToFacetsConfigurationModelWizard_description
+ </description>
+ <selection
+ class="org.eclipse.core.resources.IResource">
+ </selection>
+ </wizard>
+ </extension>
+
+</plugin>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetConfigurationModelEditorPlugin.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetConfigurationModelEditorPlugin.java
new file mode 100644
index 00000000000..7203c95be2e
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetConfigurationModelEditorPlugin.java
@@ -0,0 +1,101 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.ui.EclipseUIPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.ecore.provider.EcoreEditPlugin;
+
+import org.eclipse.uml2.uml.edit.UMLEditPlugin;
+
+/**
+ * This is the central singleton for the ProfileToFacetConfigurationModel editor plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class ProfileToFacetConfigurationModelEditorPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final ProfileToFacetConfigurationModelEditorPlugin INSTANCE = new ProfileToFacetConfigurationModelEditorPlugin();
+
+ /**
+ * 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 ProfileToFacetConfigurationModelEditorPlugin() {
+ super
+ (new ResourceLocator [] {
+ EcoreEditPlugin.INSTANCE,
+ UMLEditPlugin.INSTANCE,
+ });
+ }
+
+ /**
+ * 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/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationActionBarContributor.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationActionBarContributor.java
new file mode 100644
index 00000000000..38a0dd6bb10
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationActionBarContributor.java
@@ -0,0 +1,427 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation;
+
+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 ProfileToFacetsConfiguration model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ProfileToFacetsConfigurationActionBarContributor
+ 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(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ShowPropertiesView_menu_item")) {
+ @Override
+ public void run() {
+ try {
+ getPage().showView("org.eclipse.ui.views.PropertySheet");
+ }
+ catch (PartInitException exception) {
+ ProfileToFacetConfigurationModelEditorPlugin.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(ProfileToFacetConfigurationModelEditorPlugin.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 ProfileToFacetsConfigurationActionBarContributor() {
+ 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("profiletofacetsconfiguration-settings"));
+ toolBarManager.add(new Separator("profiletofacetsconfiguration-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(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ProfileToFacetsConfigurationEditor_menu"), "org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfigurationMenuID");
+ 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(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ submenuManager.insertBefore("additions", createChildMenuManager);
+
+ // Prepare for CreateSibling item addition or removal.
+ //
+ createSiblingMenuManager = new MenuManager(ProfileToFacetConfigurationModelEditorPlugin.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(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
+ populateManager(submenuManager, createChildActions, null);
+ menuManager.insertBefore("edit", submenuManager);
+
+ submenuManager = new MenuManager(ProfileToFacetConfigurationModelEditorPlugin.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;
+ }
+
+} \ No newline at end of file
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationEditor.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationEditor.java
new file mode 100644
index 00000000000..9da52f2cc93
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationEditor.java
@@ -0,0 +1,1822 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+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.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+
+import org.eclipse.jface.viewers.ColumnWeightData;
+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.ListViewer;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+
+import org.eclipse.swt.SWT;
+
+import org.eclipse.swt.custom.CTabFolder;
+
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.Transfer;
+
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+
+import org.eclipse.swt.graphics.Point;
+
+import org.eclipse.swt.layout.FillLayout;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeColumn;
+
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+
+import org.eclipse.ui.dialogs.SaveAsDialog;
+
+import org.eclipse.ui.ide.IGotoMarker;
+
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+
+import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.PropertySheet;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+import org.eclipse.emf.common.command.BasicCommandStack;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.command.CommandStackListener;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.ui.MarkerHelper;
+import org.eclipse.emf.common.ui.ViewerPane;
+
+import org.eclipse.emf.common.ui.editor.ProblemEditorPart;
+
+import org.eclipse.emf.common.ui.viewer.IViewerProvider;
+
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EValidator;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+
+import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
+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.action.EditingDomainActionBarContributor;
+
+import org.eclipse.emf.edit.ui.celleditor.AdapterFactoryTreeEditor;
+
+import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider;
+
+import org.eclipse.emf.edit.ui.util.EditUIMarkerHelper;
+import org.eclipse.emf.edit.ui.util.EditUIUtil;
+
+import org.eclipse.emf.edit.ui.view.ExtendedPropertySheetPage;
+
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.provider.ProfileToFacetsConfigurationItemProviderAdapterFactory;
+
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
+
+
+/**
+ * This is an example of a ProfileToFacetsConfiguration model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ProfileToFacetsConfigurationEditor
+ extends MultiPageEditorPart
+ implements IEditingDomainProvider, ISelectionProvider, IMenuListener, IViewerProvider, IGotoMarker {
+ /**
+ * This keeps track of the editing domain that is used to track all changes to the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected AdapterFactoryEditingDomain editingDomain;
+
+ /**
+ * This is the one adapter factory used for providing views of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory adapterFactory;
+
+ /**
+ * This is the content outline page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IContentOutlinePage contentOutlinePage;
+
+ /**
+ * This is a kludge...
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IStatusLineManager contentOutlineStatusLineManager;
+
+ /**
+ * This is the content outline page's viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer contentOutlineViewer;
+
+ /**
+ * This is the property sheet page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PropertySheetPage propertySheetPage;
+
+ /**
+ * This is the viewer that shadows the selection in the content outline.
+ * The parent relation must be correctly defined for this to work.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer selectionViewer;
+
+ /**
+ * This inverts the roll of parent and child in the content provider and show parents as a tree.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer parentViewer;
+
+ /**
+ * This shows how a tree view works.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer treeViewer;
+
+ /**
+ * This shows how a list view works.
+ * A list viewer doesn't support icons.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ListViewer listViewer;
+
+ /**
+ * This shows how a table view works.
+ * A table can be used as a list with icons.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TableViewer tableViewer;
+
+ /**
+ * This shows how a tree view with columns works.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected TreeViewer treeViewerWithColumns;
+
+ /**
+ * This keeps track of the active viewer pane, in the book.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ViewerPane currentViewerPane;
+
+ /**
+ * This keeps track of the active content viewer, which may be either one of the viewers in the pages or the content outline viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Viewer currentViewer;
+
+ /**
+ * This listens to which ever viewer is active.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelectionChangedListener selectionChangedListener;
+
+ /**
+ * This keeps track of all the {@link org.eclipse.jface.viewers.ISelectionChangedListener}s that are listening to this editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<ISelectionChangedListener> selectionChangedListeners = new ArrayList<ISelectionChangedListener>();
+
+ /**
+ * This keeps track of the selection of the editor as a whole.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ISelection editorSelection = StructuredSelection.EMPTY;
+
+ /**
+ * The MarkerHelper is responsible for creating workspace resource markers presented
+ * in Eclipse's Problems View.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected MarkerHelper markerHelper = new EditUIMarkerHelper();
+
+ /**
+ * This listens for when the outline becomes active
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IPartListener partListener =
+ new IPartListener() {
+ public void partActivated(IWorkbenchPart p) {
+ if (p instanceof ContentOutline) {
+ if (((ContentOutline)p).getCurrentPage() == contentOutlinePage) {
+ getActionBarContributor().setActiveEditor(ProfileToFacetsConfigurationEditor.this);
+
+ setCurrentViewer(contentOutlineViewer);
+ }
+ }
+ else if (p instanceof PropertySheet) {
+ if (((PropertySheet)p).getCurrentPage() == propertySheetPage) {
+ getActionBarContributor().setActiveEditor(ProfileToFacetsConfigurationEditor.this);
+ handleActivate();
+ }
+ }
+ else if (p == ProfileToFacetsConfigurationEditor.this) {
+ handleActivate();
+ }
+ }
+ public void partBroughtToTop(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partClosed(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partDeactivated(IWorkbenchPart p) {
+ // Ignore.
+ }
+ public void partOpened(IWorkbenchPart p) {
+ // Ignore.
+ }
+ };
+
+ /**
+ * Resources that have been removed since last activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been changed since last activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+
+ /**
+ * Resources that have been saved.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Resource> savedResources = new ArrayList<Resource>();
+
+ /**
+ * Map to store the diagnostic associated with a resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Map<Resource, Diagnostic> resourceToDiagnosticMap = new LinkedHashMap<Resource, Diagnostic>();
+
+ /**
+ * Controls whether the problem indication should be updated.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean updateProblemIndication = true;
+
+ /**
+ * Adapter used to update the problem indication when resources are demanded loaded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected EContentAdapter problemIndicationAdapter =
+ new EContentAdapter() {
+ @Override
+ public void notifyChanged(Notification notification) {
+ if (notification.getNotifier() instanceof Resource) {
+ switch (notification.getFeatureID(Resource.class)) {
+ case Resource.RESOURCE__IS_LOADED:
+ case Resource.RESOURCE__ERRORS:
+ case Resource.RESOURCE__WARNINGS: {
+ Resource resource = (Resource)notification.getNotifier();
+ Diagnostic diagnostic = analyzeResourceProblems(resource, null);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, diagnostic);
+ }
+ else {
+ resourceToDiagnosticMap.remove(resource);
+ }
+
+ if (updateProblemIndication) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+ break;
+ }
+ }
+ }
+ else {
+ super.notifyChanged(notification);
+ }
+ }
+
+ @Override
+ protected void setTarget(Resource target) {
+ basicSetTarget(target);
+ }
+
+ @Override
+ protected void unsetTarget(Resource target) {
+ basicUnsetTarget(target);
+ }
+ };
+
+ /**
+ * This listens for workspace changes.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IResourceChangeListener resourceChangeListener =
+ new IResourceChangeListener() {
+ public void resourceChanged(IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ class ResourceDeltaVisitor implements IResourceDeltaVisitor {
+ protected ResourceSet resourceSet = editingDomain.getResourceSet();
+ protected Collection<Resource> changedResources = new ArrayList<Resource>();
+ protected Collection<Resource> removedResources = new ArrayList<Resource>();
+
+ public boolean visit(IResourceDelta delta) {
+ if (delta.getResource().getType() == IResource.FILE) {
+ if (delta.getKind() == IResourceDelta.REMOVED ||
+ delta.getKind() == IResourceDelta.CHANGED && delta.getFlags() != IResourceDelta.MARKERS) {
+ Resource resource = resourceSet.getResource(URI.createPlatformResourceURI(delta.getFullPath().toString(), true), false);
+ if (resource != null) {
+ if (delta.getKind() == IResourceDelta.REMOVED) {
+ removedResources.add(resource);
+ }
+ else if (!savedResources.remove(resource)) {
+ changedResources.add(resource);
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public Collection<Resource> getChangedResources() {
+ return changedResources;
+ }
+
+ public Collection<Resource> getRemovedResources() {
+ return removedResources;
+ }
+ }
+
+ final ResourceDeltaVisitor visitor = new ResourceDeltaVisitor();
+ delta.accept(visitor);
+
+ if (!visitor.getRemovedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ removedResources.addAll(visitor.getRemovedResources());
+ if (!isDirty()) {
+ getSite().getPage().closeEditor(ProfileToFacetsConfigurationEditor.this, false);
+ }
+ }
+ });
+ }
+
+ if (!visitor.getChangedResources().isEmpty()) {
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ changedResources.addAll(visitor.getChangedResources());
+ if (getSite().getPage().getActiveEditor() == ProfileToFacetsConfigurationEditor.this) {
+ handleActivate();
+ }
+ }
+ });
+ }
+ }
+ catch (CoreException exception) {
+ ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ };
+
+ /**
+ * Handles activation of the editor or it's associated views.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void handleActivate() {
+ // Recompute the read only state.
+ //
+ if (editingDomain.getResourceToReadOnlyMap() != null) {
+ editingDomain.getResourceToReadOnlyMap().clear();
+
+ // Refresh any actions that may become enabled or disabled.
+ //
+ setSelection(getSelection());
+ }
+
+ if (!removedResources.isEmpty()) {
+ if (handleDirtyConflict()) {
+ getSite().getPage().closeEditor(ProfileToFacetsConfigurationEditor.this, false);
+ }
+ else {
+ removedResources.clear();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+ else if (!changedResources.isEmpty()) {
+ changedResources.removeAll(savedResources);
+ handleChangedResources();
+ changedResources.clear();
+ savedResources.clear();
+ }
+ }
+
+ /**
+ * Handles what to do with changed resources on activation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void handleChangedResources() {
+ if (!changedResources.isEmpty() && (!isDirty() || handleDirtyConflict())) {
+ if (isDirty()) {
+ changedResources.addAll(editingDomain.getResourceSet().getResources());
+ }
+ editingDomain.getCommandStack().flush();
+
+ updateProblemIndication = false;
+ for (Resource resource : changedResources) {
+ if (resource.isLoaded()) {
+ resource.unload();
+ try {
+ resource.load(Collections.EMPTY_MAP);
+ }
+ catch (IOException exception) {
+ if (!resourceToDiagnosticMap.containsKey(resource)) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ }
+ }
+ }
+
+ if (AdapterFactoryEditingDomain.isStale(editorSelection)) {
+ setSelection(StructuredSelection.EMPTY);
+ }
+
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+ }
+
+ /**
+ * Updates the problems indication with the information described in the specified diagnostic.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void updateProblemIndication() {
+ if (updateProblemIndication) {
+ BasicDiagnostic diagnostic =
+ new BasicDiagnostic
+ (Diagnostic.OK,
+ "org.eclipse.papyrus.profile.facets.configuration.editor",
+ 0,
+ null,
+ new Object [] { editingDomain.getResourceSet() });
+ for (Diagnostic childDiagnostic : resourceToDiagnosticMap.values()) {
+ if (childDiagnostic.getSeverity() != Diagnostic.OK) {
+ diagnostic.add(childDiagnostic);
+ }
+ }
+
+ int lastEditorPage = getPageCount() - 1;
+ if (lastEditorPage >= 0 && getEditor(lastEditorPage) instanceof ProblemEditorPart) {
+ ((ProblemEditorPart)getEditor(lastEditorPage)).setDiagnostic(diagnostic);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ setActivePage(lastEditorPage);
+ }
+ }
+ else if (diagnostic.getSeverity() != Diagnostic.OK) {
+ ProblemEditorPart problemEditorPart = new ProblemEditorPart();
+ problemEditorPart.setDiagnostic(diagnostic);
+ problemEditorPart.setMarkerHelper(markerHelper);
+ try {
+ addPage(++lastEditorPage, problemEditorPart, getEditorInput());
+ setPageText(lastEditorPage, problemEditorPart.getPartName());
+ setActivePage(lastEditorPage);
+ showTabs();
+ }
+ catch (PartInitException exception) {
+ ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ if (markerHelper.hasMarkers(editingDomain.getResourceSet())) {
+ markerHelper.deleteMarkers(editingDomain.getResourceSet());
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ try {
+ markerHelper.createMarkers(diagnostic);
+ }
+ catch (CoreException exception) {
+ ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Shows a dialog that asks if conflicting changes should be discarded.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean handleDirtyConflict() {
+ return
+ MessageDialog.openQuestion
+ (getSite().getShell(),
+ getString("_UI_FileConflict_label"),
+ getString("_WARN_FileConflict"));
+ }
+
+ /**
+ * This creates a model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationEditor() {
+ super();
+ initializeEditingDomain();
+ }
+
+ /**
+ * This sets up the editing domain for the model editor.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @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 ProfileToFacetsConfigurationItemProviderAdapterFactory());
+ adapterFactory.addAdapterFactory(new EcoreItemProviderAdapterFactory());
+ 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() {
+ public void commandStackChanged(final EventObject event) {
+ getContainer().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+
+ // Try to select the affected objects.
+ //
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
+ if (mostRecentCommand != null) {
+ setSelectionToViewer(mostRecentCommand.getAffectedObjects());
+ }
+ if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) {
+ propertySheetPage.refresh();
+ }
+ }
+ });
+ }
+ });
+
+ // Create the editing domain with a special command stack.
+ //
+ editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, new HashMap<Resource, Boolean>());
+ }
+
+ /**
+ * This is here for the listener to be able to call it.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void firePropertyChange(int action) {
+ super.firePropertyChange(action);
+ }
+
+ /**
+ * This sets the selection into whichever viewer is active.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSelectionToViewer(Collection<?> collection) {
+ final Collection<?> theSelection = collection;
+ // Make sure it's okay.
+ //
+ if (theSelection != null && !theSelection.isEmpty()) {
+ Runnable runnable =
+ new Runnable() {
+ public void run() {
+ // Try to select the items in the current content viewer of the editor.
+ //
+ if (currentViewer != null) {
+ currentViewer.setSelection(new StructuredSelection(theSelection.toArray()), true);
+ }
+ }
+ };
+ getSite().getShell().getDisplay().asyncExec(runnable);
+ }
+ }
+
+ /**
+ * This returns the editing domain as required by the {@link IEditingDomainProvider} interface.
+ * This is important for implementing the static methods of {@link AdapterFactoryEditingDomain}
+ * and for supporting {@link org.eclipse.emf.edit.ui.action.CommandAction}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EditingDomain getEditingDomain() {
+ return editingDomain;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class ReverseAdapterFactoryContentProvider extends AdapterFactoryContentProvider {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ReverseAdapterFactoryContentProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object [] getElements(Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object [] getChildren(Object object) {
+ Object parent = super.getParent(object);
+ return (parent == null ? Collections.EMPTY_SET : Collections.singleton(parent)).toArray();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ Object parent = super.getParent(object);
+ return parent != null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getParent(Object object) {
+ return null;
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCurrentViewerPane(ViewerPane viewerPane) {
+ if (currentViewerPane != viewerPane) {
+ if (currentViewerPane != null) {
+ currentViewerPane.showFocus(false);
+ }
+ currentViewerPane = viewerPane;
+ }
+ setCurrentViewer(currentViewerPane.getViewer());
+ }
+
+ /**
+ * This makes sure that one content viewer, either for the current page or the outline view, if it has focus,
+ * is the current one.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setCurrentViewer(Viewer viewer) {
+ // If it is changing...
+ //
+ if (currentViewer != viewer) {
+ if (selectionChangedListener == null) {
+ // Create the listener on demand.
+ //
+ selectionChangedListener =
+ new ISelectionChangedListener() {
+ // This just notifies those things that are affected by the section.
+ //
+ public void selectionChanged(SelectionChangedEvent selectionChangedEvent) {
+ setSelection(selectionChangedEvent.getSelection());
+ }
+ };
+ }
+
+ // Stop listening to the old one.
+ //
+ if (currentViewer != null) {
+ currentViewer.removeSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Start listening to the new one.
+ //
+ if (viewer != null) {
+ viewer.addSelectionChangedListener(selectionChangedListener);
+ }
+
+ // Remember it.
+ //
+ currentViewer = viewer;
+
+ // Set the editors selection based on the current viewer's selection.
+ //
+ setSelection(currentViewer == null ? StructuredSelection.EMPTY : currentViewer.getSelection());
+ }
+ }
+
+ /**
+ * This returns the viewer as required by the {@link IViewerProvider} interface.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Viewer getViewer() {
+ return currentViewer;
+ }
+
+ /**
+ * This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void createContextMenuFor(StructuredViewer viewer) {
+ MenuManager contextMenu = new MenuManager("#PopUp");
+ contextMenu.add(new Separator("additions"));
+ contextMenu.setRemoveAllWhenShown(true);
+ contextMenu.addMenuListener(this);
+ Menu menu= contextMenu.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
+
+ int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
+ Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
+ viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
+ viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
+ }
+
+ /**
+ * This is the method called to load a resource into the editing domain's resource set based on the editor's input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createModel() {
+ URI resourceURI = EditUIUtil.getURI(getEditorInput());
+ Exception exception = null;
+ Resource resource = null;
+ try {
+ // Load the resource through the editing domain.
+ //
+ resource = editingDomain.getResourceSet().getResource(resourceURI, true);
+ }
+ catch (Exception e) {
+ exception = e;
+ resource = editingDomain.getResourceSet().getResource(resourceURI, false);
+ }
+
+ Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
+ if (diagnostic.getSeverity() != Diagnostic.OK) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
+ }
+
+ /**
+ * Returns a diagnostic describing the errors and warnings listed in the resource
+ * and the specified exception (if any).
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
+ if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
+ BasicDiagnostic basicDiagnostic =
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.papyrus.profile.facets.configuration.editor",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object [] { exception == null ? (Object)resource : exception });
+ basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
+ return basicDiagnostic;
+ }
+ else if (exception != null) {
+ return
+ new BasicDiagnostic
+ (Diagnostic.ERROR,
+ "org.eclipse.papyrus.profile.facets.configuration.editor",
+ 0,
+ getString("_UI_CreateModelError_message", resource.getURI()),
+ new Object[] { exception });
+ }
+ else {
+ return Diagnostic.OK_INSTANCE;
+ }
+ }
+
+ /**
+ * This is the method used by the framework to install your own controls.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void createPages() {
+ // Creates the model from the editor input
+ //
+ createModel();
+
+ // Only creates the other pages if there is something that can be edited
+ //
+ if (!getEditingDomain().getResourceSet().getResources().isEmpty()) {
+ // Create a page for the selection tree view.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), ProfileToFacetsConfigurationEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ selectionViewer = (TreeViewer)viewerPane.getViewer();
+ selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+
+ selectionViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ selectionViewer.setInput(editingDomain.getResourceSet());
+ selectionViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+ viewerPane.setTitle(editingDomain.getResourceSet());
+
+ new AdapterFactoryTreeEditor(selectionViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(selectionViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_SelectionPage_label"));
+ }
+
+ // Create a page for the parent tree view.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), ProfileToFacetsConfigurationEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ Tree tree = new Tree(composite, SWT.MULTI);
+ TreeViewer newTreeViewer = new TreeViewer(tree);
+ return newTreeViewer;
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ parentViewer = (TreeViewer)viewerPane.getViewer();
+ parentViewer.setAutoExpandLevel(30);
+ parentViewer.setContentProvider(new ReverseAdapterFactoryContentProvider(adapterFactory));
+ parentViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(parentViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_ParentPage_label"));
+ }
+
+ // This is the page for the list viewer
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), ProfileToFacetsConfigurationEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new ListViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ listViewer = (ListViewer)viewerPane.getViewer();
+ listViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ listViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(listViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_ListPage_label"));
+ }
+
+ // This is the page for the tree viewer
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), ProfileToFacetsConfigurationEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TreeViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ treeViewer = (TreeViewer)viewerPane.getViewer();
+ treeViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ new AdapterFactoryTreeEditor(treeViewer.getTree(), adapterFactory);
+
+ createContextMenuFor(treeViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TreePage_label"));
+ }
+
+ // This is the page for the table viewer.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), ProfileToFacetsConfigurationEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TableViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+ tableViewer = (TableViewer)viewerPane.getViewer();
+
+ Table table = tableViewer.getTable();
+ TableLayout layout = new TableLayout();
+ table.setLayout(layout);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ TableColumn objectColumn = new TableColumn(table, SWT.NONE);
+ layout.addColumnData(new ColumnWeightData(3, 100, true));
+ objectColumn.setText(getString("_UI_ObjectColumn_label"));
+ objectColumn.setResizable(true);
+
+ TableColumn selfColumn = new TableColumn(table, SWT.NONE);
+ layout.addColumnData(new ColumnWeightData(2, 100, true));
+ selfColumn.setText(getString("_UI_SelfColumn_label"));
+ selfColumn.setResizable(true);
+
+ tableViewer.setColumnProperties(new String [] {"a", "b"});
+ tableViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(tableViewer);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TablePage_label"));
+ }
+
+ // This is the page for the table tree viewer.
+ //
+ {
+ ViewerPane viewerPane =
+ new ViewerPane(getSite().getPage(), ProfileToFacetsConfigurationEditor.this) {
+ @Override
+ public Viewer createViewer(Composite composite) {
+ return new TreeViewer(composite);
+ }
+ @Override
+ public void requestActivation() {
+ super.requestActivation();
+ setCurrentViewerPane(this);
+ }
+ };
+ viewerPane.createControl(getContainer());
+
+ treeViewerWithColumns = (TreeViewer)viewerPane.getViewer();
+
+ Tree tree = treeViewerWithColumns.getTree();
+ tree.setLayoutData(new FillLayout());
+ tree.setHeaderVisible(true);
+ tree.setLinesVisible(true);
+
+ TreeColumn objectColumn = new TreeColumn(tree, SWT.NONE);
+ objectColumn.setText(getString("_UI_ObjectColumn_label"));
+ objectColumn.setResizable(true);
+ objectColumn.setWidth(250);
+
+ TreeColumn selfColumn = new TreeColumn(tree, SWT.NONE);
+ selfColumn.setText(getString("_UI_SelfColumn_label"));
+ selfColumn.setResizable(true);
+ selfColumn.setWidth(200);
+
+ treeViewerWithColumns.setColumnProperties(new String [] {"a", "b"});
+ treeViewerWithColumns.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ treeViewerWithColumns.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+
+ createContextMenuFor(treeViewerWithColumns);
+ int pageIndex = addPage(viewerPane.getControl());
+ setPageText(pageIndex, getString("_UI_TreeWithColumnsPage_label"));
+ }
+
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ setActivePage(0);
+ }
+ });
+ }
+
+ // Ensures that this editor will only display the page's tab
+ // area if there are more than one page
+ //
+ getContainer().addControlListener
+ (new ControlAdapter() {
+ boolean guard = false;
+ @Override
+ public void controlResized(ControlEvent event) {
+ if (!guard) {
+ guard = true;
+ hideTabs();
+ guard = false;
+ }
+ }
+ });
+
+ getSite().getShell().getDisplay().asyncExec
+ (new Runnable() {
+ public void run() {
+ updateProblemIndication();
+ }
+ });
+ }
+
+ /**
+ * If there is just one page in the multi-page editor part,
+ * this hides the single tab at the bottom.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void hideTabs() {
+ if (getPageCount() <= 1) {
+ setPageText(0, "");
+ if (getContainer() instanceof CTabFolder) {
+ ((CTabFolder)getContainer()).setTabHeight(1);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y + 6);
+ }
+ }
+ }
+
+ /**
+ * If there is more than one page in the multi-page editor part,
+ * this shows the tabs at the bottom.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void showTabs() {
+ if (getPageCount() > 1) {
+ setPageText(0, getString("_UI_SelectionPage_label"));
+ if (getContainer() instanceof CTabFolder) {
+ ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
+ Point point = getContainer().getSize();
+ getContainer().setSize(point.x, point.y - 6);
+ }
+ }
+ }
+
+ /**
+ * This is used to track the active viewer.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void pageChange(int pageIndex) {
+ super.pageChange(pageIndex);
+
+ if (contentOutlinePage != null) {
+ handleContentOutlineSelection(contentOutlinePage.getSelection());
+ }
+ }
+
+ /**
+ * This is how the framework determines which interfaces we implement.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class key) {
+ if (key.equals(IContentOutlinePage.class)) {
+ return showOutlineView() ? getContentOutlinePage() : null;
+ }
+ else if (key.equals(IPropertySheetPage.class)) {
+ return getPropertySheetPage();
+ }
+ else if (key.equals(IGotoMarker.class)) {
+ return this;
+ }
+ else {
+ return super.getAdapter(key);
+ }
+ }
+
+ /**
+ * This accesses a cached version of the content outliner.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IContentOutlinePage getContentOutlinePage() {
+ if (contentOutlinePage == null) {
+ // The content outline is just a tree.
+ //
+ class MyContentOutlinePage extends ContentOutlinePage {
+ @Override
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ contentOutlineViewer = getTreeViewer();
+ contentOutlineViewer.addSelectionChangedListener(this);
+
+ // Set up the tree viewer.
+ //
+ contentOutlineViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
+ contentOutlineViewer.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
+ contentOutlineViewer.setInput(editingDomain.getResourceSet());
+
+ // Make sure our popups work.
+ //
+ createContextMenuFor(contentOutlineViewer);
+
+ if (!editingDomain.getResourceSet().getResources().isEmpty()) {
+ // Select the root object in the view.
+ //
+ contentOutlineViewer.setSelection(new StructuredSelection(editingDomain.getResourceSet().getResources().get(0)), true);
+ }
+ }
+
+ @Override
+ public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
+ super.makeContributions(menuManager, toolBarManager, statusLineManager);
+ contentOutlineStatusLineManager = statusLineManager;
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ }
+
+ contentOutlinePage = new MyContentOutlinePage();
+
+ // Listen to selection so that we can handle it is a special way.
+ //
+ contentOutlinePage.addSelectionChangedListener
+ (new ISelectionChangedListener() {
+ // This ensures that we handle selections correctly.
+ //
+ public void selectionChanged(SelectionChangedEvent event) {
+ handleContentOutlineSelection(event.getSelection());
+ }
+ });
+ }
+
+ return contentOutlinePage;
+ }
+
+ /**
+ * This accesses a cached version of the property sheet.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IPropertySheetPage getPropertySheetPage() {
+ if (propertySheetPage == null) {
+ propertySheetPage =
+ new ExtendedPropertySheetPage(editingDomain) {
+ @Override
+ public void setSelectionToViewer(List<?> selection) {
+ ProfileToFacetsConfigurationEditor.this.setSelectionToViewer(selection);
+ ProfileToFacetsConfigurationEditor.this.setFocus();
+ }
+
+ @Override
+ public void setActionBars(IActionBars actionBars) {
+ super.setActionBars(actionBars);
+ getActionBarContributor().shareGlobalActions(this, actionBars);
+ }
+ };
+ propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory));
+ }
+
+ return propertySheetPage;
+ }
+
+ /**
+ * This deals with how we want selection in the outliner to affect the other views.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void handleContentOutlineSelection(ISelection selection) {
+ if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator();
+ if (selectedElements.hasNext()) {
+ // Get the first selected element.
+ //
+ Object selectedElement = selectedElements.next();
+
+ // If it's the selection viewer, then we want it to select the same selection as this selection.
+ //
+ if (currentViewerPane.getViewer() == selectionViewer) {
+ ArrayList<Object> selectionList = new ArrayList<Object>();
+ selectionList.add(selectedElement);
+ while (selectedElements.hasNext()) {
+ selectionList.add(selectedElements.next());
+ }
+
+ // Set the selection to the widget.
+ //
+ selectionViewer.setSelection(new StructuredSelection(selectionList));
+ }
+ else {
+ // Set the input to the widget.
+ //
+ if (currentViewerPane.getViewer().getInput() != selectedElement) {
+ currentViewerPane.getViewer().setInput(selectedElement);
+ currentViewerPane.setTitle(selectedElement);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply tests the command stack.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isDirty() {
+ return ((BasicCommandStack)editingDomain.getCommandStack()).isSaveNeeded();
+ }
+
+ /**
+ * This is for implementing {@link IEditorPart} and simply saves the model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void doSave(IProgressMonitor progressMonitor) {
+ // 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 {
+ long timeStamp = resource.getTimeStamp();
+ resource.save(saveOptions);
+ if (resource.getTimeStamp() != timeStamp) {
+ savedResources.add(resource);
+ }
+ }
+ catch (Exception exception) {
+ resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
+ }
+ first = false;
+ }
+ }
+ }
+ };
+
+ updateProblemIndication = false;
+ try {
+ // This runs the options, and shows progress.
+ //
+ new ProgressMonitorDialog(getSite().getShell()).run(true, false, operation);
+
+ // Refresh the necessary state.
+ //
+ ((BasicCommandStack)editingDomain.getCommandStack()).saveIsDone();
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ catch (Exception exception) {
+ // Something went wrong that shouldn't.
+ //
+ ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.log(exception);
+ }
+ updateProblemIndication = true;
+ updateProblemIndication();
+ }
+
+ /**
+ * 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.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @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;
+ }
+
+ /**
+ * This always returns true because it is not currently supported.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * This also changes the editor's input.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void doSaveAs() {
+ SaveAsDialog saveAsDialog = new SaveAsDialog(getSite().getShell());
+ saveAsDialog.open();
+ IPath path = saveAsDialog.getResult();
+ if (path != null) {
+ IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ if (file != null) {
+ doSaveAs(URI.createPlatformResourceURI(file.getFullPath().toString(), true), new FileEditorInput(file));
+ }
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void doSaveAs(URI uri, IEditorInput editorInput) {
+ (editingDomain.getResourceSet().getResources().get(0)).setURI(uri);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ IProgressMonitor progressMonitor =
+ getActionBars().getStatusLineManager() != null ?
+ getActionBars().getStatusLineManager().getProgressMonitor() :
+ new NullProgressMonitor();
+ doSave(progressMonitor);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void gotoMarker(IMarker marker) {
+ try {
+ if (marker.getType().equals(EValidator.MARKER)) {
+ String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ if (uriAttribute != null) {
+ URI uri = URI.createURI(uriAttribute);
+ EObject eObject = editingDomain.getResourceSet().getEObject(uri, true);
+ if (eObject != null) {
+ setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject)));
+ }
+ }
+ }
+ }
+ catch (CoreException exception) {
+ ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.log(exception);
+ }
+ }
+
+ /**
+ * This is called during startup.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void init(IEditorSite site, IEditorInput editorInput) {
+ setSite(site);
+ setInputWithNotify(editorInput);
+ setPartName(editorInput.getName());
+ site.setSelectionProvider(this);
+ site.getPage().addPartListener(partListener);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setFocus() {
+ if (currentViewerPane != null) {
+ currentViewerPane.setFocus();
+ }
+ else {
+ getControl(getActivePage()).setFocus();
+ }
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.add(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+ selectionChangedListeners.remove(listener);
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to return this editor's overall selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ISelection getSelection() {
+ return editorSelection;
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.viewers.ISelectionProvider} to set this editor's overall selection.
+ * Calling this result will notify the listeners.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setSelection(ISelection selection) {
+ editorSelection = selection;
+
+ for (ISelectionChangedListener listener : selectionChangedListeners) {
+ listener.selectionChanged(new SelectionChangedEvent(this, selection));
+ }
+ setStatusLineManager(selection);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setStatusLineManager(ISelection selection) {
+ IStatusLineManager statusLineManager = currentViewer != null && currentViewer == contentOutlineViewer ?
+ contentOutlineStatusLineManager : getActionBars().getStatusLineManager();
+
+ if (statusLineManager != null) {
+ if (selection instanceof IStructuredSelection) {
+ Collection<?> collection = ((IStructuredSelection)selection).toList();
+ switch (collection.size()) {
+ case 0: {
+ statusLineManager.setMessage(getString("_UI_NoObjectSelected"));
+ break;
+ }
+ case 1: {
+ String text = new AdapterFactoryItemDelegator(adapterFactory).getText(collection.iterator().next());
+ statusLineManager.setMessage(getString("_UI_SingleObjectSelected", text));
+ break;
+ }
+ default: {
+ statusLineManager.setMessage(getString("_UI_MultiObjectSelected", Integer.toString(collection.size())));
+ break;
+ }
+ }
+ }
+ else {
+ statusLineManager.setMessage("");
+ }
+ }
+ }
+
+ /**
+ * This looks up a string in the plugin's plugin.properties file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key) {
+ return ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString(key);
+ }
+
+ /**
+ * This looks up a string in plugin.properties, making a substitution.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static String getString(String key, Object s1) {
+ return ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString(key, new Object [] { s1 });
+ }
+
+ /**
+ * This implements {@link org.eclipse.jface.action.IMenuListener} to help fill the context menus with contributions from the Edit menu.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void menuAboutToShow(IMenuManager menuManager) {
+ ((IMenuListener)getEditorSite().getActionBarContributor()).menuAboutToShow(menuManager);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EditingDomainActionBarContributor getActionBarContributor() {
+ return (EditingDomainActionBarContributor)getEditorSite().getActionBarContributor();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public IActionBars getActionBars() {
+ return getActionBarContributor().getActionBars();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AdapterFactory getAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void dispose() {
+ updateProblemIndication = false;
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
+
+ getSite().getPage().removePartListener(partListener);
+
+ adapterFactory.dispose();
+
+ if (getActionBarContributor().getActiveEditor() == this) {
+ getActionBarContributor().setActiveEditor(null);
+ }
+
+ if (propertySheetPage != null) {
+ propertySheetPage.dispose();
+ }
+
+ if (contentOutlinePage != null) {
+ contentOutlinePage.dispose();
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * Returns whether the outline view should be presented to the user.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected boolean showOutlineView() {
+ return true;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationModelWizard.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationModelWizard.java
new file mode 100644
index 00000000000..db93321d20d
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration.editor/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/presentation/ProfileToFacetsConfigurationModelWizard.java
@@ -0,0 +1,632 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.presentation;
+
+
+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 java.util.MissingResourceException;
+import java.util.StringTokenizer;
+
+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.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.emf.ecore.xmi.XMLResource;
+
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+
+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.jface.dialogs.MessageDialog;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+
+import org.eclipse.swt.SWT;
+
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.ModifyEvent;
+
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.ISetSelectionTarget;
+
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationFactory;
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage;
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.provider.ProfileToFacetConfigurationModelEditPlugin;
+
+
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+
+
+/**
+ * This is a simple wizard for creating a new model file.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ProfileToFacetsConfigurationModelWizard 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(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ProfileToFacetsConfigurationEditorFilenameExtensions").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 =
+ ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ProfileToFacetsConfigurationEditorFilenameExtensions").replaceAll("\\s*,\\s*", ", ");
+
+ /**
+ * This caches an instance of the model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ProfileToFacetsConfigurationPackage profileToFacetsConfigurationPackage = ProfileToFacetsConfigurationPackage.eINSTANCE;
+
+ /**
+ * This caches an instance of the model factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ProfileToFacetsConfigurationFactory profileToFacetsConfigurationFactory = profileToFacetsConfigurationPackage.getProfileToFacetsConfigurationFactory();
+
+ /**
+ * This is the file creation page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ProfileToFacetsConfigurationModelWizardNewFileCreationPage newFileCreationPage;
+
+ /**
+ * This is the initial object creation page.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ProfileToFacetsConfigurationModelWizardInitialObjectCreationPage 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(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_Wizard_label"));
+ setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getImage("full/wizban/NewProfileToFacetsConfiguration")));
+ }
+
+ /**
+ * 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 : profileToFacetsConfigurationPackage.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
+ */
+ protected EObject createInitialModel() {
+ EClass eClass = (EClass)profileToFacetsConfigurationPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName());
+ EObject rootObject = profileToFacetsConfigurationFactory.create(eClass);
+ return rootObject;
+ }
+
+ /**
+ * Do the work after everything is specified.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @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, initialObjectCreationPage.getEncoding());
+ resource.save(options);
+ }
+ catch (Exception exception) {
+ ProfileToFacetConfigurationModelEditorPlugin.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(), ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage());
+ return false;
+ }
+
+ return true;
+ }
+ catch (Exception exception) {
+ ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.log(exception);
+ return false;
+ }
+ }
+
+ /**
+ * This is the one page of the wizard.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public class ProfileToFacetsConfigurationModelWizardNewFileCreationPage extends WizardNewFileCreationPage {
+ /**
+ * Pass in the selection.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationModelWizardNewFileCreationPage(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(ProfileToFacetConfigurationModelEditorPlugin.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 ProfileToFacetsConfigurationModelWizardInitialObjectCreationPage 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 ProfileToFacetsConfigurationModelWizardInitialObjectCreationPage(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(ProfileToFacetConfigurationModelEditorPlugin.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(ProfileToFacetConfigurationModelEditorPlugin.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 ProfileToFacetConfigurationModelEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type");
+ }
+ catch(MissingResourceException mre) {
+ ProfileToFacetConfigurationModelEditorPlugin.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(ProfileToFacetConfigurationModelEditorPlugin.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
+ */
+ @Override
+ public void addPages() {
+ // Create a page, set the title, and the initial model file name.
+ //
+ newFileCreationPage = new ProfileToFacetsConfigurationModelWizardNewFileCreationPage("Whatever", selection);
+ newFileCreationPage.setTitle(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ProfileToFacetsConfigurationModelWizard_label"));
+ newFileCreationPage.setDescription(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ProfileToFacetsConfigurationModelWizard_description"));
+ newFileCreationPage.setFileName(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ProfileToFacetsConfigurationEditorFilenameDefaultBase") + "." + 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 = ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ProfileToFacetsConfigurationEditorFilenameDefaultBase");
+ 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 ProfileToFacetsConfigurationModelWizardInitialObjectCreationPage("Whatever2");
+ initialObjectCreationPage.setTitle(ProfileToFacetConfigurationModelEditorPlugin.INSTANCE.getString("_UI_ProfileToFacetsConfigurationModelWizard_label"));
+ initialObjectCreationPage.setDescription(ProfileToFacetConfigurationModelEditorPlugin.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/sandbox/org.eclipse.papyrus.profile.facets.configuration/.classpath b/sandbox/org.eclipse.papyrus.profile.facets.configuration/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/.project b/sandbox/org.eclipse.papyrus.profile.facets.configuration/.project
new file mode 100644
index 00000000000..34a809f575c
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.profile.facets.configuration</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/sandbox/org.eclipse.papyrus.profile.facets.configuration/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.profile.facets.configuration/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..526f5c74c0a
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.profile.facets.configuration;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration,
+ org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl,
+ org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.util
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.xmi;visibility:=reexport,
+ org.eclipse.uml2.uml;visibility:=reexport
+Bundle-ActivationPolicy: lazy
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/build.properties b/sandbox/org.eclipse.papyrus.profile.facets.configuration/build.properties
new file mode 100644
index 00000000000..1a3a48b2220
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/build.properties
@@ -0,0 +1,14 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/model/profileToFacetConfigurationModel.ecore b/sandbox/org.eclipse.papyrus.profile.facets.configuration/model/profileToFacetConfigurationModel.ecore
new file mode 100644
index 00000000000..4aa2d267478
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/model/profileToFacetConfigurationModel.ecore
@@ -0,0 +1,18 @@
+<?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="profileToFacetsConfiguration"
+ nsURI="http://www.eclipse.org/Papyrus/profileToFacetsConfiguration" nsPrefix="profileToFacetsConfiguration">
+ <eClassifiers xsi:type="ecore:EClass" name="ProfileToFacetsConfiguration">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="profile" lowerBound="1"
+ eType="ecore:EClass platform:/plugin/org.eclipse.uml2.uml/model/UML.ecore#//Profile"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="basePackage" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="header" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="javaFolder" lowerBound="1"
+ eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral="src-gen"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="modelFolder" lowerBound="1"
+ eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"
+ defaultValueLiteral="resources"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/model/profileToFacetConfigurationModel.genmodel b/sandbox/org.eclipse.papyrus.profile.facets.configuration/model/profileToFacetConfigurationModel.genmodel
new file mode 100644
index 00000000000..fcf89bdf8fe
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/model/profileToFacetConfigurationModel.genmodel
@@ -0,0 +1,17 @@
+<?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.profile.facets.configuration/src"
+ modelPluginID="org.eclipse.papyrus.profile.facets.configuration" modelName="ProfileToFacetConfigurationModel"
+ importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false"
+ usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore platform:/plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml">
+ <foreignModel>profileToFacetConfigurationModel.ecore</foreignModel>
+ <genPackages prefix="ProfileToFacetsConfiguration" basePackage="org.eclipse.papyrus.profile.facets.configuration"
+ resource="XML" disposableProviderFactory="true" ecorePackage="profileToFacetConfigurationModel.ecore#/">
+ <genClasses ecoreClass="profileToFacetConfigurationModel.ecore#//ProfileToFacetsConfiguration">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute profileToFacetConfigurationModel.ecore#//ProfileToFacetsConfiguration/header"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference profileToFacetConfigurationModel.ecore#//ProfileToFacetsConfiguration/profile"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute profileToFacetConfigurationModel.ecore#//ProfileToFacetsConfiguration/basePackage"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/plugin.properties b/sandbox/org.eclipse.papyrus.profile.facets.configuration/plugin.properties
new file mode 100644
index 00000000000..bc39bc77639
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/plugin.properties
@@ -0,0 +1,8 @@
+
+# <copyright>
+# </copyright>
+#
+# $Id$
+
+pluginName = ProfileToFacetConfigurationModel Model
+providerName = www.example.org
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/plugin.xml b/sandbox/org.eclipse.papyrus.profile.facets.configuration/plugin.xml
new file mode 100644
index 00000000000..ebb8d7b0f22
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/plugin.xml
@@ -0,0 +1,26 @@
+<?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/profileToFacetsConfiguration"
+ class="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage"
+ genModel="model/profileToFacetConfigurationModel.genmodel"/>
+ </extension>
+
+ <extension point="org.eclipse.emf.ecore.extension_parser">
+ <parser
+ type="profiletofacetsconfiguration"
+ class="org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.util.ProfileToFacetsConfigurationResourceFactoryImpl"/>
+ </extension>
+
+</plugin>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfiguration.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfiguration.java
new file mode 100644
index 00000000000..d0456a3a0ef
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfiguration.java
@@ -0,0 +1,166 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.uml2.uml.Profile;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Profile To Facets Configuration</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getProfile <em>Profile</em>}</li>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getBasePackage <em>Base Package</em>}</li>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getHeader <em>Header</em>}</li>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getJavaFolder <em>Java Folder</em>}</li>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getModelFolder <em>Model Folder</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage#getProfileToFacetsConfiguration()
+ * @model
+ * @generated
+ */
+public interface ProfileToFacetsConfiguration extends EObject {
+ /**
+ * Returns the value of the '<em><b>Profile</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Profile</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Profile</em>' reference.
+ * @see #setProfile(Profile)
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage#getProfileToFacetsConfiguration_Profile()
+ * @model required="true"
+ * @generated
+ */
+ Profile getProfile();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getProfile <em>Profile</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Profile</em>' reference.
+ * @see #getProfile()
+ * @generated
+ */
+ void setProfile(Profile value);
+
+ /**
+ * Returns the value of the '<em><b>Base Package</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Base Package</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Base Package</em>' attribute.
+ * @see #setBasePackage(String)
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage#getProfileToFacetsConfiguration_BasePackage()
+ * @model required="true"
+ * @generated
+ */
+ String getBasePackage();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getBasePackage <em>Base Package</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Base Package</em>' attribute.
+ * @see #getBasePackage()
+ * @generated
+ */
+ void setBasePackage(String value);
+
+ /**
+ * Returns the value of the '<em><b>Header</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Header</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Header</em>' attribute.
+ * @see #setHeader(String)
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage#getProfileToFacetsConfiguration_Header()
+ * @model
+ * @generated
+ */
+ String getHeader();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getHeader <em>Header</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Header</em>' attribute.
+ * @see #getHeader()
+ * @generated
+ */
+ void setHeader(String value);
+
+ /**
+ * Returns the value of the '<em><b>Java Folder</b></em>' attribute.
+ * The default value is <code>"src-gen"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Java Folder</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Java Folder</em>' attribute.
+ * @see #setJavaFolder(String)
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage#getProfileToFacetsConfiguration_JavaFolder()
+ * @model default="src-gen" required="true"
+ * @generated
+ */
+ String getJavaFolder();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getJavaFolder <em>Java Folder</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Java Folder</em>' attribute.
+ * @see #getJavaFolder()
+ * @generated
+ */
+ void setJavaFolder(String value);
+
+ /**
+ * Returns the value of the '<em><b>Model Folder</b></em>' attribute.
+ * The default value is <code>"resources"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Model Folder</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Model Folder</em>' attribute.
+ * @see #setModelFolder(String)
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage#getProfileToFacetsConfiguration_ModelFolder()
+ * @model default="resources" required="true"
+ * @generated
+ */
+ String getModelFolder();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getModelFolder <em>Model Folder</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Model Folder</em>' attribute.
+ * @see #getModelFolder()
+ * @generated
+ */
+ void setModelFolder(String value);
+
+} // ProfileToFacetsConfiguration
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfigurationFactory.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfigurationFactory.java
new file mode 100644
index 00000000000..206c6a829a8
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfigurationFactory.java
@@ -0,0 +1,46 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration;
+
+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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage
+ * @generated
+ */
+public interface ProfileToFacetsConfigurationFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ ProfileToFacetsConfigurationFactory eINSTANCE = org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Profile To Facets Configuration</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Profile To Facets Configuration</em>'.
+ * @generated
+ */
+ ProfileToFacetsConfiguration createProfileToFacetsConfiguration();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ ProfileToFacetsConfigurationPackage getProfileToFacetsConfigurationPackage();
+
+} //ProfileToFacetsConfigurationFactory
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfigurationPackage.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfigurationPackage.java
new file mode 100644
index 00000000000..80b28db9bcb
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/ProfileToFacetsConfigurationPackage.java
@@ -0,0 +1,266 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface ProfileToFacetsConfigurationPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "profileToFacetsConfiguration";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/Papyrus/profileToFacetsConfiguration";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "profileToFacetsConfiguration";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ ProfileToFacetsConfigurationPackage eINSTANCE = org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl <em>Profile To Facets Configuration</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationPackageImpl#getProfileToFacetsConfiguration()
+ * @generated
+ */
+ int PROFILE_TO_FACETS_CONFIGURATION = 0;
+
+ /**
+ * The feature id for the '<em><b>Profile</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PROFILE_TO_FACETS_CONFIGURATION__PROFILE = 0;
+
+ /**
+ * The feature id for the '<em><b>Base Package</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE = 1;
+
+ /**
+ * The feature id for the '<em><b>Header</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PROFILE_TO_FACETS_CONFIGURATION__HEADER = 2;
+
+ /**
+ * The feature id for the '<em><b>Java Folder</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER = 3;
+
+ /**
+ * The feature id for the '<em><b>Model Folder</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER = 4;
+
+ /**
+ * The number of structural features of the '<em>Profile To Facets Configuration</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PROFILE_TO_FACETS_CONFIGURATION_FEATURE_COUNT = 5;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration <em>Profile To Facets Configuration</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Profile To Facets Configuration</em>'.
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration
+ * @generated
+ */
+ EClass getProfileToFacetsConfiguration();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getProfile <em>Profile</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Profile</em>'.
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getProfile()
+ * @see #getProfileToFacetsConfiguration()
+ * @generated
+ */
+ EReference getProfileToFacetsConfiguration_Profile();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getBasePackage <em>Base Package</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Base Package</em>'.
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getBasePackage()
+ * @see #getProfileToFacetsConfiguration()
+ * @generated
+ */
+ EAttribute getProfileToFacetsConfiguration_BasePackage();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getHeader <em>Header</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Header</em>'.
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getHeader()
+ * @see #getProfileToFacetsConfiguration()
+ * @generated
+ */
+ EAttribute getProfileToFacetsConfiguration_Header();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getJavaFolder <em>Java Folder</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Java Folder</em>'.
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getJavaFolder()
+ * @see #getProfileToFacetsConfiguration()
+ * @generated
+ */
+ EAttribute getProfileToFacetsConfiguration_JavaFolder();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getModelFolder <em>Model Folder</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Model Folder</em>'.
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration#getModelFolder()
+ * @see #getProfileToFacetsConfiguration()
+ * @generated
+ */
+ EAttribute getProfileToFacetsConfiguration_ModelFolder();
+
+ /**
+ * 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
+ */
+ ProfileToFacetsConfigurationFactory getProfileToFacetsConfigurationFactory();
+
+ /**
+ * <!-- 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.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl <em>Profile To Facets Configuration</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationPackageImpl#getProfileToFacetsConfiguration()
+ * @generated
+ */
+ EClass PROFILE_TO_FACETS_CONFIGURATION = eINSTANCE.getProfileToFacetsConfiguration();
+
+ /**
+ * The meta object literal for the '<em><b>Profile</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference PROFILE_TO_FACETS_CONFIGURATION__PROFILE = eINSTANCE.getProfileToFacetsConfiguration_Profile();
+
+ /**
+ * The meta object literal for the '<em><b>Base Package</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE = eINSTANCE.getProfileToFacetsConfiguration_BasePackage();
+
+ /**
+ * The meta object literal for the '<em><b>Header</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PROFILE_TO_FACETS_CONFIGURATION__HEADER = eINSTANCE.getProfileToFacetsConfiguration_Header();
+
+ /**
+ * The meta object literal for the '<em><b>Java Folder</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER = eINSTANCE.getProfileToFacetsConfiguration_JavaFolder();
+
+ /**
+ * The meta object literal for the '<em><b>Model Folder</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER = eINSTANCE.getProfileToFacetsConfiguration_ModelFolder();
+
+ }
+
+} //ProfileToFacetsConfigurationPackage
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationFactoryImpl.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationFactoryImpl.java
new file mode 100644
index 00000000000..700db1386ab
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationFactoryImpl.java
@@ -0,0 +1,99 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl;
+
+import org.eclipse.emf.ecore.EClass;
+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.profile.facets.configuration.profileToFacetsConfiguration.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ProfileToFacetsConfigurationFactoryImpl extends EFactoryImpl implements ProfileToFacetsConfigurationFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static ProfileToFacetsConfigurationFactory init() {
+ try {
+ ProfileToFacetsConfigurationFactory theProfileToFacetsConfigurationFactory = (ProfileToFacetsConfigurationFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/Papyrus/profileToFacetsConfiguration");
+ if (theProfileToFacetsConfigurationFactory != null) {
+ return theProfileToFacetsConfigurationFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new ProfileToFacetsConfigurationFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION: return createProfileToFacetsConfiguration();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfiguration createProfileToFacetsConfiguration() {
+ ProfileToFacetsConfigurationImpl profileToFacetsConfiguration = new ProfileToFacetsConfigurationImpl();
+ return profileToFacetsConfiguration;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationPackage getProfileToFacetsConfigurationPackage() {
+ return (ProfileToFacetsConfigurationPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static ProfileToFacetsConfigurationPackage getPackage() {
+ return ProfileToFacetsConfigurationPackage.eINSTANCE;
+ }
+
+} //ProfileToFacetsConfigurationFactoryImpl
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationImpl.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationImpl.java
new file mode 100644
index 00000000000..52b69fd4a41
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationImpl.java
@@ -0,0 +1,392 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration;
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage;
+
+import org.eclipse.uml2.uml.Profile;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Profile To Facets Configuration</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl#getProfile <em>Profile</em>}</li>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl#getBasePackage <em>Base Package</em>}</li>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl#getHeader <em>Header</em>}</li>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl#getJavaFolder <em>Java Folder</em>}</li>
+ * <li>{@link org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl.ProfileToFacetsConfigurationImpl#getModelFolder <em>Model Folder</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class ProfileToFacetsConfigurationImpl extends EObjectImpl implements ProfileToFacetsConfiguration {
+ /**
+ * The cached value of the '{@link #getProfile() <em>Profile</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getProfile()
+ * @generated
+ * @ordered
+ */
+ protected Profile profile;
+
+ /**
+ * The default value of the '{@link #getBasePackage() <em>Base Package</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getBasePackage()
+ * @generated
+ * @ordered
+ */
+ protected static final String BASE_PACKAGE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getBasePackage() <em>Base Package</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getBasePackage()
+ * @generated
+ * @ordered
+ */
+ protected String basePackage = BASE_PACKAGE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getHeader() <em>Header</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getHeader()
+ * @generated
+ * @ordered
+ */
+ protected static final String HEADER_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getHeader() <em>Header</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getHeader()
+ * @generated
+ * @ordered
+ */
+ protected String header = HEADER_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getJavaFolder() <em>Java Folder</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJavaFolder()
+ * @generated
+ * @ordered
+ */
+ protected static final String JAVA_FOLDER_EDEFAULT = "src-gen";
+
+ /**
+ * The cached value of the '{@link #getJavaFolder() <em>Java Folder</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getJavaFolder()
+ * @generated
+ * @ordered
+ */
+ protected String javaFolder = JAVA_FOLDER_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getModelFolder() <em>Model Folder</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getModelFolder()
+ * @generated
+ * @ordered
+ */
+ protected static final String MODEL_FOLDER_EDEFAULT = "resources";
+
+ /**
+ * The cached value of the '{@link #getModelFolder() <em>Model Folder</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getModelFolder()
+ * @generated
+ * @ordered
+ */
+ protected String modelFolder = MODEL_FOLDER_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ProfileToFacetsConfigurationImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return ProfileToFacetsConfigurationPackage.Literals.PROFILE_TO_FACETS_CONFIGURATION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Profile getProfile() {
+ if (profile != null && profile.eIsProxy()) {
+ InternalEObject oldProfile = (InternalEObject)profile;
+ profile = (Profile)eResolveProxy(oldProfile);
+ if (profile != oldProfile) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__PROFILE, oldProfile, profile));
+ }
+ }
+ return profile;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Profile basicGetProfile() {
+ return profile;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setProfile(Profile newProfile) {
+ Profile oldProfile = profile;
+ profile = newProfile;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__PROFILE, oldProfile, profile));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getBasePackage() {
+ return basePackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setBasePackage(String newBasePackage) {
+ String oldBasePackage = basePackage;
+ basePackage = newBasePackage;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE, oldBasePackage, basePackage));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getHeader() {
+ return header;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setHeader(String newHeader) {
+ String oldHeader = header;
+ header = newHeader;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__HEADER, oldHeader, header));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getJavaFolder() {
+ return javaFolder;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setJavaFolder(String newJavaFolder) {
+ String oldJavaFolder = javaFolder;
+ javaFolder = newJavaFolder;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER, oldJavaFolder, javaFolder));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getModelFolder() {
+ return modelFolder;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setModelFolder(String newModelFolder) {
+ String oldModelFolder = modelFolder;
+ modelFolder = newModelFolder;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER, oldModelFolder, modelFolder));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__PROFILE:
+ if (resolve) return getProfile();
+ return basicGetProfile();
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE:
+ return getBasePackage();
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__HEADER:
+ return getHeader();
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER:
+ return getJavaFolder();
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER:
+ return getModelFolder();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__PROFILE:
+ setProfile((Profile)newValue);
+ return;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE:
+ setBasePackage((String)newValue);
+ return;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__HEADER:
+ setHeader((String)newValue);
+ return;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER:
+ setJavaFolder((String)newValue);
+ return;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER:
+ setModelFolder((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__PROFILE:
+ setProfile((Profile)null);
+ return;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE:
+ setBasePackage(BASE_PACKAGE_EDEFAULT);
+ return;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__HEADER:
+ setHeader(HEADER_EDEFAULT);
+ return;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER:
+ setJavaFolder(JAVA_FOLDER_EDEFAULT);
+ return;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER:
+ setModelFolder(MODEL_FOLDER_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__PROFILE:
+ return profile != null;
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE:
+ return BASE_PACKAGE_EDEFAULT == null ? basePackage != null : !BASE_PACKAGE_EDEFAULT.equals(basePackage);
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__HEADER:
+ return HEADER_EDEFAULT == null ? header != null : !HEADER_EDEFAULT.equals(header);
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER:
+ return JAVA_FOLDER_EDEFAULT == null ? javaFolder != null : !JAVA_FOLDER_EDEFAULT.equals(javaFolder);
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER:
+ return MODEL_FOLDER_EDEFAULT == null ? modelFolder != null : !MODEL_FOLDER_EDEFAULT.equals(modelFolder);
+ }
+ 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(" (basePackage: ");
+ result.append(basePackage);
+ result.append(", header: ");
+ result.append(header);
+ result.append(", javaFolder: ");
+ result.append(javaFolder);
+ result.append(", modelFolder: ");
+ result.append(modelFolder);
+ result.append(')');
+ return result.toString();
+ }
+
+} //ProfileToFacetsConfigurationImpl
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationPackageImpl.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationPackageImpl.java
new file mode 100644
index 00000000000..f70d0030821
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/impl/ProfileToFacetsConfigurationPackageImpl.java
@@ -0,0 +1,236 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration;
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationFactory;
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage;
+
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ProfileToFacetsConfigurationPackageImpl extends EPackageImpl implements ProfileToFacetsConfigurationPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass profileToFacetsConfigurationEClass = 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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private ProfileToFacetsConfigurationPackageImpl() {
+ super(eNS_URI, ProfileToFacetsConfigurationFactory.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 ProfileToFacetsConfigurationPackage#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 ProfileToFacetsConfigurationPackage init() {
+ if (isInited) return (ProfileToFacetsConfigurationPackage)EPackage.Registry.INSTANCE.getEPackage(ProfileToFacetsConfigurationPackage.eNS_URI);
+
+ // Obtain or create and register package
+ ProfileToFacetsConfigurationPackageImpl theProfileToFacetsConfigurationPackage = (ProfileToFacetsConfigurationPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ProfileToFacetsConfigurationPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ProfileToFacetsConfigurationPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ UMLPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theProfileToFacetsConfigurationPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theProfileToFacetsConfigurationPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theProfileToFacetsConfigurationPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(ProfileToFacetsConfigurationPackage.eNS_URI, theProfileToFacetsConfigurationPackage);
+ return theProfileToFacetsConfigurationPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getProfileToFacetsConfiguration() {
+ return profileToFacetsConfigurationEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getProfileToFacetsConfiguration_Profile() {
+ return (EReference)profileToFacetsConfigurationEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getProfileToFacetsConfiguration_BasePackage() {
+ return (EAttribute)profileToFacetsConfigurationEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getProfileToFacetsConfiguration_Header() {
+ return (EAttribute)profileToFacetsConfigurationEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getProfileToFacetsConfiguration_JavaFolder() {
+ return (EAttribute)profileToFacetsConfigurationEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getProfileToFacetsConfiguration_ModelFolder() {
+ return (EAttribute)profileToFacetsConfigurationEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationFactory getProfileToFacetsConfigurationFactory() {
+ return (ProfileToFacetsConfigurationFactory)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
+ profileToFacetsConfigurationEClass = createEClass(PROFILE_TO_FACETS_CONFIGURATION);
+ createEReference(profileToFacetsConfigurationEClass, PROFILE_TO_FACETS_CONFIGURATION__PROFILE);
+ createEAttribute(profileToFacetsConfigurationEClass, PROFILE_TO_FACETS_CONFIGURATION__BASE_PACKAGE);
+ createEAttribute(profileToFacetsConfigurationEClass, PROFILE_TO_FACETS_CONFIGURATION__HEADER);
+ createEAttribute(profileToFacetsConfigurationEClass, PROFILE_TO_FACETS_CONFIGURATION__JAVA_FOLDER);
+ createEAttribute(profileToFacetsConfigurationEClass, PROFILE_TO_FACETS_CONFIGURATION__MODEL_FOLDER);
+ }
+
+ /**
+ * <!-- 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);
+
+ // Obtain other dependent packages
+ UMLPackage theUMLPackage = (UMLPackage)EPackage.Registry.INSTANCE.getEPackage(UMLPackage.eNS_URI);
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(profileToFacetsConfigurationEClass, ProfileToFacetsConfiguration.class, "ProfileToFacetsConfiguration", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getProfileToFacetsConfiguration_Profile(), theUMLPackage.getProfile(), null, "profile", null, 1, 1, ProfileToFacetsConfiguration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getProfileToFacetsConfiguration_BasePackage(), ecorePackage.getEString(), "basePackage", null, 1, 1, ProfileToFacetsConfiguration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getProfileToFacetsConfiguration_Header(), theEcorePackage.getEString(), "header", null, 0, 1, ProfileToFacetsConfiguration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getProfileToFacetsConfiguration_JavaFolder(), ecorePackage.getEString(), "javaFolder", "src-gen", 1, 1, ProfileToFacetsConfiguration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getProfileToFacetsConfiguration_ModelFolder(), theEcorePackage.getEString(), "modelFolder", "resources", 1, 1, ProfileToFacetsConfiguration.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //ProfileToFacetsConfigurationPackageImpl
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationAdapterFactory.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationAdapterFactory.java
new file mode 100644
index 00000000000..433fa0674c3
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationAdapterFactory.java
@@ -0,0 +1,124 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.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.profile.facets.configuration.profileToFacetsConfiguration.*;
+
+/**
+ * <!-- 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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage
+ * @generated
+ */
+public class ProfileToFacetsConfigurationAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static ProfileToFacetsConfigurationPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = ProfileToFacetsConfigurationPackage.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 ProfileToFacetsConfigurationSwitch<Adapter> modelSwitch =
+ new ProfileToFacetsConfigurationSwitch<Adapter>() {
+ @Override
+ public Adapter caseProfileToFacetsConfiguration(ProfileToFacetsConfiguration object) {
+ return createProfileToFacetsConfigurationAdapter();
+ }
+ @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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration <em>Profile To Facets Configuration</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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration
+ * @generated
+ */
+ public Adapter createProfileToFacetsConfigurationAdapter() {
+ 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;
+ }
+
+} //ProfileToFacetsConfigurationAdapterFactory
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationResourceFactoryImpl.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationResourceFactoryImpl.java
new file mode 100644
index 00000000000..0123250296b
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationResourceFactoryImpl.java
@@ -0,0 +1,56 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.util;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+import org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl;
+
+import org.eclipse.emf.ecore.xmi.XMLResource;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Resource Factory</b> associated with the package.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.util.ProfileToFacetsConfigurationResourceImpl
+ * @generated
+ */
+public class ProfileToFacetsConfigurationResourceFactoryImpl extends ResourceFactoryImpl {
+ /**
+ * Creates an instance of the resource factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationResourceFactoryImpl() {
+ super();
+ }
+
+ /**
+ * Creates an instance of the resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Resource createResource(URI uri) {
+ XMLResource result = new ProfileToFacetsConfigurationResourceImpl(uri);
+ result.getDefaultSaveOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+ result.getDefaultLoadOptions().put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+
+ result.getDefaultSaveOptions().put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
+
+ result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
+ result.getDefaultSaveOptions().put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
+
+ result.getDefaultLoadOptions().put(XMLResource.OPTION_USE_LEXICAL_HANDLER, Boolean.TRUE);
+ return result;
+ }
+
+} //ProfileToFacetsConfigurationResourceFactoryImpl
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationResourceImpl.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationResourceImpl.java
new file mode 100644
index 00000000000..8978b845897
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationResourceImpl.java
@@ -0,0 +1,32 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.util;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Resource </b> associated with the package.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.util.ProfileToFacetsConfigurationResourceFactoryImpl
+ * @generated
+ */
+public class ProfileToFacetsConfigurationResourceImpl extends XMLResourceImpl {
+ /**
+ * Creates an instance of the resource.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param uri the URI of the new resource.
+ * @generated
+ */
+ public ProfileToFacetsConfigurationResourceImpl(URI uri) {
+ super(uri);
+ }
+
+} //ProfileToFacetsConfigurationResourceImpl
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationSwitch.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationSwitch.java
new file mode 100644
index 00000000000..186d6eebcde
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationSwitch.java
@@ -0,0 +1,114 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.util;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.*;
+
+/**
+ * <!-- 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.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage
+ * @generated
+ */
+public class ProfileToFacetsConfigurationSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static ProfileToFacetsConfigurationPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationSwitch() {
+ if (modelPackage == null) {
+ modelPackage = ProfileToFacetsConfigurationPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * 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
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case ProfileToFacetsConfigurationPackage.PROFILE_TO_FACETS_CONFIGURATION: {
+ ProfileToFacetsConfiguration profileToFacetsConfiguration = (ProfileToFacetsConfiguration)theEObject;
+ T result = caseProfileToFacetsConfiguration(profileToFacetsConfiguration);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Profile To Facets Configuration</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>Profile To Facets Configuration</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseProfileToFacetsConfiguration(ProfileToFacetsConfiguration 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
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //ProfileToFacetsConfigurationSwitch
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationXMLProcessor.java b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationXMLProcessor.java
new file mode 100644
index 00000000000..02a5df19cf3
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.configuration/src/org/eclipse/papyrus/profile/facets/configuration/profileToFacetsConfiguration/util/ProfileToFacetsConfigurationXMLProcessor.java
@@ -0,0 +1,54 @@
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.util;
+
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+import org.eclipse.emf.ecore.xmi.util.XMLProcessor;
+
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfigurationPackage;
+
+/**
+ * This class contains helper methods to serialize and deserialize XML documents
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ProfileToFacetsConfigurationXMLProcessor extends XMLProcessor {
+
+ /**
+ * Public constructor to instantiate the helper.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ProfileToFacetsConfigurationXMLProcessor() {
+ super((EPackage.Registry.INSTANCE));
+ ProfileToFacetsConfigurationPackage.eINSTANCE.eClass();
+ }
+
+ /**
+ * Register for "*" and "xml" file extensions the ProfileToFacetsConfigurationResourceFactoryImpl factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected Map<String, Resource.Factory> getRegistrations() {
+ if (registrations == null) {
+ super.getRegistrations();
+ registrations.put(XML_EXTENSION, new ProfileToFacetsConfigurationResourceFactoryImpl());
+ registrations.put(STAR_EXTENSION, new ProfileToFacetsConfigurationResourceFactoryImpl());
+ }
+ return registrations;
+ }
+
+} //ProfileToFacetsConfigurationXMLProcessor
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.classpath b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.project b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.project
new file mode 100644
index 00000000000..f95d19edab2
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.profile.facets.generation.acceleo.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.settings/org.eclipse.core.resources.prefs b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..c70fa79ab83
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Mon Jun 06 14:24:28 CEST 2011
+eclipse.preferences.version=1
+encoding//src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/messages.properties=ISO-8859-1
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.settings/org.eclipse.jdt.core.prefs b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..394868dcd9a
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon May 23 10:21:17 CEST 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/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..f3473879ea1
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.profile.facets.generation.acceleo.ui;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.profile.facets.generation.acceleo.ui.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.expressions,
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.properties,
+ org.eclipse.emf.common,
+ org.eclipse.emf.ecore,
+ org.eclipse.core.resources,
+ org.eclipse.papyrus.profile.facets.configuration;bundle-version="1.0.0",
+ org.eclipse.papyrus.log,
+ org.eclipse.jdt.core,
+ org.eclipse.emf.facet.infra.query,
+ org.eclipse.m2m.qvt.oml,
+ org.eclipse.papyrus.profile.facets.generation.acceleo,
+ org.eclipse.emf.facet.infra.facet,
+ org.eclipse.papyrus.profile.facets.generation,
+ org.eclipse.acceleo.engine;bundle-version="3.1.0",
+ org.eclipse.jdt.ui,
+ org.eclipse.papyrus.diagram.common,
+ org.eclipse.emf.facet.infra.facet.core,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.papyrus.eclipse.project.editors;bundle-version="0.8.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/about.html b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/build.properties b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/build.properties
new file mode 100644
index 00000000000..6f20375d6c7
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/icons/profileToFacets.png b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/icons/profileToFacets.png
new file mode 100644
index 00000000000..2f45b451b59
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/icons/profileToFacets.png
Binary files differ
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/plugin.xml b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/plugin.xml
new file mode 100644
index 00000000000..8484023f649
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/plugin.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.ui.popup.any">
+ <command
+ commandId="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.generate.facets.from.profile"
+ icon="icons/profileToFacets.png"
+ label="Generate Facets From UML Profile"
+ mnemonic="G"
+ style="push"
+ tooltip="Generate the facets from the UML Profile">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ description="Generate the facets from a UML profile"
+ id="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.generate.facets.from.profile"
+ name="Generate Facets From UML Profile">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler.GenerateFacetsHandler"
+ commandId="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.generate.facets.from.profile">
+ <activeWhen>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler.propertyTester.isProfileToFacetsConfigurationFile"
+ value="true">
+ </test>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler.tester.HandlerPropertyTester"
+ id="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler.propertyTester"
+ namespace="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler.propertyTester"
+ properties="isProfileToFacetsConfigurationFile"
+ type="org.eclipse.jface.viewers.ISelection">
+ </propertyTester>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.infra.facet.registration">
+ <facetset
+ file="org.eclipse.papyrus.profile.facets.generation.acceleo.ui.facetset2">
+ </facetset>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.infra.query.registration">
+ <modelqueryset
+ file="src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/GenerateFacetsHandler.java">
+ </modelqueryset>
+ </extension>
+
+</plugin>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/Activator.java b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/Activator.java
new file mode 100644
index 00000000000..0dd8666fad7
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/Activator.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.profile.facets.generation.acceleo.ui;
+
+import org.eclipse.papyrus.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.profile.facets.generation.acceleo.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/FacetGenerator.java b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/FacetGenerator.java
new file mode 100644
index 00000000000..880ba60110c
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/FacetGenerator.java
@@ -0,0 +1,296 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+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.facet.infra.facet.FacetSet;
+import org.eclipse.emf.facet.infra.query.ModelQuery;
+import org.eclipse.emf.facet.infra.query.ModelQuerySet;
+import org.eclipse.m2m.qvt.oml.BasicModelExtent;
+import org.eclipse.m2m.qvt.oml.ExecutionContextImpl;
+import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic;
+import org.eclipse.m2m.qvt.oml.ModelExtent;
+import org.eclipse.m2m.qvt.oml.TransformationExecutor;
+import org.eclipse.ocl.ecore.EcorePackage;
+import org.eclipse.papyrus.profile.facets.generation.acceleo.Generate;
+import org.eclipse.papyrus.profile.facets.generation.postgeneration.FacetSetSplitter;
+import org.eclipse.uml2.uml.Profile;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ *
+ * This generator is used to "transform" a UML profile in EMF-Facet Facets. Its allows to generate the following files :
+ * <ul>
+ * <li>facetSet</li>
+ * <li>QuerySet</li>
+ * <li>java source</li>
+ * </ul>
+ *
+ */
+public class FacetGenerator {
+
+ /** the profile used to generate the facets */
+ private final Profile profile;
+
+ /** the base name for the java package */
+ private final String basePackageName;
+
+ /** the uri of the model folder */
+ private URI targetModelFolder;
+
+ /** the java source folder */
+ private File javaTargetFolder;
+
+ /** the header for the java source */
+ private String header;
+
+ /** the list owning the generated ModelQuerySet */
+ private final List<EObject> generatedModelQuerySet = new ArrayList<EObject>();
+
+ /** the list owning the generated FacetSet */
+ private final List<FacetSet> generatedFacetSet = new ArrayList<FacetSet>();
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param profile
+ * the profile to transform into facet
+ * @param basePackageName
+ * the base name for the java package generation
+ */
+ public FacetGenerator(final Profile profile, final String basePackageName) {
+ this.profile = profile;
+ this.basePackageName = basePackageName;
+ }
+
+ /**
+ * Setter for {@link #targetModelFolder}
+ *
+ * @param targetModelURI
+ * the URI of the model folder
+ *
+ */
+ public void setQVTTransformationParameters(final URI targetModelURI){
+ this.targetModelFolder = targetModelURI;
+ }
+
+ /**
+ *
+ * @param header
+ * the header for the java generation
+ * @param javaTargetFolderPath
+ * the folder for the java source
+ */
+ public void setAcceleoTransformationParameter(final String header, final String javaTargetFolderPath){
+ this.javaTargetFolder = new File(javaTargetFolderPath);
+ this.header = header;
+ }
+
+ /**
+ * this method allows to generate the facetSet, the querySet and the required java source
+ */
+ public void generate() {
+ runQVTTransformation(this.profile, this.targetModelFolder, this.basePackageName);
+ runAcceleoTransformation(this.javaTargetFolder);
+ }
+
+ /**
+ *
+ * @param sourceProfile
+ * the source profile
+ * @param targetURI
+ * the target folder for the generated files
+ * @param packageName
+ * the package name
+ */
+ private void runQVTTransformation(final Profile sourceProfile, final URI targetURI, final String packageName) {
+ URI transformationURI = URI.createPlatformPluginURI("/org.eclipse.papyrus.profile.facets.generation/transforms/ProfileToFacetSet.qvto", true); //$NON-NLS-1$
+ TransformationExecutor executor = new TransformationExecutor(transformationURI);
+
+ //Transformation input
+ ModelExtent sourceProfileExtent = new BasicModelExtent(Collections.singletonList(sourceProfile));
+ ModelExtent umlEcoreExtent = new BasicModelExtent(Collections.singletonList(UMLPackage.eINSTANCE));
+ ModelExtent ecoreExtent = new BasicModelExtent(Collections.singletonList(EcorePackage.eINSTANCE));
+
+ //Transformation output
+ ModelExtent facetSetsExtent = new BasicModelExtent();
+ ModelExtent querySetExtent = new BasicModelExtent();
+
+ ModelExtent[] extents = new ModelExtent[]{ sourceProfileExtent, umlEcoreExtent, ecoreExtent, facetSetsExtent, querySetExtent };
+
+ ExecutionContextImpl context = new ExecutionContextImpl();
+ context.setConfigProperty("keepModeling", true); //$NON-NLS-1$
+ context.setConfigProperty("packageName", packageName); //$NON-NLS-1$
+ //context.setLog(new WriterLog(new OutputStreamWriter(System.out)));
+
+ ExecutionDiagnostic result = executor.execute(context, extents);
+
+
+
+ if(result.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) {
+ List<EObject> querySet = querySetExtent.getContents();
+ EObject querySetResult = querySet.get(0);
+
+ if(querySetResult instanceof ModelQuerySet) {
+ ModelQuerySet resultQuerySet = (ModelQuerySet)querySetResult;
+ ResourceSet resourceSet = new ResourceSetImpl();
+
+ URI queriesURI = URI.createURI("queries/" + resultQuerySet.getName() + ".querySet").resolve(targetURI); //$NON-NLS-1$ //$NON-NLS-2$
+ Resource querySetResource = resourceSet.createResource(queriesURI);
+ querySetResource.getContents().addAll(querySet);
+ this.generatedModelQuerySet.addAll(querySet);
+ try {
+ querySetResource.save(null);
+ } catch (IOException ex) {
+ ex.printStackTrace(System.err);
+ }
+ }
+
+ List<EObject> facetSets = facetSetsExtent.getContents();
+ EObject facetSetResult = facetSets.get(0);
+ if(facetSetResult instanceof FacetSet) {
+ FacetSet resultFacetSet = (FacetSet)facetSetResult;
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource facetSetResource = resourceSet.createResource(URI.createURI("facets/" + resultFacetSet.getName() + ".facetSet").resolve(targetURI)); //$NON-NLS-1$ //$NON-NLS-2$
+ facetSetResource.getContents().add(resultFacetSet);
+
+ // repairURI(resultFacetSet); //TODO
+
+ try {
+ facetSetResource.save(null);
+ } catch (IOException ex) {
+ ex.printStackTrace(System.err);
+ }
+
+ runFacetSetSplit(resultFacetSet);
+ }
+ } else {
+ IStatus status = BasicDiagnostic.toIStatus(result);
+ //Activator.getDefault().getLog().log(status);
+ System.err.println(status);
+ }
+ //return null;
+ }
+
+ public void repairURI2() {
+ for(int i = 0; i < this.generatedFacetSet.size(); i++) {
+ repairURI(this.generatedFacetSet.get(i));
+ try {
+ this.generatedFacetSet.get(i).eResource().save(null);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ private void repairURI(final FacetSet facetSet) {
+ if(facetSet.getFacets().isEmpty()) {
+ if(!facetSet.getESubpackages().isEmpty()) {
+ for(EPackage subPackage : facetSet.getESubpackages()) {
+ if(subPackage instanceof FacetSet) {
+ repairURI((FacetSet)subPackage);
+ break;
+ }
+ }
+
+ }
+ } else {
+ ModelQuery query = facetSet.getFacets().get(0).getConditionQuery();
+ Resource queryResource = query.eResource();
+ URI queryURI = queryResource.getURI();
+
+ System.out.print("Replacing " + queryURI + " by "); //$NON-NLS-1$ //$NON-NLS-2$
+
+ URI newURI = URI.createURI("emffacet:/query/" + queryURI.lastSegment().replace(".querySet", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ queryResource.setURI(newURI);
+ System.out.println(newURI);
+ System.out.println();
+ }
+ }
+
+ private void runFacetSetSplit(final FacetSet facetSet) {
+ Set<Resource> resources = FacetSetSplitter.instance.splitFacetSet(facetSet);
+ List<EObject> contents = new ArrayList<EObject>();
+ Iterator<Resource> iter = resources.iterator();
+ while(iter.hasNext()) {
+ contents.addAll(iter.next().getContents());
+ }
+
+ for(int i = 0; i < contents.size(); i++) {
+ if(contents.get(i) instanceof FacetSet) {
+ this.generatedFacetSet.add((FacetSet)contents.get(i));
+ }
+ }
+ }
+
+ /**
+ * generate the java source
+ *
+ * @param targetFolder
+ * the target folder for the java source
+ */
+ private void runAcceleoTransformation( final File targetFolder) {
+ try {
+ // targetFolder = new File("D:\\runtime-Neptune-New_configuration(1)\\tutu\\src-gen");
+ Generate generate = new Generate(this.profile, targetFolder, Collections.EMPTY_LIST);
+ //TODO a tester!
+ // generate.addPropertiesFile(propertiesFile)
+ generate.setHeader(this.header);
+ // generate.setHeader("");
+ generate.setPackageName(this.basePackageName);
+ // generate.setPackageName("");
+ // generate.setPackageName("oep.test");
+ generate.doGenerate(null);
+ } catch (IOException ex) {
+ ex.printStackTrace(System.err);
+ }
+ }
+
+ /**
+ * Getter for {@link #generatedFacetSet}
+ *
+ * @return
+ * the generated facetSet
+ */
+ public List<FacetSet> getGeneratedFacetSet() {
+ return this.generatedFacetSet;
+ }
+
+ /**
+ * Getter for {@link #getGeneratedQuerySet()}
+ *
+ * @return
+ * the generated querySet
+ */
+ public List<EObject> getGeneratedQuerySet() {
+ return this.generatedModelQuerySet;
+
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/GenerateFacetsHandler.java b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/GenerateFacetsHandler.java
new file mode 100644
index 00000000000..27398ee9d3b
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/GenerateFacetsHandler.java
@@ -0,0 +1,655 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler;
+
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IImportDeclaration;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.eclipse.project.editors.file.ManifestEditor;
+import org.eclipse.papyrus.eclipse.project.editors.project.EMFFacetProjectEditor;
+import org.eclipse.papyrus.profile.facets.configuration.profileToFacetsConfiguration.ProfileToFacetsConfiguration;
+import org.eclipse.papyrus.profile.facets.generation.acceleo.ui.Activator;
+import org.eclipse.papyrus.profile.facets.generation.acceleo.ui.messages.Messages;
+import org.eclipse.papyrus.properties.util.EMFHelper;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.uml2.common.util.UML2Util;
+import org.eclipse.uml2.uml.DataType;
+import org.eclipse.uml2.uml.Profile;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * This handler provides the action to generate the facet from a UML Profile
+ *
+ */
+public class GenerateFacetsHandler extends AbstractHandler {
+
+
+ /** the extension of the configuration file */
+ public static final String CONFIGURATION_FILE_EXTENSION = "profiletofacetsconfiguration"; //$NON-NLS-1$
+
+ /** the Java Source Folder for generated code */
+ private static final String JAVA_SOURCE_FOLDER = "src-gen"; //$NON-NLS-1$
+
+ /** the name of the extension point for the facet registration */
+ private static final String FACET_REGISTRATION = "org.eclipse.emf.facet.infra.facet.registration"; //$NON-NLS-1$
+
+ /** the name of the extension point for the query registration */
+ private static final String QUERY_REGISTRATION = "org.eclipse.emf.facet.infra.query.registration"; //$NON-NLS-1$
+
+ /** the image used for the dialog */
+ private static Image im = org.eclipse.papyrus.diagram.common.Activator.getImage("/icons/papyrus/PapyrusLogo16x16.gif"); //$NON-NLS-1$
+
+ /** a space */
+ private static final String SPACE_WITH_DASH = " -"; //$NON-NLS-1$
+
+ private static final String FACET_SET = "facetset"; //$NON-NLS-1$
+
+ private static final String FILE = "file"; //$NON-NLS-1$
+
+ private static final String QUERY_SET = "modelqueryset"; //$NON-NLS-1$
+
+ /** the configuration for the generator */
+ private ProfileToFacetsConfiguration configuration = null;
+
+ /** the project owning the configuration */
+ private IProject project = null;
+
+ /**
+ * Initialize the field {@link #project} and {@link #configuration}
+ *
+ * @param file
+ * the configuration file
+ */
+ private void init(final IFile file) {
+ this.project = file.getProject();
+ URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ try {
+ this.configuration = (ProfileToFacetsConfiguration)EMFHelper.loadEMFModel(null, uri);
+ } catch (IOException e) {
+ Activator.log.error(uri.toString() + "not found", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * {@inheritDoc}
+ */
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if(!selection.isEmpty() && selection instanceof IStructuredSelection) {
+ Object firstElement = ((IStructuredSelection)selection).getFirstElement();
+ IFile file = null;
+ if(firstElement instanceof IFile) {
+ file = (IFile)firstElement;
+ if(file.getFileExtension().equals(CONFIGURATION_FILE_EXTENSION)) {
+ init(file);
+ Assert.isNotNull(this.project);
+ Assert.isNotNull(this.configuration);
+
+
+ EMFFacetProjectEditor editor = null;
+ try {
+ editor = new EMFFacetProjectEditor(this.project);
+ editor.init();
+ } catch (IOException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ } catch (CoreException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ } catch (ParserConfigurationException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ } catch (SAXException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
+ }
+ if(editor != null) {
+ Set<String> missingNatures = editor.getMissingNature();
+ Set<String> missingFiles = editor.getMissingFiles();
+ Set<String> missingBuildCommand = editor.getMissingBuildCommand();
+ int result = Dialog.OK;
+ //TODO : ask for the build command
+ if(missingNatures.size() != 0 || missingFiles.size() != 0 || missingBuildCommand.size() != 0) {
+ String message = "The current project doesn't allow to generate the required files. \n We need to transform your project in EMF-Facet Project : ";
+ message += "The following natures will be added to your project :\n";
+ Iterator<String> iter = missingNatures.iterator();
+ while(iter.hasNext()) {
+ message += SPACE_WITH_DASH + iter.next() + "\n";
+ }
+ message += "\n\n";
+ message += "The following files will be created :\n";
+
+ iter = missingFiles.iterator();
+ while(iter.hasNext()) {
+ message += SPACE_WITH_DASH + iter.next() + "\n";
+ }
+
+ MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), "Change the project configuration", im, message, MessageDialog.QUESTION_WITH_CANCEL, new String[]{ "Accept", "Cancel" }, Dialog.OK);
+ result = dialog.open();
+ if(result != Dialog.OK) {
+ return null; //nothing to do
+ }
+ editor.create();
+ try {
+ editor.save();
+ } catch (Throwable e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ /*
+ * we prepare the generation
+ */
+ editor.addToBuild(getModelTargetFolderName() + "/");
+ editor.addJavaSourceFolder(getJavaSourceFolderName());
+
+ try {
+ editor.save();
+ } catch (Throwable e2) {
+ Activator.log.error(e2);
+ }
+ /*
+ * we generate the files
+ */
+ FacetGenerator gen = new FacetGenerator(this.configuration.getProfile(), this.configuration.getBasePackage());
+ gen.setQVTTransformationParameters(getModelTargetURI());
+ gen.setAcceleoTransformationParameter(this.configuration.getHeader(), getJavaSourceFolderPath());
+ gen.generate();
+ //
+ //
+ editor.registerFacetSets(gen.getGeneratedFacetSet());
+ editor.registerQuerySets(gen.getGeneratedQuerySet());
+ gen.repairURI2();
+ //we refresh the workspace
+ try {
+ this.project.refreshLocal(IProject.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ }
+ // ManifestEditor manEditor = null;
+ // try {
+ // // manEditor = new ManifestEditor(this.project);
+ // // manEditor.init();
+ // } catch (IOException e2) {
+ // // TODO Auto-generated catch block
+ // e2.printStackTrace();
+ // } catch (CoreException e2) {
+ // // TODO Auto-generated catch block
+ // e2.printStackTrace();
+ // }
+ // if(!manEditor.exists()){
+ // // manEditor.create();
+ // }
+ Set<String> dependencies = getDependencies();
+ Iterator<String> iter = dependencies.iterator();
+ while(iter.hasNext()) {
+ // break;
+ editor.addDependency(iter.next());
+ // manEditor.addDependency(iter.next());
+ }
+
+
+ try {
+
+ editor.save();
+ // manEditor.save();
+ } catch (Throwable e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ //we refresh the workspace
+ try {
+ this.project.refreshLocal(IProject.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ }
+ manageDatatypes();
+ }
+ }
+ }
+ }
+
+
+ return null;
+ }
+
+ // private boolean isEMFFacetProject(final IProject project) {
+ // ProjectEditor editor = new ProjectEditor(project);
+ // return editor.hasNature(EMF_FACET_NATURE);
+ // }
+ private void registerDependencies(final ManifestEditor manifestEditor) {
+ //register the dependencies
+ IJavaProject proj = JavaCore.create(this.project);
+ IJavaElement[] children = null;
+ try {
+ children = proj.getChildren();
+ } catch (JavaModelException e1) {
+ Activator.log.error(e1);
+ e1.printStackTrace();
+ }
+ IPackageFragmentRoot sourceFolder=null;
+ //we look for the source folder
+ String sourceFolderName = getJavaSourceFolderName();
+ for(int i = 0; i < children.length; i++) {
+ IJavaElement el = children[i];
+ if(el instanceof IPackageFragmentRoot && el.getElementName().equals(sourceFolderName)) {
+ sourceFolder = (IPackageFragmentRoot)el;
+ break;
+ }
+ }
+
+ if(sourceFolder!=null){
+ try {
+ children = sourceFolder.getChildren();
+ List<IImportDeclaration> iImportDeclaration = new ArrayList<IImportDeclaration>();
+ for(int i = 0; i < children.length; i++) {
+ if(children[i] instanceof IPackageFragment) {
+ ICompilationUnit[] units;
+ units = ((IPackageFragment)children[i]).getCompilationUnits();
+ for(int j = 0; j < units.length; j++) {
+ ICompilationUnit unit = units[j];
+ iImportDeclaration.addAll(Arrays.asList(unit.getImports()));
+ }
+ }
+ }
+
+ Iterator<IImportDeclaration> iter = iImportDeclaration.iterator();
+ while(iter.hasNext()) {
+ manifestEditor.addDependency(iter.next().getElementName());
+ }
+ } catch (JavaModelException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ /**
+ *
+ * @return
+ * the dependencies to register
+ */
+ private Set<String> getDependencies() {
+ //register the dependencies
+ Set<String> dependencies = new HashSet<String>();
+ IJavaProject proj = JavaCore.create(this.project);
+ IJavaElement[] children = null;
+ try {
+ children = proj.getChildren();
+ } catch (JavaModelException e1) {
+ Activator.log.error(e1);
+ }
+ IPackageFragmentRoot sourceFolder = null;
+ //we look for the source folder
+ String sourceFolderName = getJavaSourceFolderName();
+ for(int i = 0; i < children.length; i++) {
+ IJavaElement el = children[i];
+ if(el instanceof IPackageFragmentRoot && el.getElementName().equals(sourceFolderName)) {
+ sourceFolder = (IPackageFragmentRoot)el;
+ break;
+ }
+ }
+
+ if(sourceFolder != null) {
+ try {
+ children = sourceFolder.getChildren();
+ List<IImportDeclaration> iImportDeclaration = new ArrayList<IImportDeclaration>();
+ for(int i = 0; i < children.length; i++) {
+ if(children[i] instanceof IPackageFragment) {
+ ICompilationUnit[] units;
+ units = ((IPackageFragment)children[i]).getCompilationUnits();
+ for(int j = 0; j < units.length; j++) {
+ ICompilationUnit unit = units[j];
+ iImportDeclaration.addAll(Arrays.asList(unit.getImports()));
+ }
+ }
+ }
+
+ Iterator<IImportDeclaration> iter = iImportDeclaration.iterator();
+ while(iter.hasNext()) {
+ dependencies.add(iter.next().getElementName());
+ }
+ } catch (JavaModelException e) {
+ Activator.log.error(e);
+ }
+ }
+ return dependencies;
+ }
+
+
+
+
+ private String getJavaSourceFolderName() {
+ String folderName = this.configuration.getJavaFolder();
+ if(folderName.equals("")) { //$NON-NLS-1$
+ folderName = JAVA_SOURCE_FOLDER;
+ }
+
+
+ if(folderName.charAt(0) == '/') {
+ folderName = folderName.substring(1);
+ }
+ if(folderName.charAt(folderName.length() - 1) == '/') {
+ folderName = folderName.substring(0, folderName.length() - 1);
+ }
+
+ return folderName;
+ }
+
+ ///**
+ // * Register the FacetSets if they are not already registered
+ // *
+ // * @param editor
+ // * the plugin editor
+ // * @param facetSets
+ // * the querySets to register
+ // */
+ //private void registerFacetSets(final PluginEditor pluginEditor, final List<FacetSet> facetSets) {
+ // for(int i = 0; i < facetSets.size(); i++) {
+ // FacetSet set = facetSets.get(i);
+ // String filepath = this.configuration.getModelFolder() + "/" + "facets" + "/";
+ // filepath += set.getName() + ".facetSet"; //$NON-NLS-1$
+ // boolean registered = false;
+ // //we test if the file is already registered
+ // List<Node> extensions = pluginEditor.getExtensions(FACET_REGISTRATION);
+ // Iterator<Node> iter = extensions.iterator();
+ // while(iter.hasNext()) {
+ // Node current = iter.next();
+ // Node child = current.getFirstChild();
+ // if(child != null) {
+ // NamedNodeMap attributes = child.getAttributes();
+ // Node node = attributes.getNamedItem(FILE);
+ // if(node != null) {
+ // String path = node.getNodeValue();
+ // registered = filepath.equals(path);
+ //
+ // }
+ // }
+ // }
+ //
+ // if(!registered) {
+ // Element extension = pluginEditor.addExtension(FACET_REGISTRATION);
+ // Element facetSet = pluginEditor.addChild(extension, FACET_SET);
+ // pluginEditor.setAttribute(facetSet, FILE, filepath);
+ // }
+ // }
+ //}
+
+ ///**
+ // * Register the QuerySet if they are not already registered
+ // *
+ // * @param editor
+ // * the plugin editor
+ // * @param querySets
+ // * the querySets to register
+ // */
+ //private void registerQuerySets(final PluginEditor editor, final List<EObject> querySets) {
+ // for(int i = 0; i < querySets.size(); i++) {
+ // ModelQuerySet set = (ModelQuerySet)querySets.get(i);
+ // String filepath = this.configuration.getModelFolder() + "/" + "queries" + "/";//TODO is there another way to find the path of the query? //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ // filepath += set.getName() + ".querySet"; //$NON-NLS-1$
+ // boolean registered = false;
+ // //we test if the file is already registered
+ // List<Node> extensions = editor.getExtensions(QUERY_REGISTRATION);
+ // Iterator<Node> iter = extensions.iterator();
+ // while(iter.hasNext() && registered == false) {
+ // Node current = iter.next();
+ // Node child = current.getFirstChild();
+ // if(child != null) {
+ // NamedNodeMap attributes = child.getAttributes();
+ // Node node = attributes.getNamedItem(FILE);
+ // if(node != null) {
+ // String path = node.getNodeValue();
+ // registered = filepath.equals(path);
+ //
+ // }
+ // }
+ // }
+ //
+ // if(!registered) {
+ // Element extension = editor.addExtension(QUERY_REGISTRATION);
+ // Element queySet = editor.addChild(extension, QUERY_SET);
+ // editor.setAttribute(queySet, FILE, filepath);
+ // }
+ // }
+ //}
+
+
+ /**
+ * This method open a dialog to inform the user that the datatype are not handled by the generator
+ */
+ private void manageDatatypes() {
+ List<DataType> datatypes = new ArrayList<DataType>();
+ Profile profile = this.configuration.getProfile();
+ if(profile != null) {
+ TreeIterator<Object> contents = UML2Util.getAllContents(profile, true, false);
+ while(contents.hasNext()) {
+ Object next = contents.next();
+ if(next instanceof DataType) {
+ datatypes.add((DataType)next);
+ }
+ }
+ }
+ if(datatypes.isEmpty()) {
+ String message = Messages.GenerateFacetsHandler_message_datatype_are_not_handled;
+ for(int i = 0; i < datatypes.size(); i++) {
+ message += SPACE_WITH_DASH + datatypes.get(i).getName() + "\n"; //$NON-NLS-1$
+ }
+ MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), Messages.GenerateFacetsHandler_Title_Problem_during_facets_generation, im, message, MessageDialog.INFORMATION, new String[]{ IDialogConstants.OK_LABEL }, 0);
+ dialog.open();
+ }
+ }
+
+
+ // /**
+ // * Returns the missing nature for the project
+ // *
+ // * @param project
+ // * the project
+ // * @return
+ // * the missing natures of the project
+ // */
+ // private String[] getMissingNatures(final IProject project) {
+ // ProjectEditor editor = new ProjectEditor(project);
+ // List<String> missingNatures = new ArrayList<String>();
+ // for(int i = 0; i < REQUIRED_NATURES.length; i++) {
+ // if(!editor.hasNature(REQUIRED_NATURES[i])) {
+ // missingNatures.add(REQUIRED_NATURES[i]);
+ // }
+ // }
+ // return missingNatures.toArray(new String[missingNatures.size()]);
+ // }
+
+ // /**
+ // * Adds the missing natures to the project
+ // *
+ // * @param project
+ // * the project
+ // * @param missingNature
+ // * the natures to add to the project
+ // */
+ // private void addRequiredNatures(final IProject project, final String[] missingNature) {
+ // ProjectEditor editor = new ProjectEditor(project);
+ // for(int i = 0; i < missingNature.length; i++) {
+ // editor.addNature(missingNature[i]);
+ // //the associated build command seems to be automatically added!
+ // }
+ // try {
+ // editor.save();
+ // } catch (Exception e) {
+ // Activator.log.error(e);
+ // }
+ //
+ // }
+
+ /**
+ *
+ *
+ * @return the path for the java source folder
+ */
+ private String getJavaSourceFolderPath() {
+ String folder = getJavaSourceFolderName();
+
+ //we create the wanted source folder
+ IFolder iFolder = this.project.getFolder(folder);
+ if(!iFolder.exists()) {
+ try {
+ iFolder.create(true, false, new NullProgressMonitor());
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+ // //TODO change that!
+ // JavaProjectEditor javaEditor = new JavaProjectEditor(this.project);
+ // javaEditor.addJavaSourceFolder(folder);
+ // try {
+ // javaEditor.save();
+ // } catch (Exception e) {
+ // Activator.log.error(e);
+ // } catch (Throwable e) {
+ // // TODO Auto-generated catch block
+ // e.printStackTrace();
+ // }
+ String path = iFolder.getLocation().toOSString();
+
+ String basePackage = this.configuration.getBasePackage();
+ basePackage = basePackage.replace(".", "/"); //$NON-NLS-1$ //$NON-NLS-2$
+ path += "/" + basePackage; //$NON-NLS-1$
+ return path;
+
+ }
+
+ // private String getJavaSourceFolder() {
+ // String folder = getJavaSourceFolderName();
+ //
+ // if(folder.charAt(0) == '/') {
+ // folder = folder.substring(1);
+ // }
+ // if(folder.charAt(folder.length() - 1) == '/') {
+ // folder = folder.substring(0, folder.length() - 1);
+ // }
+ // return folder;
+ // }
+ /**
+ *
+ * @return the URI for the target model folder
+ */
+ private URI getModelTargetURI() {
+ String folder = this.configuration.getModelFolder();
+ java.net.URI uri1 = this.project.getLocationURI();
+ String path = uri1.getPath();
+
+ path += getModelTargetFolder();
+ return URI.createFileURI(path);
+ }
+
+ private String getModelTargetFolder() {
+ String folder = this.configuration.getModelFolder();
+ if(folder.charAt(0) != '/') {
+ folder = "/" + folder; //$NON-NLS-1$
+ }
+ if(folder.charAt(folder.length() - 1) != '/') {
+ folder = folder + "/"; //$NON-NLS-1$
+ }
+ return folder;
+ }
+
+ private String getModelTargetFolderName() {
+ String folder = this.configuration.getModelFolder();
+ if(folder.charAt(0) == '/') {
+ folder = folder.substring(0);
+ }
+ if(folder.charAt(folder.length() - 1) == '/') {
+ folder = folder.substring(0, folder.length() - 2);
+ }
+ return folder;
+ }
+
+ // /**
+ // *
+ // * @param project
+ // * the current project
+ // * @return
+ // * <code>true</code> if the current project is a JavaProject
+ // */
+ // private boolean isJavaProject(final IProject project) {
+ // IJavaProject javaProject = JavaCore.create(project);
+ // return javaProject.exists();
+ // }
+
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isEnabled() {
+ ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ ISelection selection = selectionService.getSelection();
+ if(selection instanceof IStructuredSelection && ((IStructuredSelection)selection).size() == 1) {
+ Object firstElement = ((IStructuredSelection)selection).getFirstElement();
+ if(firstElement instanceof IFile) {
+ IFile file = (IFile)firstElement;
+ String fileExtension = file.getFileExtension();
+ return CONFIGURATION_FILE_EXTENSION.equals(fileExtension);
+ }
+ }
+ return false;
+ }
+
+
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/tester/HandlerPropertyTester.java b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/tester/HandlerPropertyTester.java
new file mode 100644
index 00000000000..cf39bba1a22
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/handler/tester/HandlerPropertyTester.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler.tester;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.papyrus.profile.facets.generation.acceleo.ui.handler.GenerateFacetsHandler;
+
+/**
+ *
+ * property tester for actions in the popup menu
+ *
+ */
+public class HandlerPropertyTester extends PropertyTester{
+
+ /**property to test for the Facets generation*/
+ public static final String PROFILE_TO_FACETS_CONFIGURATION_FILE = "isProfileToFacetsConfigurationFile"; //$NON-NLS-1$
+
+ /**
+ *
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ *
+ * {@inheritDoc}
+ */
+ public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
+ if(PROFILE_TO_FACETS_CONFIGURATION_FILE.equals(property)){
+ if(expectedValue instanceof Boolean){
+ AbstractHandler handler = new GenerateFacetsHandler();
+ return handler.isEnabled()==((Boolean)expectedValue).booleanValue();
+ }
+ }
+ return false;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/Messages.java b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/Messages.java
new file mode 100644
index 00000000000..9b34e0c31f3
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/Messages.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.profile.facets.generation.acceleo.ui.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.profile.facets.generation.acceleo.ui.messages"; //$NON-NLS-1$
+
+ public static String GenerateFacetsHandler_message_add_nature;
+
+ public static String GenerateFacetsHandler_message_datatype_are_not_handled;
+
+ public static String GenerateFacetsHandler_message_missing_nature;
+
+ public static String GenerateFacetsHandler_message_not_a_java_project;
+
+ public static String GenerateFacetsHandler_Title_Problem_during_facets_generation;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/messages.properties b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/messages.properties
new file mode 100644
index 00000000000..bf03e25c1b4
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo.ui/src/org/eclipse/papyrus/profile/facets/generation/acceleo/ui/messages/messages.properties
@@ -0,0 +1,5 @@
+GenerateFacetsHandler_message_add_nature=\nAdd these natures? If not the generation will be cancelled.
+GenerateFacetsHandler_message_datatype_are_not_handled=The Datatypes are not handled by this generator. You should manage the following elements yourself : \n
+GenerateFacetsHandler_message_missing_nature=The following natures should be added to your project : \n
+GenerateFacetsHandler_message_not_a_java_project=The project is not a plugin project. I can't generate the facets.
+GenerateFacetsHandler_Title_Problem_during_facets_generation=Problem during Facets Generation
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.classpath b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.classpath
new file mode 100644
index 00000000000..abfee048d70
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.project b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.project
new file mode 100644
index 00000000000..f5697949d95
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.profile.facets.generation.acceleo</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>
+ <buildCommand>
+ <name>org.eclipse.acceleo.ide.ui.acceleoBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.acceleo.ide.ui.acceleoNature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.settings/org.eclipse.jdt.core.prefs b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..6cbd2a772e8
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+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/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..352a771b321
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Acceleo Acceleo Module Runtime Plug-in
+Bundle-SymbolicName: org.eclipse.papyrus.profile.facets.generation.acceleo
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.profile.facets.generation.acceleo.Activator
+Bundle-Vendor: Eclipse Modeling Project
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.ocl,
+ org.eclipse.ocl.ecore,
+ org.eclipse.acceleo.model,
+ org.eclipse.acceleo.engine,
+ org.eclipse.uml2.uml;bundle-version="3.2.0",
+ org.eclipse.emf.facet.infra.query.core;bundle-version="0.1.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.papyrus.profile.facets.generation.acceleo
+
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/build.acceleo b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/build.acceleo
new file mode 100644
index 00000000000..e9e744aaf41
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/build.acceleo
@@ -0,0 +1,24 @@
+<!-- ===================================================================== -->
+<!-- Custom targets. -->
+<!-- Set customBuildCallbacks = build.acceleo in your build.properties. -->
+<!-- ===================================================================== -->
+<project name="Build Acceleo Module" default="noDefault">
+ <!-- ================================================================= -->
+ <!-- Default target -->
+ <!-- ================================================================= -->
+ <target name="noDefault">
+ <echo message="This file must be called with explicit targets" />
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- This will be called automatically after the compilation of each -->
+ <!-- Bundle... in dependency order. -->
+ <!-- ================================================================= -->
+ <target name="post.compile.@dot">
+ <acceleoCompiler
+ sourceFolder="${target.folder}"
+ dependencies="${target.folder}/../../org.eclipse.ocl;${target.folder}/../../org.eclipse.ocl.ecore;"
+ binaryResource="true">
+ </acceleoCompiler>
+ </target>
+</project>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/build.properties b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/build.properties
new file mode 100644
index 00000000000..a7eaec6b4e7
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
+customBuildCallbacks = build.acceleo
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/buildstandalone.xml b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/buildstandalone.xml
new file mode 100644
index 00000000000..7cd5f348a06
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/buildstandalone.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project basedir="." default="compile" name="org.eclipse.papyrus.profile.facets.generation.acceleo">
+
+ <property name="ECLIPSE_HOME" value="../../EclipseIndigo3.7M6a/eclipse"/>
+ <property name="ECLIPSE_WORKSPACE" value=".."/>
+
+<!--
+Start of user code to add new properties
+-->
+ <!-- You can add new properties here but do not touch the previous and following comments.-->
+ <property name="SOURCE_FOLDER" value="${basedir}/src/"/>
+ <property name="OUTPUT_FOLDER" value="${basedir}/bin/"/>
+<!--
+End of user code
+-->
+
+
+
+ <!--
+ If deleted, this file will be recreated with a full build (Project -> Clean...).
+ -->
+
+
+ <!-- The classpath with only the dependencies used by the project -->
+ <path id="org.eclipse.papyrus.profile.facets.generation.acceleo.libraryclasspath">
+ <pathelement location="${ECLIPSE_WORKSPACE}/org.eclipse.papyrus.profile.facets.generation.acceleo/bin"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.7.0.v20110304.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.6.0.v20110110.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.5.100.v20110214.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime.compatibility.registry_3.3.100.v20101108/runtime_registry_compatibility.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.5.100.v20110207.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.4.0.v20110124-0830.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.4.100.v20110207.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.3.100.v20110214.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.7.0.v20110429-2014.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.7.0.v20110429-2014.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.7.0.v20110411-2239.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/lpg.runtime.java_2.0.17.v201004271640.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.1.0.v20110503-0405.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.1.0.v20110503-0405.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.common_3.1.0.v20110503-0405.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.profiler_3.1.0.v20110503-0405.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen.ecore_2.7.0.v20110502-1136.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen_2.6.0.v20110502-1136.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.uml_3.2.0.v201101271655.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.common_1.5.0.v201005031530.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.facet.infra.query.core_0.1.0.v201105171123.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.facet.infra.query_0.1.0.v201105171123.jar"/>
+ <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.resources_3.7.100.v20110228.jar"/>
+ </path>
+
+
+ <path id="org.eclipse.papyrus.profile.facets.generation.acceleo.classpath">
+ <path refid="org.eclipse.papyrus.profile.facets.generation.acceleo.libraryclasspath" />
+ </path>
+
+ <taskdef id="acceleoCompiler" name="acceleoCompiler" classname="org.eclipse.acceleo.parser.compiler.AcceleoCompiler" classpathref="org.eclipse.papyrus.profile.facets.generation.acceleo.classpath" >
+ </taskdef>
+
+ <!-- Change the value of the property SOURCE_FOLDERS to match the configuration of your project. -->
+ <target name="compile">
+ <acceleoCompiler sourceFolder="${SOURCE_FOLDER}"
+ outputFolder="${OUTPUT_FOLDER}"
+ dependencies=""
+ binaryResource="true">
+ </acceleoCompiler>
+ </target>
+
+
+<!--
+Start of user code to add new targets
+-->
+ <!-- You can add new targets here but do not touch the previous and following comments.-->
+<!--
+End of user code
+-->
+
+</project>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/pom.xml b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/pom.xml
new file mode 100644
index 00000000000..c93bd35a08b
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/pom.xml
@@ -0,0 +1,265 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!--
+ This file will only be created once by Acceleo, it will not be modified after that by Acceleo.
+ If you want Acceleo to recreate this file, delete it and rebuild your project.
+ -->
+
+ <groupId>acceleo</groupId>
+ <artifactId>org.eclipse.papyrus.profile.facets.generation.acceleo</artifactId>
+ <version>1.0.0.SNAPSHOT</version>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <!--
+ Calls the AcceleoMainCompiler to launch the compilation.
+ -->
+ <mainClass>org.eclipse.acceleo.parser.compiler.AcceleoMainCompiler</mainClass>
+ <arguments>
+ <argument>${basedir}/src/main/java</argument> <!-- input folder -->
+ <argument>${basedir}/target/classes/</argument> <!-- output folder -->
+ <argument>true</argument> <!-- use binary resources -->
+ <argument></argument> <!-- dependencies with other projects -->
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <profiles>
+ <profile>
+ <id>acceleo-compilation</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.1.1</version>
+ <executions>
+ <execution>
+ <phase>compile</phase>
+ <goals>
+ <goal>java</goal>
+ </goals>
+ <configuration>
+ <!--
+ Calls the AcceleoMainCompiler to launch the compilation.
+ -->
+ <mainClass>org.eclipse.acceleo.parser.compiler.AcceleoMainCompiler</mainClass>
+ <arguments>
+ <argument>${basedir}/src/main/java</argument> <!-- input folder -->
+ <argument>${basedir}/target/classes/</argument> <!-- output folder -->
+ <argument>true</argument> <!-- use binary resources -->
+ <argument></argument> <!-- dependencies with other projects -->
+ </arguments>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.core.runtime</artifactId>
+ <version>3.7.0.v20110110</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>3.7.0.v20110427</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.osgi_3.7.0.v20110427.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.equinox.common</artifactId>
+ <version>3.6.0.v20110427</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.equinox.common_3.6.0.v20110427.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.core.jobs</artifactId>
+ <version>3.5.100.v20110404</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.core.jobs_3.5.100.v20110404.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.core.runtime.compatibility.registry</artifactId>
+ <version>3.3.100.v20110420/runtime_registry_compatibility</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.core.runtime.compatibility.registry_3.3.100.v20110420/runtime_registry_compatibility.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.equinox.registry</artifactId>
+ <version>3.5.100.v20110321</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.equinox.registry_3.5.100.v20110321.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.equinox.preferences</artifactId>
+ <version>3.4.0.v20110328</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.equinox.preferences_3.4.0.v20110328.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.core.contenttype</artifactId>
+ <version>3.4.100.v20110423-0524</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.equinox.app</artifactId>
+ <version>1.3.100.v20110321</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.equinox.app_1.3.100.v20110321.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.emf.ecore</artifactId>
+ <version>2.7.0.v20110429-2014</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.emf.ecore_2.7.0.v20110429-2014.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.emf.common</artifactId>
+ <version>2.7.0.v20110429-2014</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.emf.common_2.7.0.v20110429-2014.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.emf.ecore.xmi</artifactId>
+ <version>2.7.0.v20110411-2239</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.emf.ecore.xmi_2.7.0.v20110411-2239.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.ocl</artifactId>
+ <version>3.1.0.v20110502-1445</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.ocl_3.1.0.v20110502-1445.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>lpg.runtime.java</artifactId>
+ <version>2.0.17.v201004271640</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/lpg.runtime.java_2.0.17.v201004271640.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.ocl.ecore</artifactId>
+ <version>3.1.0.v20110501-2031</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.ocl.ecore_3.1.0.v20110501-2031.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.acceleo.model</artifactId>
+ <version>3.1.0.v20110503-0405</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.acceleo.model_3.1.0.v20110503-0405.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.acceleo.engine</artifactId>
+ <version>3.1.0.v20110503-0405</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.acceleo.engine_3.1.0.v20110503-0405.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.acceleo.common</artifactId>
+ <version>3.1.0.v20110503-0405</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.acceleo.common_3.1.0.v20110503-0405.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.acceleo.profiler</artifactId>
+ <version>3.1.0.v20110503-0405</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.acceleo.profiler_3.1.0.v20110503-0405.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.emf.codegen.ecore</artifactId>
+ <version>2.7.0.v20110502-1136</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.emf.codegen.ecore_2.7.0.v20110502-1136.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.emf.codegen</artifactId>
+ <version>2.6.0.v20110502-1136</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.emf.codegen_2.6.0.v20110502-1136.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.uml2.uml</artifactId>
+ <version>3.2.0.v201101271655</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.uml2.uml_3.2.0.v201101271655.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.uml2.common</artifactId>
+ <version>1.5.0.v201005031530</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.uml2.common_1.5.0.v201005031530.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.emf.facet.infra.query.core</artifactId>
+ <version>0.1.0.v201105031513</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.emf.facet.infra.query.core_0.1.0.v201105031513.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.emf.facet.infra.query</artifactId>
+ <version>0.1.0.v201105031513</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.emf.facet.infra.query_0.1.0.v201105031513.jar</systemPath>
+ </dependency>
+ <dependency>
+ <groupId>eclipse</groupId>
+ <artifactId>org.eclipse.core.resources</artifactId>
+ <version>3.7.100.v20110427-0856</version>
+ <scope>system</scope>
+ <systemPath>${basedir}/../../../../../eclipses/Indigo M6/plugins/org.eclipse.core.resources_3.7.100.v20110427-0856.jar</systemPath>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/Activator.java b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/Activator.java
new file mode 100644
index 00000000000..b65a7751dc1
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/Activator.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.profile.facets.generation.acceleo;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends Plugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.facets.profile.generation.acceleo";
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The constructor.
+ */
+ public Activator() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/Generate.java b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/Generate.java
new file mode 100644
index 00000000000..23d3cf97636
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/Generate.java
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Obeo.
+ * 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:
+ * Obeo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.papyrus.profile.facets.generation.acceleo;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.acceleo.engine.service.AcceleoService;
+import org.eclipse.acceleo.engine.service.properties.AbstractAcceleoPropertiesLoaderService;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'Generate' generation module.
+ *
+ * @generated
+ */
+public class Generate extends AbstractAcceleoGenerator {
+
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "/org/eclipse/papyrus/profile/facets/generation/acceleo/generate";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "generateQuery", "generateGetter", "generateSetter" };
+
+ /**
+ * The list of properties files from the launch parameters (Launch configuration).
+ */
+ private final List<String> propertiesFiles = new ArrayList<String>();
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of {@link #initialize(EObject, File, List)} or {@link #initialize(URI, File, List)} is
+ * called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this generation to call it from another Java file, as it allows for the retrieval
+ * of {@link #getProperties()} and {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public Generate() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public Generate(URI modelURI, File targetFolder, List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public Generate(EObject model, File targetFolder, List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+
+ List<String> arguments = new ArrayList<String>();
+
+ /*
+ * Add in this list all the arguments used by the starting point of the generation
+ * If your main template is called on an element of your model and a String, you can
+ * add in "arguments" this "String" attribute.
+ */
+
+ Generate generator = new Generate(modelURI, folder, arguments);
+
+ /*
+ * Add the properties from the launch arguments.
+ * If you want to programmatically add new arguments, add them in "propertiesFiles"
+ * You can add the absolute path of a properties files, or even a project relative path.
+ * If you want to add another "protocol" for your properties files, please override
+ * "getPropertiesLoaderService(AcceleoService)" in order to return a new property loader.
+ * The basic properties loader will look for properties in the current project if the path
+ * of the properties file is like this "packagea.packageb.packagec.default" for a properties
+ * file named default.properties, or if the path is an absolute path. With a new property
+ * loader you could for example, look for properties files in a bundle.
+ */
+
+ for (int i = 2; i < args.length; i++) {
+ generator.addPropertiesFile(args[i]);
+ }
+
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this. The default behavior should
+ * be sufficient in most cases. If you want to change the content of this method, do NOT forget to
+ * change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
+ * any compilation of the Acceleo module with the main template that has caused the creation of this
+ * class will revert your modifications. If you encounter a problem with an unresolved proxy during the
+ * generation, you can remove the comments in the following instructions to check for problems. Please
+ * note that those instructions may have a significant impact on the performances.
+ */
+
+ //org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
+
+ //if (model != null && model.eResource() != null) {
+ // List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
+ // for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
+ // System.err.println(diagnostic.toString());
+ // }
+ //}
+
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ /*
+ * TODO if you need to listen to generation event, add listeners to the list here. If you want to change
+ * the content of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method
+ * to "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template
+ * that has caused the creation of this class will revert your modifications.
+ */
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates files on the fly. If you only need to
+ * preview the results, return a new {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of the
+ * running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna override files that are under clear case or
+ * any other VCS that could forbid the overriding), then return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}. <b>Note</b>, however, that this <b>cannot</b> be used
+ * standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ @Override
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of the form &lt;package>.&lt;properties
+ * file name without extension>. For example, if you have a file named "messages.properties" in package "org.eclipse.acceleo.sample", the path
+ * that needs be returned by a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ /*
+ * TODO if your generation module requires access to properties files, add their qualified path to the list here.
+ * Properties files are expected to be in source folders, and the path here to be the qualified path as if referring
+ * to a Java class. For example, if you have a file named "messages.properties" in package "org.eclipse.acceleo.sample",
+ * the path that needs be added to this list is "org.eclipse.acceleo.sample.messages". If you want to change the content
+ * of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method to "@generated NOT".
+ * Without this new tag, any compilation of the Acceleo module with the main template that has caused the creation of
+ * this class will revert your modifications.
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * Adds a properties file in the list of properties files.
+ *
+ * @param propertiesFile
+ * The properties file to add.
+ * @since 3.1
+ */
+ @Override
+ public void addPropertiesFile(final String propertiesFile) {
+ this.propertiesFiles.add(propertiesFile);
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ if (!isInWorkspace(org.eclipse.uml2.uml.UMLPackage.class)) {
+ resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
+ }
+
+ /*
+ * TODO If you need additional package registrations, you can register them here. The following line
+ * (in comment) is an example of the package registration for UML. If you want to change the content
+ * of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method to
+ * "@generated NOT". Without this new tag, any compilation of the Acceleo module with the main template
+ * that has caused the creation of this class will revert your modifications. You can use the method
+ * "isInWorkspace(Class c)" to check if the package that you are about to register is in the workspace.
+ * To register a package properly, please follow the following conventions:
+ *
+ * if (!isInWorkspace(UMLPackage.class)) {
+ * // The normal package registration if your metamodel is in a plugin.
+ * resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ * } else {
+ * // The package registration that will be used if the metamodel is not deployed in a plugin.
+ * // This should be used if your metamodel is in your workspace.
+ * resourceSet.getPackageRegistry().put("/myproject/myfolder/mysubfolder/MyUMLMetamodel.ecore", UMLPackage.eINSTANCE);
+ * }
+ */
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ /*
+ * TODO If you need additional resource factories registrations, you can register them here. the following line
+ * (in comment) is an example of the resource factory registration for UML. If you want to change the content
+ * of this method, do NOT forget to change the "@generated" tag in the Javadoc of this method to "@generated NOT".
+ * Without this new tag, any compilation of the Acceleo module with the main template that has caused the creation
+ * of this class will revert your modifications.
+ */
+
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+ private String header;
+
+ protected String packageName;
+
+ public void setHeader(final String header) {
+ this.header = header;
+ }
+
+ public void setPackageName(final String packageName){
+ this.packageName = packageName;
+ }
+
+
+
+ /**
+ *
+ * @see org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator#getPropertiesLoaderService(org.eclipse.acceleo.engine.service.AcceleoService)
+ *
+ * @param acceleoService
+ * @return
+ * @notgenerated
+ */
+ @Override
+ protected AbstractAcceleoPropertiesLoaderService getPropertiesLoaderService(final AcceleoService service) {
+ System.out.println("GetPropertiesLoaderService");
+ return new AbstractAcceleoPropertiesLoaderService() {
+
+ {
+ this.acceleoService = service;
+ }
+
+ @Override
+ public void initializeService(final List<String> propertiesFiles) {
+ super.initializeService(propertiesFiles);
+ Map<String, String> myCustomProperties = new HashMap<String, String>();
+ if(Generate.this.header != null) {
+ myCustomProperties.put("copyright", Generate.this.header);
+ }
+ if(Generate.this.packageName!=null){
+ myCustomProperties.put("packageName", Generate.this.packageName);
+ }
+ service.addProperties(myCustomProperties);
+ }
+
+ @Override
+ protected Properties alternatePropertiesLoading(final String filepath) {
+ System.out.println("Loading " + filepath);
+
+ try {
+ Properties properties = new Properties();
+ File file = new File(filepath);
+ properties.load(new FileInputStream(file));
+ return properties;
+ } catch (IOException ex) {
+ System.err.println(ex);
+ ex.printStackTrace(System.err);
+ }
+ return null;
+ }
+
+
+ };
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/HasStereotypeQuery.java b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/HasStereotypeQuery.java
new file mode 100644
index 00000000000..4af00f7e68e
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/HasStereotypeQuery.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * Copyright (c) 2011 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:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.profile.facets.generation.acceleo;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+
+/**
+ *
+ * This class allows to test if a FacetSet can be used for an UML Element
+ *
+ */
+public class HasStereotypeQuery implements IJavaModelQuery<Element, Boolean> {
+
+ /** the id of the stereotype */
+ private final String stereotypeID;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param stereotypeID
+ */
+ public HasStereotypeQuery(final String stereotypeID) {
+ this.stereotypeID = stereotypeID;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public Boolean evaluate(final Element context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Stereotype ste = context.getAppliedStereotype(stereotypeID);
+ if(ste != null) {
+ return Boolean.TRUE;
+ }
+ return Boolean.FALSE;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/generate.mtl b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/generate.mtl
new file mode 100644
index 00000000000..bc050150589
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation.acceleo/src/org/eclipse/papyrus/profile/facets/generation/acceleo/generate.mtl
@@ -0,0 +1,181 @@
+[comment encoding = UTF-8 /]
+[module generate(http://www.eclipse.org/uml2/3.0.0/UML)]
+
+[template public getFacetClassName(stereotype : Stereotype) post(trim())]
+Has[getQualifiedName().replaceAll(':', '')/]Query
+[/template]
+
+[template public getGetterClassName(property : Property) post(trim())]
+Get[owner.oclAsType(Stereotype).name /][property.name.toUpperFirst() /]
+[/template]
+
+[template public getSetterClassName(property : Property) post(trim())]
+Set[owner.oclAsType(NamedElement).name /][property.name.toUpperFirst() /]
+[/template]
+
+[template public getGetterFileName(property : Property) post(trim())]
+[if (owner.oclIsKindOf(Stereotype))]
+ [getProperty('packageName').replaceAll('.','/')/]/queries/getters/[getGetterClassName()/].java
+[/if]
+[/template]
+
+[template public getSetterFileName(property : Property) post(trim())]
+[if (owner.oclIsKindOf(Stereotype) and not type.oclIsKindOf(DataType))]
+ [getProperty('packageName').replaceAll('.','/')/]/queries/setters/[getSetterClassName()/].java
+[/if]
+[/template]
+
+[template public generateQuery(stereotype : Stereotype)]
+[comment @main/]
+[file (getProperty('packageName').replaceAll('.','/')+'/queries/facets/'+getFacetClassName()+'.java', false, 'UTF-8')]
+[getProperty('copyright')/]
+package [getProperty('packageName')/].queries.facets;
+
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.papyrus.profile.facets.generation.acceleo.HasStereotypeQuery;
+
+/** Condition Query */
+public class [getFacetClassName()/] extends HasStereotypeQuery implements IJavaModelQuery<Element, Boolean> {
+
+ public [getFacetClassName()/]() {
+ super("[getQualifiedName()/]"); //$NON-NLS-1$
+ }
+
+}
+
+[/file]
+[/template]
+
+[template public generateGetter(property : Property)]
+[comment @main/]
+[file (getGetterFileName(), false, 'UTF-8')]
+[getProperty('copyright')/]
+package [getProperty('packageName')/].queries.getters;
+
+import java.util.Collection;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to get the text of the requirement */
+public class [getGetterClassName()/] implements IJavaModelQuery<[findScope()/], [findReturnType()/]> {
+
+ public [findReturnType()/] evaluate(final [findScope()/] context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ [if type.oclIsKindOf(DataType)]
+ //TODO : The generator cannot handle DataTypes correctly. You should probably edit this query
+ [/if]
+ Stereotype ste = context.getAppliedStereotype("[owner.oclAsType(Stereotype).getQualifiedName() /]"); //$NON-NLS-1$
+ if(ste != null) {
+ Object value = context.getValue(ste, "[name /]"); //$NON-NLS-1$
+ return ([findReturnType()/])value;
+ }
+ return null;
+ }
+}
+
+
+[/file]
+[/template]
+
+[template public generateSetter(property : Property)]
+[comment @main/]
+[file (getSetterFileName(), false, 'UTF-8')]
+[getProperty('copyright')/]
+package [getProperty('packageName')/].queries.setters;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.emf.facet.infra.query.runtime.ModelQueryParameterValue;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Stereotype;
+
+/** Query to set the attribute "attrName" of a stereotypeName */
+public class [getSetterClassName() /] implements IJavaModelQueryWithEditingDomain<Class, EObject> {
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList)
+ *
+ * @param context
+ * @param parameterValues
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public EObject evaluate(final Class context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ //Unused
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQueryWithEditingDomain#evaluate(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList, org.eclipse.emf.edit.domain.EditingDomain)
+ *
+ * @param arg0
+ * @param parameter
+ * @param arg2
+ * @return
+ * @throws ModelQueryExecutionException
+ */
+ public EObject evaluate(final Class context, final ParameterValueList parameter, final EditingDomain editingDomain) throws ModelQueryExecutionException {
+ final Stereotype ste = context.getAppliedStereotype("[owner.oclAsType(Stereotype).getQualifiedName() /]"); //$NON-NLS-1$
+ if(ste != null) {
+ if(parameter.size() != 0) {
+ final ModelQueryParameterValue newValue = parameter.get(0);
+ if(newValue != null && newValue.getValue() instanceof String) {
+ Command command = null;
+ TransactionalEditingDomain domain = null;
+ if(!(editingDomain instanceof TransactionalEditingDomain)) {
+ //if we work with a uml file, it is possible to get a UML2AdapterFactoryEditingDomain instead of TransactionEditingDomain
+ domain = TransactionUtil.getEditingDomain(context);
+ } else {
+ domain = (TransactionalEditingDomain)editingDomain;
+ }
+ if(domain != null) {
+ command = new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ context.setValue(ste, "[name /]", newValue.getValue());
+ }
+ };
+ }
+ if(command != null && command.canExecute()) {
+ domain.getCommandStack().execute(command);
+ }
+ }
+ }
+ }
+ return context;
+ }
+}
+[/file]
+[/template]
+
+[template public findScope(property : Property) post(trim())]
+
+[/template]
+
+[template public findReturnType(property : Property) post(trim())]
+[if type.oclIsKindOf(Stereotype)]
+ Unknown return type (Stereotype/Facet)
+[elseif type.oclIsKindOf(Enumeration)]
+ org.eclipse.uml2.uml.EnumerationLiteral
+[elseif type.oclIsKindOf(DataType)]
+ org.eclipse.emf.ecore.EObject
+[else]
+ org.eclipse.uml2.uml.[type.name /]
+[/if]
+[/template]
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation/.classpath b/sandbox/org.eclipse.papyrus.profile.facets.generation/.classpath
new file mode 100644
index 00000000000..efdacce142c
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation/.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/sandbox/org.eclipse.papyrus.profile.facets.generation/.project b/sandbox/org.eclipse.papyrus.profile.facets.generation/.project
new file mode 100644
index 00000000000..e277023ffcb
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation/.project
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.profile.facets.generation</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2m.qvt.oml.project.QVTOBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>src_container</key>
+ <value>transforms</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.m2m.qvt.oml.project.QVTONature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation/.settings/org.eclipse.jdt.core.prefs b/sandbox/org.eclipse.papyrus.profile.facets.generation/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..02805d72a61
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri May 13 10:22:18 CEST 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/sandbox/org.eclipse.papyrus.profile.facets.generation/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.profile.facets.generation/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..5881deccfe4
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation/META-INF/MANIFEST.MF
@@ -0,0 +1,9 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Facet Generation (Incubation)
+Bundle-SymbolicName: org.eclipse.papyrus.profile.facets.generation
+Bundle-Version: 0.8.0.qualifier
+Bundle-Vendor: Eclipse Modeling Project
+Require-Bundle: org.eclipse.emf;bundle-version="2.6.0",
+ org.eclipse.emf.facet.infra.facet;bundle-version="0.1.0"
+Export-Package: org.eclipse.papyrus.profile.facets.generation.postgeneration
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation/build.properties b/sandbox/org.eclipse.papyrus.profile.facets.generation/build.properties
new file mode 100644
index 00000000000..cc4fd85e322
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation/build.properties
@@ -0,0 +1,2 @@
+bin.includes = META-INF/,\
+ transforms/
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation/src/org/eclipse/papyrus/profile/facets/generation/postgeneration/FacetSetSplitter.java b/sandbox/org.eclipse.papyrus.profile.facets.generation/src/org/eclipse/papyrus/profile/facets/generation/postgeneration/FacetSetSplitter.java
new file mode 100644
index 00000000000..48e146e48e8
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation/src/org/eclipse/papyrus/profile/facets/generation/postgeneration/FacetSetSplitter.java
@@ -0,0 +1,59 @@
+package org.eclipse.papyrus.profile.facets.generation.postgeneration;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EPackage;
+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.facet.infra.facet.FacetSet;
+
+
+public class FacetSetSplitter {
+
+ public static FacetSetSplitter instance = new FacetSetSplitter();
+
+ private FacetSetSplitter() {
+
+ }
+
+ public Set<Resource> splitFacetSet(FacetSet facetSet) {
+ return splitFacetSet(facetSet, true);
+ }
+
+ public Set<Resource> splitFacetSet(FacetSet facetSet, boolean removeEmptySets) {
+ return splitFacetSet(facetSet, true, facetSet.eResource().getURI());
+ }
+
+ public Set<Resource> splitFacetSet(FacetSet facetSet, boolean removeEmptySets, URI baseURI) {
+ Set<Resource> result = new HashSet<Resource>();
+ ResourceSet rs = new ResourceSetImpl();
+
+ Iterator<EPackage> iterator = facetSet.getESubpackages().iterator();
+ while(iterator.hasNext()) {
+ EPackage ePackage = iterator.next();
+ if(ePackage instanceof FacetSet) {
+ result.addAll(splitFacetSet((FacetSet)ePackage, removeEmptySets));
+ iterator.remove();
+ }
+ }
+
+ if(!(removeEmptySets && facetSet.getFacets().isEmpty())) {
+ Resource resource = rs.createResource(URI.createURI(facetSet.getName() + ".facetSet").resolve(baseURI));
+ resource.getContents().add(facetSet);
+ result.add(resource);
+
+ try {
+ resource.save(null);
+ } catch (IOException ex) {
+ ex.printStackTrace(System.err);
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.profile.facets.generation/transforms/ProfileToFacetSet.qvto b/sandbox/org.eclipse.papyrus.profile.facets.generation/transforms/ProfileToFacetSet.qvto
new file mode 100644
index 00000000000..ed0ae98c6e2
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.profile.facets.generation/transforms/ProfileToFacetSet.qvto
@@ -0,0 +1,156 @@
+modeltype facetset uses "http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation";
+modeltype uml uses "http://www.eclipse.org/uml2/3.0.0/UML";
+modeltype queryset uses "http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation";
+modeltype Ecore uses "http://www.eclipse.org/emf/2002/Ecore";
+
+transformation ProfileToFacetSet(in profile : uml, in umlEcore : Ecore, in ecore : Ecore, out facets : facetset, out queries : queryset);
+
+/**
+* Package for queries implementation
+*/
+configuration property packageName : String; //For example : org.eclipse.papyrus.myProject
+
+main() {
+ log("Begin QVT Transformation");
+ profile.rootObjects()[Package]->map toFacetSet();
+ var querySet := profile.rootObjects()[Package]->any(e | true).map toQuerySet();
+ querySet.queries := queries.objectsOfType(ModelQuery);
+ log("End QVT Transformation");
+}
+
+query String::firstToLower() : String {
+ return self.substring(1, 1).toLower()+self.substring(2, self.length());
+}
+
+mapping Package::toFacetSet() : FacetSet {
+ result.eClassifiers := self.ownedElement->select(e | e.oclIsKindOf(Stereotype)).oclAsType(Stereotype)->map toFacet();
+ result.eSubpackages := self.ownedElement->select(e | e.oclIsKindOf(Package)).oclAsType(Package)->map toFacetSet();
+
+ result.extendedPackage := umlEcore.rootObjects()[EPackage]->any(e | true);
+ result.name := self.name.firstToLower()+'Facets';
+ result.nsPrefix := self.getQualifiedName().replace(":", "")+'FacetSet';
+ result.nsURI := 'http://www.eclipse.org/papyrus/'+self.getQualifiedName().toLower().replace("::", "/")+"/"+nsPrefix+'.facetSet';
+}
+
+mapping Package::toQuerySet() : ModelQuerySet {
+ result.associatedMetamodels := umlEcore.rootObjects()[EPackage];
+ result.name := self.name.firstToLower()+'QuerySet';
+ result.description := 'Set of queries for '+self.getQualifiedName();
+}
+
+query Package::findAllStereotypes() : Collection(Stereotype) {
+ var stereotypes := self.ownedElement->select(e | e.oclIsKindOf(Stereotype)).oclAsType(Stereotype);
+ stereotypes := stereotypes->union(self.ownedElement->select(e | e.oclIsKindOf(Package)).oclAsType(Package).findAllStereotypes());
+ return stereotypes;
+}
+
+mapping Stereotype::toFacet() : Facet {
+ name := self.name;
+ conditionQuery := self.map toQuery();
+ result.eSuperTypes := self.attribute->select(e | e.name.startsWith("base_")).getMetaClass(); -- UML Metaclass
+ result.eSuperTypes := result.eSuperTypes->union( -- Stereotype inheritance
+ self.generalization.target->select(e | e.oclIsKindOf(Stereotype)).oclAsType(Stereotype)->map toFacet()
+ );
+
+ result.eStructuralFeatures := self.ownedAttribute->map toEStructuralFeature();
+}
+
+mapping Property::toEStructuralFeature() : EStructuralFeature disjuncts Property::toEAttribute, Property::toEReference{
+ //Nothing (Disjuncts)
+}
+
+abstract mapping Property::toFeature() : EStructuralFeature {
+ name := if self.isDerived then '/' else '' endif + self.name;
+ eType := self.type.getEClassifier();
+ lowerBound := self.lower;
+ upperBound := self.upper;
+ _ordered := self.isOrdered;
+ unique := self.isUnique;
+}
+
+abstract mapping Property::toFacetFeature() : FacetStructuralFeature {
+ valueQuery := self.map toGetQuery();
+ valueQuery := self.map toSetQuery();
+}
+
+mapping Property::toEAttribute() : FacetAttribute inherits Property::toFeature, Property::toFacetFeature
+ when { self.type.oclIsKindOf(PrimitiveType) } {
+ //Nothing (Inherited)
+}
+
+mapping Property::toEReference() : FacetReference inherits Property::toFeature, Property::toFacetFeature {
+ //Nothing (Inherited)
+}
+
+mapping Property::toSetQuery() : JavaModelQuery {
+ name := 'Set'+self.owner.oclAsType(NamedElement).name +self.name.firstToUpper();
+ returnType := ecore.objectsOfType(EClass)->any(e | e.name = 'EObject');
+ scope := self.findScope();
+ implementationClassName := packageName+'.queries.setters.Set'+self.owner.oclAsType(NamedElement).name+self.name.firstToUpper();
+}
+
+mapping Property::toGetQuery() : JavaModelQuery {
+ name := 'Get'+self.owner.oclAsType(NamedElement).name +self.name.firstToUpper();
+ if self.type.oclIsKindOf(Enumeration) then{
+ returnType := umlEcore.objectsOfType(EClass)->any(e | e.name = 'EnumerationLiteral');
+ log('Enumeration return type');
+ }else
+ returnType := self.type.getEClassifier()
+ endif;
+
+ if returnType.oclIsUndefined() then {
+ log('Cannot find a returnType for property '+self.getQualifiedName());
+ log('Type : '+self.type.name);
+ log('TypeClassifier : '+self.type.getEClassifier().name);
+ } endif;
+
+ dump(returnType);
+
+ scope := self.findScope();
+ implementationClassName := packageName+'.queries.getters.Get'+self.owner.oclAsType(NamedElement).name+self.name.firstToUpper();
+}
+
+query Property::findScope() : Collection(EClass){
+ var stereotype := self.owner.oclAsType(Stereotype);
+ var scope := stereotype.attribute->select(e | e.name.startsWith('base_')).getMetaClass();
+
+ if scope->isEmpty() then
+ log('Cannot find Scope for property '+self.getQualifiedName())
+ endif;
+
+ return scope;
+}
+
+query Type::getEClassifier() : EClassifier {
+ return if self.oclIsKindOf(Stereotype) then
+ self.oclAsType(Stereotype).map toFacet()
+ else
+ umlEcore.objectsOfType(EClassifier)->any(e | e.name = self.name)
+ endif;
+}
+
+mapping Stereotype::toQuery() : JavaModelQuery {
+ name := 'is'+self.name;
+ description := 'Tests if the UML Element has the '+self.getQualifiedName()+' Stereotype';
+ returnType := ecore.objectsOfType(EClassifier)->any(e | e.name = 'EBoolean');
+
+ if returnType.oclIsUndefined() then
+ log('Cannot find EClassifier EBoolean')
+ endif;
+
+ scope := umlEcore.objectsOfType(EClass)->any(e | e.name = 'Element');
+ upperBound := 1;
+ lowerBound := 1;
+ implementationClassName := packageName+'.queries.facets.Has'+self.getQualifiedName().replace(':', '')+'Query';
+}
+
+/**
+* Return the metaclass corresponding to a stereotype extension
+* Input : property p | p.name = "base_x"
+* Ouput : EClass c | c.name = "x"
+*/
+query Property::getMetaClass() : EClass {
+ var metaclassName := self.name.substring(self.name.indexOf("_")+1, self.name.length());
+ return umlEcore.objectsOfType(EClass)->any(e | e.name = metaclassName);
+}
+

Back to the top