Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick tessier2014-02-10 12:45:32 +0000
committerPatrick tessier2014-02-10 12:45:32 +0000
commitdf1d4d493dc8ea4b4a81ad8da993f91df220431a (patch)
treef9621c66abaacba819a508e5626c3ced2c43b056 /plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core
parent74550693a485c6ff27748a6c5a9bfdae21b8bd5b (diff)
downloadorg.eclipse.papyrus-df1d4d493dc8ea4b4a81ad8da993f91df220431a.tar.gz
org.eclipse.papyrus-df1d4d493dc8ea4b4a81ad8da993f91df220431a.tar.xz
org.eclipse.papyrus-df1d4d493dc8ea4b4a81ad8da993f91df220431a.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.util.emf.core')
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.checkstyle11
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.classpath7
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.project40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.jdt.core.prefs77
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/API.README.txt13
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/META-INF/MANIFEST.MF34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/OSGI-INF/l10n/bundle.properties21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/about.html28
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/build.properties21
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.ecore8
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.genmodel12
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/plugin.xml48
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/catalogmanager.exsd96
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/modelViewer.exsd185
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd95
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/serialization.exsd136
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java53
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java90
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java86
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java57
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager.java64
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java83
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java40
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java253
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java24
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java23
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java25
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java47
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java162
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java187
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java36
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java23
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java105
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java71
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java26
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java54
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java212
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java133
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java66
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java33
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java32
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java35
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java29
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java34
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java41
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java121
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java151
-rw-r--r--plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java170
59 files changed, 3743 insertions, 0 deletions
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.checkstyle b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.checkstyle
new file mode 100644
index 00000000000..770a15aa024
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.checkstyle
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
+ <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"/>
+ </fileset>
+ <filter name="FilesFromPackage" enabled="true">
+ <filter-data value="src/org/eclipse/emf/facet/util/emf/core/serialization/model"/>
+ </filter>
+</fileset-config>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.classpath b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.project b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.project
new file mode 100644
index 00000000000..290460a7835
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.emf.facet.util.emf.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>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>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.core.resources.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..94183d066ea
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Thu Sep 22 10:55:09 CEST 2011
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.jdt.core.prefs b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..fb1ad0674ba
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,77 @@
+#Thu Oct 27 17:54:45 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.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=warning
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=warning
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/API.README.txt b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/API.README.txt
new file mode 100644
index 00000000000..a9c1c3b3454
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/API.README.txt
@@ -0,0 +1,13 @@
+/*******************************************************************************
+ * 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 341238 - We need to be able to specify which column have to be hidden/visible using the customization mechanism
+ *******************************************************************************/
+ org.eclipse.emf.facet.util.emf.core
+ x-friends:="org.eclipse.emf.facet.widgets.nattable" org.eclipse.emf.facet.widgets.nattable.internal.NatTableWidget need to use org.eclipse.emf.facet.util.emf.core.internal.EMFUtils
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/META-INF/MANIFEST.MF b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..c037787185a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/META-INF/MANIFEST.MF
@@ -0,0 +1,34 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.emf.facet.util.emf.core;singleton:=true
+Bundle-Version: 0.4.0.qualifier
+Bundle-Activator: org.eclipse.emf.facet.util.emf.core.internal.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;bundle-version="2.2.0",
+ org.eclipse.papyrus.emf.facet.util.emf.catalog;bundle-version="0.1.0";visibility:=reexport,
+ org.eclipse.emf.facet.common.core;bundle-version="0.1.0",
+ org.eclipse.papyrus.emf.facet.util.core;bundle-version="0.1.0",
+ org.eclipse.core.resources;bundle-version="3.6.0",
+ org.eclipse.emf.edit;bundle-version="2.6.0",
+ 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.util.emf.core,
+ org.eclipse.emf.facet.util.emf.core.command,
+ org.eclipse.emf.facet.util.emf.core.exception,
+ org.eclipse.emf.facet.util.emf.core.internal;
+ x-friends:="org.eclipse.emf.facet.util.emf.core.tests,
+ org.eclipse.emf.facet.widgets.nattable,
+ org.eclipse.papyrus.emf.facet.efacet.core,
+ org.eclipse.papyrus.emf.facet.util.emf.ui",
+ org.eclipse.emf.facet.util.emf.core.internal.catalog;x-internal:=true,
+ org.eclipse.emf.facet.util.emf.core.internal.exported,
+ org.eclipse.emf.facet.util.emf.core.internal.preferences,
+ org.eclipse.emf.facet.util.emf.core.internal.registry;x-internal:=true,
+ org.eclipse.emf.facet.util.emf.core.internal.serialization;x-internal:=true,
+ org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;x-internal:=true,
+ org.eclipse.emf.facet.util.emf.core.serialization,
+ org.eclipse.emf.facet.util.emf.core.serialization.model.serialization,
+ org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl;x-internal:=true
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/OSGI-INF/l10n/bundle.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..6b974421890
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# 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:
+# Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+# Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+# Gregoire Dupe (Mia-Software) - Bug 334000 Simple catalog manager
+# Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+###############################################################################
+#Properties file for org.eclipse.emf.facet.util.emf.core
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = EMF Utils (Incubation)
+extension-point.name = catalogManager
+extension-point.name.0 = modeldeclaration
+
+model.viewer.extension-point.name = Model Viewer
+serialization.extension-point.name = Serialization \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/about.html b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/about.html
new file mode 100644
index 00000000000..d1714826b27
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.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>January 4, 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.util.emf.core/build.properties b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/build.properties
new file mode 100644
index 00000000000..1c065f0b7be
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/build.properties
@@ -0,0 +1,21 @@
+###############################################################################
+# 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) - initial API and implementation
+# Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ OSGI-INF/,\
+ about.html,\
+ schema/,\
+ model/
+src.includes = about.html
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.ecore b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.ecore
new file mode 100644
index 00000000000..2ed9219c2e0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.ecore
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="serialization"
+ nsURI="http://www.eclipse.org/emf/facet/serialization/0.1.incubation" nsPrefix="serialization">
+ <eClassifiers xsi:type="ecore:EDataType" name="ExtensibleSerializableJavaObject"
+ instanceClassName="java.lang.Object"/>
+</ecore:EPackage>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.genmodel b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.genmodel
new file mode 100644
index 00000000000..22baddb8b06
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/model/serialization.genmodel
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2011 Mia-Software.&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA;Contributors:&#xD;&#xA; Nicolas Bros (Mia-Software) - initial API and implementation"
+ modelDirectory="/org.eclipse.emf.facet.util.emf.core/src" modelPluginID="org.eclipse.emf.facet.util.emf.core"
+ modelName="Serialization" nonNLSMarkers="true" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0" copyrightFields="false">
+ <foreignModel>serialization.ecore</foreignModel>
+ <genPackages prefix="Serialization" basePackage="org.eclipse.emf.facet.util.emf.core.serialization.model"
+ disposableProviderFactory="true" ecorePackage="serialization.ecore#/">
+ <genDataTypes ecoreDataType="serialization.ecore#//ExtensibleSerializableJavaObject"/>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/plugin.xml b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/plugin.xml
new file mode 100644
index 00000000000..f7d9021d965
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/plugin.xml
@@ -0,0 +1,48 @@
+<?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 334000 Simple catalog manager
+ Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ Nicolas Guyomar (Mia-Software) - Bug 339899 - everything must be externalized before UI freeze
+-->
+<plugin>
+ <extension-point id="modelViewer" name="%model.viewer.extension-point.name" schema="schema/modelViewer.exsd"/>
+ <extension-point id="org.eclipse.emf.facet.util.emf.core.catalogmanager" name="%extension-point.name" schema="schema/catalogmanager.exsd"/>
+ <extension-point id="org.eclipse.emf.facet.util.emf.core.modeldeclaration" name="%extension-point.name.0" schema="schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd"/>
+ <extension-point id="serialization" name="%serialization.extension-point.name" schema="schema/serialization.exsd"/>
+
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.util.emf.core.serialization">
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.StringSerializer">
+ </serializer>
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.IntegerSerializer">
+ </serializer>
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.BooleanSerializer">
+ </serializer>
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.IResourceSerializer">
+ </serializer>
+ <serializer
+ class="org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers.EMFURISerializer">
+ </serializer>
+ </extension>
+
+</plugin>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/catalogmanager.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/catalogmanager.exsd
new file mode 100644
index 00000000000..7b6709e5eca
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/catalogmanager.exsd
@@ -0,0 +1,96 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.util.emf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.util.emf.core" id="catalogmanager" name="EMF Facet Catalog Manager"/>
+ </appinfo>
+ <documentation>
+ Allows the registration of a ICatalogManager
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="catalog" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="catalog">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements the catalog.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.core.ICatalogManager"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.2.0
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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 334000 Simple catalog manager
+ Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ Nicolas Bros (Mia-Software) - Bug 371631 - Wrong definition for &quot;catalogmanager&quot; extension point
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/modelViewer.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/modelViewer.exsd
new file mode 100644
index 00000000000..53b84cb5c6d
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/modelViewer.exsd
@@ -0,0 +1,185 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.util.emf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.util.emf.core" id="modelViewer" name="Model Viewer"/>
+ </appinfo>
+ <documentation>
+ A model viewer for an EPackage, EObject and/or Resource can be declared with this extension point.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="ePackageViewer" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="eObjectViewer" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="resourceViewer" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="ePackageViewer">
+ <annotation>
+ <documentation>
+ Registers a model browser that is capable of opening itself on an EPackage.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements IEPackageBrowserOpener.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.ui.IEPackageBrowserOpener"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="eObjectViewer">
+ <annotation>
+ <documentation>
+ Registers a model browser that is capable of opening itself on an EObject.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements IEObjectBrowserOpener.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.ui.IEObjectBrowserOpener"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="resourceViewer">
+ <annotation>
+ <documentation>
+ Registers a model browser that is capable of opening itself on a Resource.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements IResourceBrowserOpener.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.ui.IResourceBrowserOpener"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ For example, the MoDisco model browser is registered like this in &lt;strong&gt;org.eclipse.gmt.modisco.infra.browser&lt;/strong&gt;:
+&lt;pre&gt;
+ &lt;extension
+ point=&quot;org.eclipse.emf.facet.util.emf.core.modelViewer&quot;&gt;
+ &lt;resourceViewer
+ class=&quot;org.eclipse.gmt.modisco.infra.browser.opener.BrowserOpener&quot;&gt;
+ &lt;/resourceViewer&gt;
+ &lt;eObjectViewer
+ class=&quot;org.eclipse.gmt.modisco.infra.browser.opener.BrowserOpener&quot;&gt;
+ &lt;/eObjectViewer&gt;
+ &lt;ePackageViewer
+ class=&quot;org.eclipse.gmt.modisco.infra.browser.opener.BrowserOpener&quot;&gt;
+ &lt;/ePackageViewer&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ You must implement a subset or all of these interfaces:&lt;ul&gt;
+&lt;li&gt;IEObjectBrowserOpener to open an EObject
+&lt;li&gt;IEPackageBrowserOpener to open an EPackage
+&lt;li&gt;IResourceBrowserOpener to open a Resource
+&lt;/ul&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ &lt;strong&gt;org.eclipse.gmt.modisco.infra.browser&lt;/strong&gt; implements this extension.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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:
+ Nicolas Guyomar (Mia-Software) - initial API and implementation
+ Fabien Giquel (Mia-Software)
+ Nicolas Bros (Mia-Software)
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd
new file mode 100644
index 00000000000..9ac24749182
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/org.eclipse.emf.facet.util.emf.core.modeldeclaration.exsd
@@ -0,0 +1,95 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.util.emf.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.facet.util.emf.core" id="org.eclipse.emf.facet.util.emf.core.modeldeclaration" name="modeldeclaration"/>
+ </appinfo>
+ <documentation>
+ Allows the registration of an EMF model.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="modeldeclaration" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="modeldeclaration">
+ <complexType>
+ <attribute name="file" type="string">
+ <annotation>
+ <documentation>
+ an emf model file
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.1.0
+ </documentation>
+ </annotation>
+
+
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ 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 334000 Simple catalog manager
+ Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/serialization.exsd b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/serialization.exsd
new file mode 100644
index 00000000000..4243294d832
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/schema/serialization.exsd
@@ -0,0 +1,136 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.facet.widgets.celleditors" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.emf.facet.widgets.celleditors" id="serialization" name="Serialization"/>
+ </appInfo>
+ <documentation>
+ This extension point is used to specify an implementation for serializing specific types.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="serializer" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="serializer">
+ <annotation>
+ <documentation>
+ Defines a serializer.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ A class that implements the interface ISerializer to provide an implementation for the serialization of a type.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.facet.util.emf.core.ISerializer"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 0.1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;
+A serializer can be registered like this:
+&lt;pre&gt;
+ &lt;extension point=&quot;org.eclipse.emf.facet.util.emf.core.serialization&quot;&gt;
+ &lt;serializer class=&quot;com.example.MyTypeSerializer&quot;/&gt;
+ &lt;/extension&gt;
+&lt;/pre&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;
+A serializer must implement the interface ISerializer&lt;T&gt; :
+&lt;ul&gt;
+&lt;li&gt;getType : return the type that can be serialized by this serializer (this is required for loading the class from the correct bundle).
+&lt;li&gt;serialize : takes a value and serializes it to a String
+&lt;li&gt;deserialize : takes a String and deserializes it back to a value
+&lt;/ul&gt;
+&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ &lt;p&gt;See default serializers registered in plug-in &quot;org.eclipse.emf.facet.util.emf.core&quot;, defined in package &quot;org.eclipse.emf.facet.util.emf.core.serialization&quot;.&lt;/p&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ 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:
+ Nicolas Bros (Mia-Software) - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java
new file mode 100644
index 00000000000..e7bfe0737da
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/CommandFactory.java
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2011 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.core.internal.command.SetResourceContentCommand;
+
+public final class CommandFactory {
+
+ private CommandFactory() {
+ //Must not be called
+ }
+
+ /**
+ * This method creates a command to set a collection of element to a resource
+ * @param resource the resource to set
+ * @param content a collection of EObject to set as the content of the resource.
+ * @return an EMF Command
+ */
+ public static Command createSetResourceContentsCommand(final Resource resource,
+ final Collection<EObject> content) {
+ Command result = new SetResourceContentCommand(resource, content);
+ return result;
+ }
+
+ /**
+ * This method creates a command to set an EObject to a resource
+ * @param resource the resource to set
+ * @param eObject an EObject to set as the content of the resource.
+ * @return an EMF Command
+ */
+ public static Command createSetResourceContentsCommand(final Resource resource,
+ final EObject eObject) {
+ List<EObject> content = new ArrayList<EObject>();
+ content.add(eObject);
+ Command result = createSetResourceContentsCommand(resource, content);
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java
new file mode 100644
index 00000000000..a15168252b9
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/EmfDebugUtils.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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 366804 - [Restructuring] Table widget upgrade
+ * Grégoire Dupé (Mia-Software) - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2] org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925
+ * Grégoire Dupé (Mia-Software) - Bug 367700 - [Unit Test Failure][0.2/3.8] org.eclipse.emf.facet.widgets.table.tests.internal.v0_2.swtbot.NatTableUITests.testOpenLoadCustomizationDialog
+ * Grégoire Dupé (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core;
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+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.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.facet.util.core.DebugUtils;
+import org.eclipse.emf.facet.util.emf.core.exception.DebugRuntimeException;
+
+/**
+ * @since 0.2
+ */
+public final class EmfDebugUtils {
+
+ private EmfDebugUtils() {
+ // Must not be used
+ }
+
+ public static String debugCommand(final Command command) {
+ return debugCommand(command, 1);
+ }
+
+ private static String debugCommand(final Command command, final int indent) {
+ StringBuffer result = new StringBuffer();
+ result.append('\n');
+ for (int i = 0; i < indent; i++) {
+ result.append("--"); //$NON-NLS-1$
+ }
+ result.append(command.getClass().getSimpleName());
+ result.append(" \""); //$NON-NLS-1$
+ result.append(command.getLabel());
+ result.append("\" "); //$NON-NLS-1$
+ result.append(" canExecute="); //$NON-NLS-1$
+ result.append(command.canExecute());
+ result.append(" ("); //$NON-NLS-1$
+ result.append(command.getClass().getName());
+ result.append(')');
+ if (command instanceof CompoundCommand) {
+ CompoundCommand compoundCommand = (CompoundCommand) command;
+ for (Command subCommand : compoundCommand.getCommandList()) {
+ result.append(debugCommand(subCommand, indent + 1));
+ }
+ }
+ return result.toString();
+ }
+
+ /**
+ * This method can be used to easily dump a model into a file. This method has been written to be
+ * used by unit tests.
+ *
+ * @param eObject
+ * @param fileExtension
+ * @return a string explaining where the file has been saved.
+ */
+ public static String getStateDumpMessage(final EObject eObject, final String fileExtension) {
+ final File file = new File(DebugUtils.getCallerLocation(1) + '.' + fileExtension);
+ URI uri = URI.createFileURI(file.getAbsolutePath());
+ ResourceSet resourceSet = new ResourceSetImpl();
+ Resource resource = resourceSet.createResource(uri);
+ resource.getContents().add(EcoreUtil.copy(eObject));
+ try {
+ resource.save(Collections.EMPTY_MAP);
+ } catch (IOException e) {
+ throw new DebugRuntimeException(e);
+ }
+ return "A model containing the dumped EObject has been saved in " + file.getAbsolutePath(); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java
new file mode 100644
index 00000000000..e8fd6df4e16
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IBrowserRegistry.java
@@ -0,0 +1,86 @@
+/**********************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Fabien Giquel (Mia-Software) -Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ ***********************************************************************************/
+package org.eclipse.emf.facet.util.emf.core;
+
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.core.internal.registry.BrowserRegistry;
+
+/**
+ * A registry for the {@link EObject}, {@link EPackage}, and {@link Resource} browser opener
+ * extension point. It can be used to open a default model browser (chosen by the user) or get a
+ * list of model browsers that can be opened on a model element, {@link EPackage} or
+ * {@link Resource}.
+ */
+public interface IBrowserRegistry {
+
+ public static IBrowserRegistry INSTANCE = new BrowserRegistry();
+
+ /**
+ * Browse the given package using the default EPackage browser opener
+ *
+ * @param ePackage
+ * the element to browse
+ */
+ public void browseEPackage(EPackage ePackage);
+
+ /**
+ * Browse the given resource using the default Resource browser opener
+ *
+ * @param resource
+ * the element to browse
+ */
+ public void browseResource(Resource resource);
+
+ /**
+ * Browse the given eObject using the default EObject browser opener
+ *
+ * @param eObject
+ * the element to browse
+ */
+ public void browseEObject(EObject eObject);
+
+ /**
+ * @return the registered EPackage browser openers
+ */
+ public List<IEPackageBrowserOpener> getAllRegisteredEPackageBrowsers();
+
+ /**
+ * @return the registered EObject browser openers
+ */
+ public List<IEObjectBrowserOpener> getAllRegisteredEObjectBrowsers();
+
+ /**
+ * @return the registered Resource browser openers
+ */
+ public List<IResourceBrowserOpener> getAllRegisteredResourceBrowsers();
+
+ /**
+ * @return the default EPackage browser opener, can be <code>null</code>
+ */
+ public IEPackageBrowserOpener getDefaultEPackageBrowserOpener();
+
+ /**
+ * @return the default EObject browser opener, can be <code>null</code>
+ */
+ public IEObjectBrowserOpener getDefaultEObjectBrowserOpener();
+
+ /**
+ * @return the default Resource browser opener, can be <code>null</code>
+ */
+ public IResourceBrowserOpener getDefaultResourceBrowserOpener();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java
new file mode 100644
index 00000000000..5c4e1d50a13
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogManager.java
@@ -0,0 +1,57 @@
+/**
+ * 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 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManager;
+
+/**
+ * Manager for catalogs containing registered elements defined in models.
+ *
+ * @since 0.2
+ * @noextend This interface is not intended to be extended by clients.
+ */
+public interface ICatalogManager {
+
+ /**
+ * Return <code>true</code> if the eObject can be managed as a catalog entry.
+ *
+ * @param root
+ * the root element of a catalog
+ * @return whether the given element is of the right type to be a catalog root
+ */
+ public boolean canBeManaged(EObject root);
+
+ /**
+ * This method is called by {@link CatalogSetManager} when a model registration that can be
+ * managed (according to {@link ICatalogManager#canBeManaged(EObject) canBeManaged}) is detected
+ * while loading. This method adds the given root model element to the catalog.
+ *
+ * @param root
+ * a root element of a model that should be added to the catalog
+ */
+ public void manage(EObject root);
+
+ /**
+ * This method is called by the {@link CatalogSetManager} after the instantiation of this
+ * {@link ICatalogManager}. This method must attach the catalog(s) managed by this
+ * {@link ICatalogManager} to the given <code>catalogSet</code>.
+ *
+ * @param catalogSet
+ * the {@link CatalogSet} to which the catalog managed by this
+ * {@link ICatalogManager} should be attached
+ */
+ public void setCatalogSet(CatalogSet catalogSet);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager.java
new file mode 100644
index 00000000000..6f6a377dea8
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager.java
@@ -0,0 +1,64 @@
+/**
+ * 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 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334529 ICatalogManager should be exposed in org.eclipse.emf.facet.common.core
+ * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Gregoire Dupe (Mia-Software) - Bug 362084 - Get the instance of a catalog manager
+ * Gregoire Dupe (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManager;
+import org.osgi.framework.Bundle;
+
+/**
+ * @deprecated This interface has been replaced by {@link ICatalogSetManager2}
+ */
+@Deprecated
+public interface ICatalogSetManager {
+
+ /**
+ * This method returns the {@link CatalogSet} object which contains all the registered catalogs.
+ *
+ * @return the set of registered {@link Catalog}s
+ */
+ public CatalogSet getCatalogSet();
+
+ /**
+ * The singleton instance of this {@link ICatalogSetManager}.
+ */
+ public static ICatalogSetManager INSTANCE = CatalogSetManager.INSTANCE;
+
+ /**
+ * Return the bundle containing the file from which we have created the given resource.
+ *
+ * @param eResource
+ * @return the Bundle matching the given resource.
+ * @author Nicolas Guyomar
+ */
+ public Bundle getBundleByResource(Resource eResource);
+
+ /**
+ * This method takes a file to register it as a "modelDeclaration" extension in its containing
+ * plug-in.
+ *
+ * @param file
+ * the file to be registered as a "modelDeclaration"
+ * @throws InvalidFacetSetException
+ */
+ public void registerModelDeclaration(IFile file) throws InvalidFacetSetException;
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java
new file mode 100644
index 00000000000..22fd15e1416
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManager2.java
@@ -0,0 +1,83 @@
+/**
+ * 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 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334529 ICatalogManager should be exposed in org.eclipse.emf.facet.common.core
+ * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Gregoire Dupe (Mia-Software) - Bug 362084 - Get the instance of a catalog manager
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.catalog.Catalog;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManager;
+import org.osgi.framework.Bundle;
+
+/**
+ * @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 ICatalogSetManager2 {
+
+ /**
+ * This method returns the {@link CatalogSet} object which contains all the registered catalogs.
+ *
+ * @return the set of registered {@link Catalog}s
+ */
+ public CatalogSet getCatalogSet();
+
+ /**
+ * The singleton instance of this {@link ICatalogSetManager2}.
+ *
+ * @deprecated has been replaced by
+ * org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory
+ * .createICatalogSetManager(ResourceSet)
+ */
+ @Deprecated
+ public static ICatalogSetManager2 INSTANCE = CatalogSetManager.INSTANCE;
+
+ /**
+ * Return the bundle containing the file from which we have created the given resource.
+ *
+ * @param eResource
+ * the EMF Resource
+ * @return the {@link Bundle} matching the given resource, or <code>null</code> if the resource
+ * is not defined in a Bundle.
+ * @throws IllegalArgumentException
+ * if the resource is <code>null</code>
+ *
+ * @author Nicolas Guyomar
+ */
+ public Bundle getBundleByResource(Resource eResource);
+
+ /**
+ * This method takes a file to register it as a "modelDeclaration" extension in its containing
+ * plug-in.
+ *
+ * @param file
+ * the file to be registered as a "modelDeclaration"
+ * @throws InvalidFacetSetException
+ */
+ public void registerModelDeclaration(IFile file) throws InvalidFacetSetException;
+
+ /**
+ * Return the registered catalogs conforming to the parameter class.
+ *
+ * @return a list of {@link ICatalogManager}
+ */
+ public <T> List<T> getCatalogManagerByType(Class<? extends T> catalogManagerClass);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.java
new file mode 100644
index 00000000000..259367aaa44
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ICatalogSetManagerFactory.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:
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.util.emf.core.internal.catalog.CatalogSetManagerFactory;
+
+/**
+ * @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 ICatalogSetManagerFactory {
+ ICatalogSetManagerFactory DEFAULT = new CatalogSetManagerFactory();
+
+ ICatalogSetManager2 createICatalogSetManager(ResourceSet resourceSet);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.java
new file mode 100644
index 00000000000..9808529d9e6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEObjectBrowserOpener.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:
+ * Fabien Giquel (Mia-Software)
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * This class is used to register a Browser (typically an Eclipse editor or view), that can be
+ * opened from a given EObject. The registration is done through the
+ * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point.
+ */
+public interface IEObjectBrowserOpener {
+
+ /**
+ * This method opens the given {@link EObject} with the browser corresponding to this
+ * {@link IEObjectBrowserOpener}.
+ *
+ * @param eObject
+ * the {@link EObject} to be opened
+ */
+ public void openEObject(final EObject eObject);
+
+ /**
+ * Return a human readable name for the {@link EObject} browser.
+ *
+ * @return a human readable name for the {@link EObject} browser
+ */
+ public String getBrowserName();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.java
new file mode 100644
index 00000000000..ee489e7f91e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IEPackageBrowserOpener.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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.EPackage;
+
+/**
+ * This class is used to register a Browser (typically an Eclipse editor or view), that can be
+ * opened from a given EPackage. The registration is done through the
+ * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point.
+ */
+public interface IEPackageBrowserOpener {
+
+ /**
+ * This method opens the given {@link EPackage} with the browser corresponding to this
+ * {@link IEPackageBrowserOpener}.
+ *
+ * @param ePackage
+ * the {@link EPackage} to be opened
+ */
+ public void openEPackage(final EPackage ePackage);
+
+ /**
+ * Return a human readable name for the {@link EPackage} browser.
+ *
+ * @return a human readable name for the {@link EPackage} browser
+ */
+ public String getBrowserName();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.java
new file mode 100644
index 00000000000..9fe3b0baf76
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/IResourceBrowserOpener.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:
+ * Fabien Giquel (Mia-Software)
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core;
+
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * This class is used to register a Browser (typically an Eclipse editor or view), that can be
+ * opened from a given EMF Resource. The registration is done through the
+ * "org.eclipse.emf.facet.util.emf.core.modelViewer" extension point.
+ */
+public interface IResourceBrowserOpener {
+
+ /**
+ * This method opens the given {@link Resource} with the browser corresponding to this
+ * {@link IResourceBrowserOpener}.
+ *
+ * @param resource
+ * the {@link Resource} to be opened
+ */
+ public void openResource(final Resource resource);
+
+ /**
+ * Return a human readable name for the {@link Resource} browser.
+ *
+ * @return a human readable name for the {@link Resource} browser
+ */
+ public String getBrowserName();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java
new file mode 100644
index 00000000000..e48aa19706f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/ModelUtils.java
@@ -0,0 +1,253 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010, 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 366367 - To be able to change the "CanBePresentedInTheTable" query
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ * Gregoire Dupe (Mia-Software) - Bug 371367 - Hierarchical FacetSets
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ * Gregoire Dupe (Mia-Software) - Bug 387470 - [EFacet][Custom] Editors
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.core.internal.exported.StringUtils;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+
+/**
+ * Utility class for models.
+ * @since 0.2
+ */
+public final class ModelUtils {
+
+ /**
+ * Meta-model qualified name separator
+ */
+ private static final String MM_QNAME_SEPARATOR = "::"; //$NON-NLS-1$
+
+ /**
+ * Utility classes don't need to (and shouldn't) be instantiated.
+ */
+ private ModelUtils() {
+ // prevents instantiation
+ }
+
+ /**
+ * Computes a list of {@link EObject}s from the same {@link ResourceSet} as
+ * <code>source</code> that can be assigned to the given feature.
+ */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.computeAssignableElements(EStructuralFeature, EObject)
+ public static List<EObject> computeAssignableElements(final EStructuralFeature feature,
+ final EObject source) {
+ EClassifier eType = feature.getEType();
+
+ // build a list of EObjects assignable to the EReference
+ List<EObject> list = new ArrayList<EObject>();
+ Resource eResource = source.eResource();
+ ResourceSet resourceSet = eResource.getResourceSet();
+ TreeIterator<Notifier> allContents = resourceSet.getAllContents();
+ while (allContents.hasNext()) {
+ Notifier notifier = allContents.next();
+ if (notifier instanceof EObject) {
+ EObject eObject = (EObject) notifier;
+ if (eType.isInstance(eObject)) {
+ list.add(eObject);
+ }
+ }
+ }
+ return list;
+ }
+
+ public static boolean isBooleanDataType(final EClassifier classifier) {
+ if (classifier instanceof EDataType) {
+ EDataType dataType = (EDataType) classifier;
+ Class<?> instanceClass = dataType.getInstanceClass();
+ return instanceClass == Boolean.class || instanceClass == boolean.class;
+ }
+ return false;
+ }
+
+ /**
+ * Find all subclasses of the given metaclass in the package registry
+ *
+ * @param context
+ * the metaclass whose subclasses must be found
+ * @return all the subclasses
+ */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.allSubClasses(final EClass context)
+ public static List<EClass> allSubClasses(final EClass context) {
+ List<EClass> result = new ArrayList<EClass>();
+ // Set<Resource> resources = new HashSet<Resource>();
+ Collection<String> uris = new ArrayList<String>(EPackage.Registry.INSTANCE.keySet());
+ for (String ePackageURI : uris) {
+ try {
+ EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(ePackageURI);
+ EList<EClassifier> eClassifiers = ePackage.getEClassifiers();
+ for (EClassifier eClassifier : eClassifiers) {
+ if (eClassifier instanceof EClass) {
+ EClass eClass = (EClass) eClassifier;
+ if (isSuperTypeOf(context, eClass)) {
+ result.add(eClass);
+ }
+ }
+ }
+ } catch (Exception e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ return result;
+ }
+
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.isSuperTypeOf(final EClass self, final EClass typeDeclaration)
+ public static boolean isSuperTypeOf(final EClass self, final EClass typeDeclaration) {
+ return typeDeclaration.getEAllSuperTypes().contains(self);
+ }
+
+ /** @return the qualified name of the given metaclass */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getMetaclassQualifiedName(final EClassifier eClass)
+ public static String getMetaclassQualifiedName(final EClassifier eClass) {
+ final ArrayList<String> qualifiedNameParts = new ArrayList<String>();
+ final StringBuilder builder = new StringBuilder();
+
+ EPackage ePackage = eClass.getEPackage();
+ while (ePackage != null) {
+ qualifiedNameParts.add(ePackage.getName());
+ ePackage = ePackage.getESuperPackage();
+ }
+
+ for (int i = qualifiedNameParts.size() - 1; i >= 0; i--) {
+ builder.append(qualifiedNameParts.get(i) + "."); //$NON-NLS-1$
+ }
+
+ builder.append(eClass.getName());
+
+ return builder.toString();
+ }
+
+ /**
+ * Returns a name for the given model element from the EMF global registry,
+ * or use a default name taken from a String attribute.
+ *
+ * @return a name for the given element
+ */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getName(EObject)
+ public static String getName(final EObject eObject) {
+ IItemLabelProvider itemLabelProvider = (IItemLabelProvider) new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE).adapt(eObject, IItemLabelProvider.class);
+ if (itemLabelProvider != null) {
+ return itemLabelProvider.getText(eObject);
+ }
+ return ModelUtils.getDefaultName(eObject);
+ }
+
+ /**
+ * @return a default name based on a string feature of the given
+ * {@link EObject}
+ */
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getDefaultName(EObject)
+ public static String getDefaultName(final EObject eObject) {
+ // find a feature that can be used as a name
+ final EStructuralFeature feature = ModelUtils.getLabelFeature(eObject.eClass());
+ if (feature != null) {
+ final Object value = eObject.eGet(feature);
+ if (value != null) {
+ return StringUtils.truncateBeforeNewline(value.toString());
+ }
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ //Copied from ReflectiveItemProvider class
+ //Copied from org.eclipse.emf.facet.infra.common.core.internal.utils.ModelUtils.getLabelFeature(EClass)
+ private static EStructuralFeature getLabelFeature(final EClass eClass) {
+ EAttribute result = null;
+ for (final EAttribute eAttribute : eClass.getEAllAttributes()) {
+ if (!eAttribute.isMany()
+ && eAttribute.getEType().getInstanceClass() != FeatureMap.Entry.class) {
+ if ("name".equalsIgnoreCase(eAttribute.getName())) { //$NON-NLS-1$
+ result = eAttribute;
+ break;
+ } else if (result == null) {
+ result = eAttribute;
+ } else if (eAttribute.getEAttributeType().getInstanceClass() == String.class
+ && result.getEAttributeType().getInstanceClass() != String.class) {
+ result = eAttribute;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @author Gregoire Dupe (Mia-Software)
+ * @param namedElement
+ * @return
+ */
+ public static String getQualifiedName(final ENamedElement namedElement) {
+ String parentQName = ""; //$NON-NLS-1$
+ if (namedElement.eContainer() instanceof ENamedElement) {
+ ENamedElement parent = (ENamedElement) namedElement.eContainer();
+ parentQName = getQualifiedName(parent) + ModelUtils.MM_QNAME_SEPARATOR;
+ }
+ return parentQName + namedElement.getName();
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static ResourceSet getOrCreateResourceSet(final EObject eObject) {
+ ResourceSet resourceSet = null;
+ if (eObject.eResource() == null) {
+ resourceSet = new ResourceSetImpl();
+ } else {
+ resourceSet = eObject.eResource().getResourceSet();
+ }
+ return resourceSet;
+ }
+
+ /**
+ * @since 0.3
+ */
+ public static IProject getProject(final EObject eObject) {
+ IProject result = null;
+ final Resource resource = eObject.eResource();
+ final URI uri = resource.getURI();
+ if (uri.isPlatformResource()) {
+ final String projectName = uri.segment(1);
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ result = workspace.getRoot()
+ .getProject(projectName);
+ }
+ return result;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java
new file mode 100644
index 00000000000..f853f3d5fbb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/EmfCommandUtils.java
@@ -0,0 +1,41 @@
+/**
+ * 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.util.emf.core.command;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+
+/**
+ * @since 0.3
+ */
+public final class EmfCommandUtils {
+
+ private EmfCommandUtils() {
+ // Must not be used
+ }
+
+ public static final Command createResult(final List<Command> commandList,
+ final String label) {
+ Command result = null;
+ while (commandList.contains(null)) {
+ commandList.remove(null);
+ }
+ if (!commandList.isEmpty()) {
+ result = new CompoundCommand(label, commandList);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java
new file mode 100644
index 00000000000..a4ffca99d8c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResult.java
@@ -0,0 +1,24 @@
+/**
+ * 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.util.emf.core.command;
+
+import org.eclipse.emf.common.command.Command;
+
+/**
+ * @since 0.2
+ */
+public interface ICommandFactoryResult<T> {
+ Command getCommand();
+ T getResult();
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.java
new file mode 100644
index 00000000000..a96b4d3a701
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ICommandFactoryResultFactory.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:
+ * 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.util.emf.core.command;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.facet.util.emf.core.internal.command.CommandFactoryResultFactory;
+
+/**
+ * @since 0.2
+ */
+public interface ICommandFactoryResultFactory {
+
+ ICommandFactoryResultFactory DEFAULT = new CommandFactoryResultFactory();
+
+ <T> ICommandFactoryResult<T> createCommandFactoryResult(Command command, T result);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java
new file mode 100644
index 00000000000..4a756ce01ee
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/command/ILockableUndoCommand.java
@@ -0,0 +1,23 @@
+/**
+ * Copyright (c) 2011 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table
+ */
+package org.eclipse.emf.facet.util.emf.core.command;
+
+/**
+ * This interface is used to force an EMF command to not be "undo-able"
+ * @since 0.1.1
+ */
+public interface ILockableUndoCommand {
+
+ /**
+ * @param enableUndo false to lock the command in an not "undo-able" mode
+ */
+ public void enableCanUndo(boolean enableUndo);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java
new file mode 100644
index 00000000000..64fa8b90f16
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/DebugRuntimeException.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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:
+ * Grégoire Dupé - Bug 365843 - [Unit Test Failure][0.2/3.8][0.2/4.2]org.eclipse.emf.facet.widgets.nattable.tests.swtbot.Bug344925Test.testBug344925
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.exception;
+
+/**
+ * @since 0.2
+ */
+public final class DebugRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = -2130942266962627760L;
+
+ public DebugRuntimeException(final Throwable throwable) {
+ super(throwable);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java
new file mode 100644
index 00000000000..d95231f1fc4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/exception/InvalidFacetSetException.java
@@ -0,0 +1,36 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
+ */
+package org.eclipse.emf.facet.util.emf.core.exception;
+
+/**
+ * This exception is raised when an invalid FacetSet is found
+ *
+ * @since 0.2
+ */
+public final class InvalidFacetSetException extends Exception {
+
+ private static final long serialVersionUID = -7684948344074635385L;
+
+ public InvalidFacetSetException(final String message) {
+ super(message);
+ }
+
+ public InvalidFacetSetException(final String message, final Throwable cause) {
+ super(message, cause);
+ }
+
+ public InvalidFacetSetException(final Throwable cause) {
+ super(cause);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java
new file mode 100644
index 00000000000..7f4418493e6
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/Activator.java
@@ -0,0 +1,47 @@
+/**
+ * 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 334000 - Simple catalog manager
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends Plugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.emf.facet.util.emf.core"; //$NON-NLS-1$
+
+ private static BundleContext context;
+ private static Activator plugin;
+
+ public static Plugin getDefault() {
+ return Activator.plugin;
+ }
+
+ static BundleContext getContext() {
+ return Activator.context;
+ }
+
+ @Override
+ public void start(final BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.plugin = this;
+ Activator.context = bundleContext;
+ }
+
+ @Override
+ public void stop(final BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ Activator.plugin = null;
+ super.stop(bundleContext);
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java
new file mode 100644
index 00000000000..2c153706cbe
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/EMFUtils.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Bros (Mia-Software) - Bug 340588 - Least common supertype
+ * Vincent Lorenzo (CEA-LIST) - bug 341328 - We need to be able to specify which column have to be hidden/visible using the customization mechanism
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+
+public final class EMFUtils {
+
+ private EMFUtils() {
+ // prevent instantiation
+ }
+
+ /**
+ * Computes the least common supertype of all the given metaclasses. That is, the most derived
+ * type that is a supertype of all the given classes.
+ *
+ * @param classes
+ * the list of metaclasses
+ *
+ * @return the least common supertype of all the given metaclasses, or <code>null</code> if
+ * there is none, or several. In this case, the only common supertype can be considered
+ * as {@link EObject} .
+ */
+ public static EClass computeLeastCommonSupertype(final Collection<EClass> classes) {
+ return computeLeastCommonSupertype(classes, null);
+ }
+
+ /**
+ * Computes the least common supertype of all the given metaclasses. That is, the most derived
+ * type that is a supertype of all the given classes.
+ *
+ * @param classes
+ * the list of metaclasses
+ * @param feature
+ * if not <code>null</code>, then only metaclasses that contain this feature will be
+ * considered
+ *
+ * @return the least common supertype of all the given metaclasses, or the {@link EObject}
+ * {@link EClass} if there is none, or several.
+ */
+ public static EClass computeLeastCommonSupertype(final Collection<EClass> classes,
+ final EStructuralFeature feature) {
+ Set<EClass> commonClasses = new HashSet<EClass>();
+ Iterator<EClass> iterator = classes.iterator();
+ boolean first = true;
+ while (iterator.hasNext()) {
+ EClass eClass = iterator.next();
+ if (first) {
+ commonClasses.addAll(eClass.getEAllSuperTypes());
+ commonClasses.add(eClass);
+ first = false;
+ } else {
+ List<EClass> filter = new ArrayList<EClass>(eClass.getEAllSuperTypes());
+ filter.add(eClass);
+ commonClasses.retainAll(filter);
+ }
+ }
+
+ Collection<EClass> commonClassesFiltered;
+ // keep only metaclasses that contain the feature
+ if (feature != null) {
+ commonClassesFiltered = new ArrayList<EClass>();
+ for (EClass eClass : commonClasses) {
+ if (eClass.getEAllStructuralFeatures().contains(feature)) {
+ commonClassesFiltered.add(eClass);
+ }
+ }
+ } else {
+ commonClassesFiltered = commonClasses;
+ }
+
+ // handle the easy (and common) cases early
+ int size = commonClassesFiltered.size();
+ if (size == 0) {
+ return EcorePackage.eINSTANCE.getEObject();
+ }
+ if (size == 1) {
+ return commonClassesFiltered.iterator().next();
+ }
+
+ // now, remove EClasses that are not a direct or indirect sub- or super-type
+ // of all the other classes.
+ ArrayList<EClass> list = new ArrayList<EClass>(commonClassesFiltered);
+ ListIterator<EClass> listIterator = list.listIterator();
+ while (listIterator.hasNext()) {
+ EClass eClass = listIterator.next();
+ for (EClass eClass2 : commonClassesFiltered) {
+ if (eClass != eClass2 && !eClass.isSuperTypeOf(eClass2)
+ && !eClass2.isSuperTypeOf(eClass)) {
+ listIterator.remove();
+ break;
+ }
+ }
+ }
+
+ int size2 = list.size();
+ if (size2 == 0) {
+ return EcorePackage.eINSTANCE.getEObject();
+ }
+ if (size2 == 1) {
+ return list.iterator().next();
+ }
+
+ // now commonClasses only contains classes in the same hierarchy,
+ // so we can sort them using a "is subtype of" comparison operator
+
+ Collections.sort(list, new Comparator<EClass>() {
+ public int compare(final EClass e1, final EClass e2) {
+ if (e1 == e2) {
+ return 0;
+ } else if (e1.isSuperTypeOf(e2)) {
+ return 1;
+ } else if (e2.isSuperTypeOf(e1)) {
+ return -1;
+ } else {
+ throw new IllegalStateException("comparing classes not in the same hierarchy"); //$NON-NLS-1$
+ }
+ }
+ });
+
+ if (list.isEmpty()) {
+ return EcorePackage.eINSTANCE.getEObject();
+ }
+ return list.get(0);
+ }
+
+
+ public static Set<EClass> getAllFeatureOwner(final List<EObject> elements,
+ final EStructuralFeature feature) {
+ Set<EClass> owners = new HashSet<EClass>();
+ for (EObject el : elements) {
+ if (el.eClass().getEAllStructuralFeatures().contains(feature)) {
+ owners.add(el.eClass());
+ }
+ }
+ return owners;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java
new file mode 100644
index 00000000000..ded84793e57
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManager.java
@@ -0,0 +1,187 @@
+/**
+ * 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 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334000 Simple catalog manager
+ * Nicolas Guyomar (Mia-Software) - Bug 334529 - ICatalogManager should be exposed in org.eclipse.emf.facet.common.core
+ * Nicolas Guyomar (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Gregoire Dupe (Mia-Software) - Bug 338811 - A model registration method in the interface ICatalogSetManager
+ * Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
+ * Gregoire Dupe (Mia-Software) - Bug 362084 - Get the instance of a catalog manager
+ * Gregoire Dupe (Mia-Software) - Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager
+ */
+package org.eclipse.emf.facet.util.emf.core.internal.catalog;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogFactory;
+import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
+import org.eclipse.emf.facet.util.emf.core.ICatalogManager;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2;
+import org.eclipse.emf.facet.util.emf.core.exception.InvalidFacetSetException;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+import org.eclipse.emf.facet.util.pde.core.internal.exported.PluginUtils;
+import org.osgi.framework.Bundle;
+
+@SuppressWarnings("deprecation") //TODO Bug 362087 - [Deprecated] org.eclipse.emf.facet.util.emf.core.ICatalogSetManager
+public class CatalogSetManager implements ICatalogSetManager, ICatalogSetManager2, Adapter {
+
+ private static final String CATALOG_MGR_EXTENSION_POINT_ID = "org.eclipse.emf.facet.util.emf.core.catalogmanager"; //$NON-NLS-1$
+ private static final String MODEL_DECLARATION_EXTENSION_POINT_ID = "org.eclipse.emf.facet.util.emf.core.modeldeclaration"; //$NON-NLS-1$
+ private static final String CLASS = "class"; //$NON-NLS-1$
+ private static final String FILE = "file"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of this {@link CatalogSetManager}.
+ */
+ public static final CatalogSetManager INSTANCE = new CatalogSetManager();
+
+ private final Map<Resource, Bundle> resourceToBundleMap = new HashMap<Resource, Bundle>();
+ private final ResourceSet resourceSet;
+
+ private final List<ICatalogManager> catalogManagers = new ArrayList<ICatalogManager>();
+ private final CatalogSet catalogSet;
+
+ public CatalogSetManager() {
+ this.resourceSet = new ResourceSetImpl();
+ this.catalogSet = CatalogFactory.eINSTANCE.createCatalogSet();
+ initRegisteredEntries();
+ }
+
+ public CatalogSetManager(final ResourceSet resourceSet) {
+ this.resourceSet = resourceSet;
+ this.catalogSet = CatalogFactory.eINSTANCE.createCatalogSet();
+ initRegisteredEntries();
+ }
+
+ private void initRegisteredEntries() {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extPointCatalogMgr = registry
+ .getExtensionPoint(CatalogSetManager.CATALOG_MGR_EXTENSION_POINT_ID);
+ if (extPointCatalogMgr != null) {
+ for (IExtension ext : extPointCatalogMgr.getExtensions()) {
+ for (IConfigurationElement configElt : ext
+ .getConfigurationElements()) {
+ ICatalogManager catalogMgr;
+ try {
+ catalogMgr = (ICatalogManager) configElt
+ .createExecutableExtension(CatalogSetManager.CLASS);
+ this.catalogManagers.add(catalogMgr);
+ catalogMgr.setCatalogSet(this.catalogSet);
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ }
+ IExtensionPoint modelDeclarationExtPoint = registry
+ .getExtensionPoint(CatalogSetManager.MODEL_DECLARATION_EXTENSION_POINT_ID);
+ if (modelDeclarationExtPoint != null) {
+ for (IExtension ext : modelDeclarationExtPoint.getExtensions()) {
+ for (IConfigurationElement configElt : ext
+ .getConfigurationElements()) {
+ String filePath = configElt
+ .getAttribute(CatalogSetManager.FILE);
+ if (filePath != null) {
+ String pluginName = ext.getNamespaceIdentifier();
+ Bundle bundle = Platform.getBundle(pluginName);
+ URI uri = URI.createPlatformPluginURI(pluginName + "/" //$NON-NLS-1$
+ + filePath, false);
+ try {
+ Resource resource = this.resourceSet.getResource(
+ uri, true);
+ this.resourceToBundleMap.put(resource, bundle);
+ for (EObject root : resource.getContents()) {
+ for (ICatalogManager catalogMgr : this.catalogManagers) {
+ if (catalogMgr.canBeManaged(root)) {
+ catalogMgr.manage(root);
+ }
+ }
+ }
+ } catch (Exception e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public CatalogSet getCatalogSet() {
+ return this.catalogSet;
+ }
+
+ /**
+ * @author Nicolas Guyomar
+ * Modified by Emmanuelle Rouillé
+ */
+ public Bundle getBundleByResource(final Resource eResource) {
+ if (eResource == null) {
+ throw new IllegalArgumentException("The resource cannot be null"); //$NON-NLS-1$
+ }
+ if (eResource.getURI().scheme().equals("platform") && eResource.getURI().segment(0).equals("plugin")) { //$NON-NLS-1$//$NON-NLS-2$
+ return Platform.getBundle(eResource.getURI().segment(1));
+ }
+ return this.resourceToBundleMap.get(eResource);
+ }
+
+ public void registerModelDeclaration(final IFile file) throws InvalidFacetSetException {
+ PluginUtils.register(file, CatalogSetManager.MODEL_DECLARATION_EXTENSION_POINT_ID,
+ "modeldeclaration"); //$NON-NLS-1$
+ }
+
+ public <T> List<T> getCatalogManagerByType(final Class<? extends T> catalogManagerClass) {
+ List<T> result = new ArrayList<T>();
+ for (ICatalogManager catalogManager : this.catalogManagers) {
+ if (catalogManagerClass.isInstance(catalogManager)) {
+ result.add((T) catalogManager);
+ }
+ }
+ return result;
+ }
+
+ public void notifyChanged(final Notification notification) {
+ // Nothing to do
+ }
+
+ public Notifier getTarget() {
+ return this.resourceSet;
+ }
+
+ public void setTarget(final Notifier newTarget) {
+ // Nothing to do
+ }
+
+ public boolean isAdapterForType(final Object type) {
+ return type == ICatalogSetManager2.class;
+ }
+
+
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java
new file mode 100644
index 00000000000..074f6fdb63c
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/catalog/CatalogSetManagerFactory.java
@@ -0,0 +1,36 @@
+/**
+ * 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.util.emf.core.internal.catalog;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManager2;
+import org.eclipse.emf.facet.util.emf.core.ICatalogSetManagerFactory;
+
+public class CatalogSetManagerFactory implements ICatalogSetManagerFactory {
+
+ public ICatalogSetManager2 createICatalogSetManager(final ResourceSet resourceSet) {
+ CatalogSetManager result = null;
+ for (Adapter adapter : resourceSet.eAdapters()) {
+ if (adapter instanceof CatalogSetManager) {
+ result = (CatalogSetManager) adapter;
+
+ }
+ }
+ if (result == null) {
+ result = new CatalogSetManager(resourceSet);
+ resourceSet.eAdapters().add(result);
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java
new file mode 100644
index 00000000000..b0779d0de88
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResult.java
@@ -0,0 +1,35 @@
+/**
+ * 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.util.emf.core.internal.command;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult;
+
+public class CommandFactoryResult<T> implements ICommandFactoryResult<T> {
+
+ private final Command cmd;
+ private final T result;
+
+ public CommandFactoryResult(final Command cmd, final T result) {
+ this.cmd = cmd;
+ this.result = result;
+ }
+
+ public Command getCommand() {
+ return this.cmd;
+ }
+
+ public T getResult() {
+ return this.result;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java
new file mode 100644
index 00000000000..f7bcaedc7e2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/CommandFactoryResultFactory.java
@@ -0,0 +1,23 @@
+/**
+ * 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.util.emf.core.internal.command;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResult;
+import org.eclipse.emf.facet.util.emf.core.command.ICommandFactoryResultFactory;
+
+public class CommandFactoryResultFactory implements ICommandFactoryResultFactory {
+
+ public <T> ICommandFactoryResult<T> createCommandFactoryResult(final Command command, final T result) {
+ return new CommandFactoryResult<T>(command, result);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java
new file mode 100644
index 00000000000..c36b82de0fb
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/command/SetResourceContentCommand.java
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2011 CEA LIST.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Gregoire Dupe (Mia-Software) - Bug 345730 - Deleting an element in the model breaks the table
+ */
+package org.eclipse.emf.facet.util.emf.core.internal.command;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.emf.core.command.ILockableUndoCommand;
+
+/**
+ * This command has to be used to set the content of a resource
+ */
+public class SetResourceContentCommand implements Command, ILockableUndoCommand {
+ private EList<EObject> oldContent = null;
+ private Collection<EObject> newContent = null;
+ private Resource resource;
+ private boolean enableUndo = true;
+
+ /**
+ * @param resource the resource of which we want to set the content.
+ * @param content a list of EObject to set as the content of the resource
+ */
+ public SetResourceContentCommand(final Resource resource, final Collection<EObject> content) {
+ this.resource = resource;
+ this.newContent = content;
+ }
+
+ public boolean canExecute() {
+ return true;
+ }
+
+ public void execute() {
+ this.oldContent = this.resource.getContents();
+ this.resource.getContents().clear();
+ this.resource.getContents().addAll(this.newContent);
+
+ }
+
+ public boolean canUndo() {
+ boolean canUndo = (this.enableUndo && (this.oldContent != null));
+ return canUndo;
+ }
+
+ public void undo() {
+ this.resource.getContents().clear();
+ this.resource.getContents().addAll(this.oldContent);
+
+ }
+
+ public void redo() {
+ this.resource.getContents().clear();
+ this.resource.getContents().addAll(this.newContent);
+ }
+
+ public Collection<?> getResult() {
+ Collection<Resource> result = new ArrayList<Resource>();
+ result.add(this.resource);
+ return result;
+ }
+
+ public Collection<?> getAffectedObjects() {
+ Collection<Object> affectedObjects = new ArrayList<Object>();
+ affectedObjects.add(this.resource);
+ affectedObjects.addAll(this.newContent);
+ affectedObjects.addAll(this.oldContent);
+ return affectedObjects;
+ }
+
+ public String getLabel() {
+ //TODO: Must be externalized
+ return "Set Resource Content"; //$NON-NLS-1$
+ }
+
+ public String getDescription() {
+ //TODO: Must be externalized
+ return "This command changes the content of an EMF resource"; //$NON-NLS-1$
+ }
+
+ public void dispose() {
+ this.oldContent = null;
+ this.newContent = null;
+ this.resource = null;
+ }
+
+ public Command chain(final Command command) {
+ return null;
+ }
+
+ public void enableCanUndo(final boolean enable) {
+ this.enableUndo = enable;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java
new file mode 100644
index 00000000000..8b096d48eca
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/exported/ICommandFactory.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.exported;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.MoveCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+
+/**
+ * Creates {@link Command}s for a specific {@link EditingDomain}.
+ * <p>
+ * See also {@link ICommandFactoriesRegistry}
+ *
+ * @since 0.2
+ */
+// Copied from org.eclipse.emf.facet.widgets.celleditors.ICommandFactory
+public interface ICommandFactory {
+ /**
+ * Whether this command factory should be used for the given {@link EditingDomain}
+ */
+ boolean handles(EditingDomain editingDomain);
+
+ /**
+ * This creates a {@link SetCommand} to set the owner's feature to the specified value.
+ */
+ Command createSetCommand(EditingDomain domain, Object owner, Object feature, Object value);
+
+ /**
+ * This creates a {@link SetCommand} to set the owner's feature to the specified value at the
+ * specified index.
+ */
+ Command createSetCommand(EditingDomain domain, Object owner, Object feature,
+ Object value, int index);
+
+ /**
+ * This creates a {@link MoveCommand} to move a particular value to a particular index in the
+ * specified feature of the owner. The feature will often be <code>null</code> because the
+ * domain will deduce it.
+ */
+ Command createMoveCommand(EditingDomain domain, Object owner, Object feature, Object value,
+ int index);
+
+ /**
+ * This creates an {@link AddCommand} to add a particular value to the specified feature of the
+ * owner. The feature will often be <code>null</code> because the domain will deduce it.
+ */
+ Command createAddCommand(EditingDomain domain, Object owner, Object feature, Object value);
+
+ /**
+ * This creates a {@link RemoveCommand} to remove a particular value from the specified feature
+ * of the owner.
+ */
+ Command createRemoveCommand(EditingDomain domain, Object owner, Object feature, Object value);
+
+ /** This creates a command that deletes the given object. */
+ Command createDeleteCommand(EditingDomain domain, Object object);
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java
new file mode 100644
index 00000000000..7c62b2ca436
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceConstants.java
@@ -0,0 +1,26 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Fabien Giquel (Mia-Software)
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ */
+package org.eclipse.emf.facet.util.emf.core.internal.preferences;
+
+public final class PreferenceConstants {
+
+ private PreferenceConstants() {
+ // constants class: no need to instantiate
+ }
+
+ public static final String P_DEFAULT_EPACKAGE_VIEWER = "emf_facet_default_epackage_viewer"; //$NON-NLS-1$
+ public static final String P_DEFAULT_EOBJECT_VIEWER = "emf_facet_default_eobject_viewer"; //$NON-NLS-1$
+ public static final String P_DEFAULT_RESOURCE_VIEWER = "emf_facet_default_resource_viewer"; //$NON-NLS-1$
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java
new file mode 100644
index 00000000000..7ea8549ef9f
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/preferences/PreferenceInitializer.java
@@ -0,0 +1,54 @@
+/**
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ */
+package org.eclipse.emf.facet.util.emf.core.internal.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry;
+import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IEclipsePreferences preferenceNode = new DefaultScope().getNode(Activator.PLUGIN_ID);
+ // general rule is to keep the same behavior as EMF by default
+ IEObjectBrowserOpener defaultEObjectBrowserOpener = IBrowserRegistry.INSTANCE
+ .getDefaultEObjectBrowserOpener();
+ if (defaultEObjectBrowserOpener != null) {
+ preferenceNode.put(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER,
+ defaultEObjectBrowserOpener.getClass().getName());
+ }
+
+ IEPackageBrowserOpener defaultEPackageBrowserOpener = IBrowserRegistry.INSTANCE
+ .getDefaultEPackageBrowserOpener();
+ if (defaultEPackageBrowserOpener != null) {
+ preferenceNode.put(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER,
+ defaultEPackageBrowserOpener.getClass().getName());
+ }
+
+ IResourceBrowserOpener defaultResourceBrowserOpener = IBrowserRegistry.INSTANCE
+ .getDefaultResourceBrowserOpener();
+ if (defaultResourceBrowserOpener != null) {
+ preferenceNode.put(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER,
+ defaultResourceBrowserOpener.getClass().getName());
+ }
+
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java
new file mode 100644
index 00000000000..d3748194ac3
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/registry/BrowserRegistry.java
@@ -0,0 +1,212 @@
+/**********************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 333652 Extension point offering the possibility to declare an EPackage browser
+ * Nicolas Bros (Mia-Software) - Bug 335218 - Extension point for registering EObject, EPackage, model editor
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ ***********************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.registry;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.IBrowserRegistry;
+import org.eclipse.emf.facet.util.emf.core.IEObjectBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IEPackageBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.IResourceBrowserOpener;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+import org.eclipse.emf.facet.util.emf.core.internal.preferences.PreferenceConstants;
+
+/** A registry for the EObject, EPackage, and Resource browser opener extension point. */
+public class BrowserRegistry implements IBrowserRegistry {
+
+ private static final String EXTENSION_POINT_RESOURCE_VIEWER_ELT = "resourceViewer"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_EOBJECT_VIEWER_ELT = "eObjectViewer"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_EPACKAGE_VIEWER_ELT = "ePackageViewer"; //$NON-NLS-1$
+ private final List<IEPackageBrowserOpener> epackageBrowserOpeners;
+ private final List<IEObjectBrowserOpener> eobjectBrowserOpeners;
+ private final List<IResourceBrowserOpener> resourceBrowserOpeners;
+
+ public static final String EXTENSION_POINT_MODEL_VIEWER_ID = "org.eclipse.emf.facet.util.emf.core.modelViewer"; //$NON-NLS-1$
+
+ public static final String CLASS = "class"; //$NON-NLS-1$
+
+ public BrowserRegistry() {
+ this.epackageBrowserOpeners = new ArrayList<IEPackageBrowserOpener>();
+ this.eobjectBrowserOpeners = new ArrayList<IEObjectBrowserOpener>();
+ this.resourceBrowserOpeners = new ArrayList<IResourceBrowserOpener>();
+
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = registry
+ .getExtensionPoint(BrowserRegistry.EXTENSION_POINT_MODEL_VIEWER_ID);
+ if (extensionPoint != null) {
+ for (IExtension ext : extensionPoint.getExtensions()) {
+ for (IConfigurationElement configElt : ext.getConfigurationElements()) {
+
+ String kind = configElt.getName();
+ String classID = configElt.getAttribute(BrowserRegistry.CLASS);
+ try {
+ if (classID != null) {
+ if (kind.equals(BrowserRegistry.EXTENSION_POINT_EPACKAGE_VIEWER_ELT)) {
+ this.epackageBrowserOpeners.add((IEPackageBrowserOpener) configElt
+ .createExecutableExtension(BrowserRegistry.CLASS));
+ } else if (kind
+ .equals(BrowserRegistry.EXTENSION_POINT_EOBJECT_VIEWER_ELT)) {
+ this.eobjectBrowserOpeners.add((IEObjectBrowserOpener) configElt
+ .createExecutableExtension(BrowserRegistry.CLASS));
+ } else if (kind
+ .equals(BrowserRegistry.EXTENSION_POINT_RESOURCE_VIEWER_ELT)) {
+ this.resourceBrowserOpeners.add((IResourceBrowserOpener) configElt
+ .createExecutableExtension(BrowserRegistry.CLASS));
+ }
+ }
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ }
+ }
+ }
+ } else {
+ Logger.logError(
+ "Extension point not found: " + BrowserRegistry.EXTENSION_POINT_MODEL_VIEWER_ID, //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ }
+
+ public void browseEPackage(final EPackage ePackage) {
+ if (ePackage == null) {
+ throw new IllegalArgumentException();
+ }
+ IEPackageBrowserOpener opener = getDefaultEPackageBrowserOpener();
+ if (opener != null) {
+ opener.openEPackage(ePackage);
+ } else {
+ Logger.logWarning(
+ "No epackage browser opener is registered to open ePackage " + ePackage.getNsURI(), Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ public void browseResource(final Resource resource) {
+ if (resource == null) {
+ throw new IllegalArgumentException();
+ }
+ IResourceBrowserOpener opener = getDefaultResourceBrowserOpener();
+ if (opener != null) {
+ opener.openResource(resource);
+ } else {
+ Logger.logWarning(
+ "No resource browser opener is registered to open " + resource.getURI(), Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ public void browseEObject(final EObject eObject) {
+ if (eObject == null) {
+ throw new IllegalArgumentException();
+ }
+ IEObjectBrowserOpener opener = getDefaultEObjectBrowserOpener();
+ if (opener != null) {
+ opener.openEObject(eObject);
+ } else {
+ Logger.logWarning(
+ "No eobject browser opener is registered to open " + eObject.toString(), Activator.getDefault()); //$NON-NLS-1$
+ }
+ }
+
+ public List<IEPackageBrowserOpener> getAllRegisteredEPackageBrowsers() {
+ return Collections.unmodifiableList(this.epackageBrowserOpeners);
+ }
+
+ public List<IEObjectBrowserOpener> getAllRegisteredEObjectBrowsers() {
+ return Collections.unmodifiableList(this.eobjectBrowserOpeners);
+ }
+
+ public List<IResourceBrowserOpener> getAllRegisteredResourceBrowsers() {
+ return Collections.unmodifiableList(this.resourceBrowserOpeners);
+ }
+
+ /**
+ * @return the default EPackage browser opener, can be null
+ */
+ public IEPackageBrowserOpener getDefaultEPackageBrowserOpener() {
+ IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_EPACKAGE_VIEWER, null);
+ if (className != null) {
+ for (IEPackageBrowserOpener ePackageBrowserFactory : this.epackageBrowserOpeners) {
+ if (ePackageBrowserFactory.getClass().getName().equals(className)) {
+ return ePackageBrowserFactory;
+ }
+ }
+ }
+ // By default return the first editor registered through the extension
+ // point org.eclipse.emf.facet.util.emf.core.modelViewer
+ if (!this.epackageBrowserOpeners.isEmpty()) {
+ return this.epackageBrowserOpeners.get(0);
+ }
+
+ return null;
+
+ }
+
+ /**
+ * @return the default EObject browser opener, can be null
+ */
+ public IEObjectBrowserOpener getDefaultEObjectBrowserOpener() {
+ IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_EOBJECT_VIEWER, null);
+ if (className != null) {
+ for (IEObjectBrowserOpener eObjectBrowserFactory : this.eobjectBrowserOpeners) {
+ if (eObjectBrowserFactory.getClass().getName().equals(className)) {
+ return eObjectBrowserFactory;
+ }
+ }
+ }
+ // By default return the first editor registered through the extension
+ // point org.eclipse.emf.facet.util.emf.core.modelViewer
+ if (!this.eobjectBrowserOpeners.isEmpty()) {
+ return this.eobjectBrowserOpeners.get(0);
+ }
+
+ return null;
+
+ }
+
+ /**
+ * @return the default Resource browser opener, can be <code>null</code>
+ */
+ public IResourceBrowserOpener getDefaultResourceBrowserOpener() {
+ IEclipsePreferences preferenceNode = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String className = preferenceNode.get(PreferenceConstants.P_DEFAULT_RESOURCE_VIEWER, null);
+ if (className != null) {
+ for (IResourceBrowserOpener resourceBrowserOpener : this.resourceBrowserOpeners) {
+ if (resourceBrowserOpener.getClass().getName().equals(className)) {
+ return resourceBrowserOpener;
+ }
+ }
+ }
+ // By default return the first editor registered through the extension
+ // point org.eclipse.emf.facet.util.emf.core.modelViewer
+ if (!this.resourceBrowserOpeners.isEmpty()) {
+ return this.resourceBrowserOpeners.get(0);
+ }
+
+ return null;
+ }
+
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java
new file mode 100644
index 00000000000..9a73c5c9f3e
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationRegistry.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Laurent Pichierri (Soft-Maint) - Bug 371204 - Compatibility with Helios
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+//import org.eclipse.emf.facet.infra.common.core.internal.extensions.AbstractRegistry;
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.core.internal.exported.AbstractRegistry;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationRegistry;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+/** Registry for the "serialization" extension point */
+public class SerializationRegistry extends AbstractRegistry implements ISerializationRegistry {
+
+ private static final String EXTENSION_POINT_NAMESPACE = "org.eclipse.emf.facet.util.emf.core"; //$NON-NLS-1$
+ private static final String EXTENSION_POINT_NAME = "serialization"; //$NON-NLS-1$
+
+ private static final String SERIALIZER_ELEMENT = "serializer"; //$NON-NLS-1$
+ private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
+ private static SerializationRegistry instance = null;
+
+ private final List<ISerializer<?>> serializers = new ArrayList<ISerializer<?>>();
+
+ public static SerializationRegistry getInstance() {
+ if (SerializationRegistry.instance == null) {
+ SerializationRegistry.instance = new SerializationRegistry();
+ }
+ return SerializationRegistry.instance;
+ }
+
+ public SerializationRegistry() {
+ initialize();
+ }
+
+ public List<ISerializer<?>> getSerializers() {
+ return Collections.unmodifiableList(this.serializers);
+ }
+
+ public ISerializer<?> getSerializerFor(final Class<?> type) {
+ for (ISerializer<?> serializer : this.serializers) {
+ if (serializer.getType().isAssignableFrom(type)) {
+ return serializer;
+ }
+ }
+ return null;
+ }
+
+ public ISerializer<?> getSerializerFor(final String type) {
+ for (ISerializer<?> serializer : this.serializers) {
+ if (serializer.getType().getName().equals(type)) {
+ return serializer;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ protected String getExtensionPointName() {
+ return SerializationRegistry.EXTENSION_POINT_NAME;
+ }
+
+ @Override
+ protected String getExtensionPointNamespace() {
+ return SerializationRegistry.EXTENSION_POINT_NAMESPACE;
+ }
+
+ @Override
+ protected void handleRootElement(final IConfigurationElement configurationElement) {
+ final String name = configurationElement.getName();
+ if (name.equalsIgnoreCase(SerializationRegistry.SERIALIZER_ELEMENT)) {
+ readSerializerElement(configurationElement);
+ } else {
+ logUnknownElement(configurationElement);
+ }
+ }
+
+ /** Read a 'serializer' element */
+ private void readSerializerElement(final IConfigurationElement configurationElement) {
+ Object object;
+ try {
+ object = configurationElement
+ .createExecutableExtension(SerializationRegistry.CLASS_ATTRIBUTE);
+ } catch (CoreException e) {
+ Logger.logError(e, Activator.getDefault());
+ return;
+ }
+ if (object == null) {
+ logMissingAttribute(configurationElement, SerializationRegistry.CLASS_ATTRIBUTE);
+ return;
+ }
+
+ if (object instanceof ISerializer<?>) {
+ ISerializer<?> serializer = (ISerializer<?>) object;
+ ISerializer<?> existingSerializer = getSerializerFor(serializer.getType());
+ if (existingSerializer != null) {
+ logError(
+ configurationElement,
+ "Several serializers are provided for the type: " + serializer.getType().getName() + ". Only the first one will be used."); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // always take the first one in the alphabetical order => determinism to avoid
+ // trying to serialize with one implementation and deserialize with an incompatible
+ // implementation
+ if (serializer.getClass().getName()
+ .compareTo(existingSerializer.getClass().getName()) < 0) {
+ // replace the already registered serializer by this one
+ this.serializers.remove(existingSerializer);
+ } else {
+ return;
+ }
+ }
+ this.serializers.add(serializer);
+ } else {
+ logError(configurationElement,
+ "class must implement " + ISerializer.class.getSimpleName()); //$NON-NLS-1$
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java
new file mode 100644
index 00000000000..f6cc050a8a1
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/SerializationService.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization;
+
+import org.eclipse.emf.facet.util.core.Logger;
+import org.eclipse.emf.facet.util.emf.core.internal.Activator;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationRegistry;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationService;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class SerializationService implements ISerializationService {
+
+ public String serialize(final Object instanceValue) {
+ if (instanceValue == null) {
+ return "null"; //$NON-NLS-1$
+ }
+
+ ISerializer<Object> serializer = (ISerializer<Object>) ISerializationRegistry.INSTANCE
+ .getSerializerFor(instanceValue.getClass());
+ if (serializer != null) {
+ return serializer.getType().getName() + ":" //$NON-NLS-1$
+ + serializer.serialize(instanceValue);
+ }
+
+ Logger.logError("serialization of type " + instanceValue.getClass().getName() //$NON-NLS-1$
+ + " is not implemented.", Activator.getDefault()); //$NON-NLS-1$
+ return "null"; //$NON-NLS-1$
+ }
+
+ public Object deserialize(final String serializedValue) {
+ try {
+ if ("null".equals(serializedValue)) { //$NON-NLS-1$
+ return null;
+ }
+
+ int colonPos = serializedValue.indexOf(':');
+ if (colonPos == -1) {
+ throw new IllegalArgumentException("invalid serialization format"); //$NON-NLS-1$
+ }
+ String type = serializedValue.substring(0, colonPos);
+ String strValue = serializedValue.substring(colonPos + 1);
+
+ ISerializer<?> serializer = ISerializationRegistry.INSTANCE.getSerializerFor(type);
+ if (serializer != null) {
+ Object value = serializer.deserialize(strValue);
+ return value;
+ }
+
+ Logger.logError("deserialization of type " + type //$NON-NLS-1$
+ + " is not implemented.", Activator.getDefault()); //$NON-NLS-1$
+ } catch (Exception e) {
+ Logger.logError(e, "Error deserializing: " + serializedValue, //$NON-NLS-1$
+ Activator.getDefault());
+ }
+ return null;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.java
new file mode 100644
index 00000000000..8da42917f95
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/BooleanSerializer.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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class BooleanSerializer implements ISerializer<Boolean> {
+
+ public BooleanSerializer() {
+ //
+ }
+
+ public Class<Boolean> getType() {
+ return Boolean.class;
+ }
+
+ public String serialize(final Boolean value) {
+ return value.toString();
+ }
+
+ public Boolean deserialize(final String serializedValue) {
+ return Boolean.valueOf(serializedValue);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java
new file mode 100644
index 00000000000..9379a66b4f4
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/EMFURISerializer.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class EMFURISerializer implements ISerializer<URI> {
+
+ public EMFURISerializer() {
+ //
+ }
+
+ public Class<URI> getType() {
+ return URI.class;
+ }
+
+ public String serialize(final URI value) {
+ return value.toString();
+ }
+
+ public URI deserialize(final String serializedValue) {
+ return URI.createURI(serializedValue);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java
new file mode 100644
index 00000000000..b7c1db13a18
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IResourceSerializer.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class IResourceSerializer implements ISerializer<IResource> {
+
+ public IResourceSerializer() {
+ //
+ }
+
+ public Class<IResource> getType() {
+ return IResource.class;
+ }
+
+ public String serialize(final IResource value) {
+ return value.getFullPath().toPortableString();
+ }
+
+ public IResource deserialize(final String serializedValue) {
+ return ResourcesPlugin.getWorkspace().getRoot().findMember(serializedValue);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.java
new file mode 100644
index 00000000000..30fd0697119
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/IntegerSerializer.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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class IntegerSerializer implements ISerializer<Integer> {
+
+ public IntegerSerializer() {
+ //
+ }
+
+ public Class<Integer> getType() {
+ return Integer.class;
+ }
+
+ public String serialize(final Integer value) {
+ return value.toString();
+ }
+
+ public Integer deserialize(final String serializedValue) {
+ return Integer.valueOf(serializedValue);
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.java
new file mode 100644
index 00000000000..5861790692b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/internal/serialization/serializers/StringSerializer.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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.internal.serialization.serializers;
+
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializer;
+
+public class StringSerializer implements ISerializer<String> {
+
+ public StringSerializer() {
+ //
+ }
+
+ public Class<String> getType() {
+ return String.class;
+ }
+
+ public String serialize(final String value) {
+ return value;
+ }
+
+ public String deserialize(final String serializedValue) {
+ return serializedValue;
+ }
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java
new file mode 100644
index 00000000000..bfe26dc13dd
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationRegistry.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.serialization;
+
+import java.util.List;
+
+import org.eclipse.emf.facet.util.emf.core.internal.serialization.SerializationRegistry;
+
+/** The registry of {@link ISerializer}s per type. */
+public interface ISerializationRegistry {
+ public static ISerializationRegistry INSTANCE = new SerializationRegistry();
+
+ /** Get all the serializers . */
+ List<ISerializer<?>> getSerializers();
+
+ /**
+ * @return the serializer for the given type, or <code>null</code> if none has been registered.
+ * Also returns serializers for super-types of <code>type</code>.
+ */
+ ISerializer<?> getSerializerFor(Class<?> type);
+
+ /**
+ * @return the serializer for the given type qualified name, or <code>null</code> if none has
+ * been registered. Does not return serializers for super-types of <code>type</code>.
+ */
+ ISerializer<?> getSerializerFor(String type);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java
new file mode 100644
index 00000000000..8c342c1c6cf
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializationService.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.serialization;
+
+import org.eclipse.emf.facet.util.emf.core.internal.serialization.SerializationService;
+
+/**
+ * Provides a serialization service so that the following is true:<br/>
+ * <code>deserialize(serialize(object)) == object</code>
+ */
+public interface ISerializationService {
+
+ public ISerializationService INSTANCE = new SerializationService();
+
+ /** Serialize the given value. */
+ String serialize(Object instanceValue);
+
+ /** Deserialize the given string back into the value. */
+ Object deserialize(String serializedValue);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java
new file mode 100644
index 00000000000..bf69f05b3a0
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/ISerializer.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.facet.util.emf.core.serialization;
+
+/**
+ * The interface that must be implemented when adding an extension to the "serializer" extension
+ * point.
+ *
+ * @see ISerializationRegistry
+ */
+// note: the serializer has to return the {@link Class} object instead of a qualified name
+// because that's the one that has it on its bundle classpath.
+public interface ISerializer<T> {
+
+ /** @return the type handled by this serializer. */
+ Class<T> getType();
+
+ /** Serialize the given value into a String */
+ String serialize(T value);
+
+ /**
+ * Deserialize the given String back into the original value that was serialized with
+ * {@link ISerializer#serialize(Object)}
+ */
+ T deserialize(String serializedValue);
+}
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java
new file mode 100644
index 00000000000..797d6e5d3e2
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationFactory.java
@@ -0,0 +1,41 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage
+ * @generated
+ */
+public interface SerializationFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ SerializationFactory eINSTANCE = org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationFactoryImpl.init();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ SerializationPackage getSerializationPackage();
+
+} //SerializationFactory
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java
new file mode 100644
index 00000000000..377b694a470
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/SerializationPackage.java
@@ -0,0 +1,121 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization;
+
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory
+ * @model kind="package"
+ * @generated
+ */
+@SuppressWarnings("all")
+public interface SerializationPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "serialization"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/emf/facet/serialization/0.1.incubation"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "serialization"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ SerializationPackage eINSTANCE = org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl.init();
+
+ /**
+ * The meta object id for the '<em>Extensible Serializable Java Object</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.Object
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl#getExtensibleSerializableJavaObject()
+ * @generated
+ */
+ int EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT = 0;
+
+
+ /**
+ * Returns the meta object for data type '{@link java.lang.Object <em>Extensible Serializable Java Object</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for data type '<em>Extensible Serializable Java Object</em>'.
+ * @see java.lang.Object
+ * @model instanceClass="java.lang.Object"
+ * @generated
+ */
+ EDataType getExtensibleSerializableJavaObject();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ SerializationFactory getSerializationFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '<em>Extensible Serializable Java Object</em>' data type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see java.lang.Object
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl.SerializationPackageImpl#getExtensibleSerializableJavaObject()
+ * @generated
+ */
+ EDataType EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT = SerializationPackage.eINSTANCE.getExtensibleSerializableJavaObject();
+
+ }
+
+} //SerializationPackage
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java
new file mode 100644
index 00000000000..74a70b2166a
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationFactoryImpl.java
@@ -0,0 +1,151 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ * Nicolas Bros (Mia-Software) - Bug 338907 - expose serialization services from SerializationFactoryImpl
+ */
+package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+import org.eclipse.emf.facet.util.emf.core.serialization.ISerializationService;
+import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory;
+import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage;
+
+/**
+ * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- end-user-doc -->
+ *
+ * @generated
+ */
+public class SerializationFactoryImpl extends EFactoryImpl implements SerializationFactory {
+ /**
+ * Creates the default factory implementation. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public static SerializationFactory init() {
+ try {
+ SerializationFactory theSerializationFactory = (SerializationFactory) EPackage.Registry.INSTANCE
+ .getEFactory("http://www.eclipse.org/emf/facet/serialization/0.1.incubation"); //$NON-NLS-1$
+ if (theSerializationFactory != null) {
+ return theSerializationFactory;
+ }
+ } catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new SerializationFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public SerializationFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public EObject create(final EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ default:
+ throw new IllegalArgumentException(
+ "The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public Object createFromString(final EDataType eDataType, final String initialValue) {
+ switch (eDataType.getClassifierID()) {
+ case SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT:
+ return createExtensibleSerializableJavaObjectFromString(eDataType, initialValue);
+ default:
+ throw new IllegalArgumentException(
+ "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ @Override
+ public String convertToString(final EDataType eDataType, final Object instanceValue) {
+ switch (eDataType.getClassifierID()) {
+ case SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT:
+ return convertExtensibleSerializableJavaObjectToString(eDataType, instanceValue);
+ default:
+ throw new IllegalArgumentException(
+ "The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc --> Deserializes a value.
+ *
+ * @param eDataType
+ * the datatype
+ * @param initialValue
+ * the serialized value to deserialize <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public static Object createExtensibleSerializableJavaObjectFromString(
+ final EDataType eDataType, final String initialValue) {
+ return ISerializationService.INSTANCE.deserialize(initialValue);
+ }
+
+ /**
+ * <!-- begin-user-doc --> Serializes a value.
+ *
+ * @param eDataType
+ * the datatype
+ * @param instanceValue
+ * the value to serialize <!-- end-user-doc -->
+ * @generated NOT
+ */
+ public static String convertExtensibleSerializableJavaObjectToString(final EDataType eDataType,
+ final Object instanceValue) {
+ return ISerializationService.INSTANCE.serialize(instanceValue);
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ public SerializationPackage getSerializationPackage() {
+ return (SerializationPackage) getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static SerializationPackage getPackage() {
+ return SerializationPackage.eINSTANCE;
+ }
+
+} // SerializationFactoryImpl
diff --git a/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java
new file mode 100644
index 00000000000..3e10c2d549b
--- /dev/null
+++ b/plugins/facet/org.eclipse.papyrus.emf.facet.util.emf.core/src/org/eclipse/emf/facet/util/emf/core/serialization/model/serialization/impl/SerializationPackageImpl.java
@@ -0,0 +1,170 @@
+/**
+ * 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:
+ * Nicolas Bros (Mia-Software) - initial API and implementation
+ */
+package org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.impl;
+
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationFactory;
+import org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class SerializationPackageImpl extends EPackageImpl implements SerializationPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType extensibleSerializableJavaObjectEDataType = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.emf.facet.util.emf.core.serialization.model.serialization.SerializationPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private SerializationPackageImpl() {
+ super(SerializationPackage.eNS_URI, SerializationFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link SerializationPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static SerializationPackage init() {
+ if (SerializationPackageImpl.isInited) {
+ return (SerializationPackage)EPackage.Registry.INSTANCE.getEPackage(SerializationPackage.eNS_URI);
+ }
+
+ // Obtain or create and register package
+ SerializationPackageImpl theSerializationPackage = (SerializationPackageImpl)(EPackage.Registry.INSTANCE.get(SerializationPackage.eNS_URI) instanceof SerializationPackageImpl ? EPackage.Registry.INSTANCE.get(SerializationPackage.eNS_URI) : new SerializationPackageImpl());
+
+ SerializationPackageImpl.isInited = true;
+
+ // Create package meta-data objects
+ theSerializationPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theSerializationPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theSerializationPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(SerializationPackage.eNS_URI, theSerializationPackage);
+ return theSerializationPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EDataType getExtensibleSerializableJavaObject() {
+ return this.extensibleSerializableJavaObjectEDataType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public SerializationFactory getSerializationFactory() {
+ return (SerializationFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (this.isCreated) {
+ return;
+ }
+ this.isCreated = true;
+
+ // Create data types
+ this.extensibleSerializableJavaObjectEDataType = createEDataType(SerializationPackage.EXTENSIBLE_SERIALIZABLE_JAVA_OBJECT);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (this.isInitialized) {
+ return;
+ }
+ this.isInitialized = true;
+
+ // Initialize package
+ setName(SerializationPackage.eNAME);
+ setNsPrefix(SerializationPackage.eNS_PREFIX);
+ setNsURI(SerializationPackage.eNS_URI);
+
+ // Initialize data types
+ initEDataType(this.extensibleSerializableJavaObjectEDataType, Object.class, "ExtensibleSerializableJavaObject", EPackageImpl.IS_SERIALIZABLE, !EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+
+ // Create resource
+ createResource(SerializationPackage.eNS_URI);
+ }
+
+} //SerializationPackageImpl

Back to the top