Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.checkstyle18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.pmd7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.core.runtime.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/entries1
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/format1
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/00/00e1f1bc150986effc780aa7408f83a5747113fd.svn-base7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/05/05193c1e7357387965ed1eb2cd9c9eaf493aa4cc.svn-base11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/0c/0cc6c886ddbccaf52e6be6d42080cbbfc25e56ca.svn-base21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/11/116b5d4fe5dfc6332ebe62073c7418854c7fa0ff.svn-base69
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/2d/2dd844ef78323af52ceb766e9c887d44a383b8ef.svn-base116
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/30/302e29032d5d32ddd4d3df340a9685cc744a1a8d.svn-base39
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/30/304ceb77ed16eeaeb7ad57328580051968f30e51.svn-base18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/32/323446449cbc59bcf2c40b0b050b6ab71c81c0d0.svn-base93
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/44/44cb9b63b696c3d4af061065582f3976480164ca.svn-base23
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/4d/4dab3b7f5164a23ba1042b4eea522e5d593eb7e7.svn-base3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/59/591683df846d17be338ee87444446487dea61404.svn-base3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/69/692901b1bee1a5f825ada4d4f239e0e78c89c957.svn-base18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/79/79e246f193041a380f86ac4208a456b2d7589e3a.svn-base20
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/91/91586d440ea4a0a9488f6c44d3d50355ae5c8853.svn-base61
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/9a/9a94d7694ab93517178dd5b45cbaa22be6ecdc63.svn-base26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/a7/a74d1387a693257bf25043385748483d45b9a4b7.svn-base49
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/b3/b3269fbbc3eb5e1d7de39487cc983a4d780d918a.svn-base7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/b9/b9c6c9d89432316d7b672fb8a7258985a4bb4b0b.svn-base28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/bb/bb820d90fb6cd944710b7b23474fc1aab411ac21.svn-base40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/c6/c6d8a1615c1e74ebb1c847ac7b3b05fc412bfb22.svn-base57
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/cf/cf17d834635368097dc4069f64744a7d63619461.svn-base44
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/da/da2a75534b5f3b04a4ea05f281826dcaae448cfb.svn-base54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/wc.dbbin0 -> 67584 bytes
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/META-INF/MANIFEST.MF21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/OSGI-INF/l10n/bundle.properties18
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/build.properties20
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/plugin.xml49
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationActions.java44
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationCommandFactory.java61
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationCommandFactoryFactory.java39
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/Activator.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationActionsImpl.java69
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationCommandFactory.java93
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationCommandFactoryFactory.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/AvoidEClassOverlayConstraint.java57
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/CustomizationValidationBuilder.java116
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/ValidationDelegateClientSelector.java23
47 files changed, 1616 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.checkstyle
new file mode 100644
index 00000000000..cc4564edfe6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.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 Bros (Mia-Software) - initial API and implementation
+-->
+<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.sdk.core/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.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.sdk.core/.pmd b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.pmd
new file mode 100644
index 00000000000..a64878bfdf6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.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.sdk.core/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.project
new file mode 100644
index 00000000000..0f06907e6e4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.custom.sdk.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>
+ </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>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..4b8505e6d1e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Wed Sep 14 13:39:57 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.core.runtime.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 00000000000..dea8d10ff97
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,3 @@
+#Tue Dec 13 09:46:07 CET 2011
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..060c5ee3d2e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/entries b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/entries
new file mode 100644
index 00000000000..3cacc0b93c9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/entries
@@ -0,0 +1 @@
+12 \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/format b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/format
new file mode 100644
index 00000000000..3cacc0b93c9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/format
@@ -0,0 +1 @@
+12 \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/00/00e1f1bc150986effc780aa7408f83a5747113fd.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/00/00e1f1bc150986effc780aa7408f83a5747113fd.svn-base
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/00/00e1f1bc150986effc780aa7408f83a5747113fd.svn-base
@@ -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.sdk.core/.svn/pristine/05/05193c1e7357387965ed1eb2cd9c9eaf493aa4cc.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/05/05193c1e7357387965ed1eb2cd9c9eaf493aa4cc.svn-base
new file mode 100644
index 00000000000..060c5ee3d2e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/05/05193c1e7357387965ed1eb2cd9c9eaf493aa4cc.svn-base
@@ -0,0 +1,11 @@
+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.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/0c/0cc6c886ddbccaf52e6be6d42080cbbfc25e56ca.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/0c/0cc6c886ddbccaf52e6be6d42080cbbfc25e56ca.svn-base
new file mode 100644
index 00000000000..77df09483b5
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/0c/0cc6c886ddbccaf52e6be6d42080cbbfc25e56ca.svn-base
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.emf.facet.custom.sdk.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.custom.sdk.core.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.validation;bundle-version="1.4.0",
+ org.eclipse.emf.facet.efacet.metamodel;bundle-version="0.2.0",
+ org.eclipse.emf.facet.custom.metamodel;bundle-version="0.2.0",
+ org.eclipse.emf.facet.custom.core;bundle-version="0.2.0",
+ org.eclipse.emf.facet.common.sdk.core;bundle-version="0.2.0",
+ org.eclipse.emf.facet.util.core;bundle-version="0.2.1",
+ org.eclipse.emf.facet.util.pde.core;bundle-version="0.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.custom.sdk.core,
+ org.eclipse.emf.facet.custom.sdk.core.internal.validation;x-internal:=true
+Import-Package: org.eclipse.emf.edit.command,
+ org.eclipse.emf.edit.domain
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/11/116b5d4fe5dfc6332ebe62073c7418854c7fa0ff.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/11/116b5d4fe5dfc6332ebe62073c7418854c7fa0ff.svn-base
new file mode 100644
index 00000000000..e8efe00ed91
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/11/116b5d4fe5dfc6332ebe62073c7418854c7fa0ff.svn-base
@@ -0,0 +1,69 @@
+/**
+ * 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.sdk.core.internal;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+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.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.sdk.core.ICustomizationActions;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.pde.core.internal.exported.BuildPropertiesUtils;
+
+/**
+ * Concrete implementation of {@link ICustomizationActions}.
+ */
+public class CustomizationActionsImpl implements ICustomizationActions {
+
+ public void saveCustomization(final Customization customization,
+ final IFile file) throws IOException, InvalidFacetSetException {
+
+ if (customization == null) {
+ throw new IllegalArgumentException(
+ "The given customization cannot be null"); //$NON-NLS-1$
+ }
+ if (file == null) {
+ throw new IllegalArgumentException("The given file cannot be null"); //$NON-NLS-1$
+ }
+ if (file.exists()) {
+ throw new IllegalArgumentException("The given file already exists"); //$NON-NLS-1$
+ }
+ // Create a resource set
+ final ResourceSet resourceSet = new ResourceSetImpl();
+ // Get the URI of the model file.
+ final URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
+ .toString(), true);
+ // Create a resource for this file.
+ final Resource resource = resourceSet.createResource(fileURI);
+ // Add the facetSet the resource contents.
+ resource.getContents().add(customization);
+ // Save the contents of the resource to the file system.
+ resource.save(null);
+ try {
+ BuildPropertiesUtils.addToBuild(file);
+ } catch (final Exception e) {
+ Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$
+ + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$
+ }
+ final ICatalogSetManager2 catalogSetManager = ICatalogSetManagerFactory.DEFAULT
+ .createICatalogSetManager(resourceSet);
+ catalogSetManager.registerModelDeclaration(file);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/2d/2dd844ef78323af52ceb766e9c887d44a383b8ef.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/2d/2dd844ef78323af52ceb766e9c887d44a383b8ef.svn-base
new file mode 100644
index 00000000000..666d02d586b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/2d/2dd844ef78323af52ceb766e9c887d44a383b8ef.svn-base
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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 375054 - Add validation warning for overlay on EClass
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.sdk.core.internal.validation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.common.sdk.core.internal.exported.IEmfFacetProjectBuilder;
+import org.eclipse.emf.facet.custom.core.internal.exported.Constants;
+import org.eclipse.emf.validation.marker.MarkerUtil;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.ModelValidationService;
+
+/** A builder that validates customization model files. */
+public class CustomizationValidationBuilder implements IEmfFacetProjectBuilder, IResourceDeltaVisitor, IResourceVisitor {
+
+ public IProject[] build(final IncrementalProjectBuilder builder, final int kind, final Map<?, ?> args, final IProgressMonitor monitor) throws CoreException {
+ if (kind == IncrementalProjectBuilder.FULL_BUILD) {
+ fullBuild(builder);
+ } else {
+ final IResourceDelta delta = builder.getDelta(builder.getProject());
+ if (delta == null) {
+ fullBuild(builder);
+ } else {
+ incrementalBuild(delta);
+ }
+ }
+ return new IProject[0];
+ }
+
+ public void clean(final IncrementalProjectBuilder builder, final IProgressMonitor monitor) throws CoreException {
+ builder.getProject().accept(new IResourceVisitor() {
+ public boolean visit(final IResource resource) throws CoreException {
+ if (isCustomizationFile(resource)) {
+ resource.deleteMarkers(MarkerUtil.VALIDATION_MARKER_TYPE, true, IResource.DEPTH_INFINITE);
+ }
+ return true;
+ }
+ });
+ }
+
+ private void incrementalBuild(final IResourceDelta delta) throws CoreException {
+ delta.accept(this);
+ }
+
+ private void fullBuild(final IncrementalProjectBuilder builder) throws CoreException {
+ builder.getProject().accept(this);
+ }
+
+ protected static boolean isCustomizationFile(final IResource resource) {
+ return resource.getType() == IResource.FILE
+ && Constants.CUSTOM_FILE_EXT
+ .equals(resource.getFileExtension());
+ }
+
+ public boolean visit(final IResourceDelta delta) throws CoreException {
+ if (isCustomizationFile(delta.getResource())) {
+ validate(delta.getResource());
+ }
+ return true;
+ }
+
+ public boolean visit(final IResource resource) throws CoreException {
+ if (Constants.CUSTOM_FILE_EXT.equals(resource.getFileExtension())) {
+ validate(resource);
+ }
+ return true;
+ }
+
+ protected static void validate(final IResource resource) throws CoreException {
+ if (resource.exists()) {
+ final IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance()
+ .newValidator(EvaluationMode.BATCH);
+ validator.setOption(IBatchValidator.OPTION_TRACK_RESOURCES, Boolean.TRUE);
+ final IStatus multiStatus = validator.validate(getAllContents(resource));
+ MarkerUtil.updateMarkers(multiStatus);
+ }
+ }
+
+ /** @return all the model elements contained in the given platform resource. */
+ public static List<EObject> getAllContents(final IResource resource) {
+ final List<EObject> result = new ArrayList<EObject>();
+ final ResourceSetImpl resourceSet = new ResourceSetImpl();
+ final Resource modelResource = resourceSet.getResource(URI.createPlatformResourceURI(resource.getFullPath().toString(), true), true);
+ final TreeIterator<EObject> allContents = EcoreUtil.getAllContents(modelResource, true);
+ while (allContents.hasNext()) {
+ result.add(allContents.next());
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/30/302e29032d5d32ddd4d3df340a9685cc744a1a8d.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/30/302e29032d5d32ddd4d3df340a9685cc744a1a8d.svn-base
new file mode 100644
index 00000000000..3e038315588
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/30/302e29032d5d32ddd4d3df340a9685cc744a1a8d.svn-base
@@ -0,0 +1,39 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.custom.sdk.core.internal.CustomizationCommandFactoryFactory;
+import org.eclipse.emf.facet.custom.sdk.core.internal.CustomizationCommandFactory;
+
+/**
+ * This interface provide a command factory. A command modify the editingDomain.
+ *
+ * @since 0.3
+ * @see CustomizationCommandFactory
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationCommandFactoryFactory {
+
+ ICustomizationCommandFactoryFactory DEFAULT = new CustomizationCommandFactoryFactory();
+
+ /**
+ * Set the editingDomain.
+ *
+ * @param editingDomain
+ * the current editing domain.
+ */
+ ICustomizationCommandFactory createICustomizationCommandFactory(
+ EditingDomain editingDomain);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/30/304ceb77ed16eeaeb7ad57328580051968f30e51.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/30/304ceb77ed16eeaeb7ad57328580051968f30e51.svn-base
new file mode 100644
index 00000000000..a04987648b2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/30/304ceb77ed16eeaeb7ad57328580051968f30e51.svn-base
@@ -0,0 +1,18 @@
+###############################################################################
+# 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 375054 - Add validation warning for overlay on EClass
+###############################################################################
+#Properties file for org.eclipse.emf.facet.custom.sdk.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Custom SDK Core (Incubation)
+modelValidation.category = EMF Facet Custom Model Validation
+avoidEClassOverlay.constraint.name = Avoid EClass Overlay
+avoidEClassOverlay.constraint.message = Avoid overlay customizations on EClass. Define an overlay on a Facet instead.
+avoidEClassOverlay.constraint.description = Overlay customizations on EClass should be avoided, and replaced by an overlay on a Facet.
+validation.builder.name = EMF Facet Customization Validation Builder
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/32/323446449cbc59bcf2c40b0b050b6ab71c81c0d0.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/32/323446449cbc59bcf2c40b0b050b6ab71c81c0d0.svn-base
new file mode 100644
index 00000000000..98454ba3191
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/32/323446449cbc59bcf2c40b0b050b6ab71c81c0d0.svn-base
@@ -0,0 +1,93 @@
+/**
+ * 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
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core.internal;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+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.ETypedElementCase;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization;
+import org.eclipse.emf.facet.custom.sdk.core.ICustomizationCommandFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+/**
+ * Concrete implementation of {@link ICustomizationCommandFactory}.
+ */
+public class CustomizationCommandFactory implements
+ ICustomizationCommandFactory {
+
+ private final EditingDomain editingDomain;
+
+ public CustomizationCommandFactory(final EditingDomain editingDomain) {
+ if (editingDomain == null) {
+ throw new IllegalArgumentException(
+ "The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+ this.editingDomain = editingDomain;
+ }
+
+ /**
+ * Create an {@link AddCommand} to add the element to the owner.
+ *
+ * @param owner
+ * the owner.
+ * @param element
+ * the element to add.
+ * @return the command.
+ */
+ private Command createAddCommand(final Object owner, final Object element) {
+ if (owner == null) {
+ throw new IllegalArgumentException("The given owner cannot be null"); //$NON-NLS-1$
+ }
+ if (element == null) {
+ throw new IllegalArgumentException(
+ "The given element cannot be null"); //$NON-NLS-1$
+ }
+ return AddCommand.create(this.editingDomain, owner,
+ getEStructuralFeature(element), element);
+ }
+
+ /**
+ * Return the {@link EStructuralFeature} for a given element.
+ *
+ * @param element
+ * the element.
+ * @return the eStructuralFeature for the element.
+ */
+ private static EStructuralFeature getEStructuralFeature(final Object element) {
+ EStructuralFeature result = null;
+ if (element instanceof EClassCustomization) {
+ result = EcorePackage.eINSTANCE.getEPackage_EClassifiers();
+ }
+ return result;
+ }
+
+ public Command createEClassCustomization(final Customization parent,
+ final EClassCustomization eClassCustom) {
+ return createAddCommand(parent, eClassCustom);
+ }
+
+ public Command createFacetCustomization(final Customization parent,
+ final FacetCustomization facetCustom) {
+ return createAddCommand(parent, facetCustom);
+ }
+
+ public Command addValueInCase(final ETypedElementCase elementCase,
+ final Query value) {
+ return createAddCommand(elementCase, value);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/44/44cb9b63b696c3d4af061065582f3976480164ca.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/44/44cb9b63b696c3d4af061065582f3976480164ca.svn-base
new file mode 100644
index 00000000000..cc56ae119af
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/44/44cb9b63b696c3d4af061065582f3976480164ca.svn-base
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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 375054 - Add validation warning for overlay on EClass
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.sdk.core.internal.validation;
+
+import org.eclipse.emf.validation.model.IClientSelector;
+
+/** Enables validation depending on a client context. */
+public class ValidationDelegateClientSelector implements IClientSelector {
+
+ public boolean selects(final Object object) {
+ // always enabled
+ return true;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/4d/4dab3b7f5164a23ba1042b4eea522e5d593eb7e7.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/4d/4dab3b7f5164a23ba1042b4eea522e5d593eb7e7.svn-base
new file mode 100644
index 00000000000..4b8505e6d1e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/4d/4dab3b7f5164a23ba1042b4eea522e5d593eb7e7.svn-base
@@ -0,0 +1,3 @@
+#Wed Sep 14 13:39:57 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/59/591683df846d17be338ee87444446487dea61404.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/59/591683df846d17be338ee87444446487dea61404.svn-base
new file mode 100644
index 00000000000..dea8d10ff97
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/59/591683df846d17be338ee87444446487dea61404.svn-base
@@ -0,0 +1,3 @@
+#Tue Dec 13 09:46:07 CET 2011
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/69/692901b1bee1a5f825ada4d4f239e0e78c89c957.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/69/692901b1bee1a5f825ada4d4f239e0e78c89c957.svn-base
new file mode 100644
index 00000000000..cc4564edfe6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/69/692901b1bee1a5f825ada4d4f239e0e78c89c957.svn-base
@@ -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 Bros (Mia-Software) - initial API and implementation
+-->
+<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.sdk.core/.svn/pristine/79/79e246f193041a380f86ac4208a456b2d7589e3a.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/79/79e246f193041a380f86ac4208a456b2d7589e3a.svn-base
new file mode 100644
index 00000000000..2196632f9a2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/79/79e246f193041a380f86ac4208a456b2d7589e3a.svn-base
@@ -0,0 +1,20 @@
+###############################################################################
+# 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 375054 - Add validation warning for overlay on EClass
+# Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ OSGI-INF/,\
+ plugin.xml
+src.includes = about.html
+javacDefaultEncoding.. = UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/91/91586d440ea4a0a9488f6c44d3d50355ae5c8853.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/91/91586d440ea4a0a9488f6c44d3d50355ae5c8853.svn-base
new file mode 100644
index 00000000000..b25fd22378e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/91/91586d440ea4a0a9488f6c44d3d50355ae5c8853.svn-base
@@ -0,0 +1,61 @@
+/**
+ * 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
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core;
+
+import org.eclipse.emf.common.command.Command;
+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.ETypedElementCase;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization;
+import org.eclipse.emf.facet.custom.sdk.core.internal.CustomizationCommandFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+/**
+ * This interface provide a command factory. A command modify the editingDomain.
+ *
+ * @since 0.3
+ * @see CustomizationCommandFactory
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationCommandFactory {
+
+ /**
+ * Create the command to add a eClassCustomization to an existing
+ * customization (parent).
+ *
+ * @param Customization
+ * the parent of the eClassCustomization to add.
+ * @param eClassCustom
+ * the eClassCustomization to add.
+ * @return the command.
+ */
+ Command createEClassCustomization(Customization parent,
+ EClassCustomization eClassCustom);
+
+ /**
+ * Create the command to add a facetCustomization to an existing
+ * customization (parent).
+ *
+ * @param parent
+ * the parent of the facetCustomization to add.
+ * @param facetCustom
+ * the facetCustomization to add.
+ * @return the command.
+ */
+ Command createFacetCustomization(Customization parent,
+ FacetCustomization facetCustom);
+
+ Command addValueInCase(final ETypedElementCase elementCase,
+ final Query value);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/9a/9a94d7694ab93517178dd5b45cbaa22be6ecdc63.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/9a/9a94d7694ab93517178dd5b45cbaa22be6ecdc63.svn-base
new file mode 100644
index 00000000000..b96f8240d28
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/9a/9a94d7694ab93517178dd5b45cbaa22be6ecdc63.svn-base
@@ -0,0 +1,26 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core.internal;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.custom.sdk.core.ICustomizationCommandFactory;
+import org.eclipse.emf.facet.custom.sdk.core.ICustomizationCommandFactoryFactory;
+
+public class CustomizationCommandFactoryFactory implements
+ ICustomizationCommandFactoryFactory {
+
+ public ICustomizationCommandFactory createICustomizationCommandFactory(
+ final EditingDomain editingDomain) {
+ return new CustomizationCommandFactory(editingDomain);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/a7/a74d1387a693257bf25043385748483d45b9a4b7.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/a7/a74d1387a693257bf25043385748483d45b9a4b7.svn-base
new file mode 100644
index 00000000000..f7f989630e0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/a7/a74d1387a693257bf25043385748483d45b9a4b7.svn-base
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="org.eclipse.emf.facet.custom.sdk.core.validation"
+ point="org.eclipse.emf.validation.constraintProviders">
+ <category
+ id="org.eclipse.emf.facet.custom.sdk.core.validation.category"
+ name="%modelValidation.category">
+ </category>
+ <constraintProvider mode="Batch">
+ <package namespaceUri="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"/>
+ <package namespaceUri="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet"/>
+ <constraints categories="org.eclipse.emf.facet.custom.sdk.core.validation.category">
+ <constraint
+ class="org.eclipse.emf.facet.custom.sdk.core.internal.validation.AvoidEClassOverlayConstraint"
+ id="org.eclipse.emf.facet.custom.sdk.core.constraint.avoidEClassOverlay"
+ isEnabledByDefault="true"
+ lang="Java"
+ mode="Batch"
+ name="%avoidEClassOverlay.constraint.name"
+ severity="WARNING"
+ statusCode="1">
+ <message>
+ %avoidEClassOverlay.constraint.message
+ </message>
+ <description>
+ %avoidEClassOverlay.constraint.description
+ </description>
+ </constraint>
+ </constraints>
+ </constraintProvider>
+ </extension>
+
+ <extension point="org.eclipse.emf.validation.constraintBindings">
+ <clientContext
+ default="false"
+ id="org.eclipse.emf.facet.custom.sdk.core.validation.context">
+ <selector class="org.eclipse.emf.facet.custom.sdk.core.internal.validation.ValidationDelegateClientSelector"/>
+ </clientContext>
+ <binding
+ context="org.eclipse.emf.facet.custom.sdk.core.validation.context"
+ category="org.eclipse.emf.facet.custom.sdk.core.validation.category"/>
+ </extension>
+
+ <extension point="org.eclipse.emf.facet.common.sdk.core.builderRegistration">
+ <builder class="org.eclipse.emf.facet.custom.sdk.core.internal.validation.CustomizationValidationBuilder"/>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/b3/b3269fbbc3eb5e1d7de39487cc983a4d780d918a.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/b3/b3269fbbc3eb5e1d7de39487cc983a4d780d918a.svn-base
new file mode 100644
index 00000000000..a64878bfdf6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/b3/b3269fbbc3eb5e1d7de39487cc983a4d780d918a.svn-base
@@ -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.sdk.core/.svn/pristine/b9/b9c6c9d89432316d7b672fb8a7258985a4bb4b0b.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/b9/b9c6c9d89432316d7b672fb8a7258985a4bb4b0b.svn-base
new file mode 100644
index 00000000000..3019b95b9cf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/b9/b9c6c9d89432316d7b672fb8a7258985a4bb4b0b.svn-base
@@ -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>December 22, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/bb/bb820d90fb6cd944710b7b23474fc1aab411ac21.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/bb/bb820d90fb6cd944710b7b23474fc1aab411ac21.svn-base
new file mode 100644
index 00000000000..0bf408ff5ad
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/bb/bb820d90fb6cd944710b7b23474fc1aab411ac21.svn-base
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.facet.custom.sdk.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>
+ </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>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/c6/c6d8a1615c1e74ebb1c847ac7b3b05fc412bfb22.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/c6/c6d8a1615c1e74ebb1c847ac7b3b05fc412bfb22.svn-base
new file mode 100644
index 00000000000..b8081af3e8d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/c6/c6d8a1615c1e74ebb1c847ac7b3b05fc412bfb22.svn-base
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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 375054 - Add validation warning for overlay on EClass
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.sdk.core.internal.validation;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ * Creates a warning if a {@link FacetOperation} defined in an {@link EClassCustomization} overrides (i.e. customizes)
+ * an overlay operation.
+ */
+public class AvoidEClassOverlayConstraint extends AbstractModelConstraint {
+
+ private static final List<String> OVERLAY_OPS = Arrays.asList(
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/topLeftOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/topMiddleOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/topRightOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/bottomLeftOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/bottomMiddleOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/bottomRightOverlay" //$NON-NLS-1$
+ );
+
+ @Override
+ public IStatus validate(final IValidationContext ctx) {
+ IStatus result = ctx.createSuccessStatus();
+ final EObject target = ctx.getTarget();
+ if (target instanceof FacetOperation) {
+ final FacetOperation facetOperation = (FacetOperation) target;
+ final DerivedTypedElement override = facetOperation.getOverride();
+ final URI overrideURI = EcoreUtil.getURI(override);
+ if (facetOperation.eContainer() instanceof EClassCustomization
+ && AvoidEClassOverlayConstraint.OVERLAY_OPS.contains(overrideURI.toString())) {
+ result = ctx.createFailureStatus();
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/cf/cf17d834635368097dc4069f64744a7d63619461.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/cf/cf17d834635368097dc4069f64744a7d63619461.svn-base
new file mode 100644
index 00000000000..cbe214e96bf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/cf/cf17d834635368097dc4069f64744a7d63619461.svn-base
@@ -0,0 +1,44 @@
+/**
+ * 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.sdk.core;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.sdk.core.internal.CustomizationActionsImpl;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+
+/**
+ * This interface provides the creation of a new customization model file.
+ *
+ * @see CustomizationActionsImpl
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationActions {
+
+ ICustomizationActions INSTANCE = new CustomizationActionsImpl();
+
+ /**
+ * Add the given customization to the given customization model file, which
+ * will be created.
+ *
+ * @param customization
+ * the customization to be created. Cannot be <code>null</code>
+ * @param file
+ * the new file in which the customization has to be created.
+ * Cannot be <code>null</code>, and cannot already exist
+ */
+ void saveCustomization(Customization customization, IFile file)
+ throws IOException, InvalidFacetSetException;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/da/da2a75534b5f3b04a4ea05f281826dcaae448cfb.svn-base b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/da/da2a75534b5f3b04a4ea05f281826dcaae448cfb.svn-base
new file mode 100644
index 00000000000..fdf1b570d8c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/pristine/da/da2a75534b5f3b04a4ea05f281826dcaae448cfb.svn-base
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2012 CEA LIST.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass
+ * Alban MĂ©nager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+@SuppressWarnings("PMD.UseSingleton")
+// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because
+// this class is an Eclipse plug-in activator which will be instantiated by the
+// Eclipse framework.
+public class Activator extends Plugin {
+
+ private static Activator plugin;
+
+ @Override
+ @SuppressWarnings("PMD.SignatureDeclareThrowsException")
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.plugin = this;
+ }
+
+ @Override
+ @SuppressWarnings({ "PMD.SignatureDeclareThrowsException",
+ "PMD.NullAssignment" })
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ // @SuppressWarnings("PMD.NullAssignment")
+ // No choice to right it in another way : this is an Eclipse pattern.
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/wc.db b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/wc.db
new file mode 100644
index 00000000000..625eb188239
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/.svn/wc.db
Binary files differ
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..fdbe1936219
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.custom.sdk.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.custom.sdk.core.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.validation;bundle-version="1.4.0",
+ org.eclipse.papyrus.emf.facet.efacet.metamodel;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.custom.metamodel;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.common.sdk.core;bundle-version="0.2.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.2.1",
+ org.eclipse.papyrus.emf.facet.util.pde.core;bundle-version="0.4.0"
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.emf.facet.custom.sdk.core,
+ org.eclipse.emf.facet.custom.sdk.core.internal.validation;x-internal:=true
+Import-Package: org.eclipse.emf.edit.command,
+ org.eclipse.emf.edit.domain
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..a04987648b2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,18 @@
+###############################################################################
+# 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 375054 - Add validation warning for overlay on EClass
+###############################################################################
+#Properties file for org.eclipse.emf.facet.custom.sdk.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Facet Custom SDK Core (Incubation)
+modelValidation.category = EMF Facet Custom Model Validation
+avoidEClassOverlay.constraint.name = Avoid EClass Overlay
+avoidEClassOverlay.constraint.message = Avoid overlay customizations on EClass. Define an overlay on a Facet instead.
+avoidEClassOverlay.constraint.description = Overlay customizations on EClass should be avoided, and replaced by an overlay on a Facet.
+validation.builder.name = EMF Facet Customization Validation Builder
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/about.html
new file mode 100644
index 00000000000..3019b95b9cf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.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>December 22, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/build.properties
new file mode 100644
index 00000000000..2196632f9a2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/build.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# 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 375054 - Add validation warning for overlay on EClass
+# Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ OSGI-INF/,\
+ plugin.xml
+src.includes = about.html
+javacDefaultEncoding.. = UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/plugin.xml
new file mode 100644
index 00000000000..6e12dc65908
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/plugin.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="org.eclipse.emf.facet.custom.sdk.core.validation"
+ point="org.eclipse.emf.validation.constraintProviders">
+ <category
+ id="org.eclipse.emf.facet.custom.sdk.core.validation.category"
+ name="%modelValidation.category">
+ </category>
+ <constraintProvider mode="Batch">
+ <package namespaceUri="http://www.eclipse.org/emf/facet/custom/0.2.incubation/custom"/>
+ <package namespaceUri="http://www.eclipse.org/emf/facet/efacet/0.2.incubation/efacet"/>
+ <constraints categories="org.eclipse.emf.facet.custom.sdk.core.validation.category">
+ <constraint
+ class="org.eclipse.emf.facet.custom.sdk.core.internal.validation.AvoidEClassOverlayConstraint"
+ id="org.eclipse.emf.facet.custom.sdk.core.constraint.avoidEClassOverlay"
+ isEnabledByDefault="true"
+ lang="Java"
+ mode="Batch"
+ name="%avoidEClassOverlay.constraint.name"
+ severity="WARNING"
+ statusCode="1">
+ <message>
+ %avoidEClassOverlay.constraint.message
+ </message>
+ <description>
+ %avoidEClassOverlay.constraint.description
+ </description>
+ </constraint>
+ </constraints>
+ </constraintProvider>
+ </extension>
+
+ <extension point="org.eclipse.emf.validation.constraintBindings">
+ <clientContext
+ default="false"
+ id="org.eclipse.emf.facet.custom.sdk.core.validation.context">
+ <selector class="org.eclipse.emf.facet.custom.sdk.core.internal.validation.ValidationDelegateClientSelector"/>
+ </clientContext>
+ <binding
+ context="org.eclipse.emf.facet.custom.sdk.core.validation.context"
+ category="org.eclipse.emf.facet.custom.sdk.core.validation.category"/>
+ </extension>
+
+ <extension point="org.eclipse.papyrus.emf.facet.common.sdk.core.builderRegistration">
+ <builder class="org.eclipse.emf.facet.custom.sdk.core.internal.validation.CustomizationValidationBuilder"/>
+ </extension>
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationActions.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationActions.java
new file mode 100644
index 00000000000..cbe214e96bf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationActions.java
@@ -0,0 +1,44 @@
+/**
+ * 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.sdk.core;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.sdk.core.internal.CustomizationActionsImpl;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+
+/**
+ * This interface provides the creation of a new customization model file.
+ *
+ * @see CustomizationActionsImpl
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationActions {
+
+ ICustomizationActions INSTANCE = new CustomizationActionsImpl();
+
+ /**
+ * Add the given customization to the given customization model file, which
+ * will be created.
+ *
+ * @param customization
+ * the customization to be created. Cannot be <code>null</code>
+ * @param file
+ * the new file in which the customization has to be created.
+ * Cannot be <code>null</code>, and cannot already exist
+ */
+ void saveCustomization(Customization customization, IFile file)
+ throws IOException, InvalidFacetSetException;
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationCommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationCommandFactory.java
new file mode 100644
index 00000000000..b25fd22378e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationCommandFactory.java
@@ -0,0 +1,61 @@
+/**
+ * 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
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core;
+
+import org.eclipse.emf.common.command.Command;
+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.ETypedElementCase;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization;
+import org.eclipse.emf.facet.custom.sdk.core.internal.CustomizationCommandFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+/**
+ * This interface provide a command factory. A command modify the editingDomain.
+ *
+ * @since 0.3
+ * @see CustomizationCommandFactory
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationCommandFactory {
+
+ /**
+ * Create the command to add a eClassCustomization to an existing
+ * customization (parent).
+ *
+ * @param Customization
+ * the parent of the eClassCustomization to add.
+ * @param eClassCustom
+ * the eClassCustomization to add.
+ * @return the command.
+ */
+ Command createEClassCustomization(Customization parent,
+ EClassCustomization eClassCustom);
+
+ /**
+ * Create the command to add a facetCustomization to an existing
+ * customization (parent).
+ *
+ * @param parent
+ * the parent of the facetCustomization to add.
+ * @param facetCustom
+ * the facetCustomization to add.
+ * @return the command.
+ */
+ Command createFacetCustomization(Customization parent,
+ FacetCustomization facetCustom);
+
+ Command addValueInCase(final ETypedElementCase elementCase,
+ final Query value);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationCommandFactoryFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationCommandFactoryFactory.java
new file mode 100644
index 00000000000..3e038315588
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/ICustomizationCommandFactoryFactory.java
@@ -0,0 +1,39 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.custom.sdk.core.internal.CustomizationCommandFactoryFactory;
+import org.eclipse.emf.facet.custom.sdk.core.internal.CustomizationCommandFactory;
+
+/**
+ * This interface provide a command factory. A command modify the editingDomain.
+ *
+ * @since 0.3
+ * @see CustomizationCommandFactory
+ * @noextend This interface is not intended to be extended by clients.
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
+public interface ICustomizationCommandFactoryFactory {
+
+ ICustomizationCommandFactoryFactory DEFAULT = new CustomizationCommandFactoryFactory();
+
+ /**
+ * Set the editingDomain.
+ *
+ * @param editingDomain
+ * the current editing domain.
+ */
+ ICustomizationCommandFactory createICustomizationCommandFactory(
+ EditingDomain editingDomain);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/Activator.java
new file mode 100644
index 00000000000..fdf1b570d8c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/Activator.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2012 CEA LIST.
+ * 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:
+ * Nicolas Bros (Mia-Software) - Bug 375054 - Add validation warning for overlay on EClass
+ * Alban MĂ©nager (Soft-Maint) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+@SuppressWarnings("PMD.UseSingleton")
+// @SuppressWarnings("PMD.UseSingleton") We cannot conforms to this rule because
+// this class is an Eclipse plug-in activator which will be instantiated by the
+// Eclipse framework.
+public class Activator extends Plugin {
+
+ private static Activator plugin;
+
+ @Override
+ @SuppressWarnings("PMD.SignatureDeclareThrowsException")
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.plugin = this;
+ }
+
+ @Override
+ @SuppressWarnings({ "PMD.SignatureDeclareThrowsException",
+ "PMD.NullAssignment" })
+ // @SuppressWarnings("PMD.SignatureDeclareThrowsException") We have to use
+ // this signature because this is an override of an Eclipse framework's
+ // method.
+ // @SuppressWarnings("PMD.NullAssignment")
+ // No choice to right it in another way : this is an Eclipse pattern.
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationActionsImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationActionsImpl.java
new file mode 100644
index 00000000000..e8efe00ed91
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationActionsImpl.java
@@ -0,0 +1,69 @@
+/**
+ * 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.sdk.core.internal;
+
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+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.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.emf.facet.custom.sdk.core.ICustomizationActions;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.pde.core.internal.exported.BuildPropertiesUtils;
+
+/**
+ * Concrete implementation of {@link ICustomizationActions}.
+ */
+public class CustomizationActionsImpl implements ICustomizationActions {
+
+ public void saveCustomization(final Customization customization,
+ final IFile file) throws IOException, InvalidFacetSetException {
+
+ if (customization == null) {
+ throw new IllegalArgumentException(
+ "The given customization cannot be null"); //$NON-NLS-1$
+ }
+ if (file == null) {
+ throw new IllegalArgumentException("The given file cannot be null"); //$NON-NLS-1$
+ }
+ if (file.exists()) {
+ throw new IllegalArgumentException("The given file already exists"); //$NON-NLS-1$
+ }
+ // Create a resource set
+ final ResourceSet resourceSet = new ResourceSetImpl();
+ // Get the URI of the model file.
+ final URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
+ .toString(), true);
+ // Create a resource for this file.
+ final Resource resource = resourceSet.createResource(fileURI);
+ // Add the facetSet the resource contents.
+ resource.getContents().add(customization);
+ // Save the contents of the resource to the file system.
+ resource.save(null);
+ try {
+ BuildPropertiesUtils.addToBuild(file);
+ } catch (final Exception e) {
+ Logger.logError(e, "Error adding file " + file.getFullPath() //$NON-NLS-1$
+ + " to the build.properties", Activator.getDefault()); //$NON-NLS-1$
+ }
+ final ICatalogSetManager2 catalogSetManager = ICatalogSetManagerFactory.DEFAULT
+ .createICatalogSetManager(resourceSet);
+ catalogSetManager.registerModelDeclaration(file);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationCommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationCommandFactory.java
new file mode 100644
index 00000000000..98454ba3191
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationCommandFactory.java
@@ -0,0 +1,93 @@
+/**
+ * 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
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core.internal;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+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.ETypedElementCase;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.FacetCustomization;
+import org.eclipse.emf.facet.custom.sdk.core.ICustomizationCommandFactory;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
+
+/**
+ * Concrete implementation of {@link ICustomizationCommandFactory}.
+ */
+public class CustomizationCommandFactory implements
+ ICustomizationCommandFactory {
+
+ private final EditingDomain editingDomain;
+
+ public CustomizationCommandFactory(final EditingDomain editingDomain) {
+ if (editingDomain == null) {
+ throw new IllegalArgumentException(
+ "The given EditingDomain cannot be null"); //$NON-NLS-1$
+ }
+ this.editingDomain = editingDomain;
+ }
+
+ /**
+ * Create an {@link AddCommand} to add the element to the owner.
+ *
+ * @param owner
+ * the owner.
+ * @param element
+ * the element to add.
+ * @return the command.
+ */
+ private Command createAddCommand(final Object owner, final Object element) {
+ if (owner == null) {
+ throw new IllegalArgumentException("The given owner cannot be null"); //$NON-NLS-1$
+ }
+ if (element == null) {
+ throw new IllegalArgumentException(
+ "The given element cannot be null"); //$NON-NLS-1$
+ }
+ return AddCommand.create(this.editingDomain, owner,
+ getEStructuralFeature(element), element);
+ }
+
+ /**
+ * Return the {@link EStructuralFeature} for a given element.
+ *
+ * @param element
+ * the element.
+ * @return the eStructuralFeature for the element.
+ */
+ private static EStructuralFeature getEStructuralFeature(final Object element) {
+ EStructuralFeature result = null;
+ if (element instanceof EClassCustomization) {
+ result = EcorePackage.eINSTANCE.getEPackage_EClassifiers();
+ }
+ return result;
+ }
+
+ public Command createEClassCustomization(final Customization parent,
+ final EClassCustomization eClassCustom) {
+ return createAddCommand(parent, eClassCustom);
+ }
+
+ public Command createFacetCustomization(final Customization parent,
+ final FacetCustomization facetCustom) {
+ return createAddCommand(parent, facetCustom);
+ }
+
+ public Command addValueInCase(final ETypedElementCase elementCase,
+ final Query value) {
+ return createAddCommand(elementCase, value);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationCommandFactoryFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationCommandFactoryFactory.java
new file mode 100644
index 00000000000..b96f8240d28
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/CustomizationCommandFactoryFactory.java
@@ -0,0 +1,26 @@
+/**
+ * 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:
+ * Grégoire Dupé (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ */
+package org.eclipse.emf.facet.custom.sdk.core.internal;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.facet.custom.sdk.core.ICustomizationCommandFactory;
+import org.eclipse.emf.facet.custom.sdk.core.ICustomizationCommandFactoryFactory;
+
+public class CustomizationCommandFactoryFactory implements
+ ICustomizationCommandFactoryFactory {
+
+ public ICustomizationCommandFactory createICustomizationCommandFactory(
+ final EditingDomain editingDomain) {
+ return new CustomizationCommandFactory(editingDomain);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/AvoidEClassOverlayConstraint.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/AvoidEClassOverlayConstraint.java
new file mode 100644
index 00000000000..b8081af3e8d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/AvoidEClassOverlayConstraint.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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 375054 - Add validation warning for overlay on EClass
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.sdk.core.internal.validation;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.custom.metamodel.v0_2_0.custom.EClassCustomization;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.DerivedTypedElement;
+import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetOperation;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ * Creates a warning if a {@link FacetOperation} defined in an {@link EClassCustomization} overrides (i.e. customizes)
+ * an overlay operation.
+ */
+public class AvoidEClassOverlayConstraint extends AbstractModelConstraint {
+
+ private static final List<String> OVERLAY_OPS = Arrays.asList(
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/topLeftOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/topMiddleOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/topRightOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/bottomLeftOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/bottomMiddleOverlay", //$NON-NLS-1$
+ "platform:/plugin/org.eclipse.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/bottomRightOverlay" //$NON-NLS-1$
+ );
+
+ @Override
+ public IStatus validate(final IValidationContext ctx) {
+ IStatus result = ctx.createSuccessStatus();
+ final EObject target = ctx.getTarget();
+ if (target instanceof FacetOperation) {
+ final FacetOperation facetOperation = (FacetOperation) target;
+ final DerivedTypedElement override = facetOperation.getOverride();
+ final URI overrideURI = EcoreUtil.getURI(override);
+ if (facetOperation.eContainer() instanceof EClassCustomization
+ && AvoidEClassOverlayConstraint.OVERLAY_OPS.contains(overrideURI.toString())) {
+ result = ctx.createFailureStatus();
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/CustomizationValidationBuilder.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/CustomizationValidationBuilder.java
new file mode 100644
index 00000000000..666d02d586b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/CustomizationValidationBuilder.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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 375054 - Add validation warning for overlay on EClass
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.sdk.core.internal.validation;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.common.sdk.core.internal.exported.IEmfFacetProjectBuilder;
+import org.eclipse.emf.facet.custom.core.internal.exported.Constants;
+import org.eclipse.emf.validation.marker.MarkerUtil;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.ModelValidationService;
+
+/** A builder that validates customization model files. */
+public class CustomizationValidationBuilder implements IEmfFacetProjectBuilder, IResourceDeltaVisitor, IResourceVisitor {
+
+ public IProject[] build(final IncrementalProjectBuilder builder, final int kind, final Map<?, ?> args, final IProgressMonitor monitor) throws CoreException {
+ if (kind == IncrementalProjectBuilder.FULL_BUILD) {
+ fullBuild(builder);
+ } else {
+ final IResourceDelta delta = builder.getDelta(builder.getProject());
+ if (delta == null) {
+ fullBuild(builder);
+ } else {
+ incrementalBuild(delta);
+ }
+ }
+ return new IProject[0];
+ }
+
+ public void clean(final IncrementalProjectBuilder builder, final IProgressMonitor monitor) throws CoreException {
+ builder.getProject().accept(new IResourceVisitor() {
+ public boolean visit(final IResource resource) throws CoreException {
+ if (isCustomizationFile(resource)) {
+ resource.deleteMarkers(MarkerUtil.VALIDATION_MARKER_TYPE, true, IResource.DEPTH_INFINITE);
+ }
+ return true;
+ }
+ });
+ }
+
+ private void incrementalBuild(final IResourceDelta delta) throws CoreException {
+ delta.accept(this);
+ }
+
+ private void fullBuild(final IncrementalProjectBuilder builder) throws CoreException {
+ builder.getProject().accept(this);
+ }
+
+ protected static boolean isCustomizationFile(final IResource resource) {
+ return resource.getType() == IResource.FILE
+ && Constants.CUSTOM_FILE_EXT
+ .equals(resource.getFileExtension());
+ }
+
+ public boolean visit(final IResourceDelta delta) throws CoreException {
+ if (isCustomizationFile(delta.getResource())) {
+ validate(delta.getResource());
+ }
+ return true;
+ }
+
+ public boolean visit(final IResource resource) throws CoreException {
+ if (Constants.CUSTOM_FILE_EXT.equals(resource.getFileExtension())) {
+ validate(resource);
+ }
+ return true;
+ }
+
+ protected static void validate(final IResource resource) throws CoreException {
+ if (resource.exists()) {
+ final IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance()
+ .newValidator(EvaluationMode.BATCH);
+ validator.setOption(IBatchValidator.OPTION_TRACK_RESOURCES, Boolean.TRUE);
+ final IStatus multiStatus = validator.validate(getAllContents(resource));
+ MarkerUtil.updateMarkers(multiStatus);
+ }
+ }
+
+ /** @return all the model elements contained in the given platform resource. */
+ public static List<EObject> getAllContents(final IResource resource) {
+ final List<EObject> result = new ArrayList<EObject>();
+ final ResourceSetImpl resourceSet = new ResourceSetImpl();
+ final Resource modelResource = resourceSet.getResource(URI.createPlatformResourceURI(resource.getFullPath().toString(), true), true);
+ final TreeIterator<EObject> allContents = EcoreUtil.getAllContents(modelResource, true);
+ while (allContents.hasNext()) {
+ result.add(allContents.next());
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/ValidationDelegateClientSelector.java b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/ValidationDelegateClientSelector.java
new file mode 100644
index 00000000000..cc56ae119af
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.custom.sdk.core/src/org/eclipse/emf/facet/custom/sdk/core/internal/validation/ValidationDelegateClientSelector.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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 375054 - Add validation warning for overlay on EClass
+ *******************************************************************************/
+package org.eclipse.emf.facet.custom.sdk.core.internal.validation;
+
+import org.eclipse.emf.validation.model.IClientSelector;
+
+/** Enables validation depending on a client context. */
+public class ValidationDelegateClientSelector implements IClientSelector {
+
+ public boolean selects(final Object object) {
+ // always enabled
+ return true;
+ }
+
+}

Back to the top