Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick tessier2014-02-10 07:43:29 -0500
committerPatrick tessier2014-02-10 07:43:29 -0500
commit74550693a485c6ff27748a6c5a9bfdae21b8bd5b (patch)
treec47f42dd4f68434598c3bf6b29c7ce3a6fdb5314 /plugins/facet/org.eclipse.papyrus.emf.facet.custom.core
parentbc56e957da4deded94425181f3288b98407c5764 (diff)
downloadorg.eclipse.papyrus-74550693a485c6ff27748a6c5a9bfdae21b8bd5b.tar.gz
org.eclipse.papyrus-74550693a485c6ff27748a6c5a9bfdae21b8bd5b.tar.xz
org.eclipse.papyrus-74550693a485c6ff27748a6c5a9bfdae21b8bd5b.zip
386118: [EMF Facet] Papyrus should progressively support EMF Facet 0.2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386118 import EMF-FACET
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.custom.core')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.checkstyle18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.pmd7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.project46
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/META-INF/MANIFEST.MF22
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/OSGI-INF/l10n/bundle.properties14
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/build.properties17
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/plugin.xml40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManager.java65
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManagerFactory.java31
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManager.java91
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerFactory.java51
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManager.java42
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java31
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/exception/CustomizationException.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/Activator.java62
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManager.java99
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManagerFactory.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManager.java182
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManagerFactory.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java101
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationsDelegatingList.java147
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/Constants.java21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/CustomizationUtils.java132
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/ETypedElementSwitchQueryImplementation.java83
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/ETypedElementSwitchQueryImplementationFactory.java45
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementation.java81
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java40
33 files changed, 1687 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.checkstyle
new file mode 100644
index 00000000000..cf229b786b2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.checkstyle
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2010 Mia-Software.
+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:
+ Nicolas Guyomar (Mia-Software)
+-->
+<fileset-config file-format-version="1.2.0" simple-config="true">
+ <local-check-config name="EmfFacet" location="../org.eclipse.emf.facet.archi.tech.rules/checkstyle/EmfFacet.checkstyle" type="project" description=""/>
+ <fileset name="all" enabled="true" check-config-name="EmfFacet" local="true">
+ <file-match-pattern match-pattern="." include-pattern="true"/>
+ <file-match-pattern match-pattern="Messages.java" include-pattern="false"/>
+ </fileset>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.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/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.pmd b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.pmd
new file mode 100644
index 00000000000..efcd2dbd830
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.pmd
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<pmd>
+ <useProjectRuleSet>true</useProjectRuleSet>
+ <ruleSetFile>../org.eclipse.emf.facet.archi.tech.rules/pmd/ruleset.xml</ruleSetFile>
+ <includeDerivedFiles>false</includeDerivedFiles>
+ <violationsAsErrors>true</violationsAsErrors>
+</pmd>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.project
new file mode 100644
index 00000000000..de338310ea1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.project
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.custom.core</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>net.sf.eclipsecs.core.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
+ <nature>net.sourceforge.pmd.eclipse.plugin.pmdNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..4824b802631
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..07c22a8b70b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Mon Oct 24 13:47: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/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..0ee736edfb8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.custom.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.custom.core.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.papyrus.emf.facet.custom.metamodel;bundle-version="0.2.0";visibility:=reexport,
+ org.eclipse.papyrus.emf.facet.util.emf.core;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.efacet.core;bundle-version="0.2.0";visibility:=reexport,
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.2.0",
+ org.eclipse.emf.edit;bundle-version="2.6.0",
+ org.eclipse.emf.validation;bundle-version="1.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.custom.core,
+ org.eclipse.emf.facet.custom.core.exception,
+ org.eclipse.emf.facet.custom.core.internal,
+ org.eclipse.emf.facet.custom.core.internal.exported
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..ce27a2e6a9d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,14 @@
+#Copyright (c) 2011-2012 Mia-Software.
+#
+#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:
+# Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+# Nicolas Bros (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass
+
+#Properties file for org.eclipse.emf.facet.custom.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Customization Core (Incubation)
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/about.html
new file mode 100644
index 00000000000..25f1a82997c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/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>October 25, 2011</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/build.properties
new file mode 100644
index 00000000000..0a196a30581
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/build.properties
@@ -0,0 +1,17 @@
+#Copyright (c) 2011 Mia-Software.
+#
+#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:
+# Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ OSGI-INF/,\
+ about.html
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/plugin.xml
new file mode 100644
index 00000000000..5dc1df74eba
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/plugin.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+Copyright (c) 2011 Mia-Software.
+
+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:
+ Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ Gregoire Dupé (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point
+-->
+<plugin>
+ <extension
+ point="org.eclipse.emf.facet.util.emf.core.catalogmanager">
+ <catalog
+ class="org.eclipse.emf.facet.custom.core.internal.CustomizationCatalogManager">
+ </catalog>
+ </extension>
+
+ <extension
+ point="org.eclipse.emf.facet.util.emf.core.catalogmanager">
+ <catalog
+ class="org.eclipse.emf.facet.custom.core.internal.CustomizationPropertiesCatalogManager">
+ </catalog>
+ </extension>
+
+ <extension point="org.eclipse.emf.facet.efacet.core.derivedTypedElementImplementationRegistration">
+ <derivedTypedElementImplementationRegistration
+ class="org.eclipse.emf.facet.custom.core.internal.query.ETypedElementSwitchQueryImplementationFactory">
+ </derivedTypedElementImplementationRegistration>
+ </extension>
+
+ <extension point="org.eclipse.emf.facet.efacet.core.queryImplementationRegistration">
+ <queryImplementationRegistration class="org.eclipse.emf.facet.custom.core.internal.query.SwitchQueryImplementationFactory"/>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManager.java
new file mode 100644
index 00000000000..cc107a6c153
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManager.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2011, 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.core;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+
+/**
+ * This interface allows to access the customization catalog.
+ *
+ * @author Gregoire Dupe
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationCatalogManager {
+
+ /**
+ * This method is used to get all the registered customizations.
+ *
+ * @return all the registered customizations (may contain aggregates)
+ */
+ List<Customization> getRegisteredCustomizations();
+
+ /**
+ * This method is used to get all the customization which can be applied on a list of
+ * eObjects and on the sub elements of those eObjects.
+ *
+ * Inheritance is handled. For example, assuming meta-model A extends
+ * meta-model B, the customizations declared on meta-model B have to
+ * be available on the instances of meta-model A. Furthermore all
+ * customizations containing a customization of EObject have to be applicable
+ * on all the models.
+ *
+ * @param eObjects the {@link EObject}s for which to get the applicable customizations
+ * @return a list of customizations
+ */
+ List<Customization> getCustomizationsApplicableOn(
+ Collection<EObject> eObjects);
+
+ /**
+ * This method is used to register a customization which has not been declared through the
+ * regular way (extension point).
+ *
+ * @param customization
+ * the customization to register
+ */
+ void registerCustomization(Customization customization);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManagerFactory.java
new file mode 100644
index 00000000000..9bb1e1c358b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationCatalogManagerFactory.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.core;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.internal.CustomizationCatalogManagerFactory;
+
+/**
+ * A factory for {@link ICustomizationCatalogManager}
+ *
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationCatalogManagerFactory {
+
+ ICustomizationCatalogManagerFactory DEFAULT = new CustomizationCatalogManagerFactory();
+
+ ICustomizationCatalogManager getOrCreateCustomizationCatalogManager(
+ ResourceSet resourceSet);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManager.java
new file mode 100644
index 00000000000..5d94e0095df
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManager.java
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.core;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.exception.CustomizationException;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+
+/**
+ * This interface allows to access the customization manager. A customization
+ * manager will compute the customization property depending on the loaded
+ * customizations. Be careful, the load order has an impact on the customization
+ * property value. Customizations are loaded in a stack. If there is a conflict
+ * between two customizations, the higher customization (the nearest from the
+ * top of the stack) gets the priority.
+ *
+ * @author Gregoire Dupe
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationManager {
+
+ /**
+ * This method is used to get the customization stack. The top
+ * customization in the stack will be the first in the list.
+ *
+ * @return a mutable list of customizations
+ */
+ List<Customization> getManagedCustomizations();
+
+ /**
+ * This method is used to get the value of a customization property for a
+ * chosen eObject.
+ *
+ * @param eObject
+ * @param customProperty
+ * @param classs
+ * the expected result type
+ * @return a value having a type depending a the customizationProperty type.
+ * (Can be null.)
+ */
+ <T> T getCustomValueOf(EObject eObject,
+ FacetOperation customProperty, Class<T> classs)
+ throws CustomizationException;
+
+ /**
+ * This method is used to get the value of a customization property for a
+ * chosen eObject and a chosen eStructuralFeature.
+ *
+ * @param eObject
+ * @param structuralFeature
+ * must not be null
+ * @param customProperty
+ * must not be null
+ * @param classs
+ * the expected result type
+ * @return a value having a type depending a the customizationProperty type.
+ * (Can be null.)
+ */
+ <T> T getCustomValueOf(EObject eObject,
+ ETypedElement structuralFeature,
+ FacetOperation customProperty, Class<T> classs)
+ throws CustomizationException;
+
+ /**
+ * This method returns the resourceSet used to manage the customization
+ * models.
+ */
+ ResourceSet getResourceSet();
+
+ IFacetManager getFacetManager();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerFactory.java
new file mode 100644
index 00000000000..7680446c43a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationManagerFactory.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ */
+package org.eclipse.emf.facet.custom.core;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.internal.CustomizationManagerFactory;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+
+/**
+ * Used to instantiate a customization manager
+ * @author Gregoire Dupe
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationManagerFactory {
+
+ /**
+ * Default factory instance.
+ */
+ ICustomizationManagerFactory DEFAULT = new CustomizationManagerFactory();
+
+ /**
+ * This method is used to instantiate a customization manager
+ *
+ * @param resourceSet
+ * the resource set to use to manage the customization models.
+ * @return
+ */
+ ICustomizationManager getOrCreateICustomizationManager(ResourceSet resourceSet);
+
+ /**
+ *
+ * @param facetManager
+ * @return
+ * @since 0.2
+ */
+ ICustomizationManager createICustomizationManager(IFacetManager facetManager);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManager.java
new file mode 100644
index 00000000000..d38dec81fc8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManager.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2011, 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.core;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+
+/**
+ * This interface allows to access the customization catalog.
+ *
+ * @author Gregoire Dupe
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationPropertiesCatalogManager {
+
+ /**
+ * This method is used to get all the registered customization properties (facetSet).
+ *
+ * @return all the registered customizations
+ */
+ List<FacetSet> getAllRegisteredCustomizationPropertySet();
+
+ List<FacetOperation> getCustomizationPropertiesByName(
+ String propertyName);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java
new file mode 100644
index 00000000000..4b13ca97e06
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/ICustomizationPropertiesCatalogManagerFactory.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.core;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.internal.CustomizationPropertiesCatalogManagerFactory;
+
+/**
+ * This interface provides the customization catalog manager.
+ *
+ * @since 0.3
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationPropertiesCatalogManagerFactory {
+
+ ICustomizationPropertiesCatalogManagerFactory INSTANCE = new CustomizationPropertiesCatalogManagerFactory();
+
+ ICustomizationPropertiesCatalogManager getOrCreateCustomizationPropertiesCatalogManager(
+ final ResourceSet resourceSet);
+
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/exception/CustomizationException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/exception/CustomizationException.java
new file mode 100644
index 00000000000..de798fa52ba
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/exception/CustomizationException.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.core.exception;
+
+/**
+ * This exception is thrown when the computation of a customization property value failed.
+ * @author Gregoire Dupe
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public final class CustomizationException extends Exception {
+
+ private static final long serialVersionUID = -4070159863668577038L;
+
+ public CustomizationException() {
+ super();
+ }
+
+ public CustomizationException(final String message) {
+ super(message);
+ }
+
+ public CustomizationException(final Throwable cause) {
+ super(cause);
+ }
+
+ public CustomizationException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/Activator.java
new file mode 100644
index 00000000000..0a7285a871b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/Activator.java
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Nicolas Bros (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass
+ */
+package org.eclipse.emf.facet.custom.core.internal;
+
+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 shared instance
+ private static Activator plugin;
+
+ /**
+ * 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);
+ Activator.plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManager.java
new file mode 100644
index 00000000000..ba045d3ba8a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManager.java
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2011-2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManager;
+import org.eclipse.emf.facet.custom.core.internal.exception.CustomizationCatalogRuntimeException;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationCatalog;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogFactory;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.ICatalogManager;
+
+/**
+ * Customization catalog implementation using the catalog manager features provided by the plug-in
+ * org.eclipse.emf.facet.util.emf.core
+ *
+ * @author Gregoire Dupe
+ *
+ */
+public class CustomizationCatalogManager implements
+ ICustomizationCatalogManager, ICatalogManager {
+
+ private final CustomizationCatalog catalog = CustomizationcatalogFactory.eINSTANCE
+ .createCustomizationCatalog();
+
+ public boolean canBeManaged(final EObject root) {
+ return root instanceof Customization;
+ }
+
+ public void manage(final EObject root) {
+ if (root instanceof Customization) {
+ Customization customization = (Customization) root;
+ this.catalog.getInstalledEntries().add(customization);
+ } else {
+ throw new CustomizationCatalogRuntimeException("Only customizations (and aggregates) must be stored in the customization catalog"); //$NON-NLS-1$
+ }
+ }
+
+ public void setCatalogSet(final CatalogSet catalogSet) {
+ catalogSet.getCatalogs().add(this.catalog);
+ }
+
+ public List<Customization> getCustomizationsByName(final String name) {
+ List<Customization> result = new ArrayList<Customization>();
+ for (EObject eObject : this.catalog.getInstalledEntries()) {
+ if (eObject instanceof Customization) {
+ Customization customization = (Customization) eObject;
+ if (name.equals(customization.getName())) {
+ result.add(customization);
+ }
+ } else {
+ throw new RuntimeException("Only customizations (and aggregates) must be stored in the customization catalog"); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ public void registerCustomization(final Customization customization) {
+ this.catalog.getInstalledEntries().add(customization);
+ }
+
+ public List<Customization> getCustomizationsApplicableOn(
+ final Collection<EObject> eObjects) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Customization> getRegisteredCustomizations() {
+ List<Customization> result = new ArrayList<Customization>();
+ for (EObject eObject : this.catalog.getInstalledEntries()) {
+ if (eObject instanceof Customization) {
+ Customization customization = (Customization) eObject;
+ result.add(customization);
+ } else {
+ throw new RuntimeException("Only customizations (and aggregates) must be stored in the customization catalog"); //$NON-NLS-1$
+ }
+ }
+ return Collections.unmodifiableList(result);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManagerFactory.java
new file mode 100644
index 00000000000..21a0ec3f105
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationCatalogManagerFactory.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.custom.core.internal;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.ICustomizationCatalogManager;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+
+public class CustomizationCatalogManagerFactory implements
+ org.eclipse.emf.facet.custom.core.ICustomizationCatalogManagerFactory {
+
+ public ICustomizationCatalogManager getOrCreateCustomizationCatalogManager(
+ final ResourceSet resourceSet) {
+ return ICatalogSetManagerFactory.DEFAULT
+ .createICatalogSetManager(resourceSet)
+ .getCatalogManagerByType(ICustomizationCatalogManager.class)
+ .get(0);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManager.java
new file mode 100644
index 00000000000..eaae23e06e7
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManager.java
@@ -0,0 +1,182 @@
+/**
+ * Copyright (c) 2011-2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 372626 - Aggregates
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Nicolas Bros (Mia-Software) - Bug 378271 - [Table] Select Columns To Hide is broken
+ */
+package org.eclipse.emf.facet.custom.core.internal;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.core.exception.CustomizationException;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+
+public class CustomizationManager implements ICustomizationManager {
+
+ private final HashSet<FacetOperation> customProperties = new HashSet<FacetOperation>();
+ private final IFacetManager facetManager;
+
+ public CustomizationManager(final ResourceSet resourceSet) {
+ this.facetManager = IFacetManagerFactory.DEFAULT.getOrCreateFacetManager(resourceSet);
+ }
+
+ public CustomizationManager(final IFacetManager facetManager) {
+ this.facetManager = facetManager;
+ }
+
+ public void addFrontManagedCustomization(final Customization customization) {
+ this.facetManager.getManagedFacetSets().add(0, customization);
+ }
+
+ public void removeCustomization(final Customization customization) {
+ this.facetManager.getManagedFacetSets().remove(customization);
+ }
+
+ public List<Customization> getManagedCustomizations() {
+ return new CustomizationsDelegatingList(this.facetManager.getManagedFacetSets());
+ }
+
+ public <T> T getCustomValueOf(final EObject eObject,
+ final FacetOperation customizationProperty,
+ final Class<T> classs)
+ throws CustomizationException {
+ // Begin precondition checking section
+ /* The scope of a customization property is not available yet in new customization meta-model
+ if (!(customizationProperty.getScope().contains(
+ CustomizationPropertyScope.ECLASS) || (customizationProperty
+ .getScope().contains(CustomizationPropertyScope.FACET)))) {
+ throw new RuntimeException(
+ "The customization property is expected to be applicable on an EClass or on a Facet"); //$NON-NLS-1$
+ }
+ */
+ // End precondition checking section
+ T result = null;
+ try {
+ // the structural feature : null
+ final Object[] args = new Object[] { null };
+ result = this.facetManager.invoke(eObject, customizationProperty,
+ classs, null, args);
+ } catch (final Exception e) {
+ throw new CustomizationException(e);
+ }
+ return result;
+ }
+
+ public <T> T getCustomValueOf(final EObject eObject,
+ final ETypedElement eTypedElement,
+ final FacetOperation customizationProperty,
+ final Class<T> classs)
+ throws CustomizationException {
+ // Begin precondition checking section
+ if (eObject == null) {
+ throw new IllegalArgumentException(
+ "The parameter 'eObject' must not be null."); //$NON-NLS-1$
+ }
+ if (customizationProperty == null) {
+ throw new IllegalArgumentException(
+ "The parameter 'customizationProperty' must not be null."); //$NON-NLS-1$
+ }
+ /* The scope of a customization property is not available yet in new customization meta-model
+ if (!(eStructuralFeature instanceof EReference)) {
+ if (customizationProperty.getScope().equals(
+ CustomizationPropertyScope.EREFERENCE)) {
+ throw new CustomizationException(
+ "The eStructuralFeature is an instance of " //$NON-NLS-1$
+ + eStructuralFeature.getClass().getName()
+ + " but EReference is expected."); //$NON-NLS-1$
+ }
+ }
+
+ if (!(eStructuralFeature instanceof EAttribute)) {
+ if (customizationProperty.getScope().equals(
+ CustomizationPropertyScope.EATTRIBUTE)) {
+ throw new CustomizationException(
+ "The eStructuralFeature is an instance of " //$NON-NLS-1$
+ + eStructuralFeature.getClass().getName()
+ + " but EAttribute is expected."); //$NON-NLS-1$
+ }
+ }
+ */
+ // End precondition checking section
+ try {
+ return this.facetManager.invoke(eObject, customizationProperty, classs, null, new Object[] { eTypedElement });
+ } catch (Exception e) {
+ throw new CustomizationException(e);
+ }
+ }
+
+ public List<FacetOperation> getCustomizationPropertiesByName(
+ final String name) {
+ if (name == null) {
+ throw new IllegalArgumentException(
+ "The parameter 'name' must not be null."); //$NON-NLS-1$
+ }
+ List<FacetOperation> results = new ArrayList<FacetOperation>();
+ for (FacetOperation customizationProperty : this.customProperties) {
+ if (name.equals(customizationProperty.getName())) {
+ results.add(customizationProperty);
+ }
+ }
+ return results;
+ }
+
+ public void addCustomization(final URI uri) {
+ if (uri == null) {
+ throw new IllegalArgumentException(
+ "The parameter 'uri' must not be null."); //$NON-NLS-1$
+ }
+ Resource resource = this.facetManager.getResourceSet().getResource(uri, true);
+ Iterator<EObject> iterator = resource.getAllContents();
+ while (iterator.hasNext()) {
+ EObject eObject = iterator.next();
+ if (eObject instanceof FacetOperation) {
+ FacetOperation customizationProperty = (FacetOperation) eObject;
+ this.customProperties.add(customizationProperty);
+ }
+ }
+ }
+
+ public ResourceSet getResourceSet() {
+ return this.facetManager.getResourceSet();
+ }
+
+ public void removeAllCustomizations() {
+ List<Customization> customizationsToRemove = new LinkedList<Customization>();
+ for (FacetSet facetSet : this.facetManager.getManagedFacetSets()) {
+ if (facetSet instanceof Customization) {
+ Customization customization = (Customization) facetSet;
+ customizationsToRemove.add(customization);
+ }
+ }
+ for (Customization customization : customizationsToRemove) {
+ this.facetManager.getManagedFacetSets().remove(customization);
+ }
+ }
+
+ public IFacetManager getFacetManager() {
+ return this.facetManager;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManagerFactory.java
new file mode 100644
index 00000000000..50af2f3b597
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationManagerFactory.java
@@ -0,0 +1,32 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.core.internal;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.core.ICustomizationManagerFactory;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+
+public class CustomizationManagerFactory implements
+ ICustomizationManagerFactory {
+
+ public ICustomizationManager getOrCreateICustomizationManager(final ResourceSet resourceSet) {
+ return new CustomizationManager(resourceSet);
+ }
+
+ public ICustomizationManager createICustomizationManager(
+ final IFacetManager facetManager) {
+ return new CustomizationManager(facetManager);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java
new file mode 100644
index 00000000000..2a1b9bf72f9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManager.java
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2011, 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] EMF Facet customization meta-model
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.core.internal;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.custom.core.ICustomizationPropertiesCatalogManager;
+import org.eclipse.emf.facet.custom.core.internal.exception.CustomizationCatalogRuntimeException;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationPropertiesCatalog;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.customizationcatalog.CustomizationcatalogFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.ICatalogManager;
+
+/**
+ * Customization catalog implementation using the catalog manager features
+ * provided by the plug-in org.eclipse.emf.facet.util.emf.core
+ *
+ * @author Gregoire Dupe
+ *
+ */
+public class CustomizationPropertiesCatalogManager implements ICatalogManager,
+ ICustomizationPropertiesCatalogManager {
+
+ private static final String CUSTOM_SUFIX = "customproperties"; //$NON-NLS-1$
+ private final CustomizationPropertiesCatalog catalog = CustomizationcatalogFactory.eINSTANCE
+ .createCustomizationPropertiesCatalog();
+
+ public boolean canBeManaged(final EObject root) {
+ return root instanceof FacetSet;
+ }
+
+ public void manage(final EObject root) {
+ if (root instanceof FacetSet) {
+ final FacetSet customProperties = (FacetSet) root;
+ // We have to force the integrator to use the suffix
+ // "customproperties" to name them facetSet declaring custom
+ // properties. Otherwise we won't be able to know if a facetSet is a
+ // custom property declaration
+ if (customProperties.getName().endsWith(CUSTOM_SUFIX)) {
+ this.catalog.getInstalledEntries().add(customProperties);
+ }
+ } else {
+ throw new CustomizationCatalogRuntimeException(
+ "Only facetSets must be stored in the customization properties catalog"); //$NON-NLS-1$
+ }
+ }
+
+ public void setCatalogSet(final CatalogSet catalogSet) {
+ catalogSet.getCatalogs().add(this.catalog);
+ }
+
+ public List<FacetSet> getAllRegisteredCustomizationPropertySet() {
+ final List<FacetSet> result = new ArrayList<FacetSet>();
+ for (final EObject eObject : this.catalog.getInstalledEntries()) {
+ if (eObject instanceof FacetSet) {
+ final FacetSet facetSet = (FacetSet) eObject;
+ result.add(facetSet);
+ } else {
+ throw new RuntimeException(
+ "Only facetSets must be stored in the customization properties catalog"); //$NON-NLS-1$
+ }
+ }
+ return result;
+ }
+
+ public List<FacetOperation> getCustomizationPropertiesByName(
+ final String customPropName) {
+ final List<FacetOperation> result = new ArrayList<FacetOperation>();
+ for (final EObject facetSet : this.catalog.getInstalledEntries()) {
+ final Iterator<EObject> iterator = facetSet.eAllContents();
+ while (iterator.hasNext()) {
+ final EObject eObject = iterator.next();
+ if (eObject instanceof FacetOperation) {
+ final FacetOperation customProperty = (FacetOperation) eObject;
+ if (customPropName.equals(customProperty.getName())) {
+ result.add(customProperty);
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java
new file mode 100644
index 00000000000..9beea21b231
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationPropertiesCatalogManagerFactory.java
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2012 Mia-Software.
+ *
+ * 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:
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.core.internal;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.custom.core.ICustomizationPropertiesCatalogManager;
+import org.eclipse.emf.facet.custom.core.ICustomizationPropertiesCatalogManagerFactory;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+
+/**
+ * Implementation of {@link ICustomizationPropertiesCatalogManagerFactory}.
+ */
+public class CustomizationPropertiesCatalogManagerFactory implements ICustomizationPropertiesCatalogManagerFactory {
+
+ public ICustomizationPropertiesCatalogManager getOrCreateCustomizationPropertiesCatalogManager(
+ final ResourceSet resourceSet) {
+ return ICatalogSetManagerFactory.DEFAULT
+ .createICatalogSetManager(resourceSet)
+ .getCatalogManagerByType(
+ ICustomizationPropertiesCatalogManager.class)
+ .get(0);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationsDelegatingList.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationsDelegatingList.java
new file mode 100644
index 00000000000..b6b65503771
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/CustomizationsDelegatingList.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Nicolas Bros (Mia-Software) - Bug 374758 - [Table] repair the table
+ * Gregoire Dupe (Mia-Software) - Bug 372626 - Aggregates
+ * Thomas Cicognani (Soft-Maint) - Bug 420192 - UnsupportedOperationException in a usefull method
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.core.internal;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+
+/** Represents a list of {@link Customization}s that exists as a subset of a delegate list of {@link FacetSet}s. */
+public class CustomizationsDelegatingList implements List<Customization> {
+ private final List<FacetSet> delegate;
+
+ public CustomizationsDelegatingList(final List<FacetSet> delegate) {
+ this.delegate = delegate;
+ }
+
+ public int size() {
+ return this.delegate.size();
+ }
+
+ public boolean isEmpty() {
+ return this.delegate.isEmpty();
+ }
+
+ public boolean contains(final Object element) {
+ return element instanceof Customization && this.delegate.contains(element);
+ }
+
+ public Iterator<Customization> iterator() {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public Object[] toArray() {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public <T> T[] toArray(final T[] a) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public boolean add(final Customization o) {
+ return this.delegate.add(o);
+ }
+
+ public boolean remove(final Object element) {
+ return this.delegate.remove(element);
+ }
+
+ public boolean containsAll(final Collection<?> c) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public boolean addAll(final Collection<? extends Customization> c) {
+ return this.delegate.addAll(c);
+ }
+
+ public boolean addAll(final int index, final Collection<? extends Customization> c) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public boolean removeAll(final Collection<?> c) {
+ return this.delegate.removeAll(c);
+ }
+
+ public boolean retainAll(final Collection<?> c) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public void clear() {
+ final ListIterator<FacetSet> listIterator = this.delegate.listIterator();
+ while (listIterator.hasNext()) {
+ final FacetSet facetSet = listIterator.next();
+ if (facetSet instanceof Customization) {
+ listIterator.remove();
+ }
+ }
+ }
+
+ public Customization get(final int index) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public Customization set(final int index, final Customization element) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public void add(final int index, final Customization element) {
+ if (index == 0) {
+ this.delegate.add(0, element);
+ } else {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+ }
+
+ public Customization remove(final int index) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public int indexOf(final Object element) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public int lastIndexOf(final Object element) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public ListIterator<Customization> listIterator() {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public ListIterator<Customization> listIterator(final int index) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+
+ public List<Customization> subList(final int fromIndex, final int toIndex) {
+ // FIXME implement
+ throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java
new file mode 100644
index 00000000000..cdf9f22cc82
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exception/CustomizationCatalogRuntimeException.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2011 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.custom.core.internal.exception;
+
+/**
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ * @author Gregoire Dupe
+ *
+ */
+public final class CustomizationCatalogRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 6589838701903506569L;
+
+ public CustomizationCatalogRuntimeException() {
+ super();
+ }
+
+ public CustomizationCatalogRuntimeException(final String message) {
+ super(message);
+ }
+
+ public CustomizationCatalogRuntimeException(final Throwable cause) {
+ super(cause);
+ }
+
+ public CustomizationCatalogRuntimeException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/Constants.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/Constants.java
new file mode 100644
index 00000000000..14defed132b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/Constants.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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:
+ * Gregoire Dupe (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass
+ *******************************************************************************/
+
+package org.eclipse.emf.facet.custom.core.internal.exported;
+
+public final class Constants {
+
+ private Constants() {
+ // Must not be used
+ }
+
+ public static final String CUSTOM_FILE_EXT = "custom"; //$NON-NLS-1$
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/CustomizationUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/CustomizationUtils.java
new file mode 100644
index 00000000000..36291e9dd59
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/exported/CustomizationUtils.java
@@ -0,0 +1,132 @@
+/**
+ * Copyright (c) 2011, 2012 Mia-Software.
+ *
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ * Gregoire Dupe (Mia-Software) - Bug 376576 - [EFacet] Change the multiplicity of Facet::extendedFacet
+ * David Couvrand (Soft-Maint) - Bug 418418 - [Customization] Overlay icons not implemented
+ */
+package org.eclipse.emf.facet.custom.core.internal.exported;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.emf.facet.custom.core.exception.CustomizationException;
+import org.eclipse.emf.facet.custom.core.internal.Activator;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
+import org.eclipse.emf.facet.util.core.Logger;
+
+/**
+ * @since 0.2
+ */
+public final class CustomizationUtils {
+
+ private static final String FILE_EXTENSION = "custom"; //$NON-NLS-1$
+
+ private CustomizationUtils() {
+ // Must not be used
+ }
+
+ public static EPackage getCustomizedEPackage(
+ final Customization customization) {
+ EPackage result = null;
+ for (EClassifier eClassifier : customization.getEClassifiers()) {
+ for (EPackage ePackage : getExtendedEPackage(eClassifier)) {
+ if (ePackage != null && !(ePackage instanceof FacetSet)) {
+ result = ePackage;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ private static List<EPackage> getExtendedEPackage(
+ final EClassifier eClassifier) {
+ final List<EClassifier> extended = new ArrayList<EClassifier>();
+ if (eClassifier instanceof FacetCustomization) {
+ final FacetCustomization facetCustom = (FacetCustomization) eClassifier;
+ extended.addAll(facetCustom.getExtendedFacets());
+ } else if (eClassifier instanceof EClassCustomization) {
+ final EClassCustomization eClassCustom = (EClassCustomization) eClassifier;
+ extended.add(eClassCustom.getExtendedMetaclass());
+ }
+ final List<EPackage> ePackages = new LinkedList<EPackage>();
+ for (EClassifier extCassifier : extended) {
+ if (extCassifier != null) {
+ ePackages.add(extCassifier.getEPackage());
+ }
+ }
+ return ePackages;
+ }
+
+ /**
+ * Return the default file extension of a customization file.
+ *
+ * @return the file extension without the dot.
+ */
+ public static String getDefaultFileExtension() {
+ return CustomizationUtils.FILE_EXTENSION;
+ }
+
+ /**
+ * Find a Customization with the given name among the given list of Customizations. If several Customizations have the same name,
+ * then return the first one.
+ *
+ * @param customizations
+ * where to look for
+ * @param name
+ * the name of the Customization to find
+ * @return the Customization, or <code>null</code> if not found in the given list
+ */
+ public static Customization getCustomization(final Collection<Customization> customizations, final String name) {
+ Customization result = null;
+ for (Customization customization : customizations) {
+ if (name.equals(customization.getName())) {
+ result = customization;
+ }
+ }
+ return result;
+ }
+
+ public static <T> T getPropertyValue(
+ final ICustomizationManager customManager, final Object element,
+ final FacetOperation property, final ETypedElement eTypedElement,
+ final Class<T> classs) {
+ T result = null;
+ if (element instanceof EObject) {
+ final EObject eObject = (EObject) element;
+ try {
+ if (eTypedElement == null) {
+ result = customManager.getCustomValueOf(eObject, property,
+ classs);
+ } else {
+ result = customManager.getCustomValueOf(eObject,
+ eTypedElement, property, classs);
+ }
+ } catch (final CustomizationException e) {
+ Logger.logError(
+ e,
+ "Failed to get the value of '" + property.getName() + "' for " + element, //$NON-NLS-1$ //$NON-NLS-2$
+ Activator.getDefault());
+ }
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/ETypedElementSwitchQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/ETypedElementSwitchQueryImplementation.java
new file mode 100644
index 00000000000..fe7717359ef
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/ETypedElementSwitchQueryImplementation.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2012, 2013 Mia-Software.
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Nicolas Bros (Mia-Software) - Bug 378271 - [Table] Select Columns To Hide is broken
+ * Alban Ménager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ * Gregoire Dupé (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point
+ */
+package org.eclipse.emf.facet.custom.core.internal.query;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.query.IDerivedTypedElementImplementation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+
+/**
+ * @deprecated replaced by {@link SwitchQueryImplementation}
+ */
+@Deprecated
+public class ETypedElementSwitchQueryImplementation implements IDerivedTypedElementImplementation {
+
+ private static final String PARAM_NAME = "eStructuralFeature"; //$NON-NLS-1$
+ private boolean checkResultType = false;
+ private final ETypedElementSwitchQuery query;
+ private final IDerivedTypedElementManager derivedTEMgr;
+
+ public ETypedElementSwitchQueryImplementation(
+ final ETypedElementSwitchQuery query,
+ final IDerivedTypedElementManager derivedTEMgr) {
+ this.query = query;
+ this.derivedTEMgr = derivedTEMgr;
+ }
+
+ public Object getValue(final DerivedTypedElement derivedTypedElt,
+ final EObject source, final List<ParameterValue> parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ Object result = null;
+ EStructuralFeature sfParam = null;
+ for (final ParameterValue parameterValue : parameterValues) {
+ if (parameterValue.getParameter().getName()
+ .equals(PARAM_NAME)) {
+ sfParam = (EStructuralFeature) parameterValue.getValue();
+ }
+
+ }
+ // note: sfParam is null when there is no case query (i.e: case is always true)
+ for (final ETypedElementCase eTECase : this.query.getCases()) {
+ if (eTECase.getCase() == sfParam) {
+ result = this.derivedTEMgr.evaluate(eTECase.getValue(), source,
+ parameterValues, facetManager);
+ }
+ }
+ return result;
+ }
+
+ public void setValue(final DerivedTypedElement derivedTypedElt,
+ final EObject source, final List<ParameterValue> parameterValues,
+ final Object newValue) throws DerivedTypedElementException {
+ throw new DerivedTypedElementException("Not implemented"); //$NON-NLS-1$
+ }
+
+ public boolean getCheckResultType() {
+ return this.checkResultType;
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/ETypedElementSwitchQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/ETypedElementSwitchQueryImplementationFactory.java
new file mode 100644
index 00000000000..a9341bdaa9b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/ETypedElementSwitchQueryImplementationFactory.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2012, 2013 Mia-Software.
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupé (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point
+ */
+package org.eclipse.emf.facet.custom.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.query.IDerivedTypedElementImplementation;
+import org.eclipse.emf.facet.efacet.core.query.IDerivedTypedElementImplementationFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.osgi.framework.Bundle;
+
+/**
+ * @deprecated replaced by {@link SwitchQueryImplementationFactory}
+ */
+@Deprecated
+public class ETypedElementSwitchQueryImplementationFactory implements IDerivedTypedElementImplementationFactory {
+
+ public IDerivedTypedElementImplementation create(final Query query, final Bundle bundle, final IDerivedTypedElementManager derivedTEManager)
+ throws DerivedTypedElementException {
+ if (!(query instanceof ETypedElementSwitchQuery)) {
+ throw new IllegalArgumentException("The given DerivedTypedElement does not have a IsOneOfQuery"); //$NON-NLS-1$
+ }
+ final ETypedElementSwitchQueryImplementation evaluator = new ETypedElementSwitchQueryImplementation(
+ (ETypedElementSwitchQuery) query, derivedTEManager);
+ evaluator.setCheckResultType(false);
+ return evaluator;
+ }
+
+ public EClass getManagedQueryType() {
+ return CustomPackage.eINSTANCE.getETypedElementSwitchQuery();
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementation.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementation.java
new file mode 100644
index 00000000000..c09391e0e9c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementation.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2013 Mia-Software.
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point
+ */
+package org.eclipse.emf.facet.custom.core.internal.query;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementCase;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.IFacetManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.ParameterValue;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+public class SwitchQueryImplementation implements IQueryImplementation {
+
+ private static final String PARAM_NAME = "eStructuralFeature"; //$NON-NLS-1$
+ private final ETypedElementSwitchQuery query;
+ private boolean checkResultType = false;
+
+ /**
+ * @param query
+ * @param query
+ * the javaQuery to be evaluated
+ */
+ public SwitchQueryImplementation(final ETypedElementSwitchQuery query) {
+ this.query = query;
+ }
+
+ public Object getValue(final Query query2,
+ final DerivedTypedElement feature, final EObject source,
+ final List<ParameterValue> parameterValues,
+ final IFacetManager facetManager)
+ throws DerivedTypedElementException {
+ Object result = null;
+ EStructuralFeature sfParam = null;
+ for (final ParameterValue parameterValue : parameterValues) {
+ if (parameterValue.getParameter().getName().equals(PARAM_NAME)) {
+ sfParam = (EStructuralFeature) parameterValue.getValue();
+ }
+ }
+ for (ETypedElementCase eTECase : this.query.getCases()) {
+ if (eTECase.getCase() == sfParam) {
+ final Query subquery = eTECase.getValue();
+ if (subquery != null) {
+ result = IDerivedTypedElementManager.INSTANCE.evaluate(
+ subquery, source, parameterValues, facetManager);
+ }
+ break;
+ }
+ }
+ return result;
+ }
+
+ public void setValue(final Query query2, final DerivedTypedElement feature,
+ final EObject source, final List<ParameterValue> parameterValues,
+ final Object newValue) throws DerivedTypedElementException {
+ throw new UnsupportedOperationException("Not implemented yet"); //$NON-NLS-1$
+ }
+
+ public boolean isCheckResultType() {
+ return this.checkResultType;
+ }
+
+ public void setCheckResultType(final boolean checkResultType) {
+ this.checkResultType = checkResultType;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java
new file mode 100644
index 00000000000..d7bc220133d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.core/src/org/eclipse/emf/facet/custom/core/internal/query/SwitchQueryImplementationFactory.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2013 Mia-Software.
+ * 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:
+ * Gregoire Dupe (Mia-Software) - Bug 418885 - ETypedElementSwitchQuery implemented using a deprecated query evaluator extension point
+ */
+package org.eclipse.emf.facet.custom.core.internal.query;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.CustomPackage;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.ETypedElementSwitchQuery;
+import org.eclipse.emf.facet.efacet.core.IDerivedTypedElementManager;
+import org.eclipse.emf.facet.efacet.core.exception.DerivedTypedElementException;
+import org.eclipse.emf.facet.efacet.core.query.IQueryImplementation;
+import org.eclipse.emf.facet.efacet.core.query.IQueryImplementationFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+import org.osgi.framework.Bundle;
+
+public class SwitchQueryImplementationFactory implements
+ IQueryImplementationFactory {
+
+ public IQueryImplementation create(final Query query, final Bundle bundle,
+ final IDerivedTypedElementManager manager)
+ throws DerivedTypedElementException {
+ if (!(query instanceof ETypedElementSwitchQuery)) {
+ throw new IllegalArgumentException(
+ "The given DerivedTypedElement does not have a ETypedElementSwitchQuery"); //$NON-NLS-1$
+ }
+ final ETypedElementSwitchQuery switchQuery = (ETypedElementSwitchQuery) query;
+ return new SwitchQueryImplementation(switchQuery);
+ }
+
+ public EClass getManagedQueryType() {
+ return CustomPackage.eINSTANCE.getETypedElementSwitchQuery();
+ }
+}

Back to the top