Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-11-24 11:20:54 +0000
committerGerrit Code Review @ Eclipse.org2016-11-29 10:57:50 +0000
commitb3141df23ca644573f8b2813ad8859722d418bd9 (patch)
tree6db261c6f918988a7117bfe93731af4ca17f0723 /plugins/infra/internationalization
parent6d4f41d7e479bfa607ffde18b16fe8ebdae561c2 (diff)
downloadorg.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.tar.gz
org.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.tar.xz
org.eclipse.papyrus-b3141df23ca644573f8b2813ad8859722d418bd9.zip
Bug 496905: [Diagram][ModelExplorer][Table][Dialog] Papyrus must integrate
the internationalization feature provided by UML. https://bugs.eclipse.org/bugs/show_bug.cgi?id=496905 Commit of infra for internationalization. Change-Id: I1b1859bf111e1ef7a7522212fbe639cf2bd13890 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
Diffstat (limited to 'plugins/infra/internationalization')
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.classpath7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.project52
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.jdt.core.prefs296
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.pde.api.tools.prefs98
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/META-INF/MANIFEST.MF28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/about.html28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/build.properties22
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/environment.xmi12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/general/internationalization.ctx22
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/general/ui/SingleInternationalization.xwt17
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/plugin.properties4
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/plugin.xml24
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/pom.xml12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/Activator.java77
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java115
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElementFactory.java51
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/LanguageObservableValue.java174
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/PrivateInternationalizationPreferenceObservableValue.java171
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/UseInternationalizationObservableValue.java165
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/widgets/LanguageDialog.java55
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/widgets/editors/LanguageDialog.java266
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.classpath7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.project52
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/META-INF/MANIFEST.MF21
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/about.html28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/build.properties11
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/plugin.properties4
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/plugin.xml9
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/pom.xml12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/Activator.java153
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/command/LocaleInternationalizationPreferenceCommand.java98
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/command/UseInternationalizationPreferenceCommand.java98
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/editor/IInternationalizationEditor.java34
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationAnnotationResourceUtils.java49
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationPreferencesConstants.java41
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationPreferencesUtils.java296
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/LocaleNameResolver.java57
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.classpath7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.project52
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/META-INF/MANIFEST.MF22
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/about.html28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/build.properties9
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/plugin.properties4
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/plugin.xml22
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/pom.xml12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/Activator.java78
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/ControlPropertiesCommand.java328
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/CreatePropertiesControlResourceCommand.java257
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/InternationalizationAnnotationControlCommand.java111
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/RemovePropertiesControlResourceCommand.java243
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/InternationalizationAnnotationControlParticipant.java183
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/PropertiesControlParticipant.java159
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/PropertiesUncontrolParticipant.java249
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/utils/ControlPropertiesUtils.java25
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/.classpath8
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/.project52
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/META-INF/MANIFEST.MF18
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/about.html28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/build.properties12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/icons/full/obj16/InternationalizationEntry.gifbin0 -> 129 bytes
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/icons/full/obj16/InternationalizationLibrary.gifbin0 -> 129 bytes
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/plugin.properties25
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/plugin.xml22
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/pom.xml12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationEditPlugin.java96
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationEntryItemProvider.java171
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationItemProviderAdapterFactory.java243
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationLibraryItemProvider.java141
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src/org/eclipse/papyrus/infra/internationalization/edit/provider/InternationalizationNotationItemProviderAdapterFactory.java57
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.classpath7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.project52
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/META-INF/MANIFEST.MF22
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/about.html28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/build.properties11
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/plugin.properties4
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/plugin.xml23
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/pom.xml12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/Activator.java77
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/dialogs/InternationalizationDialog.java251
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/handlers/InternationalizationCommandHandler.java167
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.classpath7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.project52
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/META-INF/MANIFEST.MF25
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/about.html28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/build.properties11
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/plugin.properties4
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/plugin.xml9
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/pom.xml12
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/Activator.java77
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/commands/InternationalizationPasteCommand.java84
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/InternationalizationConstants.java30
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalization.java229
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalizationPreferencesUtils.java64
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalizationUtils.java259
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.classpath8
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.project52
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.settings/org.eclipse.core.resources.prefs5
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF29
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/about.html28
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/build.properties13
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/model/Internationalization.ecore13
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/model/Internationalization.genmodel21
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/plugin.properties4
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/plugin.xml32
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml50
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationEntry.java86
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationFactory.java61
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationLibrary.java51
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationPackage.java274
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationEntryImpl.java236
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationFactoryImpl.java120
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationLibraryImpl.java146
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationPackageImpl.java252
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/util/InternationalizationAdapterFactory.java147
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/util/InternationalizationSwitch.java145
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/Activator.java77
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/InternationalizationPreferenceCommandFactory.java211
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/ResetNameCommand.java108
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/ResetNameTransactionalCommand.java89
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/AbstractInternationalizationPreferenceModelProvider.java78
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/IInternationalizationPreferenceModelProvider.java56
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java1494
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModel.java606
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java252
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelsnippet/PropertiesAdjunctResourceModelSnippet.java119
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/EntryPartLabelSynchronizer.java167
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/InternationalizationPreferenceModelUtils.java61
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/PreferencePartLabelSynchronizer.java171
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/PropertiesFilesUtils.java353
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/QualifiedNameUtils.java162
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/ResourceBundleAndURI.java87
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/InternationalizationPreferences.pngbin0 -> 15707 bytes
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/LabelsInternationalizationExample.pngbin0 -> 10402 bytes
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/PropertiesModelExplorer.pngbin0 -> 6347 bytes
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev-toc.xml22
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev.html266
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev.mediawiki197
-rw-r--r--plugins/infra/internationalization/pom.xml26
144 files changed, 13363 insertions, 0 deletions
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.classpath b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.project b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.project
new file mode 100644
index 00000000000..ae67e3eb938
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.editor.welcome.internationalization</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ <nature>org.eclipse.oomph.version.VersionNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..8ddd9a88d57
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,296 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=260
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=260
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..954281dbc31
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,68 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Papyrus
+cleanup_settings_version=2
+eclipse.preferences.version=1
+formatter_profile=_Papyrus
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*****************************************************************************\n * Copyright (c) ${year} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.pde.api.tools.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.pde.api.tools.prefs
new file mode 100644
index 00000000000..23fb95e120f
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/.settings/org.eclipse.pde.api.tools.prefs
@@ -0,0 +1,98 @@
+ANNOTATION_ELEMENT_TYPE_ADDED_METHOD_WITHOUT_DEFAULT_VALUE=Error
+ANNOTATION_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_FIELD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_METHOD=Error
+ANNOTATION_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_API_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_REEXPORTED_TYPE=Error
+API_COMPONENT_ELEMENT_TYPE_REMOVED_TYPE=Error
+API_USE_SCAN_FIELD_SEVERITY=Error
+API_USE_SCAN_METHOD_SEVERITY=Error
+API_USE_SCAN_TYPE_SEVERITY=Error
+CLASS_ELEMENT_TYPE_ADDED_METHOD=Error
+CLASS_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+CLASS_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CLASS_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+CLASS_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+CLASS_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+CLASS_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+CLASS_ELEMENT_TYPE_REMOVED_CONSTRUCTOR=Error
+CLASS_ELEMENT_TYPE_REMOVED_FIELD=Error
+CLASS_ELEMENT_TYPE_REMOVED_METHOD=Error
+CLASS_ELEMENT_TYPE_REMOVED_SUPERCLASS=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+CLASS_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+CONSTRUCTOR_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+CONSTRUCTOR_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+ENUM_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+ENUM_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+ENUM_ELEMENT_TYPE_REMOVED_ENUM_CONSTANT=Error
+ENUM_ELEMENT_TYPE_REMOVED_FIELD=Error
+ENUM_ELEMENT_TYPE_REMOVED_METHOD=Error
+ENUM_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+FIELD_ELEMENT_TYPE_ADDED_VALUE=Error
+FIELD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+FIELD_ELEMENT_TYPE_CHANGED_FINAL_TO_NON_FINAL_STATIC_CONSTANT=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+FIELD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+FIELD_ELEMENT_TYPE_CHANGED_TYPE=Error
+FIELD_ELEMENT_TYPE_CHANGED_VALUE=Error
+FIELD_ELEMENT_TYPE_REMOVED_TYPE_ARGUMENT=Error
+FIELD_ELEMENT_TYPE_REMOVED_VALUE=Error
+ILLEGAL_EXTEND=Warning
+ILLEGAL_IMPLEMENT=Warning
+ILLEGAL_INSTANTIATE=Warning
+ILLEGAL_OVERRIDE=Warning
+ILLEGAL_REFERENCE=Warning
+INTERFACE_ELEMENT_TYPE_ADDED_FIELD=Ignore
+INTERFACE_ELEMENT_TYPE_ADDED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_SUPER_INTERFACE_WITH_METHODS=Error
+INTERFACE_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_CONTRACTED_SUPERINTERFACES_SET=Error
+INTERFACE_ELEMENT_TYPE_CHANGED_TYPE_CONVERSION=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_FIELD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_METHOD=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_MEMBER=Error
+INTERFACE_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+INVALID_ANNOTATION=Ignore
+INVALID_JAVADOC_TAG=Ignore
+INVALID_REFERENCE_IN_SYSTEM_LIBRARIES=Ignore
+LEAK_EXTEND=Warning
+LEAK_FIELD_DECL=Warning
+LEAK_IMPLEMENT=Warning
+LEAK_METHOD_PARAM=Warning
+LEAK_METHOD_RETURN_TYPE=Warning
+METHOD_ELEMENT_TYPE_ADDED_RESTRICTIONS=Error
+METHOD_ELEMENT_TYPE_ADDED_TYPE_PARAMETER=Error
+METHOD_ELEMENT_TYPE_CHANGED_DECREASE_ACCESS=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_ABSTRACT_TO_ABSTRACT=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_FINAL_TO_FINAL=Error
+METHOD_ELEMENT_TYPE_CHANGED_NON_STATIC_TO_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_STATIC_TO_NON_STATIC=Error
+METHOD_ELEMENT_TYPE_CHANGED_VARARGS_TO_ARRAY=Error
+METHOD_ELEMENT_TYPE_REMOVED_ANNOTATION_DEFAULT_VALUE=Error
+METHOD_ELEMENT_TYPE_REMOVED_TYPE_PARAMETER=Error
+MISSING_EE_DESCRIPTIONS=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_ADDED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_CHANGED_INTERFACE_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_CLASS_BOUND=Error
+TYPE_PARAMETER_ELEMENT_TYPE_REMOVED_INTERFACE_BOUND=Error
+UNUSED_PROBLEM_FILTERS=Warning
+automatically_removed_unused_problem_filters=Enabled
+eclipse.preferences.version=1
+incompatible_api_component_version=Error
+incompatible_api_component_version_include_major_without_breaking_change=Disabled
+incompatible_api_component_version_include_minor_without_api_change=Disabled
+invalid_since_tag_version=Error
+malformed_since_tag=Error
+missing_since_tag=Warning
+report_api_breakage_when_major_version_incremented=Disabled
+report_resolution_errors_api_component=Warning
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..2dd006251fb
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/META-INF/MANIFEST.MF
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.editor.welcome.internationalization,
+ org.eclipse.papyrus.infra.editor.welcome.internationalization.modelelements,
+ org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets,
+ org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets.editors
+Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport,
+ org.eclipse.ui;bundle-version="[3.107.0,4.0.0)";visibility:=reexport,
+ org.eclipse.core.databinding.observable;bundle-version="[1.6.0,2.0.0)";visibility:=reexport,
+ org.eclipse.nebula.widgets.nattable.core;bundle-version="[1.4.0,2.0.0)";visibility:=reexport,
+ org.eclipse.nebula.widgets.nattable.extension.glazedlists;bundle-version="[1.4.0,2.0.0)",
+ ca.odell.glazedlists;bundle-version="[1.9.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.services.navigation;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.properties.ui;bundle-version="[2.0.0,3.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.editor.welcome;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization.ui;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.infra.editor.welcome.internationalization.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.editor.welcome.internationalization;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/about.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/about.html
new file mode 100644
index 00000000000..dd3c089a94c
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/build.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/build.properties
new file mode 100644
index 00000000000..631423469dc
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/build.properties
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2015 Christian W. Damus and others.
+#
+# 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:
+# Christian W. Damus - Initial API and implementation
+#
+
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties,\
+ model/,\
+ plugin.xml
+output.. = bin/
+src.includes = about.html
+source.. = src/
+bin.. = bin/
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/environment.xmi b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/environment.xmi
new file mode 100644
index 00000000000..f0090784c71
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/environment.xmi
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="ASCII"?>
+<environment:Environment
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:environment="http://www.eclipse.org/papyrus/properties/environment/0.9">
+ <modelElementFactories
+ name="InternationalizationWelcomeModelElementFactory"
+ factoryClass="org.eclipse.papyrus.infra.editor.welcome.internationalization.modelelements.InternationalizationWelcomeModelElementFactory"/>
+ <namespaces
+ name="ppewi"
+ value="org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets"/>
+</environment:Environment>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/general/internationalization.ctx b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/general/internationalization.ctx
new file mode 100644
index 00000000000..04954fd8771
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/general/internationalization.ctx
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ASCII"?>
+<contexts:Context xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:contexts="http://www.eclipse.org/papyrus/properties/contexts/0.9" xmi:id="_MPALcI7eEeWNa5T2Agi7uA" name="welcome-internationalization" label="Internationalization">
+ <tabs xmi:id="_SsfbQcElEeS_u7hIvAIReA" label="Internationalization" id="internationalization" category="org.eclipse.papyrus" priority="75">
+ <sections xmi:id="_SsgCV8ElEeS_u7hIvAIReA" name="Single Languages" sectionFile="ui/SingleInternationalization.xwt">
+ <widget href="ui/SingleInternationalization.xwt#/"/>
+ </sections>
+ </tabs>
+ <views xmi:id="_Ssiem8ElEeS_u7hIvAIReA" name="Single Languages" sections="_SsgCV8ElEeS_u7hIvAIReA" automaticContext="true" datacontexts="_SsmJGsElEeS_u7hIvAIReA">
+ <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_SskT2cElEeS_u7hIvAIReA" name="isWelcomeElement">
+ <constraintType href="ppe:/environment/org.eclipse.papyrus.infra.editor.welcome/model/environment.xmi#//@constraintTypes.0"/>
+ <properties xsi:type="constraints:ValueProperty" xmi:id="_SskT2sElEeS_u7hIvAIReA" name="metaclassName" value="Welcome"/>
+ </constraints>
+ </views>
+ <dataContexts xmi:id="_SsmI-cElEeS_u7hIvAIReA" name="welcomeInternationalization" label="Welcome">
+ <elements xmi:id="_SsmJGsElEeS_u7hIvAIReA" name="Internationalization">
+ <properties xmi:id="_SsmJG8ElEeS_u7hIvAIReA" name="privateStorage" label="Private storage" type="Boolean" description="Determinates where the internationalization preference must be stored"/>
+ <properties xmi:id="_SsmJG8ElEeS_u7hIvAIReB" name="useInternationalization" label="Use internationalization" type="Boolean" description="Determinates if the internationalization must be used in the papyrus project"/>
+ <properties xmi:id="_SsmJG8ElEeS_u7hIvAIReC" name="language" label="Language" description="The language used for the internationalization"/>
+ </elements>
+ <modelElementFactory href="ppe:/environment/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/environment.xmi#//@modelElementFactories.0"/>
+ </dataContexts>
+</contexts:Context>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/general/ui/SingleInternationalization.xwt b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/general/ui/SingleInternationalization.xwt
new file mode 100644
index 00000000000..66a074b448a
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/model/general/ui/SingleInternationalization.xwt
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Composite
+ xmlns:ppewi="clr-namespace:org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets"
+ xmlns:x="http://www.eclipse.org/xwt" xmlns:ppe="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets"
+ xmlns="http://www.eclipse.org/xwt/presentation"
+ xmlns:ppel="clr-namespace:org.eclipse.papyrus.infra.properties.ui.widgets.layout"
+ xmlns:j="clr-namespace:java.lang">
+ <Composite.layout>
+ <ppel:PropertiesLayout></ppel:PropertiesLayout>
+ </Composite.layout>
+ <ppe:BooleanCheckbox input="{Binding}"
+ property="welcomeInternationalization:Internationalization:privateStorage"></ppe:BooleanCheckbox>
+ <ppe:BooleanCheckbox input="{Binding}"
+ property="welcomeInternationalization:Internationalization:useInternationalization"></ppe:BooleanCheckbox>
+ <ppewi:LanguageDialog input="{Binding}"
+ property="welcomeInternationalization:Internationalization:language"></ppewi:LanguageDialog>
+</Composite> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/plugin.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/plugin.properties
new file mode 100644
index 00000000000..556958d2ac1
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName=Papyrus Internationalization for Editor Welcome Page
+providerName=Eclipse Modeling Project
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/plugin.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/plugin.xml
new file mode 100644
index 00000000000..e5b77e9ba22
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/plugin.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.properties.contexts">
+ <context
+ contextModel="model/general/internationalization.ctx">
+ </context>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.properties.environments">
+ <environment
+ environmentModel="model/environment.xmi">
+ </environment>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.properties.ui.context">
+ <preferencePageBinding
+ context="welcome-internationalization"
+ page="org.eclipse.papyrus.infra.editor.welcome.content">
+ </preferencePageBinding>
+ </extension>
+</plugin>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/pom.xml
new file mode 100644
index 00000000000..b0450dffe5c
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.editor.welcome.internationalization</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/Activator.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/Activator.java
new file mode 100644
index 00000000000..06e75c1c076
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/Activator.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.editor.welcome.internationalization"; //$NON-NLS-1$
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The log helper.
+ */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java
new file mode 100644
index 00000000000..8696a73b925
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization.modelelements;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement;
+
+/**
+ * The internationalization welcome model element.
+ */
+public class InternationalizationWelcomeModelElement extends EMFModelElement {
+
+ /**
+ * The private storage identifier.
+ */
+ private final String PRIVATE_STORAGE = "privateStorage"; //$NON-NLS-1$
+
+ /**
+ * The useInternationalization identifier.
+ */
+ private final String USE_INTERNATIONALIZATION = "useInternationalization"; //$NON-NLS-1$
+
+ /**
+ * The language identifier.
+ */
+ private final String LANGUAGE = "language"; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ * @param source
+ * The source eObject.
+ * @param domain
+ * The current editing domain.
+ */
+ public InternationalizationWelcomeModelElement(final EObject source, final EditingDomain domain) {
+ super(source, domain);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#doGetObservable(java.lang.String)
+ */
+ @Override
+ protected IObservable doGetObservable(final String propertyPath) {
+ IObservable result = null;
+
+ switch (propertyPath) {
+ case PRIVATE_STORAGE:
+ result = new PrivateInternationalizationPreferenceObservableValue(domain);
+ break;
+ case USE_INTERNATIONALIZATION:
+ result = new UseInternationalizationObservableValue(domain);
+ break;
+ case LANGUAGE:
+ result = new LanguageObservableValue(domain);
+ break;
+ default:
+ break;
+ }
+
+ return null != result ? result : super.doGetObservable(propertyPath);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#isFeatureEditable(java.lang.String)
+ */
+ @Override
+ protected boolean isFeatureEditable(final String propertyPath) {
+ boolean result;
+
+ switch (propertyPath) {
+ case PRIVATE_STORAGE:
+ result = true;
+ break;
+ case USE_INTERNATIONALIZATION:
+ result = true;
+ break;
+ case LANGUAGE:
+ result = true;
+ break;
+ default:
+ result = super.isFeatureEditable(propertyPath);
+ break;
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#isElementEditable()
+ */
+ @Override
+ protected boolean isElementEditable() {
+ return true;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElementFactory.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElementFactory.java
new file mode 100644
index 00000000000..5dd2bdcc913
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElementFactory.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization.modelelements;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.editor.welcome.internationalization.Activator;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.properties.contexts.DataContextElement;
+import org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractEMFModelElementFactory;
+
+/**
+ * The internationalization welcome model element factory for the welcome properties of the internationalization.
+ */
+public class InternationalizationWelcomeModelElementFactory extends AbstractEMFModelElementFactory<InternationalizationWelcomeModelElement> {
+
+ /**
+ * Constructor.
+ */
+ public InternationalizationWelcomeModelElementFactory() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.AbstractModelElementFactory#doCreateFromSource(java.lang.Object, org.eclipse.papyrus.infra.properties.contexts.DataContextElement)
+ */
+ @Override
+ protected InternationalizationWelcomeModelElement doCreateFromSource(final Object sourceElement, final DataContextElement context) {
+ final EObject source = EMFHelper.getEObject(sourceElement);
+ if (null == source) {
+ Activator.log.warn("Unable to resolve the selected element to an EObject"); //$NON-NLS-1$
+ return null;
+ }
+
+ final EditingDomain domain = EMFHelper.resolveEditingDomain(source);
+ return new InternationalizationWelcomeModelElement(source, domain);
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/LanguageObservableValue.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/LanguageObservableValue.java
new file mode 100644
index 00000000000..062a8556070
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/LanguageObservableValue.java
@@ -0,0 +1,174 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization.modelelements;
+
+import org.eclipse.core.databinding.observable.IObserving;
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.commands.AddEAnnotationDetailCommand;
+import org.eclipse.papyrus.infra.emf.commands.AddToResourceCommand;
+import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationDetailCommand;
+import org.eclipse.papyrus.infra.emf.commands.RemoveFromResourcecommand;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
+import org.eclipse.papyrus.infra.internationalization.common.command.LocaleInternationalizationPreferenceCommand;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationAnnotationResourceUtils;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationPreferenceModel;
+import org.eclipse.papyrus.infra.internationalization.ui.Activator;
+import org.eclipse.papyrus.infra.internationalization.utils.InternationalizationPreferenceModelUtils;
+
+/**
+ * The observable value for the language internationalization preference and annotation detail.
+ */
+public class LanguageObservableValue extends AbstractObservableValue<String> implements IObserving {
+
+ /**
+ * The editing domain to execute the command.
+ */
+ private EditingDomain domain;
+
+ /**
+ * Constructor.
+ *
+ * @param domain
+ * The editing domain.
+ */
+ public LanguageObservableValue(final EditingDomain domain) {
+ super();
+ this.domain = domain;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.IObserving#getObserved()
+ */
+ @Override
+ public Object getObserved() {
+ final InternationalizationPreferenceModel model = InternationalizationPreferenceModelUtils.getInternationalizationPreferenceModel((ModelSet) domain.getResourceSet());
+ return model.getPrivateResourceURI();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ */
+ @Override
+ public Object getValueType() {
+ return String.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ */
+ @Override
+ protected String doGetValue() {
+ final InternationalizationPreferenceModel model = InternationalizationPreferenceModelUtils.getInternationalizationPreferenceModel((ModelSet) domain.getResourceSet());
+ return InternationalizationPreferencesUtils.getLocalePreference(model.getPrivateResourceURI()).toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
+ */
+ @Override
+ protected void doSetValue(final String value) {
+ final Command command = getSetCommand(value);
+ domain.getCommandStack().execute(command);
+ }
+
+ /**
+ * Returns the command used to edit the value.
+ *
+ * @param value
+ * The new value
+ * @return
+ * The Set command used to edit the value
+ */
+ protected Command getSetCommand(final String value) {
+ boolean needCreateAnnotation = true;
+
+ final InternationalizationPreferenceModel model = InternationalizationPreferenceModelUtils.getInternationalizationPreferenceModel((ModelSet) domain.getResourceSet());
+ final Resource resource = model.getResource();
+
+ // Search the internationalization annotation in the notation resource
+ EAnnotation annotation = InternationalizationAnnotationResourceUtils.getInternationalizationAnnotation(resource);
+
+ final CompoundCommand compoundCommand = new CompoundCommand("Create internationalization command"); //$NON-NLS-1$
+
+ if (null != annotation) {
+ if (annotation.getDetails().containsKey(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE)) {
+ try {
+ final TransactionalEditingDomain domainForResource = ServiceUtilsForResource.getInstance().getTransactionalEditingDomain(resource);
+
+ // Remove the details from annotation
+ compoundCommand.append(new RemoveEAnnotationDetailCommand(domainForResource, annotation, InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE));
+
+ // If the detail is the only one, delete the annotation
+ if (1 == annotation.getDetails().size()) {
+ compoundCommand.append(new RemoveFromResourcecommand(domainForResource, resource, annotation));
+ } else {
+ needCreateAnnotation = false;
+ }
+ } catch (final ServiceException e) {
+ Activator.log.error(e);
+ }
+ } else {
+ needCreateAnnotation = false;
+ }
+ }
+
+ if (null != value) {
+ // Create the annotation if the internationalization value
+ // is not false
+ if (needCreateAnnotation) {
+ annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation
+ .setSource(InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL);
+ annotation.getDetails().put(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE,
+ value);
+ compoundCommand.append(new GMFtoEMFCommandWrapper(new AddToResourceCommand(((ModelSet) resource.getResourceSet()).getTransactionalEditingDomain(), resource, annotation)));
+ } else {
+ try {
+ final TransactionalEditingDomain domainForResource = ServiceUtilsForResource.getInstance().getTransactionalEditingDomain(resource);
+
+ compoundCommand.append(new AddEAnnotationDetailCommand(domainForResource, annotation, InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE, value));
+ } catch (final ServiceException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ // Manage the preference by command
+ compoundCommand.append(new LocaleInternationalizationPreferenceCommand(model.getPrivateResourceURI(),
+ value));
+ }
+
+ return !compoundCommand.getCommandList().isEmpty() ? compoundCommand : UnexecutableCommand.INSTANCE;
+ }
+} \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/PrivateInternationalizationPreferenceObservableValue.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/PrivateInternationalizationPreferenceObservableValue.java
new file mode 100644
index 00000000000..8ec4e6ad70b
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/PrivateInternationalizationPreferenceObservableValue.java
@@ -0,0 +1,171 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization.modelelements;
+
+import static org.eclipse.core.databinding.observable.Diffs.createValueDiff;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Objects;
+
+import org.eclipse.core.databinding.observable.Diffs;
+import org.eclipse.core.databinding.observable.Realm;
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.editor.welcome.internationalization.Activator;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
+import org.eclipse.papyrus.infra.internationalization.commands.InternationalizationPreferenceCommandFactory;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationPreferenceModel;
+import org.eclipse.papyrus.infra.internationalization.utils.InternationalizationPreferenceModelUtils;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+
+/**
+ * Encapsulation of the "shared layout" property of the Papyrus Editor.
+ */
+public class PrivateInternationalizationPreferenceObservableValue extends AbstractObservableValue<Boolean> implements PropertyChangeListener {
+
+ /**
+ * The internationalization preference model.
+ */
+ private InternationalizationPreferenceModel internationalizationPrefModel;
+
+ /**
+ * The current editing domain.
+ */
+ protected final EditingDomain domain;
+
+ /**
+ * Constructor.
+ *
+ * @param domain
+ * The current editing domain.
+ */
+ public PrivateInternationalizationPreferenceObservableValue(final EditingDomain domain) {
+ this(Realm.getDefault(), domain);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param realm
+ * The {@link Realm}.
+ * @param domain
+ * The current editing domain.
+ */
+ public PrivateInternationalizationPreferenceObservableValue(final Realm realm, final EditingDomain domain) {
+ super(realm);
+
+ this.domain = domain;
+
+ internationalizationPrefModel = InternationalizationPreferenceModelUtils.getInternationalizationPreferenceModel((ModelSet) domain.getResourceSet());
+ if (null != internationalizationPrefModel) {
+ internationalizationPrefModel.addPropertyChangeListener(InternationalizationPreferenceModel.PROPERTY_LEGACY_MODE, this);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.AbstractObservable#dispose()
+ */
+ @Override
+ public synchronized void dispose() {
+ if (null != internationalizationPrefModel) {
+ internationalizationPrefModel.removePropertyChangeListener(InternationalizationPreferenceModel.PROPERTY_LEGACY_MODE, this);
+ internationalizationPrefModel = null;
+ }
+
+ super.dispose();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ */
+ @Override
+ protected Boolean doGetValue() {
+ return internationalizationPrefModel.isLegacyMode();
+ }
+
+ /**
+ * Get the command for the private storage.
+ *
+ * @param factory
+ * The factory to create the command.
+ * @return The command to manage the private storage.
+ */
+ protected Command getToggleCommand(final InternationalizationPreferenceCommandFactory factory) {
+ return factory.createTogglePrivateStorageCommand();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ */
+ @Override
+ public Object getValueType() {
+ return Boolean.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
+ */
+ @Override
+ protected void doSetValue(final Boolean value) {
+ Boolean oldValue = getValue();
+ if (!Objects.equals(oldValue, value)) {
+ IMultiDiagramEditor editor;
+
+ try {
+ editor = ServiceUtilsForResourceSet.getInstance().getService(IMultiDiagramEditor.class, domain.getResourceSet());
+ final ModelSet modelSet = (ModelSet) editor.getAdapter(EditingDomain.class).getResourceSet();
+ final Command command = getToggleCommand(new InternationalizationPreferenceCommandFactory(modelSet));
+ if (command.canExecute()) {
+ // Don't do this in an undoable command on the history
+ try {
+ domain.getCommandStack().execute(command);
+ fireValueChange(Diffs.createValueDiff(oldValue, value));
+ } catch (Exception e) {
+ Activator.log.error("Failed to toggle editor page layout option", e); //$NON-NLS-1$
+ }
+ }
+ } catch (final ServiceException e) {
+ throw new IllegalStateException("No editor available in the service registry", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
+ */
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getSource() == internationalizationPrefModel) {
+ switch (evt.getPropertyName()) {
+ case InternationalizationPreferenceModel.PROPERTY_LEGACY_MODE:
+ fireValueChange(createValueDiff(!(Boolean) evt.getOldValue(), !(Boolean) evt.getNewValue()));
+ break;
+ }
+ }
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/UseInternationalizationObservableValue.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/UseInternationalizationObservableValue.java
new file mode 100644
index 00000000000..d90e174f181
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/UseInternationalizationObservableValue.java
@@ -0,0 +1,165 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization.modelelements;
+
+import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.commands.AddEAnnotationDetailCommand;
+import org.eclipse.papyrus.infra.emf.commands.AddToResourceCommand;
+import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationDetailCommand;
+import org.eclipse.papyrus.infra.emf.commands.RemoveFromResourcecommand;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
+import org.eclipse.papyrus.infra.internationalization.common.command.UseInternationalizationPreferenceCommand;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationAnnotationResourceUtils;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationPreferenceModel;
+import org.eclipse.papyrus.infra.internationalization.ui.Activator;
+import org.eclipse.papyrus.infra.internationalization.utils.InternationalizationPreferenceModelUtils;
+
+/**
+ * The observable value for the use internationalization preference and annotation detail.
+ */
+public class UseInternationalizationObservableValue extends AbstractObservableValue<Boolean> {
+
+ /**
+ * The editing domain to execute the command.
+ */
+ private EditingDomain domain;
+
+ /**
+ * Constructor.
+ *
+ * @param domain
+ * The editing domain.
+ */
+ public UseInternationalizationObservableValue(final EditingDomain domain) {
+ super();
+ this.domain = domain;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.IObservableValue#getValueType()
+ */
+ @Override
+ public Object getValueType() {
+ return Boolean.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doGetValue()
+ */
+ @Override
+ protected Boolean doGetValue() {
+ final InternationalizationPreferenceModel model = InternationalizationPreferenceModelUtils.getInternationalizationPreferenceModel((ModelSet) domain.getResourceSet());
+ return InternationalizationPreferencesUtils.getInternationalizationPreference(model.getPrivateResourceURI());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.databinding.observable.value.AbstractObservableValue#doSetValue(java.lang.Object)
+ */
+ @Override
+ protected void doSetValue(final Boolean value) {
+ final Command command = getSetCommand(value);
+ domain.getCommandStack().execute(command);
+ }
+
+ /**
+ * Returns the command used to edit the value.
+ *
+ * @param value
+ * The new value
+ * @return
+ * The Set command used to edit the value
+ */
+ protected Command getSetCommand(final Boolean value) {
+ boolean needCreateAnnotation = true;
+
+ final InternationalizationPreferenceModel model = InternationalizationPreferenceModelUtils.getInternationalizationPreferenceModel((ModelSet) domain.getResourceSet());
+ final Resource resource = model.getResource();
+
+ // Search the internationalization annotation in the notation resource
+ EAnnotation annotation = InternationalizationAnnotationResourceUtils.getInternationalizationAnnotation(resource);
+
+ final CompoundCommand compoundCommand = new CompoundCommand("Create internationalization command"); //$NON-NLS-1$
+
+ if (null != annotation) {
+ if (annotation.getDetails().containsKey(InternationalizationPreferencesConstants.USE_DETAIL_ANNOTATION_LABEL)) {
+ try {
+ final TransactionalEditingDomain domainForResource = ServiceUtilsForResource.getInstance().getTransactionalEditingDomain(resource);
+
+ // Remove the details from annotation
+ compoundCommand.append(new RemoveEAnnotationDetailCommand(domainForResource, annotation, InternationalizationPreferencesConstants.USE_DETAIL_ANNOTATION_LABEL));
+
+ // If the detail is the only one, delete the annotation
+ if (1 == annotation.getDetails().size()) {
+ compoundCommand.append(new RemoveFromResourcecommand(domainForResource, resource, annotation));
+ } else {
+ needCreateAnnotation = false;
+ }
+ } catch (final ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ // Remove the preference by command
+ compoundCommand.append(new UseInternationalizationPreferenceCommand(model.getPrivateResourceURI(), false));
+ } else {
+ needCreateAnnotation = false;
+ }
+ }
+
+ if (value) {
+ // Create the annotation if the internationalization value
+ // is not false
+ if (needCreateAnnotation) {
+ annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation.setSource(InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL);
+ annotation.getDetails().put(
+ InternationalizationPreferencesConstants.USE_DETAIL_ANNOTATION_LABEL,
+ Boolean.toString(value));
+ compoundCommand.append(new GMFtoEMFCommandWrapper(new AddToResourceCommand(((ModelSet) resource.getResourceSet()).getTransactionalEditingDomain(), resource, annotation)));
+ } else {
+ try {
+ final TransactionalEditingDomain domainForResource = ServiceUtilsForResource.getInstance().getTransactionalEditingDomain(resource);
+
+ compoundCommand.append(new AddEAnnotationDetailCommand(domainForResource, annotation, InternationalizationPreferencesConstants.USE_DETAIL_ANNOTATION_LABEL, Boolean.toString(value)));
+ } catch (final ServiceException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ // Manage the preference by command
+ compoundCommand.append(new UseInternationalizationPreferenceCommand(model.getPrivateResourceURI(),
+ value));
+ }
+
+ return !compoundCommand.getCommandList().isEmpty() ? compoundCommand : UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/widgets/LanguageDialog.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/widgets/LanguageDialog.java
new file mode 100644
index 00000000000..240b2ed864f
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/widgets/LanguageDialog.java
@@ -0,0 +1,55 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets;
+
+import org.eclipse.papyrus.infra.properties.ui.widgets.AbstractPropertyEditor;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * The language property dialog widget for the internationalization.
+ */
+public class LanguageDialog extends AbstractPropertyEditor {
+
+ /**
+ * The LanguageDialog widget.
+ */
+ protected org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets.editors.LanguageDialog editor;
+
+ /**
+ * Constructor.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed.
+ * @param style
+ * The style for the widget.
+ */
+ public LanguageDialog(final Composite parent, final int style) {
+ setEditor(createLanguageDialogEditor(parent, style));
+ }
+
+ /**
+ * Creates the language dialog.
+ *
+ * @param parent
+ * The composite in which the widget will be displayed.
+ * @param style
+ * The style for the widget.
+ * @return The language dialog.
+ */
+ protected org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets.editors.LanguageDialog createLanguageDialogEditor(
+ final Composite parent, final int style) {
+ return editor = new org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets.editors.LanguageDialog(parent, style);
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/widgets/editors/LanguageDialog.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/widgets/editors/LanguageDialog.java
new file mode 100644
index 00000000000..c5a7a4820c7
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/widgets/editors/LanguageDialog.java
@@ -0,0 +1,266 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization.widgets.editors;
+
+import java.util.Locale;
+
+import org.eclipse.core.databinding.observable.IObserving;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.internationalization.ui.dialogs.InternationalizationDialog;
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor;
+import org.eclipse.papyrus.infra.widgets.messages.Messages;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * This allows to define the language editor.
+ */
+public class LanguageDialog extends AbstractValueEditor implements SelectionListener {
+
+ /**
+ * The CLabel displaying the current value.
+ */
+ protected final CLabel currentValueLabel;
+
+ /**
+ * The Button used to modify the value.
+ */
+ protected Button modifyValuesButton;
+
+ /**
+ * The dialog used to select the internationalization value.
+ */
+ protected final InternationalizationDialog dialog;
+
+ /**
+ * The current value for this editor
+ */
+ protected Object value;
+
+ /**
+ * Boolean to determinate if the editors are read-only.
+ */
+ protected boolean readOnly;
+
+ /**
+ * Constructs a new LanguageDialog in the given parent Composite. The style
+ * will be applied to the CLabel displaying the current value.
+ *
+ * @param parent
+ * The parent composite.
+ * @param style
+ * The style of the composites.
+ */
+ public LanguageDialog(final Composite parent, final int style) {
+ super(parent, style);
+ final GridData gridData = getDefaultLayoutData();
+
+ currentValueLabel = factory.createCLabel(this, null, factory.getBorderStyle() | style);
+ currentValueLabel.setLayoutData(gridData);
+ currentValueLabel.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ editAction();
+ }
+
+ });
+
+ dialog = createDialog(parent.getShell());
+
+ createButton();
+ updateControls();
+ controlDecoration = new ControlDecoration(currentValueLabel, SWT.TOP | SWT.LEFT);
+
+ gridData.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
+ }
+
+ /**
+ * This allows to create the internationalization language dialog.
+ *
+ * @param shell
+ * The parent shell.
+ * @return The created dialog.
+ */
+ protected InternationalizationDialog createDialog(final Shell shell) {
+ return new InternationalizationDialog(shell, null, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor#setModelObservable(org.eclipse.core.databinding.observable.value.IObservableValue)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void setModelObservable(final IObservableValue modelProperty) {
+ super.setModelObservable(modelProperty);
+
+ if (modelProperty instanceof IObserving) {
+ Object observed = ((IObserving) modelProperty).getObserved();
+ if (observed instanceof URI) {
+ URI resourceURI = (URI) observed;
+ dialog.setResourceURI(resourceURI);
+
+ final String localeAsString = InternationalizationPreferencesUtils.getLocalePreference(resourceURI).toString();
+ currentValueLabel.setText(localeAsString);
+ }
+ }
+ }
+
+ /**
+ * This allow to create the buttons.
+ */
+ protected void createButton() {
+ ((GridLayout) getLayout()).numColumns += 1;
+
+ modifyValuesButton = factory.createButton(this, null, SWT.PUSH);
+ modifyValuesButton.setImage(Activator.getDefault().getImage("/icons/Edit_12x12.gif")); //$NON-NLS-1$
+ modifyValuesButton.setToolTipText(Messages.ReferenceDialog_EditValue);
+ modifyValuesButton.addSelectionListener(this);
+ }
+
+ /**
+ * The action executed when the "edit" button is selected Edits the object
+ * that is currently selected
+ */
+ protected void editAction() {
+ int result = dialog.open();
+ if (Window.OK == result) {
+ final Locale newValue = dialog.getLocaleValue();
+ if (null != newValue) {
+ setValue(newValue.toString());
+ }
+ }
+ }
+
+ /**
+ * This allows to update the controls.
+ */
+ protected void updateControls() {
+ modifyValuesButton.setEnabled(!readOnly);
+ }
+
+ /**
+ * This allows to update the label text.
+ */
+ protected void updateLabel() {
+ currentValueLabel.setText((String) getValue());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractValueEditor#getValue()
+ */
+ @Override
+ public Object getValue() {
+ if (modelProperty != null) {
+ return modelProperty.getValue();
+ }
+ return value;
+ }
+
+ /**
+ * Set the value.
+ *
+ * @param value
+ * The value to set.
+ */
+ @SuppressWarnings("unchecked")
+ protected void setValue(final Object value) {
+ this.value = value;
+ try {
+ if (modelProperty != null) {
+ modelProperty.setValue(value);
+ }
+ } catch (Exception e) {
+ // Do nothing
+ }
+
+ updateLabel();
+ commit();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#getEditableType()
+ */
+ @Override
+ public Object getEditableType() {
+ return Object.class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#setReadOnly(boolean)
+ */
+ @Override
+ public void setReadOnly(final boolean readOnly) {
+ this.readOnly = readOnly;
+ updateControls();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.AbstractEditor#isReadOnly()
+ */
+ @Override
+ public boolean isReadOnly() {
+ return readOnly;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ Widget widget = e.widget;
+ if (widget == modifyValuesButton) {
+ editAction();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetDefaultSelected(final SelectionEvent e) {
+ // Do nothing
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.classpath b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.project b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.project
new file mode 100644
index 00000000000..89db6d88791
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.internationalization.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </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>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..d0413afa7d4
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.internationalization.common;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.papyrus.infra.internationalization.common,
+ org.eclipse.papyrus.infra.internationalization.common.command,
+ org.eclipse.papyrus.infra.internationalization.common.editor,
+ org.eclipse.papyrus.infra.internationalization.common.utils
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)",
+ org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.ui.workbench;bundle-version="[3.108.0,4.0.0)",
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jface;bundle-version="[3.12.0,4.0.0)"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.papyrus.infra.internationalization.common.Activator
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/about.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/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>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/build.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/build.properties
new file mode 100644
index 00000000000..2964bc2d7b1
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/build.properties
@@ -0,0 +1,11 @@
+#
+
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/plugin.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/plugin.properties
new file mode 100644
index 00000000000..a4775a24081
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = Papyrus Internationalization Common
+providerName = Eclipse Modeling Project
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/plugin.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/plugin.xml
new file mode 100644
index 00000000000..7ac51d15095
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+</plugin>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/pom.xml
new file mode 100644
index 00000000000..8f8eae08258
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.internationalization.common</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/Activator.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/Activator.java
new file mode 100644
index 00000000000..ae1975d5007
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/Activator.java
@@ -0,0 +1,153 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.common;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.papyrus.infra.core.resource.PapyrusProjectScope;
+import org.eclipse.papyrus.infra.ui.preferences.PapyrusScopedPreferenceStore;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.internationalization.common"; //$NON-NLS-1$
+
+ /**
+ * The internationalization preference node label.
+ */
+ public static final String INTERNATIONALIZATION_NODE_LABEL = "internationalization"; //$NON-NLS-1$
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The log helper.
+ */
+ public static LogHelper log;
+
+ /**
+ * Storage for preferences. Use a list of preference store (one preference
+ * store by internationalization of a project).
+ */
+ private List<IPreferenceStore> preferencesStore;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ preferencesStore = new ArrayList<IPreferenceStore>(0);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Get the preference store and create it if necessary.
+ *
+ * @param project
+ * The current project
+ * @param papyrusProjectName
+ * The current papyrus project name.
+ * @return The preference store.
+ */
+ public IPreferenceStore getInternationalizationPreferenceStore(final IProject project,
+ final String papyrusProjectName) {
+ IPreferenceStore result = null;
+ final IScopeContext scope = new PapyrusProjectScope(project, papyrusProjectName);
+ if (!preferencesStore.isEmpty()) {
+ final IEclipsePreferences scopePreferenceNode = scope.getNode(INTERNATIONALIZATION_NODE_LABEL);
+ final Iterator<IPreferenceStore> preferenceStoreIterator = preferencesStore.iterator();
+ while (preferenceStoreIterator.hasNext() && null == result) {
+ final IPreferenceStore preferenceStore = preferenceStoreIterator.next();
+ if (preferenceStore instanceof PapyrusScopedPreferenceStore) {
+ final IEclipsePreferences[] preferenceNodes = ((PapyrusScopedPreferenceStore) preferenceStore)
+ .getPreferenceNodes(false);
+ for (int index = 0; index < preferenceNodes.length && null == result; index++) {
+ if (preferenceNodes[index].equals(scopePreferenceNode)) {
+ result = preferenceStore;
+ }
+ }
+ }
+ }
+ }
+
+ if (null == result) {
+ result = new PapyrusScopedPreferenceStore(scope, INTERNATIONALIZATION_NODE_LABEL);
+ preferencesStore.add(result); // $NON-NLS-1$
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the first preference store if existing, else a scoped preference
+ * store must be created and added to the list of preferences store.
+ *
+ * @return The preference store.
+ */
+ public IPreferenceStore getInternationalizationPreferenceStore() {
+ // Create the preference store lazily.
+ if (preferencesStore.isEmpty()) {
+ preferencesStore.add(new ScopedPreferenceStore(InstanceScope.INSTANCE, getBundle().getSymbolicName()));
+ }
+ return preferencesStore.get(0);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/command/LocaleInternationalizationPreferenceCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/command/LocaleInternationalizationPreferenceCommand.java
new file mode 100644
index 00000000000..4d907295efc
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/command/LocaleInternationalizationPreferenceCommand.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.common.command;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+
+/**
+ * The command to modify the internationalization preference. We can't use the
+ * RecordingCommand because the modification are not applied to a resource
+ * directly.
+ */
+public class LocaleInternationalizationPreferenceCommand extends AbstractCommand {
+
+ /**
+ * The current resource URI corresponding to the internationalization
+ * preference.
+ */
+ protected URI resourceURI;
+
+ /**
+ * The new language value.
+ */
+ protected String newLanguageValue;
+
+ /**
+ * The old language value.
+ */
+ protected String oldLanguageValue;
+
+ /**
+ * Constructor.
+ *
+ * @param resourceURI
+ * The current resource URI.
+ * @param newLanguageValue
+ * The new language value.
+ */
+ public LocaleInternationalizationPreferenceCommand(final URI resourceURI, final String newLanguageValue) {
+ super("Modify locale internationalization preference"); //$NON-NLS-1$
+ this.resourceURI = resourceURI;
+ this.newLanguageValue = newLanguageValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#execute()
+ */
+ @Override
+ public void execute() {
+ oldLanguageValue = InternationalizationPreferencesUtils.getLocalePreference(resourceURI).toString();
+ InternationalizationPreferencesUtils.setLanguagePreference(resourceURI, newLanguageValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#undo()
+ */
+ @Override
+ public void undo() {
+ InternationalizationPreferencesUtils.setLanguagePreference(resourceURI, oldLanguageValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ */
+ @Override
+ public void redo() {
+ InternationalizationPreferencesUtils.setLanguagePreference(resourceURI, newLanguageValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
+ */
+ @Override
+ protected boolean prepare() {
+ return null != resourceURI;
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/command/UseInternationalizationPreferenceCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/command/UseInternationalizationPreferenceCommand.java
new file mode 100644
index 00000000000..887e31d851c
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/command/UseInternationalizationPreferenceCommand.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.common.command;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+
+/**
+ * The command to modify the internationalization preference. We can't use the
+ * RecordingCommand because the modification are not applied to a resource
+ * directly.
+ */
+public class UseInternationalizationPreferenceCommand extends AbstractCommand {
+
+ /**
+ * The current resource URI corresponding to the internationalization
+ * preference.
+ */
+ protected URI resourceURI;
+
+ /**
+ * The new boolean value.
+ */
+ protected boolean newBooleanValue;
+
+ /**
+ * The old boolean value.
+ */
+ protected boolean oldBooleanValue;
+
+ /**
+ * Constructor.
+ *
+ * @param resourceURI
+ * The current resource URI.
+ * @param newBooleanValue
+ * The new boolean value.
+ */
+ public UseInternationalizationPreferenceCommand(final URI resourceURI, final boolean newBooleanValue) {
+ super("Modify use internationalization preference"); //$NON-NLS-1$
+ this.resourceURI = resourceURI;
+ this.newBooleanValue = newBooleanValue;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#execute()
+ */
+ @Override
+ public void execute() {
+ oldBooleanValue = InternationalizationPreferencesUtils.getInternationalizationPreference(resourceURI);
+ InternationalizationPreferencesUtils.setInternationalizationPreference(resourceURI, newBooleanValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#undo()
+ */
+ @Override
+ public void undo() {
+ InternationalizationPreferencesUtils.setInternationalizationPreference(resourceURI, oldBooleanValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ */
+ @Override
+ public void redo() {
+ InternationalizationPreferencesUtils.setInternationalizationPreference(resourceURI, newBooleanValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
+ */
+ @Override
+ protected boolean prepare() {
+ return null != resourceURI;
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/editor/IInternationalizationEditor.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/editor/IInternationalizationEditor.java
new file mode 100644
index 00000000000..40b46182a1f
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/editor/IInternationalizationEditor.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.common.editor;
+
+/**
+ * Interface to define if the editor support the internationalization and the corresponding label modification.
+ */
+public interface IInternationalizationEditor {
+
+ /**
+ * This allows to modify the part name.
+ *
+ * @param name
+ * The new name of the editor.
+ */
+ public void modifyPartName(final String name);
+
+ /**
+ * This allows to refresh the editor part.
+ */
+ public void refreshEditorPart();
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationAnnotationResourceUtils.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationAnnotationResourceUtils.java
new file mode 100644
index 00000000000..5da45e6d9fd
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationAnnotationResourceUtils.java
@@ -0,0 +1,49 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.common.utils;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ * Define the utils method corresponding to the internationalization annotation
+ * and its resource.
+ */
+public class InternationalizationAnnotationResourceUtils {
+
+ /**
+ * This allows to get the annotation corresponding to the
+ * internationalization in the resource in parameter if exists.
+ *
+ * @param resource
+ * The resource to check
+ * @return The internationalization annotation if exists, <code>null</code>
+ * otherwise.
+ */
+ public static EAnnotation getInternationalizationAnnotation(final Resource resource) {
+ EAnnotation result = null;
+
+ for (final EObject objectContent : resource.getContents()) {
+ if (objectContent instanceof EAnnotation
+ && InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL
+ .equals(((EAnnotation) objectContent).getSource())) {
+ result = (EAnnotation) objectContent;
+ }
+ }
+
+ return result;
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationPreferencesConstants.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationPreferencesConstants.java
new file mode 100644
index 00000000000..b7bf90ed5c0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationPreferencesConstants.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.common.utils;
+
+/**
+ * This class defines the constants for the internationalization preferences.
+ */
+public class InternationalizationPreferencesConstants {
+
+ /**
+ * The internationalization preference label.
+ */
+ public static final String USE_INTERNATIONALIZATION_PREFERENCE = "useInternationalization"; //$NON-NLS-1$
+
+ /**
+ * The label for the internationalization annotation.
+ */
+ public static final String INTERNATIONALIZATION_ANNOTATION_LABEL = "Internationalization"; //$NON-NLS-1$
+
+ /**
+ * The label of the internationalization annotation detail.
+ */
+ public static final String USE_DETAIL_ANNOTATION_LABEL = "use"; //$NON-NLS-1$
+
+ /**
+ * The language preference name.
+ */
+ public static final String LANGUAGE_PREFERENCE = "language"; //$NON-NLS-1$
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationPreferencesUtils.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationPreferencesUtils.java
new file mode 100644
index 00000000000..58cb94f1f35
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/InternationalizationPreferencesUtils.java
@@ -0,0 +1,296 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.common.utils;
+
+import java.util.Locale;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.CommonPlugin;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.internationalization.common.Activator;
+
+/**
+ * The internationalization preference utils methods which allow to get or
+ * change the internationalization preference value.
+ */
+public class InternationalizationPreferencesUtils {
+
+ /**
+ * Get the preference store for the project containing the {@link EObject}
+ * in parameter.
+ *
+ * @param eObject
+ * The eObject.
+ * @return The preference store for the project containing the EObject.
+ */
+ public static IPreferenceStore getPreferenceStore(final EObject eObject) {
+ return getPreferenceStore(getRootContainer(eObject).eResource());
+ }
+
+ /**
+ * Get the preference store for the project containing the {@link Resource}
+ * in parameter.
+ *
+ * @param resource
+ * The resource.
+ * @return The preference store for the project containing the Resource.
+ */
+ public static IPreferenceStore getPreferenceStore(final Resource resource) {
+ IPreferenceStore result = null;
+
+ if (null != resource) {
+ result = getPreferenceStore(resource.getURI());
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the preference store for the project containing the resource
+ * {@link URI} in parameter.
+ *
+ * @param resource
+ * The resource.
+ * @return The preference store for the project containing the resource URI.
+ */
+ public static IPreferenceStore getPreferenceStore(final URI uri) {
+ IPreferenceStore result = null;
+
+ if (null != uri) {
+ final String filePathString = CommonPlugin.resolve(uri).toFileString();
+
+ if (null != filePathString) {
+ final IFile resourceFile = ResourcesPlugin.getWorkspace().getRoot()
+ .getFileForLocation(new Path(filePathString));
+
+ if (null != resourceFile) {
+ final IProject currentProject = resourceFile.getProject();
+ final String papyrusProjectName = uri.trimFileExtension().lastSegment();
+
+ if (null != currentProject && !papyrusProjectName.isEmpty()) {
+ result = Activator.getDefault().getInternationalizationPreferenceStore(currentProject,
+ papyrusProjectName);
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * This allows to modify the internationalization preference value.
+ *
+ * @param eObject
+ * The {@link EObject) corresponding (to get its resource).
+ * @param value
+ * The new preference value.
+ */
+ public static void setInternationalizationPreference(final EObject eObject, final boolean value) {
+ setInternationalizationPreference(getRootContainer(eObject).eResource(), value);
+ }
+
+ /**
+ * This allows to modify the internationalization preference value.
+ *
+ * @param resource
+ * The {@link Resource) to get the papyrus project preferences.
+ * @param value
+ * The new preference value.
+ */
+ public static void setInternationalizationPreference(final Resource resource, final boolean value) {
+ setInternationalizationPreference(resource.getURI(), value);
+ }
+
+ /**
+ * This allows to modify the internationalization preference value.
+ *
+ * @param resourceURI
+ * The resource URI to get the papyrus project preferences.
+ * @param value
+ * The new preference value.
+ */
+ public static void setInternationalizationPreference(final URI resourceURI, final boolean value) {
+ final IPreferenceStore preferenceStore = getPreferenceStore(resourceURI);
+
+ if (null != preferenceStore) {
+ preferenceStore.setValue(InternationalizationPreferencesConstants.USE_INTERNATIONALIZATION_PREFERENCE,
+ value);
+ }
+ }
+
+ /**
+ * This allows to get the internationalization preference value.
+ *
+ * @param eObject
+ * The {@link EObject) corresponding (to get its resource).
+ * @return <code>true</code> if the preference value is set to true,
+ * <code>false</code> otherwise.
+ */
+ public static boolean getInternationalizationPreference(final EObject eObject) {
+ boolean result = false;
+ if(null != eObject.eResource()){
+ result = getInternationalizationPreference(getRootContainer(eObject).eResource());
+ }
+ return result;
+ }
+
+ /**
+ * This allows to get the internationalization preference value.
+ *
+ * @param resource
+ * The {@link Resource) to get the papyrus project preferences.
+ * @return <code>true</code> if the preference value is set to true,
+ * <code>false</code> otherwise.
+ */
+ public static boolean getInternationalizationPreference(final Resource resource) {
+ return getInternationalizationPreference(resource.getURI());
+ }
+
+ /**
+ * This allows to get the internationalization preference value.
+ *
+ * @param resourceURI
+ * The resource URI to get the papyrus project preferences.
+ * @return <code>true</code> if the preference value is set to true,
+ * <code>false</code> otherwise.
+ */
+ public static boolean getInternationalizationPreference(final URI resourceURI) {
+ boolean result = false;
+
+ final IPreferenceStore preferenceStore = getPreferenceStore(resourceURI);
+
+ if (null != preferenceStore && preferenceStore
+ .contains(InternationalizationPreferencesConstants.USE_INTERNATIONALIZATION_PREFERENCE)) {
+ result = preferenceStore
+ .getBoolean(InternationalizationPreferencesConstants.USE_INTERNATIONALIZATION_PREFERENCE);
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the language preference (create it with the current locale if not
+ * existing).
+ *
+ * @param resource
+ * The {@link Resource) to get the papyrus project preferences.
+ * @return The language in the preferences.
+ */
+ private static String getLanguagePreference(final URI uri) {
+ String result = null;
+
+ final IPreferenceStore preferenceStore = getPreferenceStore(uri);
+ if (null != preferenceStore
+ && preferenceStore.contains(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE)) {
+ result = preferenceStore.getString(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE);
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the locale preference created from the language preference.
+ *
+ * @param eObject
+ * The {@link EObject) corresponding (to get its resource).
+ * @return The locale preference.
+ */
+ public static Locale getLocalePreference(final EObject eObject) {
+ return getLocalePreference(getRootContainer(eObject).eResource().getURI());
+ }
+
+ /**
+ * Get the locale preference created from the language preference.
+ *
+ * @param resource
+ * The {@link Resource) to get the papyrus project preferences.
+ * @return The locale preference.
+ */
+ public static Locale getLocalePreference(final URI uri) {
+ final String localePreference = getLanguagePreference(uri);
+
+ Locale result = null;
+
+ if (null != localePreference) {
+ result = LocaleNameResolver.getLocaleFromString(localePreference);
+ } else {
+ result = Locale.getDefault();
+ }
+
+ return result;
+ }
+
+ /**
+ * This allows to set the language preference.
+ *
+ * @param eObject
+ * The {@link EObject) corresponding (to get its resource).
+ * @param language
+ * The language to set.
+ */
+ public static void setLanguagePreference(final EObject eObject, final String language) {
+ setLanguagePreference(getRootContainer(eObject).eResource(), language);
+ }
+
+ /**
+ * This allows to set the language preference.
+ *
+ * @param resource
+ * The {@link Resource) to get the papyrus project preferences.
+ * @param language
+ * The language to set.
+ */
+ public static void setLanguagePreference(final Resource resource, final String language) {
+ setLanguagePreference(resource.getURI(), language);
+ }
+
+ /**
+ * This allows to set the language preference.
+ *
+ * @param resourceURI
+ * The resource URI to get the papyrus project preferences.
+ * @param language
+ * The language to set.
+ */
+ public static void setLanguagePreference(final URI resourceURI, final String language) {
+ final IPreferenceStore preferenceStore = getPreferenceStore(resourceURI);
+
+ if (null != preferenceStore) {
+ preferenceStore.setValue(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE, language);
+ }
+ }
+
+ /**
+ * This allows to get the root container of the EObject in parameter.
+ *
+ * @param eObject The initial EObject.
+ * @return The root container.
+ */
+ protected static EObject getRootContainer(final EObject eObject){
+ EObject rootContainer = eObject;
+
+ while(null != rootContainer.eContainer()){
+ rootContainer = rootContainer.eContainer();
+ }
+
+ return rootContainer;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/LocaleNameResolver.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/LocaleNameResolver.java
new file mode 100644
index 00000000000..699266d0fbf
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.common/src/org/eclipse/papyrus/infra/internationalization/common/utils/LocaleNameResolver.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.common.utils;
+
+import java.util.Locale;
+
+/**
+ * This allows to manage easily name for the locale.
+ */
+public class LocaleNameResolver {
+
+ /**
+ * The underscore constant.
+ */
+ public static final String UNDERSCORE = "_"; //$NON-NLS-1$
+
+ /**
+ * This allows to get the corresponding locale from a text.
+ *
+ * @param initialString
+ * The initial string representing a locale.
+ * @return The locale corresponding locale from the text in parameter.
+ */
+ public static final Locale getLocaleFromString(final String initialString) {
+ String language = ""; //$NON-NLS-1$
+ String country = ""; //$NON-NLS-1$
+ String variant = ""; //$NON-NLS-1$
+
+ if (initialString.contains(UNDERSCORE)) {
+ language = initialString.substring(0, initialString.indexOf(UNDERSCORE));
+ final String substringFirstUnderscore = initialString.substring(initialString.indexOf(UNDERSCORE) + 1,
+ initialString.length());
+ if (substringFirstUnderscore.contains(UNDERSCORE)) {
+ country = substringFirstUnderscore.substring(0, substringFirstUnderscore.indexOf(UNDERSCORE));
+ variant = substringFirstUnderscore.substring(substringFirstUnderscore.indexOf(UNDERSCORE) + 1,
+ substringFirstUnderscore.length());
+ } else {
+ country = substringFirstUnderscore;
+ }
+ } else {
+ language = initialString;
+ }
+
+ return new Locale(language, country, variant);
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.classpath b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.project b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.project
new file mode 100644
index 00000000000..e931db8e813
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.internationalization.controlmode</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </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>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..7822dbc9d6f
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.internationalization.controlmode;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.papyrus.infra.internationalization.controlmode,
+ org.eclipse.papyrus.infra.internationalization.controlmode.commands,
+ org.eclipse.papyrus.infra.internationalization.controlmode.participants
+Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport,
+ org.eclipse.ui.workbench;bundle-version="[3.108.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.107.0,4.0.0)",
+ org.eclipse.papyrus.infra.services.controlmode;bundle-version="[1.5.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,3.0.0)"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.papyrus.infra.internationalization.controlmode.Activator
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/about.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/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>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/build.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/build.properties
new file mode 100644
index 00000000000..98e56b2cd5e
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/build.properties
@@ -0,0 +1,9 @@
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/plugin.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/plugin.properties
new file mode 100644
index 00000000000..eac8c610fc4
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = Papyrus Internationalization Control mode
+providerName = Eclipse Modeling Project
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/plugin.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/plugin.xml
new file mode 100644
index 00000000000..4e0e90e1adc
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/plugin.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.services.controlmode.participant">
+ <participant
+ class="org.eclipse.papyrus.infra.internationalization.controlmode.participants.InternationalizationAnnotationControlParticipant">
+ </participant>
+ <participant
+ class="org.eclipse.papyrus.infra.internationalization.controlmode.participants.PropertiesControlParticipant">
+ </participant>
+ <participant
+ class="org.eclipse.papyrus.infra.internationalization.controlmode.participants.PropertiesUncontrolParticipant">
+ </participant>
+ </extension>
+
+
+</plugin>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/pom.xml
new file mode 100644
index 00000000000..9a7c2a022c7
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.internationalization.controlmode</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/Activator.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/Activator.java
new file mode 100644
index 00000000000..45547a86cce
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/Activator.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.controlmode;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.internationalization.controlmode"; //$NON-NLS-1$
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The log helper.
+ */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/ControlPropertiesCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/ControlPropertiesCommand.java
new file mode 100644
index 00000000000..096bb538d35
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/ControlPropertiesCommand.java
@@ -0,0 +1,328 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.controlmode.commands;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationFactory;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary;
+import org.eclipse.papyrus.infra.internationalization.controlmode.Activator;
+import org.eclipse.papyrus.infra.internationalization.controlmode.utils.ControlPropertiesUtils;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+import org.eclipse.papyrus.infra.internationalization.utils.PropertiesFilesUtils;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.commands.AbstractControlCommand;
+
+/**
+ * The control command for the properties files.
+ */
+public class ControlPropertiesCommand extends AbstractControlCommand {
+
+ /**
+ * The Constant COMMAND_TITLE.
+ */
+ private static final String COMMAND_TITLE = "Properties control command"; //$NON-NLS-1$
+
+ /**
+ * The old internationalization model resource.
+ */
+ private InternationalizationModelResource internationalizationModelResource = null;
+
+ /**
+ * The old notation resource.
+ */
+ private Resource oldNotationResource = null;
+
+ /**
+ * Constructor.
+ *
+ * @param request
+ * The request.
+ */
+ public ControlPropertiesCommand(final ControlModeRequest request) {
+ this(COMMAND_TITLE, request);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param commandTitle
+ * The command title.
+ * @param request
+ * The request.
+ */
+ public ControlPropertiesCommand(final String commandTitle, final ControlModeRequest request) {
+ super(commandTitle, null, request);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info)
+ throws ExecutionException {
+
+ final Set<Resource> createdResources = new HashSet<Resource>();
+
+ @SuppressWarnings("unchecked")
+ final Map<Locale, Resource> createdPropertiesResources = (Map<Locale, Resource>) getRequest()
+ .getParameter(ControlPropertiesUtils.CREATED_PROPERTIES_RESOURCES);
+ for (final Locale locale : createdPropertiesResources.keySet()) {
+ // Get the new properties resource for the locale
+ final Resource newPropertiesResource = createdPropertiesResources.get(locale);
+ if (null == newPropertiesResource) {
+ return CommandResult.newErrorCommandResult("The properties model has not been created"); //$NON-NLS-1$
+ }
+
+ InternationalizationLibrary library = null;
+ for (final EObject objectContant : newPropertiesResource.getContents()) {
+ if (objectContant instanceof InternationalizationLibrary) {
+ library = (InternationalizationLibrary) objectContant;
+ }
+ }
+
+ if (null == library) {
+ // The library does not exist, create it and add entries
+ library = InternationalizationFactory.eINSTANCE.createInternationalizationLibrary();
+ newPropertiesResource.getContents().add(library);
+ }
+
+ final List<InternationalizationEntry> entries = getInternationalizationEntries(locale);
+ if (!entries.isEmpty()) {
+
+ // The library exists, just add entries
+ for (final InternationalizationEntry entry : entries) {
+ library.getEntries().add(EcoreUtil.copy(entry));
+ }
+
+ final Resource oldPropertiesResource = getOldPropertiesResource(locale);
+ final InternationalizationLibrary oldLibrary = (InternationalizationLibrary) oldPropertiesResource
+ .getContents().get(0);
+
+ oldLibrary.getEntries().removeAll(entries);
+ }
+
+ createdResources.add(newPropertiesResource);
+ }
+
+ return CommandResult.newOKCommandResult(createdResources);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doRedo(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected IStatus doRedo(final IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ return doExecuteWithResult(monitor, info).getStatus();
+ }
+
+ /**
+ * Get the internationalization entries for the diagrams and the tables of
+ * objects in sub model.
+ *
+ * @param locale
+ * The current locale to manage.
+ * @return The internationalization entries.
+ * @throws ExecutionException
+ * The possible execution exception.
+ */
+ protected List<InternationalizationEntry> getInternationalizationEntries(final Locale locale)
+ throws ExecutionException {
+ final List<InternationalizationEntry> entries = new ArrayList<InternationalizationEntry>();
+
+ getInternationalizationModelResource();
+
+ if (null != internationalizationModelResource) {
+
+ // Search the EObject labels to control
+ final EObject targetObject = getRequest().getTargetObject();
+
+ InternationalizationEntry entryForKey = internationalizationModelResource
+ .getEntryForKey(getOldPropertiesURI(), targetObject, locale);
+ if (null != entryForKey) {
+ entries.add(entryForKey);
+ }
+
+ final TreeIterator<EObject> eAllContents = EcoreUtil.getAllProperContents(targetObject, true);
+ while (eAllContents.hasNext()) {
+ final EObject content = eAllContents.next();
+ entryForKey = internationalizationModelResource.getEntryForKey(getOldPropertiesURI(), content, locale);
+ if (null != entryForKey) {
+ entries.add(entryForKey);
+ }
+ }
+
+ final Resource oldNotationResource = getOldNotationResource();
+
+ // Search the diagrams labels to control
+ for (final Diagram diagram : NotationUtils.getDiagrams(oldNotationResource,
+ getRequest().getTargetObject())) {
+ entryForKey = internationalizationModelResource.getEntryForKey(getOldPropertiesURI(), diagram, locale);
+ if (null != entryForKey) {
+ entries.add(entryForKey);
+ }
+ }
+
+ // Search the tables labels to control
+ for (final Table table : getTables(oldNotationResource, getRequest().getTargetObject())) {
+ entryForKey = internationalizationModelResource.getEntryForKey(getOldPropertiesURI(), table, locale);
+ if (null != entryForKey) {
+ entries.add(entryForKey);
+ }
+ }
+ }
+
+ return entries;
+ }
+
+ /**
+ * Gets the all the tables contained in the specified ancestor eObject.
+ *
+ * @param notationResource
+ * The notation resource where search tables.
+ * @param eObject
+ * The table to search in notation resource.
+ *
+ * @return all the contained tables.
+ */
+ protected List<Table> getTables(final Resource notationResource, final EObject eObject) {
+ final List<Table> tables = new LinkedList<Table>();
+ if (null != notationResource) {
+ for (final EObject obj : notationResource.getContents()) {
+ if (obj instanceof Table) {
+ Table table = (Table) obj;
+ if (EcoreUtil.isAncestor(eObject, table.getOwner())) {
+ tables.add(table);
+ }
+ }
+ }
+ }
+ return tables;
+ }
+
+ /**
+ * Gets the old internationalization model resource.
+ *
+ * @return the old internationalization model resource.
+ */
+ protected InternationalizationModelResource getInternationalizationModelResource() {
+
+ if (null == internationalizationModelResource) {
+ try {
+ internationalizationModelResource = (InternationalizationModelResource) getRequest().getModelSet()
+ .getModelChecked(InternationalizationModelResource.MODEL_ID);
+ } catch (Exception e) {
+ Activator.log.error("Unable to retrieve old properties resource", e); //$NON-NLS-1$
+ }
+ }
+
+ return internationalizationModelResource;
+ }
+
+ /**
+ * Gets the old properties resource.
+ *
+ * @param locale
+ * The current locale to manage.
+ * @return the old properties resource.
+ */
+ private Resource getOldPropertiesResource(final Locale locale) {
+ Resource resource = null;
+
+ getInternationalizationModelResource();
+
+ try {
+ resource = internationalizationModelResource.getResourceForURIAndLocale(getOldPropertiesURI(), locale);
+ } catch (Exception e) {
+ Activator.log.error("Unable to retrieve old notation resource", e); //$NON-NLS-1$
+ }
+
+ return resource;
+ }
+
+ /**
+ * Get the old properties URI for request.
+ *
+ * @return The old properties resource URI.
+ * @throws ExecutionException
+ * The exception when the notation resource is not found.
+ */
+ protected URI getOldPropertiesURI() throws ExecutionException {
+ URI uri = getRequest().getSourceURI();
+ if (null != uri) {
+ return uri.trimFileExtension().appendFileExtension(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION);
+ }
+ throw new ExecutionException("Unable to retreive URI of the old properties model"); //$NON-NLS-1$
+ }
+
+ /**
+ * Gets the old notation resource.
+ *
+ * @return the old notation resource
+ */
+ private Resource getOldNotationResource() {
+
+ if (null == oldNotationResource) {
+ try {
+ oldNotationResource = getRequest().getModelSet().getResource(getOldNotationURI(), true);
+ } catch (Exception e) {
+ Activator.log.error("Unable to retrieve old notation resource", e); //$NON-NLS-1$
+ }
+ }
+
+ return oldNotationResource;
+ }
+
+ /**
+ * Get the old notation URI for request.
+ *
+ * @return The old notation resource URI.
+ * @throws ExecutionException
+ * The exception when the notation resource is not found.
+ */
+ protected URI getOldNotationURI() throws ExecutionException {
+ URI uri = getRequest().getSourceURI();
+ if (null != uri) {
+ return uri.trimFileExtension().appendFileExtension(NotationModel.NOTATION_FILE_EXTENSION);
+ }
+ throw new ExecutionException("Unable to retreive URI of the old notation model"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/CreatePropertiesControlResourceCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/CreatePropertiesControlResourceCommand.java
new file mode 100644
index 00000000000..e571b0c2d38
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/CreatePropertiesControlResourceCommand.java
@@ -0,0 +1,257 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.internationalization.controlmode.commands;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.internationalization.common.utils.LocaleNameResolver;
+import org.eclipse.papyrus.infra.internationalization.controlmode.utils.ControlPropertiesUtils;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.commands.CreateControlResource;
+
+/**
+ * Command used to create new controlled properties resource. This command will
+ * create the new resources. It will also handle correctly undo and redo.
+ */
+public class CreatePropertiesControlResourceCommand extends CreateControlResource {
+
+ /**
+ * The locale to add in the file name.
+ */
+ private Locale locale;
+
+ /**
+ * The created resource. We need it to remove it for undo command.
+ */
+ private Resource createdResource;
+
+ /**
+ * The internationalization model resource.
+ */
+ private InternationalizationModelResource internationalizationModelResource;
+
+ /**
+ * Constructor.
+ *
+ * @param request
+ * {@link ControlModeRequest} used to compute the command
+ * @param newFileExtension
+ * File extension use to create the resource. If not specified
+ * then it should be already provided in the {@link URI}
+ * @param locale
+ * The locale to add in the file name.
+ */
+ public CreatePropertiesControlResourceCommand(final ControlModeRequest request, final String newFileExtension,
+ final Locale locale) {
+ super(request, newFileExtension);
+ this.locale = locale;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.AbstractControlResourceCommand#getTargetUri()
+ */
+ @Override
+ public URI getTargetUri() {
+ return getModifiedURI(getRequest().getNewURI());
+ }
+
+ /**
+ * Get the URI with the locale if not null and the extension if not null.
+ *
+ * @param initialURI
+ * The initial URI.
+ * @return The modified URI.
+ */
+ protected URI getModifiedURI(final URI initialURI) {
+ URI targetURI = initialURI;
+ if (null != locale) {
+ // Get the existing file extension
+ final String existingFileExtension = targetURI.fileExtension();
+ // Get the last segment
+ String lastSegment = targetURI.trimFileExtension().lastSegment();
+ // Add the locale to the last segment
+ lastSegment = lastSegment + LocaleNameResolver.UNDERSCORE + locale.toString();
+ // Replace the last segment (managing file extension
+ targetURI = targetURI.trimFileExtension().trimSegments(1).appendSegment(lastSegment)
+ .appendFileExtension(existingFileExtension);
+ }
+ if (null != newFileExtension) {
+ targetURI = targetURI.trimFileExtension().appendFileExtension(newFileExtension);
+ }
+ return targetURI;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.CreateControlResource#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor progressMonitor, final IAdaptable info)
+ throws ExecutionException {
+ final CommandResult res = super.doExecuteWithResult(progressMonitor, info);
+
+ // Get the created resource
+ createdResource = getRequest().getTargetResource(newFileExtension);
+
+ // Manage a map of created properties resources, because several
+ // properties resources can be created
+ if (null == getRequest().getParameter(ControlPropertiesUtils.CREATED_PROPERTIES_RESOURCES)) {
+ getRequest().setParameter(ControlPropertiesUtils.CREATED_PROPERTIES_RESOURCES,
+ new HashMap<Locale, Resource>());
+ }
+ ((Map<Locale, Resource>) getRequest().getParameter(ControlPropertiesUtils.CREATED_PROPERTIES_RESOURCES))
+ .put(locale, createdResource);
+
+ // Add the resource to the internationalization model resource
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource();
+ if (null != modelResource) {
+ modelResource.addResourceToModel(getRequest().getNewURI().trimFileExtension(), createdResource, locale);
+ }
+
+ return res;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.CreateControlResource#doUndo(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected IStatus doUndo(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ getRequest().setTargetResource(createdResource, getFileExtension());
+
+ // Unload and remove the resource from the internationalization model
+ // resource
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource();
+ if (null != modelResource) {
+ modelResource.unload(createdResource);
+ modelResource.getResources().remove(createdResource);
+ }
+
+ return super.doUndo(monitor, info);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.CreateControlResource#doRedo(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected IStatus doRedo(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ getRequest().setTargetResource(createdResource, getFileExtension());
+ final IStatus result = super.doRedo(monitor, info);
+
+ // Add the resource to the internationalization model resource
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource();
+ if (null != modelResource) {
+ modelResource.addResourceToModel(getRequest().getNewURI().trimFileExtension(), createdResource, locale);
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.CreateControlResource#getNewURI()
+ */
+ @Override
+ protected URI getNewURI() {
+ return getModifiedURI(getRequest().getNewURI());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.CreateControlResource#getTargetResrource(org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ protected Resource getTargetResrource(final EObject objectToUncontrol) {
+ Resource resultResource = null;
+ URI targetURI = null;
+
+ if (null != objectToUncontrol) {
+ targetURI = objectToUncontrol.eResource().getURI().trimFileExtension();
+ if (null != locale) {
+ String lastSegment = targetURI.lastSegment();
+ lastSegment = lastSegment + LocaleNameResolver.UNDERSCORE + locale.toString();
+ targetURI = targetURI.trimSegments(1).appendSegment(lastSegment);
+ }
+ targetURI = targetURI.appendFileExtension(getFileExtension());
+ }
+
+ if (null != targetURI) {
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource();
+ if (null != modelResource) {
+ resultResource = modelResource.getResourceForURIAndLocale(objectToUncontrol.eResource().getURI()
+ .trimFileExtension().appendFileExtension(getFileExtension()), locale);
+ }
+ }
+
+ return resultResource;
+ }
+
+ /**
+ * Get the internationalization model resource.
+ *
+ * @return The internationalization model resource.
+ */
+ protected InternationalizationModelResource getInternationalizationModelResource() {
+ if (null == internationalizationModelResource) {
+ final ModelSet modelSet = getRequest().getModelSet();
+ if (null != modelSet) {
+ try {
+ internationalizationModelResource = (InternationalizationModelResource) modelSet
+ .getModelChecked(InternationalizationModelResource.MODEL_ID);
+ } catch (final NotFoundException e) {
+ // Do nothing
+ }
+ }
+ }
+
+ return internationalizationModelResource;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.workspace.AbstractEMFOperation#dispose()
+ */
+ @Override
+ public void dispose() {
+ internationalizationModelResource = null;
+ createdResource = null;
+ locale = null;
+ super.dispose();
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/InternationalizationAnnotationControlCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/InternationalizationAnnotationControlCommand.java
new file mode 100644
index 00000000000..9642cd7bcec
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/InternationalizationAnnotationControlCommand.java
@@ -0,0 +1,111 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.controlmode.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.commands.AbstractControlCommand;
+
+/**
+ * The internationalization annotation in the notation file must be copied in
+ * the new controlled file.
+ */
+public class InternationalizationAnnotationControlCommand extends AbstractControlCommand {
+
+ /**
+ * The Constant COMMAND_TITLE.
+ */
+ private static final String COMMAND_TITLE = "Annotation internationalization control command"; //$NON-NLS-1$
+
+ /**
+ * The old notation resource.
+ */
+ private Resource oldNotationResource = null;
+
+ /**
+ * Constructor.
+ *
+ * @param request
+ * The request.
+ * @param oldNotationResource
+ * The old notation resource.
+ */
+ public InternationalizationAnnotationControlCommand(final ControlModeRequest request,
+ final Resource oldNotationResource) {
+ super(COMMAND_TITLE, null, request);
+ this.oldNotationResource = oldNotationResource;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info)
+ throws ExecutionException {
+ CommandResult commandResult = null;
+
+ // Check if the old notation resource is not null
+ if (null == oldNotationResource) {
+ commandResult = CommandResult.newErrorCommandResult(
+ String.format("The source %s model does not exist", NotationModel.NOTATION_FILE_EXTENSION)); //$NON-NLS-1$
+ } else {
+ // Get the new notation resource and check if this is not null
+ final Resource newNotationResource = getTargetResource();
+ if (null == newNotationResource) {
+ commandResult = CommandResult.newErrorCommandResult("The notation model has not been created"); //$NON-NLS-1$
+ } else {
+ EAnnotation annotation = null;
+
+ // Search about the internationalization preference
+ for (final EObject objectContent : oldNotationResource.getContents()) {
+ if (objectContent instanceof EAnnotation
+ && InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL
+ .equals(((EAnnotation) objectContent).getSource())) {
+ annotation = EcoreUtil.copy((EAnnotation) objectContent);
+ }
+ }
+
+ // If the annotation exists, add a copy for the new notation
+ // resource
+ if (null != annotation) {
+ newNotationResource.getContents().add(annotation);
+ commandResult = CommandResult.newOKCommandResult(newNotationResource);
+ }
+ }
+ }
+
+ return null != commandResult ? commandResult : CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * Retrieve the target resource from the request
+ *
+ * @return The target resource.
+ */
+ protected Resource getTargetResource() {
+ return request.getTargetResource(NotationModel.NOTATION_FILE_EXTENSION);
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/RemovePropertiesControlResourceCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/RemovePropertiesControlResourceCommand.java
new file mode 100644
index 00000000000..2b90119a6ff
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/commands/RemovePropertiesControlResourceCommand.java
@@ -0,0 +1,243 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.internationalization.controlmode.commands;
+
+import java.util.Locale;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.internationalization.common.utils.LocaleNameResolver;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.commands.RemoveControlResourceCommand;
+import org.eclipse.papyrus.infra.services.controlmode.messages.Messages;
+
+/**
+ * Command used to create new controlled properties resource. This command will
+ * create the new resources. It will also handle correctly undo and redo.
+ */
+public class RemovePropertiesControlResourceCommand extends RemoveControlResourceCommand {
+
+ /**
+ * The resource to remove. We need it to remove it for undo command.
+ */
+ private Resource resourceToRemove;
+
+ /**
+ * The locale to add in the file name.
+ */
+ private Locale locale;
+
+ /**
+ * The internationalization model resource.
+ */
+ private InternationalizationModelResource internationalizationModelResource;
+
+ /**
+ * Constructor.
+ *
+ * @param request
+ * {@link ControlModeRequest} used to compute the command
+ * @param newFileExtension
+ * File extension use to create the resource. If not specified
+ * then it should be already provided in the {@link URI}
+ * @param resourceToRemove
+ * The resource to remove.
+ * @param locale
+ * The locale to add in the file name.
+ */
+ public RemovePropertiesControlResourceCommand(final ControlModeRequest request, final String fileExtension,
+ final Resource resourceToRemove, final Locale locale) {
+ super(request, fileExtension);
+ this.resourceToRemove = resourceToRemove;
+ this.locale = locale;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.RemoveControlResourceCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info)
+ throws ExecutionException {
+ CommandResult commandResult = null;
+ EObject objectToControl = getRequest().getTargetObject();
+ if (null == objectToControl) {
+ commandResult = CommandResult.newErrorCommandResult(CONTROL_OBJECT_ERROR);
+ } else {
+ ModelSet modelSet = getRequest().getModelSet();
+ if (null == modelSet) {
+ commandResult = CommandResult.newErrorCommandResult(RESOURCESET_ERROR);
+ } else {
+
+ // Delete resource back-end on save
+ modelSet.getResourcesToDeleteOnSave().add(resourceToRemove.getURI());
+
+ // Save source and target resource
+ Resource targetResource = getTargetResource(objectToControl);
+ if (null == targetResource) {
+ commandResult = CommandResult
+ .newErrorCommandResult(Messages.getString(TARGET_RESOURCE_ERROR, getFileExtension()));
+ } else {
+
+ // The target resource needs to be saved else the resolution
+ // will not operate
+ targetResource.setModified(true);
+
+ getRequest().setTargetResource(targetResource, getFileExtension());
+ getRequest().setSourceResource(resourceToRemove, getFileExtension());
+
+ // remove resource set
+ modelSet.getResources().remove(resourceToRemove);
+
+ // Unload and remove the resource from the
+ // internationalization model resource
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource();
+ if (null != modelResource) {
+ modelResource.unload(resourceToRemove.getURI());
+ modelResource.getResources().remove(resourceToRemove);
+ }
+
+ commandResult = CommandResult.newOKCommandResult();
+ }
+ }
+ }
+
+ return commandResult;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.RemoveControlResourceCommand#doUndo(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected IStatus doUndo(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IStatus result = super.doUndo(monitor, info);
+
+ // Add the resource to the internationalization model resource
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource();
+ if (null != modelResource) {
+ modelResource.addResourceToModel(getRequest().getSourceURI().trimFileExtension(), resourceToRemove, locale);
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.RemoveControlResourceCommand#getSourceResource()
+ */
+ @Override
+ protected Resource getSourceResource() {
+ return resourceToRemove;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.RemoveControlResourceCommand#doRedo(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected IStatus doRedo(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final IStatus result = super.doRedo(monitor, info);
+
+ // Unload and remove the resource from the internationalization model
+ // resource
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource();
+ if (null != modelResource) {
+ modelResource.unload(resourceToRemove.getURI());
+ modelResource.getResources().remove(resourceToRemove);
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.commands.RemoveControlResourceCommand#getTargetResource(org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ protected Resource getTargetResource(final EObject objectToUncontrol) {
+ Resource resultResource = null;
+ URI targetURI = null;
+
+ if (null != objectToUncontrol) {
+ targetURI = objectToUncontrol.eResource().getURI().trimFileExtension();
+ if (null != locale) {
+ String lastSegment = targetURI.lastSegment();
+ lastSegment = lastSegment + LocaleNameResolver.UNDERSCORE + locale.toString();
+ targetURI = targetURI.trimSegments(1).appendSegment(lastSegment);
+ }
+ targetURI = targetURI.appendFileExtension(getFileExtension());
+ }
+
+ if (null != targetURI) {
+ InternationalizationModelResource modelResource = getInternationalizationModelResource();
+ if (null != modelResource) {
+ resultResource = modelResource.getResourceForURIAndLocale(objectToUncontrol.eResource().getURI()
+ .trimFileExtension().appendFileExtension(getFileExtension()), locale);
+ }
+ }
+
+ return resultResource;
+ }
+
+ /**
+ * Get the internationalization model resource.
+ *
+ * @return The internationalization model resource.
+ */
+ protected InternationalizationModelResource getInternationalizationModelResource() {
+ if (null == internationalizationModelResource) {
+ final ModelSet modelSet = getRequest().getModelSet();
+ if (null != modelSet) {
+ try {
+ internationalizationModelResource = (InternationalizationModelResource) modelSet
+ .getModelChecked(InternationalizationModelResource.MODEL_ID);
+ } catch (final NotFoundException e) {
+ // Do nothing
+ }
+ }
+ }
+
+ return internationalizationModelResource;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.workspace.AbstractEMFOperation#dispose()
+ */
+ @Override
+ public void dispose() {
+ internationalizationModelResource = null;
+ resourceToRemove = null;
+ locale = null;
+ super.dispose();
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/InternationalizationAnnotationControlParticipant.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/InternationalizationAnnotationControlParticipant.java
new file mode 100644
index 00000000000..4d2ebf01c6e
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/InternationalizationAnnotationControlParticipant.java
@@ -0,0 +1,183 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.controlmode.participants;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.internationalization.controlmode.Activator;
+import org.eclipse.papyrus.infra.internationalization.controlmode.commands.InternationalizationAnnotationControlCommand;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant;
+import org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant;
+
+/**
+ * The internationalization annotation control participant for the preference
+ * annotation.
+ */
+public class InternationalizationAnnotationControlParticipant
+ implements IControlCommandParticipant, IUncontrolCommandParticipant {
+
+ /**
+ * The Constant PARTICIPANT_ID.
+ */
+ private static final String PARTICIPANT_ID = "org.eclipse.papyrus.infra.internationalization.controlmode.InternationalizationAnnotationControlParticipant"; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ */
+ public InternationalizationAnnotationControlParticipant() {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlModeParticipant#getID()
+ */
+ @Override
+ public String getID() {
+ return PARTICIPANT_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlModeParticipant#getPriority()
+ */
+ @Override
+ public int getPriority() {
+ return 20;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant#provideUnControlCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public boolean provideUnControlCommand(final ControlModeRequest request) {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant#getPreUncontrolCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public ICommand getPreUncontrolCommand(final ControlModeRequest request) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant#getPostUncontrolCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public ICommand getPostUncontrolCommand(final ControlModeRequest request) {
+ // Don't create the notation resource since it is already handled
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant#provideControlCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public boolean provideControlCommand(final ControlModeRequest request) {
+ boolean result = false;
+
+ // Check if the annotation for the internationalization is in the
+ // notation file
+ final Iterator<EObject> objectContentsIterator = getSourceResource(request).getContents().iterator();
+ while (objectContentsIterator.hasNext() && !result) {
+ EObject objectContent = objectContentsIterator.next();
+ if (objectContent instanceof EAnnotation
+ && InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL
+ .equals(((EAnnotation) objectContent).getSource())) {
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant#getPreControlCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public ICommand getPreControlCommand(final ControlModeRequest request) {
+ // Don't create the notation resource since it is already handled
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant#getPostControlCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public ICommand getPostControlCommand(final ControlModeRequest request) {
+ return new InternationalizationAnnotationControlCommand(request, getSourceResource(request));
+ }
+
+ /**
+ * Gets the old notation resource.
+ *
+ * @param request
+ * The control request.
+ * @return the old notation resource.
+ */
+ protected Resource getSourceResource(final ControlModeRequest request) {
+ Resource oldNotationResource = null;
+
+ try {
+ oldNotationResource = request.getModelSet().getResource(getOldNotationURI(request), true);
+ } catch (Exception e) {
+ Activator.log.error("Unable to retrieve old notation resource", e); //$NON-NLS-1$
+ }
+
+ return oldNotationResource;
+ }
+
+ /**
+ * Get the old notation URI for request.
+ *
+ * @param request
+ * The control request.
+ * @return The old notation resource.
+ * @throws ExecutionException
+ * The exception when the notation resource is not found.
+ */
+ protected URI getOldNotationURI(final ControlModeRequest request) throws ExecutionException {
+ URI uri = request.getSourceURI();
+
+ if (null != uri) {
+ return uri.trimFileExtension().appendFileExtension(NotationModel.NOTATION_FILE_EXTENSION);
+ }
+ throw new ExecutionException("Unable to retreive URI of the old notation model"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/PropertiesControlParticipant.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/PropertiesControlParticipant.java
new file mode 100644
index 00000000000..45a6a1eb09a
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/PropertiesControlParticipant.java
@@ -0,0 +1,159 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.controlmode.participants;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.internationalization.controlmode.commands.ControlPropertiesCommand;
+import org.eclipse.papyrus.infra.internationalization.controlmode.commands.CreatePropertiesControlResourceCommand;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+import org.eclipse.papyrus.infra.internationalization.utils.PropertiesFilesUtils;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant;
+
+/**
+ * The control participant for the properties files.
+ */
+public class PropertiesControlParticipant implements IControlCommandParticipant {
+
+ /**
+ * The Constant PARTICIPANT_ID.
+ */
+ private static final String PARTICIPANT_ID = "org.eclipse.papyrus.infra.internationalization.controlmode.PropertiesControlParticipant"; //$NON-NLS-1$
+
+ /**
+ * The internationalization model resource.
+ */
+ private InternationalizationModelResource internationalizationModelResource;
+
+ /**
+ * Constructor.
+ */
+ public PropertiesControlParticipant() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlModeParticipant#getID()
+ */
+ @Override
+ public String getID() {
+ return PARTICIPANT_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlModeParticipant#getPriority()
+ */
+ @Override
+ public int getPriority() {
+ return 40;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant#provideControlCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public boolean provideControlCommand(final ControlModeRequest request) {
+ boolean result = false;
+
+ final EObject objectToControl = request.getTargetObject();
+ if (null != objectToControl) {
+ // If there is no properties resource in the old resource, then
+ // there's nothing to do
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource(request);
+ final Map<Locale, Resource> localesAndResourcesForURI = modelResource
+ .getLocalesAndResourcesForURI(request.getSourceURI().trimFileExtension()
+ .appendFileExtension(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION));
+
+ result = null != localesAndResourcesForURI && !localesAndResourcesForURI.isEmpty();
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant#getPreControlCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public ICommand getPreControlCommand(final ControlModeRequest request) {
+ ICommand resultCommand = UnexecutableCommand.INSTANCE;
+
+ // Get the used locale to determinate the properties file to create
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource(request);
+ if (null != modelResource) {
+ final Set<Locale> locales = modelResource.getAvailablePropertiesLocales(request.getSourceURI());
+
+ resultCommand = new CompositeTransactionalCommand(request.getEditingDomain(), "Create properties files"); //$NON-NLS-1$
+
+ // Loop on each locale to create associated properties file
+ for (final Locale currentLocale : locales) {
+ ((CompositeTransactionalCommand) resultCommand).add(new CreatePropertiesControlResourceCommand(request,
+ PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION, currentLocale));
+ }
+ }
+
+ return resultCommand;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlCommandParticipant#getPostControlCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public ICommand getPostControlCommand(final ControlModeRequest request) {
+
+ // Dispose the internationalizationModelResource
+ internationalizationModelResource = null;
+
+ return new ControlPropertiesCommand(request);
+ }
+
+ /**
+ * Get the internationalization model resource.
+ *
+ * @return The internationalization model resource.
+ */
+ protected InternationalizationModelResource getInternationalizationModelResource(final ControlModeRequest request) {
+ if (null == internationalizationModelResource && null != request) {
+ final ModelSet modelSet = request.getModelSet();
+ if (null != modelSet) {
+ try {
+ internationalizationModelResource = (InternationalizationModelResource) modelSet
+ .getModelChecked(InternationalizationModelResource.MODEL_ID);
+ } catch (final NotFoundException e) {
+ // Do nothing
+ }
+ }
+ }
+
+ return internationalizationModelResource;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/PropertiesUncontrolParticipant.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/PropertiesUncontrolParticipant.java
new file mode 100644
index 00000000000..007f94cc02f
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/participants/PropertiesUncontrolParticipant.java
@@ -0,0 +1,249 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.controlmode.participants;
+
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.internationalization.controlmode.commands.ControlPropertiesCommand;
+import org.eclipse.papyrus.infra.internationalization.controlmode.commands.CreatePropertiesControlResourceCommand;
+import org.eclipse.papyrus.infra.internationalization.controlmode.commands.RemovePropertiesControlResourceCommand;
+import org.eclipse.papyrus.infra.internationalization.controlmode.utils.ControlPropertiesUtils;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+import org.eclipse.papyrus.infra.internationalization.utils.PropertiesFilesUtils;
+import org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest;
+import org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant;
+
+/**
+ * The uncontrol participant for the properties files.
+ */
+public class PropertiesUncontrolParticipant implements IUncontrolCommandParticipant {
+
+ /**
+ * The Constant PARTICIPANT_ID.
+ */
+ private static final String PARTICIPANT_ID = "org.eclipse.papyrus.infra.internationalization.controlmode.PropertiesUncontrolParticipant"; //$NON-NLS-1$
+
+ /**
+ * The internationalization model resource.
+ */
+ private InternationalizationModelResource internationalizationModelResource;
+
+ /**
+ * Constructor.
+ */
+ public PropertiesUncontrolParticipant() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlModeParticipant#getID()
+ */
+ @Override
+ public String getID() {
+ return PARTICIPANT_ID;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IControlModeParticipant#getPriority()
+ */
+ @Override
+ public int getPriority() {
+ return 70;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant#provideUnControlCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public boolean provideUnControlCommand(final ControlModeRequest request) {
+ boolean result = false;
+
+ final EObject objectToUncontrol = request.getTargetObject();
+ if (null != objectToUncontrol) {
+ // If there is no properties resource in the old resource, then
+ // there's nothing to do
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource(request);
+ final Map<Locale, Resource> localesAndResourcesForURI = modelResource
+ .getLocalesAndResourcesForURI(request.getSourceURI().trimFileExtension()
+ .appendFileExtension(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION));
+
+ result = null != localesAndResourcesForURI && !localesAndResourcesForURI.isEmpty();
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant#getPreUncontrolCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public ICommand getPreUncontrolCommand(final ControlModeRequest request) {
+ boolean result = setPropertiesTargetRequest(request);
+
+ CompositeTransactionalCommand compositeCommand = null;
+
+ if (result) {
+ compositeCommand = new CompositeTransactionalCommand(request.getEditingDomain(), "Uncontrol command"); //$NON-NLS-1$
+
+ // Before modify properties files, check that new properties files are available
+ final URI newPropertiesURI = request.getNewURI().trimFileExtension()
+ .appendFileExtension(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION);
+ final URI sourcePropertiesURI = request.getSourceURI().trimFileExtension()
+ .appendFileExtension(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION);
+ final ModelSet modelSet = request.getModelSet();
+
+ if (null != modelSet) {
+
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource(request);
+ if (null != modelResource) {
+ final Map<Locale, Resource> newLocalesAndResources = modelResource
+ .getLocalesAndResourcesForURI(newPropertiesURI);
+ final Map<Locale, Resource> sourceLocalesAndResources = modelResource
+ .getLocalesAndResourcesForURI(sourcePropertiesURI);
+
+ for(final Locale sourceLocale : sourceLocalesAndResources.keySet()){
+ if(!newLocalesAndResources.containsKey(sourceLocale)){
+ // The locale is not existing for the new properties resources, we need to create it
+ compositeCommand.add(new CreatePropertiesControlResourceCommand(request,
+ PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION, sourceLocale));
+ }
+ }
+ }
+ }
+
+ compositeCommand.add(new ControlPropertiesCommand(request));
+ }
+
+ return null != compositeCommand ? compositeCommand : UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.services.controlmode.participants.IUncontrolCommandParticipant#getPostUncontrolCommand(org.eclipse.papyrus.infra.services.controlmode.ControlModeRequest)
+ */
+ @Override
+ public ICommand getPostUncontrolCommand(final ControlModeRequest request) {
+ ICommand commandResult = UnexecutableCommand.INSTANCE;
+
+ final Map<Locale, Resource> result = getPropertiesSourceRequest(request);
+ if (null != result && !result.isEmpty()) {
+ final CompositeTransactionalCommand compositeCommand = new CompositeTransactionalCommand(
+ request.getEditingDomain(), "Remove properties resources"); //$NON-NLS-1$
+
+ for (final Entry<Locale, Resource> entry : result.entrySet()) {
+ compositeCommand.add(new RemovePropertiesControlResourceCommand(request,
+ PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION, entry.getValue(), entry.getKey()));
+ }
+
+ commandResult = compositeCommand;
+ }
+
+ // Dispose the internationationalizationModelResource
+ internationalizationModelResource = null;
+
+ return commandResult;
+ }
+
+ /**
+ * Init target request to have the properties resources references.
+ *
+ * @param request
+ * The request.
+ */
+ protected boolean setPropertiesTargetRequest(final ControlModeRequest request) {
+ boolean result = false;
+ final URI propertiesURI = request.getNewURI().trimFileExtension()
+ .appendFileExtension(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION);
+ final ModelSet modelSet = request.getModelSet();
+
+ if (null != modelSet) {
+
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource(request);
+ if (null != modelResource) {
+ final Map<Locale, Resource> localesAndResources = modelResource
+ .getLocalesAndResourcesForURI(propertiesURI);
+
+ if (!localesAndResources.isEmpty()) {
+ request.setParameter(ControlPropertiesUtils.CREATED_PROPERTIES_RESOURCES, localesAndResources);
+ // Nothing to do but everything is ok
+ result = true;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Init source request to have the properties resources references.
+ *
+ * @param request
+ * The request.
+ */
+ protected Map<Locale, Resource> getPropertiesSourceRequest(final ControlModeRequest request) {
+ Map<Locale, Resource> result = null;
+ final URI propertiesURI = request.getSourceURI().trimFileExtension()
+ .appendFileExtension(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION);
+ final ModelSet modelSet = request.getModelSet();
+
+ if (null != modelSet) {
+ final InternationalizationModelResource modelResource = getInternationalizationModelResource(request);
+ if (null != modelResource) {
+ result = modelResource.getLocalesAndResourcesForURI(propertiesURI);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the internationalization model resource.
+ *
+ * @return The internationalization model resource.
+ */
+ protected InternationalizationModelResource getInternationalizationModelResource(final ControlModeRequest request) {
+ if (null == internationalizationModelResource && null != request) {
+ final ModelSet modelSet = request.getModelSet();
+ if (null != modelSet) {
+ try {
+ internationalizationModelResource = (InternationalizationModelResource) modelSet
+ .getModelChecked(InternationalizationModelResource.MODEL_ID);
+ } catch (final NotFoundException e) {
+ // Do nothing
+ }
+ }
+ }
+
+ return internationalizationModelResource;
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/utils/ControlPropertiesUtils.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/utils/ControlPropertiesUtils.java
new file mode 100644
index 00000000000..11c4e3975da
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.controlmode/src/org/eclipse/papyrus/infra/internationalization/controlmode/utils/ControlPropertiesUtils.java
@@ -0,0 +1,25 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.controlmode.utils;
+
+/**
+ * The control properties utils class.
+ */
+public class ControlPropertiesUtils {
+
+ /**
+ * The created properties resources constant.
+ */
+ public static final String CREATED_PROPERTIES_RESOURCES = "createdPropertiesResources"; //$NON-NLS-1$
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/.classpath b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/.classpath
new file mode 100644
index 00000000000..8dd013afc8b
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/.project b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/.project
new file mode 100644
index 00000000000..9b31b5cc1c8
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.internationalization.edit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..a4b66a677b2
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/META-INF/MANIFEST.MF
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.internationalization.edit;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.papyrus.infra.internationalization.provider.InternationalizationEditPlugin$Implementation
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.papyrus.infra.internationalization.edit.provider,
+ org.eclipse.papyrus.infra.internationalization.provider
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.12.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)";visibility:=reexport,
+ org.eclipse.emf.edit;bundle-version="[2.12.0,3.0.0)";visibility:=reexport,
+ org.eclipse.gmf.runtime.notation.edit;bundle-version="[1.7.0,2.0.0)";visibility:=reexport,
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)"
+Bundle-ActivationPolicy: lazy
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/about.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/build.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/build.properties
new file mode 100644
index 00000000000..60f476a9c04
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/build.properties
@@ -0,0 +1,12 @@
+#
+
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ about.html,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src-gen/,\
+ src/
+output.. = bin/ \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/icons/full/obj16/InternationalizationEntry.gif b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/icons/full/obj16/InternationalizationEntry.gif
new file mode 100644
index 00000000000..5a9bc7514fa
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/icons/full/obj16/InternationalizationEntry.gif
Binary files differ
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/icons/full/obj16/InternationalizationLibrary.gif b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/icons/full/obj16/InternationalizationLibrary.gif
new file mode 100644
index 00000000000..48e3cf22687
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/icons/full/obj16/InternationalizationLibrary.gif
Binary files differ
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/plugin.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/plugin.properties
new file mode 100644
index 00000000000..632eac41a11
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/plugin.properties
@@ -0,0 +1,25 @@
+#
+
+pluginName = Papyrus Internationalization Edit Support
+providerName = Eclipse Modeling Project
+
+_UI_CreateChild_text = {0}
+_UI_CreateChild_text2 = {1} {0}
+_UI_CreateChild_text3 = {1}
+_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
+_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
+_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
+
+_UI_PropertyDescriptor_description = The {0} of the {1}
+
+_UI_InternationalizationLibrary_type = Library
+_UI_InternationalizationEntry_type = Entry
+_UI_Unknown_type = Object
+
+_UI_Unknown_datatype= Value
+
+_UI_InternationalizationLibrary_entries_feature = Entries
+_UI_InternationalizationEntry_key_feature = Key
+_UI_InternationalizationEntry_value_feature = Value
+_UI_Unknown_feature = Unspecified
+
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/plugin.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/plugin.xml
new file mode 100644
index 00000000000..d00f5dc6637
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/plugin.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.edit.itemProviderAdapterFactories">
+ <!-- @generated Internationalization -->
+ <factory
+ uri="http://www.eclipse.org/papyrus/internationalization/model"
+ class="org.eclipse.papyrus.infra.internationalization.provider.InternationalizationItemProviderAdapterFactory"
+ supportedTypes=
+ "org.eclipse.emf.edit.provider.IEditingDomainItemProvider
+ org.eclipse.emf.edit.provider.IStructuredItemContentProvider
+ org.eclipse.emf.edit.provider.ITreeItemContentProvider
+ org.eclipse.emf.edit.provider.IItemLabelProvider
+ org.eclipse.emf.edit.provider.IItemPropertySource"/>
+ </extension>
+
+</plugin>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/pom.xml
new file mode 100644
index 00000000000..e94fe7a47e9
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.internationalization.edit</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationEditPlugin.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationEditPlugin.java
new file mode 100644
index 00000000000..e424a72a7a3
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationEditPlugin.java
@@ -0,0 +1,96 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.provider;
+
+import org.eclipse.emf.common.EMFPlugin;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+/**
+ * This is the central singleton for the Internationalization edit plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public final class InternationalizationEditPlugin extends EMFPlugin {
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final InternationalizationEditPlugin INSTANCE = new InternationalizationEditPlugin();
+
+ /**
+ * Keep track of the singleton.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static Implementation plugin;
+
+ /**
+ * Create the instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InternationalizationEditPlugin() {
+ super(new ResourceLocator[] {});
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ @Override
+ public ResourceLocator getPluginResourceLocator() {
+ return plugin;
+ }
+
+ /**
+ * Returns the singleton instance of the Eclipse plugin.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the singleton instance.
+ * @generated
+ */
+ public static Implementation getPlugin() {
+ return plugin;
+ }
+
+ /**
+ * The actual implementation of the Eclipse <b>Plugin</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static class Implementation extends EclipsePlugin {
+ /**
+ * Creates an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Implementation() {
+ super();
+
+ // Remember the static instance.
+ //
+ plugin = this;
+ }
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationEntryItemProvider.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationEntryItemProvider.java
new file mode 100644
index 00000000000..7be66df9f88
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationEntryItemProvider.java
@@ -0,0 +1,171 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class InternationalizationEntryItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
+ IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InternationalizationEntryItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addKeyPropertyDescriptor(object);
+ addValuePropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Key feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addKeyPropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(), getString("_UI_InternationalizationEntry_key_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_InternationalizationEntry_key_feature", //$NON-NLS-1$//$NON-NLS-2$
+ "_UI_InternationalizationEntry_type"), //$NON-NLS-1$
+ InternationalizationPackage.Literals.INTERNATIONALIZATION_ENTRY__KEY, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This adds a property descriptor for the Value feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addValuePropertyDescriptor(Object object) {
+ itemPropertyDescriptors
+ .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(), getString("_UI_InternationalizationEntry_value_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_InternationalizationEntry_value_feature", //$NON-NLS-1$//$NON-NLS-2$
+ "_UI_InternationalizationEntry_type"), //$NON-NLS-1$
+ InternationalizationPackage.Literals.INTERNATIONALIZATION_ENTRY__VALUE, true, false, false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
+ }
+
+ /**
+ * This returns InternationalizationEntry.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/InternationalizationEntry")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ Object labelValue = ((InternationalizationEntry) object).getKey();
+ String label = labelValue == null ? null : labelValue.toString();
+ return label == null || label.length() == 0 ? getString("_UI_InternationalizationEntry_type") : //$NON-NLS-1$
+ getString("_UI_InternationalizationEntry_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(InternationalizationEntry.class)) {
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__KEY:
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__VALUE:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return InternationalizationEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationItemProviderAdapterFactory.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationItemProviderAdapterFactory.java
new file mode 100644
index 00000000000..1b0fabfb979
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationItemProviderAdapterFactory.java
@@ -0,0 +1,243 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.provider;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.edit.provider.ChangeNotifier;
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IChangeNotifier;
+import org.eclipse.emf.edit.provider.IDisposable;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.INotifyChangedListener;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+
+import org.eclipse.papyrus.infra.internationalization.util.InternationalizationAdapterFactory;
+
+/**
+ * This is the factory that is used to provide the interfaces needed to support Viewers.
+ * The adapters generated by this factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}.
+ * The adapters also support Eclipse property sheets.
+ * Note that most of the adapters are shared among multiple instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class InternationalizationItemProviderAdapterFactory extends InternationalizationAdapterFactory
+ implements ComposeableAdapterFactory, IChangeNotifier, IDisposable {
+ /**
+ * This keeps track of the root adapter factory that delegates to this adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected ComposedAdapterFactory parentAdapterFactory;
+
+ /**
+ * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected IChangeNotifier changeNotifier = new ChangeNotifier();
+
+ /**
+ * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Collection<Object> supportedTypes = new ArrayList<>();
+
+ /**
+ * This constructs an instance.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InternationalizationItemProviderAdapterFactory() {
+ supportedTypes.add(IEditingDomainItemProvider.class);
+ supportedTypes.add(IStructuredItemContentProvider.class);
+ supportedTypes.add(ITreeItemContentProvider.class);
+ supportedTypes.add(IItemLabelProvider.class);
+ supportedTypes.add(IItemPropertySource.class);
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected InternationalizationLibraryItemProvider internationalizationLibraryItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createInternationalizationLibraryAdapter() {
+ if (internationalizationLibraryItemProvider == null) {
+ internationalizationLibraryItemProvider = new InternationalizationLibraryItemProvider(this);
+ }
+
+ return internationalizationLibraryItemProvider;
+ }
+
+ /**
+ * This keeps track of the one adapter used for all {@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected InternationalizationEntryItemProvider internationalizationEntryItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createInternationalizationEntryAdapter() {
+ if (internationalizationEntryItemProvider == null) {
+ internationalizationEntryItemProvider = new InternationalizationEntryItemProvider(this);
+ }
+
+ return internationalizationEntryItemProvider;
+ }
+
+ /**
+ * This returns the root adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ComposeableAdapterFactory getRootAdapterFactory() {
+ return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory();
+ }
+
+ /**
+ * This sets the composed adapter factory that contains this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
+ this.parentAdapterFactory = parentAdapterFactory;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object type) {
+ return supportedTypes.contains(type) || super.isFactoryForType(type);
+ }
+
+ /**
+ * This implementation substitutes the factory itself as the key for the adapter.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter adapt(Notifier notifier, Object type) {
+ return super.adapt(notifier, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object adapt(Object object, Object type) {
+ if (isFactoryForType(type)) {
+ Object adapter = super.adapt(object, type);
+ if (!(type instanceof Class<?>) || (((Class<?>) type).isInstance(adapter))) {
+ return adapter;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * This adds a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void addListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.addListener(notifyChangedListener);
+ }
+
+ /**
+ * This removes a listener.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void removeListener(INotifyChangedListener notifyChangedListener) {
+ changeNotifier.removeListener(notifyChangedListener);
+ }
+
+ /**
+ * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void fireNotifyChanged(Notification notification) {
+ changeNotifier.fireNotifyChanged(notification);
+
+ if (parentAdapterFactory != null) {
+ parentAdapterFactory.fireNotifyChanged(notification);
+ }
+ }
+
+ /**
+ * This disposes all of the item providers created by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void dispose() {
+ if (internationalizationLibraryItemProvider != null) {
+ internationalizationLibraryItemProvider.dispose();
+ }
+ if (internationalizationEntryItemProvider != null) {
+ internationalizationEntryItemProvider.dispose();
+ }
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationLibraryItemProvider.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationLibraryItemProvider.java
new file mode 100644
index 00000000000..0f216466b71
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src-gen/org/eclipse/papyrus/infra/internationalization/provider/InternationalizationLibraryItemProvider.java
@@ -0,0 +1,141 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.provider;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.common.util.ResourceLocator;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+
+import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class InternationalizationLibraryItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
+ IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InternationalizationLibraryItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addEntriesPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Entries feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addEntriesPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add(createItemPropertyDescriptor(
+ ((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(),
+ getString("_UI_InternationalizationLibrary_entries_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_InternationalizationLibrary_entries_feature", //$NON-NLS-1$//$NON-NLS-2$
+ "_UI_InternationalizationLibrary_type"), //$NON-NLS-1$
+ InternationalizationPackage.Literals.INTERNATIONALIZATION_LIBRARY__ENTRIES, true, false, true, null,
+ null, null));
+ }
+
+ /**
+ * This returns InternationalizationLibrary.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/InternationalizationLibrary")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ return getString("_UI_InternationalizationLibrary_type"); //$NON-NLS-1$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+ /**
+ * Return the resource locator for this item provider's resources.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ return InternationalizationEditPlugin.INSTANCE;
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src/org/eclipse/papyrus/infra/internationalization/edit/provider/InternationalizationNotationItemProviderAdapterFactory.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src/org/eclipse/papyrus/infra/internationalization/edit/provider/InternationalizationNotationItemProviderAdapterFactory.java
new file mode 100644
index 00000000000..0837214f7ed
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.edit/src/org/eclipse/papyrus/infra/internationalization/edit/provider/InternationalizationNotationItemProviderAdapterFactory.java
@@ -0,0 +1,57 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.edit.provider;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationEditPlugin;
+import org.eclipse.gmf.runtime.notation.provider.DiagramItemProvider;
+import org.eclipse.gmf.runtime.notation.provider.NotationItemProviderAdapterFactory;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization;
+
+/**
+ * This allows to re-implement the diagram adapter for the label
+ * internationalization call.
+ */
+public class InternationalizationNotationItemProviderAdapterFactory extends NotationItemProviderAdapterFactory {
+
+ /**
+ * Constructor.
+ */
+ public InternationalizationNotationItemProviderAdapterFactory() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.gmf.runtime.notation.provider.NotationItemProviderAdapterFactory#createDiagramAdapter()
+ */
+ @Override
+ public Adapter createDiagramAdapter() {
+ if (diagramItemProvider == null) {
+ diagramItemProvider = new DiagramItemProvider(this) {
+ @Override
+ public String getText(Object object) {
+ String label = LabelInternationalization.getInstance().getDiagramLabel((Diagram) object);
+ return label == null || label.length() == 0
+ ? NotationEditPlugin.INSTANCE.getString("_UI_Diagram_type", true) //$NON-NLS-1$
+ : NotationEditPlugin.INSTANCE.getString("_UI_Diagram_type", true) + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ };
+ }
+
+ return (Adapter) diagramItemProvider;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.classpath b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.project b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.project
new file mode 100644
index 00000000000..215b0c7400b
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.internationalization.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </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>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..bd14dc1bd0a
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.internationalization.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.papyrus.infra.internationalization.ui,
+ org.eclipse.papyrus.infra.internationalization.ui.dialogs,
+ org.eclipse.papyrus.infra.internationalization.ui.handlers
+Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)",
+ org.eclipse.ui.workbench;bundle-version="[3.108.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.107.0,4.0.0)",
+ org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.emf;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.papyrus.infra.internationalization.ui.Activator
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/about.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/build.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/build.properties
new file mode 100644
index 00000000000..2964bc2d7b1
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/build.properties
@@ -0,0 +1,11 @@
+#
+
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/plugin.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/plugin.properties
new file mode 100644
index 00000000000..383429a1252
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = Papyrus Internationalization UI
+providerName = Eclipse Modeling Project
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/plugin.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/plugin.xml
new file mode 100644
index 00000000000..490fd5dec9a
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/plugin.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.papyrus.infra.internationalization.ui.handlers.InternationalizationCommandHandler"
+ description="This allows to internationalize the NamedElements, Diagrams and Tables"
+ id="org.eclipse.papyrus.infra.internationalization.activeInternationalization"
+ name="Configure internationalization">
+ <!--state
+ class="org.eclipse.papyrus.infra.internationalization.ui.handlers.InternationalizationToggleState"
+ id="org.eclipse.ui.commands.toggleState">
+ </state-->
+ </command>
+ </extension>
+
+</plugin>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/pom.xml
new file mode 100644
index 00000000000..5bf9055d118
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.internationalization.ui</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/Activator.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/Activator.java
new file mode 100644
index 00000000000..c7d97b28686
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/Activator.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.ui;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.internationalization.ui"; //$NON-NLS-1$
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The log helper.
+ */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/dialogs/InternationalizationDialog.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/dialogs/InternationalizationDialog.java
new file mode 100644
index 00000000000..0d99705fd8d
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/dialogs/InternationalizationDialog.java
@@ -0,0 +1,251 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.ui.dialogs;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.dialogs.TrayDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * The dialog to manage the internationalization configuration. This will
+ * contains: - Checkbox to determinate if the internationalization must be used
+ * or not - Viewer to select the language of the internationalization
+ */
+public class InternationalizationDialog extends TrayDialog {
+
+ /**
+ * The resource URI corresponding to the papyrus model. This is needed to
+ * get the preference of the papyrus model.
+ */
+ private URI resourceURI;
+
+ /**
+ * The viewer for the language selection.
+ */
+ protected TableViewer tableViewer;
+
+ /**
+ * The widget to manage the use internationalization value.
+ */
+ protected Button useInternationalizationButton;
+
+ /**
+ * Keep the internationalization use value after the dialog closed.
+ */
+ protected boolean useInternationalizationValue;
+
+ /**
+ * Keep the locale value after the dialog closed.
+ */
+ protected Locale localeValue;
+
+ /**
+ * Boolean to determinate if the use internationalization must be displayed.
+ */
+ private boolean displayUse;
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * The parent shell.
+ * @param resourceURI
+ * The resource URI corresponding to the papyrus model (need to
+ * get preference of the papyrus model).
+ * @param displayUse
+ * Boolean to determinate if the use internationalization must be
+ * displayed.
+ */
+ public InternationalizationDialog(final Shell parentShell, final URI resourceURI, final boolean displayUse) {
+ super(parentShell);
+ setResourceURI(resourceURI);
+ this.displayUse = displayUse;
+ }
+
+ /**
+ * This allows to set the resource URI.
+ *
+ * @param resourceURI
+ * The resource URI to set.
+ */
+ public void setResourceURI(final URI resourceURI) {
+ this.resourceURI = resourceURI;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ protected Control createDialogArea(final Composite parent) {
+ final Composite composite = (Composite) super.createDialogArea(parent);
+ final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.widthHint = 300;
+ data.heightHint = 300;
+ composite.setLayoutData(data);
+
+ getShell().setText("Configure internationalization"); //$NON-NLS-1$
+ getShell().setImage(org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("/icons/papyrus.png")); //$NON-NLS-1$
+
+ if (displayUse()) {
+ createUseInternationalization(composite);
+ }
+ createLanguage(composite);
+ initializeValues();
+
+ return composite;
+ }
+
+ /**
+ * Determinates if the use internationalization checkbox must be displayed.
+ *
+ * @return <code>true</code> if this will be displayed, <code>false</code>
+ * otherwise.
+ */
+ protected boolean displayUse() {
+ return displayUse;
+ }
+
+ /**
+ * This allows to create the checkbox which manage the use
+ * internationalization button.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createUseInternationalization(final Composite parent) {
+ useInternationalizationButton = new Button(parent, SWT.CHECK);
+ useInternationalizationButton.setText("Use internationalization");
+ }
+
+ /**
+ * This allows to create the viewer to select the language which be used for
+ * the internationalization.
+ *
+ * @param parent
+ * The parent composite.
+ */
+ protected void createLanguage(final Composite parent) {
+ // Create the viewer and the grid data
+ tableViewer = new TableViewer(parent, SWT.BORDER);
+ final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.minimumHeight = 200;
+ data.minimumWidth = 100;
+ tableViewer.getTable().setLayoutData(data);
+
+ // Set its label and content providers
+ tableViewer.setContentProvider(new ArrayContentProvider());
+ tableViewer.setLabelProvider(new LabelProvider());
+
+ // Set the input with the available locales
+ final List<Locale> availableLocales = Arrays.asList(Locale.getAvailableLocales());
+ availableLocales.sort(new Comparator<Locale>() {
+
+ @Override
+ public int compare(final Locale arg0, final Locale arg1) {
+ return arg0.toString().compareTo(arg1.toString());
+ }
+
+ });
+ tableViewer.setInput(availableLocales);
+
+ // Add a double click listener to close the dialog on double click
+ tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ setReturnCode(OK);
+ close();
+ }
+ });
+ }
+
+ /**
+ * This allows to initialize the values of fields.
+ */
+ protected void initializeValues() {
+ if (displayUse()) {
+ // Manage the selection change for the internationalization use
+ // button
+ useInternationalizationButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ useInternationalizationValue = useInternationalizationButton.getSelection();
+ }
+ });
+ // Initialize the boolean value from the preference of papyrus model
+ final boolean useInternationalization = InternationalizationPreferencesUtils
+ .getInternationalizationPreference(resourceURI);
+ useInternationalizationButton.setSelection(useInternationalization);
+ useInternationalizationValue = useInternationalization;
+ }
+
+ // Manage the selection change for locale
+ tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(final SelectionChangedEvent event) {
+ final ISelection selection = event.getSelection();
+ final Locale localeSelected = (Locale) ((StructuredSelection) selection).getFirstElement();
+ localeValue = localeSelected;
+ }
+ });
+ // Initialize the locale value from the preference of papyrus model
+ final Locale locale = InternationalizationPreferencesUtils.getLocalePreference(resourceURI);
+ tableViewer.setSelection(new StructuredSelection(locale));
+ tableViewer.reveal(locale);
+ }
+
+ /**
+ * Get the use internationalization button value.
+ *
+ * @return The use internationalization button value.
+ */
+ public boolean getUseInternationalizationValue() {
+ return useInternationalizationValue;
+ }
+
+ /**
+ * Get the locale value to use for the internationalization.
+ *
+ * @return The locale value.
+ */
+ public Locale getLocaleValue() {
+ return localeValue;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/handlers/InternationalizationCommandHandler.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/handlers/InternationalizationCommandHandler.java
new file mode 100644
index 00000000000..93ad0a6650d
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.ui/src/org/eclipse/papyrus/infra/internationalization/ui/handlers/InternationalizationCommandHandler.java
@@ -0,0 +1,167 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.ui.handlers;
+
+import java.util.Iterator;
+import java.util.Locale;
+
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.commands.AddToResourceCommand;
+import org.eclipse.papyrus.infra.emf.commands.RemoveFromResourcecommand;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
+import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationModel;
+import org.eclipse.papyrus.infra.internationalization.common.command.LocaleInternationalizationPreferenceCommand;
+import org.eclipse.papyrus.infra.internationalization.common.command.UseInternationalizationPreferenceCommand;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.internationalization.ui.Activator;
+import org.eclipse.papyrus.infra.internationalization.ui.dialogs.InternationalizationDialog;
+import org.eclipse.papyrus.infra.ui.command.AbstractCommandHandler;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The handler for the internationalization.
+ */
+public class InternationalizationCommandHandler extends AbstractCommandHandler {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.ui.command.AbstractCommandHandler#getCommand(org.eclipse.core.expressions.IEvaluationContext)
+ */
+ @Override
+ protected Command getCommand(final IEvaluationContext context) {
+ Command resultCommand = UnexecutableCommand.INSTANCE;
+
+ final EObject selectedElement = getSelectedElement();
+
+ final URI neededURIResource = getRootNotationURI(selectedElement);
+
+ Resource notationResource = null;
+ final Iterator<Resource> resources = selectedElement.eResource().getResourceSet().getResources().iterator();
+ while (resources.hasNext() && null == notationResource) {
+ final Resource resource = resources.next();
+ if (neededURIResource.equals(resource.getURI())) { // $NON-NLS-1$
+ notationResource = resource;
+ }
+ }
+
+ if (null != notationResource) {
+ final InternationalizationDialog dialog = new InternationalizationDialog(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), notationResource.getURI(), true);
+
+ if (Window.OK == dialog.open()) {
+
+ final boolean useInternationalizationValue = dialog.getUseInternationalizationValue();
+ final Locale localeValue = dialog.getLocaleValue();
+
+ EAnnotation annotation = null;
+
+ // Search the internationalization annotation in the notation
+ // resource
+ for (final EObject objectContent : notationResource.getContents()) {
+ if (objectContent instanceof EAnnotation
+ && InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL
+ .equals(((EAnnotation) objectContent).getSource())) {
+ annotation = (EAnnotation) objectContent;
+ }
+ }
+
+ final CompoundCommand compoundCommand = new CompoundCommand("Create internationalization command"); //$NON-NLS-1$
+
+ if (null != annotation) {
+ // Remove the existing annotation
+ try {
+ compoundCommand.append(new RemoveFromResourcecommand(
+ ServiceUtilsForResource.getInstance().getTransactionalEditingDomain(notationResource),
+ notationResource, annotation));
+ } catch (final ServiceException e) {
+ Activator.log.error(e);
+ }
+ compoundCommand
+ .append(new UseInternationalizationPreferenceCommand(notationResource.getURI(), false));
+ }
+
+ if (useInternationalizationValue && null != localeValue) {
+ // Create the annotation if the internationalization value
+ // is not false
+ annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation
+ .setSource(InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL);
+ if (useInternationalizationValue) {
+ annotation.getDetails().put(
+ InternationalizationPreferencesConstants.USE_DETAIL_ANNOTATION_LABEL,
+ Boolean.toString(useInternationalizationValue));
+ compoundCommand.append(new UseInternationalizationPreferenceCommand(notationResource.getURI(),
+ useInternationalizationValue));
+ }
+ if (null != localeValue) {
+ annotation.getDetails().put(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE,
+ localeValue.toString());
+ compoundCommand.append(new LocaleInternationalizationPreferenceCommand(
+ notationResource.getURI(), localeValue.toString()));
+ }
+ compoundCommand.append(new GMFtoEMFCommandWrapper(new AddToResourceCommand(
+ ((ModelSet) notationResource.getResourceSet()).getTransactionalEditingDomain(),
+ notationResource, annotation)));
+ }
+
+ if (!compoundCommand.isEmpty()) {
+ resultCommand = compoundCommand;
+ }
+ }
+ }
+
+ return resultCommand;
+ }
+
+ /**
+ * Get the root notation URI (this allows to manage the control mode
+ * elements)
+ *
+ * @param selectedObject
+ * The initial selected object.
+ * @return The {@link URI} of the root notation.
+ */
+ protected URI getRootNotationURI(final EObject selectedObject) {
+ // Get the root container of the selected object
+ final EObject rootContainer = EcoreUtil.getRootContainer(selectedObject);
+
+ URI rootURI = rootContainer.eResource().getURI();
+ // Remove the file extension and add the notation file extension
+ return rootURI.trimFileExtension().appendFileExtension(NotationModel.NOTATION_FILE_EXTENSION);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.ui.command.AbstractCommandHandler#setEnabled(java.lang.Object)
+ */
+ @Override
+ public void setEnabled(final Object evaluationContext) {
+ setBaseEnabled(true);
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.classpath b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.project b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.project
new file mode 100644
index 00000000000..8fd4ddeebb4
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.internationalization.utils</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </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>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..bb0ec4e2ce5
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/META-INF/MANIFEST.MF
@@ -0,0 +1,25 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.internationalization.utils;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.papyrus.infra.internationalization.utils.commands,
+ org.eclipse.papyrus.infra.internationalization.utils.utils
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.ui.workbench,
+ org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.core;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.gmf.runtime.notation.edit;bundle-version="[1.7.0,2.0.0)",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.emf;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.jface;bundle-version="[3.12.0,4.0.0)",
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.papyrus.infra.internationalization.utils.Activator
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/about.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/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>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/build.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/build.properties
new file mode 100644
index 00000000000..2964bc2d7b1
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/build.properties
@@ -0,0 +1,11 @@
+#
+
+bin.includes = .,\
+ META-INF/,\
+ about.html,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/plugin.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/plugin.properties
new file mode 100644
index 00000000000..eb11be415db
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = Papyrus Internationalization Utils
+providerName = Eclipse Modeling Project
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/plugin.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/plugin.xml
new file mode 100644
index 00000000000..7ac51d15095
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/plugin.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+</plugin>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/pom.xml
new file mode 100644
index 00000000000..b2e0417717d
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.internationalization.utils</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/Activator.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/Activator.java
new file mode 100644
index 00000000000..a3ea85f70bd
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/Activator.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.internationalization.utils"; //$NON-NLS-1$
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The log helper.
+ */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/commands/InternationalizationPasteCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/commands/InternationalizationPasteCommand.java
new file mode 100644
index 00000000000..704df3599d4
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/commands/InternationalizationPasteCommand.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils.commands;
+
+import java.util.Locale;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils;
+
+/**
+ * A Command to set the internationalization of the object for the locale.
+ */
+public class InternationalizationPasteCommand extends RecordingCommand {
+
+ /**
+ * The prefix to add.
+ */
+ public static final String COPY_OF = "CopyOf_"; //$NON-NLS-1$
+
+
+ /**
+ * The object to set the label.
+ */
+ private EObject eObject;
+
+ /**
+ * The label for the object.
+ */
+ private String newLabel;
+
+ /**
+ * The locale for the internationalization label for object.
+ */
+ private Locale locale;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain The editing domain.
+ * @param eObject The object to set the label.
+ * @param initialLabel The label for the object.
+ * @param locale The locale for the internationalization label for object.
+ */
+ public InternationalizationPasteCommand(final TransactionalEditingDomain domain, final EObject eObject, final String initialLabel, final Locale locale) {
+ super(domain);
+ this.eObject = eObject;
+ this.newLabel = getNewLabel(initialLabel);
+ this.locale = locale;
+ }
+
+ /**
+ * Get the label modified from the initial label.
+ *
+ * @param initialLabel The initial label.
+ * @return The modified label.
+ */
+ private String getNewLabel(final String initialLabel){
+ return new StringBuilder(COPY_OF).append(initialLabel).toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
+ */
+ @Override
+ protected void doExecute() {
+ LabelInternationalizationUtils.setLabel(eObject, newLabel, locale);
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/InternationalizationConstants.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/InternationalizationConstants.java
new file mode 100644
index 00000000000..01f51b23270
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/InternationalizationConstants.java
@@ -0,0 +1,30 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils.utils;
+
+/**
+ * This class defines the constants for the internationalization.
+ */
+public class InternationalizationConstants {
+
+ /**
+ * The label property path.
+ */
+ public static final String LABEL_PROPERTY_PATH = "label"; //$NON-NLS-1$
+
+ /**
+ * The keyword property path.
+ */
+ public static final String KEYWORD_PROPERTY_PATH = "keyword"; //$NON-NLS-1$
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalization.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalization.java
new file mode 100644
index 00000000000..257cca4d333
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalization.java
@@ -0,0 +1,229 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils.utils;
+
+import java.util.Locale;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ * The internationalization label manager.
+ */
+public class LabelInternationalization {
+
+ /**
+ * The singleton instance.
+ */
+ private static LabelInternationalization instance;
+
+ /**
+ * Constructor.
+ */
+ protected LabelInternationalization() {
+
+ }
+
+ /**
+ * Get the singleton instance (create it if not existing).
+ *
+ * @return The singleton instance.
+ */
+ public static LabelInternationalization getInstance() {
+ if (null == instance) {
+ instance = new LabelInternationalization();
+ }
+ return instance;
+ }
+
+ /**
+ * This allows to get the label of the diagram without the getName when the
+ * label is null.
+ *
+ * @param diagram
+ * The diagram.
+ * @return The label of the diagram.
+ */
+ public String getDiagramLabelWithoutName(final Diagram diagram) {
+ return getDiagramLabelWithoutName(diagram, true);
+ }
+
+ /**
+ * This allows to get the label of the diagram without the getName when the
+ * label is null.
+ *
+ * @param diagram
+ * The diagram.
+ * @param localize
+ * Boolean to determinate if the locale must be used.
+ * @return The label of the diagram.
+ */
+ public String getDiagramLabelWithoutName(final Diagram diagram, final boolean localize) {
+ return LabelInternationalizationUtils.getLabelWithoutSubstract(diagram, localize);
+ }
+
+ /**
+ * This allows to get the label of the diagram.
+ *
+ * @param diagram
+ * The diagram.
+ * @return The label of the diagram or the name if the label is null.
+ */
+ public String getDiagramLabel(final Diagram diagram) {
+ return getDiagramLabel(diagram, true);
+ }
+
+ /**
+ * This allows to get the label of the diagram.
+ *
+ * @param diagram
+ * The diagram.
+ * @param localize
+ * Boolean to determinate if the locale must be used.
+ * @return The label of the diagram or the name if the label is null.
+ */
+ public String getDiagramLabel(final Diagram diagram, final boolean localize) {
+ String result = null;
+ if (null != diagram.eResource() && InternationalizationPreferencesUtils.getInternationalizationPreference(diagram)) {
+ result = getDiagramLabelWithoutName(diagram, localize);
+ }
+ return null != result ? result : diagram.getName();
+ }
+
+ /**
+ * This allows to set the diagram label.
+ *
+ * @param diagram
+ * The diagram.
+ * @param value
+ * The label value.
+ * @param locale
+ * The locale for which set the value (if <code>null</code> set
+ * it for the current locale).
+ */
+ public void setDiagramLabel(final Diagram diagram, final String value, final Locale locale) {
+ LabelInternationalizationUtils.setLabel(diagram, value, locale);
+ }
+
+ /**
+ * This allows to get the set diagram label command.
+ *
+ * @param domain
+ * The editing domain to use.
+ * @param diagram
+ * The diagram.
+ * @param value
+ * The value to set.
+ * @param locale
+ * The locale for which set the value (if <code>null</code> set
+ * it for the current locale).
+ * @return The command which allow to set the diagram label.
+ */
+ public Command getSetDiagramLabelCommand(final EditingDomain domain, final Diagram diagram, final String value,
+ final Locale locale) {
+ return LabelInternationalizationUtils.getSetLabelCommand(domain, diagram, value, locale);
+ }
+
+ /**
+ * This allows to get the label of the table without the getName when the
+ * label is null.
+ *
+ * @param table
+ * The table.
+ * @return The label of the table.
+ */
+ public String getTableLabelWithoutName(final Table table) {
+ return getTableLabelWithoutName(table, true);
+ }
+
+ /**
+ * This allows to get the label of the table without the getName when the
+ * label is null.
+ *
+ * @param table
+ * The table.
+ * @param localize
+ * Boolean to determinate if the locale must be used.
+ * @return The label of the table.
+ */
+ public String getTableLabelWithoutName(final Table table, final boolean localize) {
+ return LabelInternationalizationUtils.getLabelWithoutSubstract(table, localize);
+ }
+
+ /**
+ * This allows to get the label of the table.
+ *
+ * @param table
+ * The table.
+ * @return The label of the table or the name if the label is null.
+ */
+ public String getTableLabel(final Table table) {
+ return getTableLabel(table, true);
+ }
+
+ /**
+ * This allows to get the label of the table.
+ *
+ * @param table
+ * The table.
+ * @param localize
+ * Boolean to determinate if the locale must be used.
+ * @return The label of the table or the name if the label is null.
+ */
+ public String getTableLabel(final Table table, final boolean localize) {
+ String result = null;
+ if (null != table.eResource() && InternationalizationPreferencesUtils.getInternationalizationPreference(table)) {
+ result = getTableLabelWithoutName(table, localize);
+ }
+ return null != result ? result : table.getName();
+ }
+
+ /**
+ * This allows to set the table label.
+ *
+ * @param table
+ * The table.
+ * @param value
+ * The label value.
+ * @param locale
+ * The locale for which set the value (if <code>null</code> set
+ * it for the current locale).
+ */
+ public void setTableLabel(final Table table, final String value, final Locale locale) {
+ LabelInternationalizationUtils.setLabel(table, value, locale);
+ }
+
+ /**
+ * This allows to get the set table label command.
+ *
+ * @param domain
+ * The editing domain to use.
+ * @param table
+ * The table.
+ * @param value
+ * The value to set.
+ * @param locale
+ * The locale for which set the value (if <code>null</code> set
+ * it for the current locale).
+ * @return The command which allow to set the table label.
+ */
+ public Command getSetTableLabelCommand(final EditingDomain domain, final Table table, final String value,
+ final Locale locale) {
+ return LabelInternationalizationUtils.getSetLabelCommand(domain, table, value, locale);
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalizationPreferencesUtils.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalizationPreferencesUtils.java
new file mode 100644
index 00000000000..8ef77d9c261
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalizationPreferencesUtils.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils.utils;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+
+/**
+ * Open the label internationalization preferences to the others plugins with the utils plugin.
+ */
+public class LabelInternationalizationPreferencesUtils {
+
+ /**
+ * This allows to modify the internationalization preference value.
+ *
+ * @param eObject The {@link EObject) corresponding (to get its resource).
+ * @param value The new preference value.
+ */
+ public static void setInternationalizationPreference(final EObject eObject, final boolean value){
+ InternationalizationPreferencesUtils.setInternationalizationPreference(eObject, value);
+ }
+
+ /**
+ * This allows to modify the internationalization preference value.
+ *
+ * @param resource The {@link Resource) to get the papyrus project preferences.
+ * @param value The new preference value.
+ */
+ public static void setInternationalizationPreference(final Resource resource, final boolean value){
+ InternationalizationPreferencesUtils.setInternationalizationPreference(resource, value);
+ }
+
+ /**
+ * This allows to get the internationalization preference value.
+ *
+ * @param eObject The {@link EObject) corresponding (to get its resource).
+ * @return <code>true</code> if the preference value is set to true, <code>false</code> otherwise.
+ */
+ public static boolean getInternationalizationPreference(final EObject eObject){
+ return InternationalizationPreferencesUtils.getInternationalizationPreference(eObject);
+ }
+
+ /**
+ * This allows to get the internationalization preference value.
+ *
+ * @param resource The {@link Resource) to get the papyrus project preferences.
+ * @return <code>true</code> if the preference value is set to true, <code>false</code> otherwise.
+ */
+ public static boolean getInternationalizationPreference(final Resource resource){
+ return InternationalizationPreferencesUtils.getInternationalizationPreference(resource);
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalizationUtils.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalizationUtils.java
new file mode 100644
index 00000000000..ee57125a72a
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization.utils/src/org/eclipse/papyrus/infra/internationalization/utils/utils/LabelInternationalizationUtils.java
@@ -0,0 +1,259 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils.utils;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+
+/**
+ * This allows to manage the utils methods for the internationalization.
+ */
+public class LabelInternationalizationUtils {
+
+ /**
+ * This allows to get the label without getting name if the label is null.
+ *
+ * @param eObject
+ * The object.
+ * @param localize
+ * Boolean to determinate if the localize must be used or not.
+ * @return The label of the object.
+ */
+ public static String getLabelWithoutSubstract(final EObject eObject, final boolean localize) {
+ String result = null;
+
+ try {
+ final InternationalizationModelResource internationalizationResource = getInternationalizationModelResource(
+ eObject.eResource());
+
+ if (null != internationalizationResource) {
+ result = internationalizationResource.getValueForEntryKey(eObject.eResource().getURI(), eObject);
+ }
+ } catch (final Exception e) {
+ // Do nothing
+ }
+
+ return result;
+ }
+
+ /**
+ * This allows to set the label.
+ *
+ * @param eObject
+ * The object.
+ * @param value
+ * The value to set.
+ * @param locale
+ * The locale for which set the value (if <code>null</code> set
+ * it for the current locale).
+ */
+ public static void setLabel(final EObject eObject, final String value, final Locale locale) {
+ try {
+ final InternationalizationModelResource internationalizationResource = getInternationalizationModelResource(
+ eObject.eResource());
+
+ if (null != internationalizationResource) {
+
+ Locale localeToUse = locale;
+ if (null == localeToUse) {
+ localeToUse = InternationalizationPreferencesUtils.getLocalePreference(eObject);
+ }
+
+ internationalizationResource.setValue(eObject.eResource().getURI(), eObject, value, localeToUse);
+ }
+ } catch (final Exception e) {
+ // Do nothing
+ }
+ }
+
+ /**
+ * This allows to get the set label command.
+ *
+ * @param domain
+ * The editing domain to use.
+ * @param eObject
+ * The object.
+ * @param value
+ * The value to set.
+ * @param locale
+ * The locale for which set the value (if <code>null</code> set
+ * it for the current locale).
+ * @return The command which allow to set the label.
+ */
+ public static Command getSetLabelCommand(final EditingDomain domain, final EObject eObject, final String value,
+ final Locale locale) {
+ Command resultCommand = null;
+ try {
+ final InternationalizationModelResource internationalizationResource = getInternationalizationModelResource(
+ eObject.eResource());
+
+ if (null != internationalizationResource) {
+
+ Locale localeToUse = locale;
+ if (null == localeToUse) {
+ localeToUse = InternationalizationPreferencesUtils.getLocalePreference(eObject);
+ }
+
+ resultCommand = internationalizationResource.getSetValueCommand(domain, eObject.eResource().getURI(),
+ eObject, value, localeToUse);
+ }
+ } catch (final Exception e) {
+ // Do nothing
+ }
+ return null != resultCommand ? resultCommand : UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * This allows to get the {@link InternationalizationEntry} corresponding to
+ * the object and the key.
+ *
+ * @param eObject
+ * The object to search.
+ * @param key
+ * The key to search in the internationalization library.
+ * @return The corresponding {@link InternationalizationEntry}.
+ */
+ public static InternationalizationEntry getInternationalizationEntry(final EObject eObject, final Object key) {
+ InternationalizationEntry resultEntry = null;
+
+ try {
+ final InternationalizationModelResource internationalizationResource = getInternationalizationModelResource(
+ eObject.eResource());
+
+ if (null != internationalizationResource) {
+ resultEntry = internationalizationResource.getEntryForKey(eObject.eResource().getURI(), key,
+ InternationalizationPreferencesUtils.getLocalePreference(eObject));
+ }
+ } catch (final Exception e) {
+ // Do nothing
+ }
+
+ return resultEntry;
+ }
+
+ /**
+ * This allows to get the {@link InternationalizationEntry} corresponding to
+ * the object and the key.
+ *
+ * @param eObject
+ * The object to search.
+ * @param key
+ * The key to search in the internationalization library.
+ * @param locale
+ * The locale of which get the value
+ * @return The corresponding {@link InternationalizationEntry}.
+ */
+ public static InternationalizationEntry getInternationalizationEntry(final EObject eObject, final Object key,
+ final Locale locale) {
+ InternationalizationEntry resultEntry = null;
+
+ try {
+ final InternationalizationModelResource internationalizationResource = getInternationalizationModelResource(
+ eObject.eResource());
+
+ if (null != internationalizationResource) {
+
+ Locale localeToUse = locale;
+ if (null == localeToUse) {
+ localeToUse = InternationalizationPreferencesUtils.getLocalePreference(eObject);
+ }
+
+ resultEntry = internationalizationResource.getEntryForKey(eObject.eResource().getURI(), key, locale);
+ }
+ } catch (final Exception e) {
+ // Do nothing
+ }
+
+ return resultEntry;
+ }
+
+ /**
+ * Get the available locales for the resource.
+ *
+ * @param resource
+ * The resource.
+ * @return The available locales of loaded properties files for resource.
+ */
+ public static Set<Locale> getAvailableLocales(final Resource resource) {
+ Set<Locale> locales = null;
+
+ try {
+ final InternationalizationModelResource internationalizationResource = getInternationalizationModelResource(
+ resource);
+
+ locales = internationalizationResource.getAvailablePropertiesLocales(resource.getURI());
+ } catch (final Exception e) {
+ // Do nothing
+ }
+
+ return null != locales ? locales : new HashSet<Locale>();
+ }
+
+ /**
+ * Get the internationalizationModelResource from the model set.
+ *
+ * @param resource
+ * The initial resource.
+ * @return The internationalization model resource.
+ * @throws ServiceException
+ * The service registry exception.
+ * @throws NotFoundException
+ * The model not found exception.
+ */
+ public static InternationalizationModelResource getInternationalizationModelResource(final Resource resource)
+ throws ServiceException, NotFoundException {
+ final ServicesRegistry servicesRegistry = ServiceUtilsForResourceSet.getInstance()
+ .getServiceRegistry(resource.getResourceSet());
+ final ModelSet modelSet = ServiceUtils.getInstance().getModelSet(servicesRegistry);
+ return (InternationalizationModelResource) modelSet.getModelChecked(InternationalizationModelResource.MODEL_ID);
+ }
+
+ /**
+ * This allows to manage part label synchronizer for the object
+ * corresponding to the editor part.
+ *
+ * @param eObject
+ * The EObject (seems to be Table or Diagram).
+ * @param editorPart
+ * The editor part corresponding to the EObject.
+ */
+ public static void managePartLabelSynchronizer(final EObject eObject,
+ final IInternationalizationEditor editorPart) {
+ try {
+ final InternationalizationModelResource internationalizationResource = getInternationalizationModelResource(
+ eObject.eResource());
+
+ internationalizationResource.addEditorPartForEObject(eObject, editorPart);
+ } catch (final Exception e) {
+ // Do nothing
+ }
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.classpath b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.classpath
new file mode 100644
index 00000000000..e7a4ca0c29c
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.project b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.project
new file mode 100644
index 00000000000..b85a6de555c
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.project
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.internationalization</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.oomph.version.VersionBuilder</name>
+ <arguments>
+ <dictionary>
+ <key>check.maven.pom</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>ignore.lower.bound.dependency.ranges</key>
+ <value>true</value>
+ </dictionary>
+ <dictionary>
+ <key>release.path</key>
+ <value>/org.eclipse.papyrus.releng.main.release/release.xml</value>
+ </dictionary>
+ </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>org.eclipse.oomph.version.VersionNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.settings/org.eclipse.core.resources.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..a8dcccbdbbf
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+encoding//src/site/mediawiki/internationalizationDev-toc.xml=utf-8
+encoding//src/site/mediawiki/internationalizationDev.html=UTF-8
+encoding//target/site/generated-eclipse-help/internationalizationDev-toc.xml=utf-8
+encoding//target/site/generated-eclipse-help/internationalizationDev.html=UTF-8
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..311910f0ab1
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/META-INF/MANIFEST.MF
@@ -0,0 +1,29 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.papyrus.infra.internationalization;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Export-Package: org.eclipse.papyrus.infra.internationalization,
+ org.eclipse.papyrus.infra.internationalization.commands,
+ org.eclipse.papyrus.infra.internationalization.modelresource,
+ org.eclipse.papyrus.infra.internationalization.modelsnippet,
+ org.eclipse.papyrus.infra.internationalization.util,
+ org.eclipse.papyrus.infra.internationalization.utils
+Require-Bundle: org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport,
+ org.eclipse.ui.workbench;bundle-version="[3.108.0,4.0.0)",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.core;bundle-version="[2.3.0,3.0.0)",
+ org.eclipse.gmf.runtime.notation.edit;bundle-version="[1.7.0,2.0.0)",
+ org.eclipse.papyrus.infra.emf;bundle-version="[2.2.0,3.0.0)",
+ org.eclipse.papyrus.infra.internationalization.common;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.jface;bundle-version="[3.12.0,4.0.0)",
+ org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.help;bundle-version="[3.8.0,4.0.0)",
+ org.eclipse.papyrus.infra.doc;bundle-version="[1.2.0,2.0.0)"
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.papyrus.infra.internationalization.Activator
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/about.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/about.html
new file mode 100644
index 00000000000..598b3684879
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/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>May 12, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/build.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/build.properties
new file mode 100644
index 00000000000..cc3850cb555
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/build.properties
@@ -0,0 +1,13 @@
+#
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ about.html,\
+ plugin.xml,\
+ plugin.properties
+jars.compile.order = .
+source.. = src-gen/,\
+ src/
+output.. = bin/
+src.includes = about.html
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/model/Internationalization.ecore b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/model/Internationalization.ecore
new file mode 100644
index 00000000000..462ae055ec6
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/model/Internationalization.ecore
@@ -0,0 +1,13 @@
+<?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="internationalization" nsURI="http://www.eclipse.org/papyrus/internationalization/model"
+ nsPrefix="internationalization">
+ <eClassifiers xsi:type="ecore:EClass" name="InternationalizationLibrary">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="entries" upperBound="-1"
+ eType="#//InternationalizationEntry"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="InternationalizationEntry">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" lowerBound="1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/model/Internationalization.genmodel b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/model/Internationalization.genmodel
new file mode 100644
index 00000000000..dfe7a13c995
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/model/Internationalization.genmodel
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2016 CEA LIST and others.&#xD;&#xA; &#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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation"
+ modelDirectory="/org.eclipse.papyrus.infra.internationalization/src-gen" editDirectory="/org.eclipse.papyrus.infra.internationalization.edit/src-gen"
+ modelPluginID="org.eclipse.papyrus.infra.internationalization" modelName="Internationalization"
+ nonNLSMarkers="true" rootExtendsClass="org.eclipse.emf.ecore.impl.MinimalEObjectImpl$Container"
+ codeFormatting="true" importerID="org.eclipse.emf.importer.ecore" complianceLevel="8.0"
+ copyrightFields="false" providerRootExtendsClass="" operationReflection="true"
+ importOrganizing="true" cleanup="true">
+ <foreignModel>Internationalization.ecore</foreignModel>
+ <genPackages prefix="Internationalization" basePackage="org.eclipse.papyrus.infra"
+ disposableProviderFactory="true" ecorePackage="Internationalization.ecore#/">
+ <genClasses ecoreClass="Internationalization.ecore#//InternationalizationLibrary">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference Internationalization.ecore#//InternationalizationLibrary/entries"/>
+ </genClasses>
+ <genClasses ecoreClass="Internationalization.ecore#//InternationalizationEntry">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Internationalization.ecore#//InternationalizationEntry/key"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute Internationalization.ecore#//InternationalizationEntry/value"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/plugin.properties b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/plugin.properties
new file mode 100644
index 00000000000..bb233bea040
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/plugin.properties
@@ -0,0 +1,4 @@
+#
+
+pluginName = Papyrus Internationalization
+providerName = Eclipse Modeling Project
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/plugin.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/plugin.xml
new file mode 100644
index 00000000000..189b4a897ee
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/plugin.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+
+<!--
+-->
+
+<plugin>
+
+ <extension point="org.eclipse.emf.ecore.generated_package">
+ <!-- @generated Internationalization -->
+ <package
+ uri="http://www.eclipse.org/papyrus/internationalization/model"
+ class="org.eclipse.papyrus.infra.internationalization.InternationalizationPackage"
+ genModel="model/Internationalization.genmodel"/>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.core.model">
+ <model
+ classname="org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationPreferenceModel"
+ description="Model for internationalization preference"
+ fileExtension="internationalization">
+ </model>
+ </extension>
+ <extension
+ point="org.eclipse.help.toc">
+ <toc
+ file="target/site/generated-eclipse-help/internationalizationDev-toc.xml"
+ primary="false">
+ </toc>
+ </extension>
+
+</plugin>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml
new file mode 100644
index 00000000000..19dc71f2eef
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/pom.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.internationalization</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.mylyn.docs</groupId>
+ <artifactId>org.eclipse.mylyn.wikitext.core.maven</artifactId>
+ <configuration>
+ <sourceFolder>src/site/mediawiki</sourceFolder>
+ <outputFolder>${project.build.directory}/site/generated-eclipse-help</outputFolder>
+ <!-- copyrightNotice>${help.copyrightNotice}</copyrightNotice>
+ <title>${help.documentTitle}</title-->
+ <multipleOutputFiles>false</multipleOutputFiles>
+ <navigationImages>true</navigationImages>
+ <formatOutput>true</formatOutput>
+ <htmlFilenameFormat>$1.html</htmlFilenameFormat>
+ <xmlFilenameFormat>$1-toc.xml</xmlFilenameFormat>
+ <helpPrefix>target/site/generated-eclipse-help</helpPrefix>
+ <!-- stylesheetUrls>
+ <param>styles/main.css</param>
+ </stylesheetUrls-->
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>eclipse-help</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.eclipse.mylyn.docs</groupId>
+ <artifactId>org.eclipse.mylyn.wikitext.mediawiki.core</artifactId>
+ <version>${mylyn.wikitext.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationEntry.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationEntry.java
new file mode 100644
index 00000000000..8c2faecd9c9
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationEntry.java
@@ -0,0 +1,86 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Entry</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry#getKey <em>Key</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry#getValue <em>Value</em>}</li>
+ * </ul>
+ *
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage#getInternationalizationEntry()
+ * @model
+ * @generated
+ */
+public interface InternationalizationEntry extends EObject {
+ /**
+ * Returns the value of the '<em><b>Key</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Key</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Key</em>' attribute.
+ * @see #setKey(Object)
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage#getInternationalizationEntry_Key()
+ * @model required="true"
+ * @generated
+ */
+ Object getKey();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry#getKey <em>Key</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Key</em>' attribute.
+ * @see #getKey()
+ * @generated
+ */
+ void setKey(Object value);
+
+ /**
+ * Returns the value of the '<em><b>Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Value</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Value</em>' attribute.
+ * @see #setValue(String)
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage#getInternationalizationEntry_Value()
+ * @model required="true"
+ * @generated
+ */
+ String getValue();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry#getValue <em>Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Value</em>' attribute.
+ * @see #getValue()
+ * @generated
+ */
+ void setValue(String value);
+
+} // InternationalizationEntry
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationFactory.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationFactory.java
new file mode 100644
index 00000000000..4d5c13fac54
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationFactory.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage
+ * @generated
+ */
+public interface InternationalizationFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ InternationalizationFactory eINSTANCE = org.eclipse.papyrus.infra.internationalization.impl.InternationalizationFactoryImpl
+ .init();
+
+ /**
+ * Returns a new object of class '<em>Library</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Library</em>'.
+ * @generated
+ */
+ InternationalizationLibrary createInternationalizationLibrary();
+
+ /**
+ * Returns a new object of class '<em>Entry</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Entry</em>'.
+ * @generated
+ */
+ InternationalizationEntry createInternationalizationEntry();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ InternationalizationPackage getInternationalizationPackage();
+
+} //InternationalizationFactory
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationLibrary.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationLibrary.java
new file mode 100644
index 00000000000..c591a85a255
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationLibrary.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Library</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary#getEntries <em>Entries</em>}</li>
+ * </ul>
+ *
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage#getInternationalizationLibrary()
+ * @model
+ * @generated
+ */
+public interface InternationalizationLibrary extends EObject {
+ /**
+ * Returns the value of the '<em><b>Entries</b></em>' reference list.
+ * The list contents are of type {@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry}.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Entries</em>' reference list isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Entries</em>' reference list.
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage#getInternationalizationLibrary_Entries()
+ * @model
+ * @generated
+ */
+ EList<InternationalizationEntry> getEntries();
+
+} // InternationalizationLibrary
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationPackage.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationPackage.java
new file mode 100644
index 00000000000..8e3da3cc47b
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/InternationalizationPackage.java
@@ -0,0 +1,274 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each operation of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface InternationalizationPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "internationalization"; //$NON-NLS-1$
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/papyrus/internationalization/model"; //$NON-NLS-1$
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "internationalization"; //$NON-NLS-1$
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ InternationalizationPackage eINSTANCE = org.eclipse.papyrus.infra.internationalization.impl.InternationalizationPackageImpl
+ .init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.internationalization.impl.InternationalizationLibraryImpl <em>Library</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.internationalization.impl.InternationalizationLibraryImpl
+ * @see org.eclipse.papyrus.infra.internationalization.impl.InternationalizationPackageImpl#getInternationalizationLibrary()
+ * @generated
+ */
+ int INTERNATIONALIZATION_LIBRARY = 0;
+
+ /**
+ * The feature id for the '<em><b>Entries</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INTERNATIONALIZATION_LIBRARY__ENTRIES = 0;
+
+ /**
+ * The number of structural features of the '<em>Library</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INTERNATIONALIZATION_LIBRARY_FEATURE_COUNT = 1;
+
+ /**
+ * The number of operations of the '<em>Library</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INTERNATIONALIZATION_LIBRARY_OPERATION_COUNT = 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.internationalization.impl.InternationalizationEntryImpl <em>Entry</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.internationalization.impl.InternationalizationEntryImpl
+ * @see org.eclipse.papyrus.infra.internationalization.impl.InternationalizationPackageImpl#getInternationalizationEntry()
+ * @generated
+ */
+ int INTERNATIONALIZATION_ENTRY = 1;
+
+ /**
+ * The feature id for the '<em><b>Key</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INTERNATIONALIZATION_ENTRY__KEY = 0;
+
+ /**
+ * The feature id for the '<em><b>Value</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INTERNATIONALIZATION_ENTRY__VALUE = 1;
+
+ /**
+ * The number of structural features of the '<em>Entry</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INTERNATIONALIZATION_ENTRY_FEATURE_COUNT = 2;
+
+ /**
+ * The number of operations of the '<em>Entry</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int INTERNATIONALIZATION_ENTRY_OPERATION_COUNT = 0;
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary <em>Library</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Library</em>'.
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary
+ * @generated
+ */
+ EClass getInternationalizationLibrary();
+
+ /**
+ * Returns the meta object for the reference list '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary#getEntries <em>Entries</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference list '<em>Entries</em>'.
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary#getEntries()
+ * @see #getInternationalizationLibrary()
+ * @generated
+ */
+ EReference getInternationalizationLibrary_Entries();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry <em>Entry</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Entry</em>'.
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationEntry
+ * @generated
+ */
+ EClass getInternationalizationEntry();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry#getKey <em>Key</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Key</em>'.
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationEntry#getKey()
+ * @see #getInternationalizationEntry()
+ * @generated
+ */
+ EAttribute getInternationalizationEntry_Key();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry#getValue <em>Value</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Value</em>'.
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationEntry#getValue()
+ * @see #getInternationalizationEntry()
+ * @generated
+ */
+ EAttribute getInternationalizationEntry_Value();
+
+ /**
+ * 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
+ */
+ InternationalizationFactory getInternationalizationFactory();
+
+ /**
+ * <!-- 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 operation of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.internationalization.impl.InternationalizationLibraryImpl <em>Library</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.internationalization.impl.InternationalizationLibraryImpl
+ * @see org.eclipse.papyrus.infra.internationalization.impl.InternationalizationPackageImpl#getInternationalizationLibrary()
+ * @generated
+ */
+ EClass INTERNATIONALIZATION_LIBRARY = eINSTANCE.getInternationalizationLibrary();
+
+ /**
+ * The meta object literal for the '<em><b>Entries</b></em>' reference list feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference INTERNATIONALIZATION_LIBRARY__ENTRIES = eINSTANCE.getInternationalizationLibrary_Entries();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.internationalization.impl.InternationalizationEntryImpl <em>Entry</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.internationalization.impl.InternationalizationEntryImpl
+ * @see org.eclipse.papyrus.infra.internationalization.impl.InternationalizationPackageImpl#getInternationalizationEntry()
+ * @generated
+ */
+ EClass INTERNATIONALIZATION_ENTRY = eINSTANCE.getInternationalizationEntry();
+
+ /**
+ * The meta object literal for the '<em><b>Key</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute INTERNATIONALIZATION_ENTRY__KEY = eINSTANCE.getInternationalizationEntry_Key();
+
+ /**
+ * The meta object literal for the '<em><b>Value</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute INTERNATIONALIZATION_ENTRY__VALUE = eINSTANCE.getInternationalizationEntry_Value();
+
+ }
+
+} //InternationalizationPackage
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationEntryImpl.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationEntryImpl.java
new file mode 100644
index 00000000000..f71b6742ccb
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationEntryImpl.java
@@ -0,0 +1,236 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Entry</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.internationalization.impl.InternationalizationEntryImpl#getKey <em>Key</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.internationalization.impl.InternationalizationEntryImpl#getValue <em>Value</em>}</li>
+ * </ul>
+ *
+ * @generated
+ */
+public class InternationalizationEntryImpl extends MinimalEObjectImpl.Container implements InternationalizationEntry {
+ /**
+ * The default value of the '{@link #getKey() <em>Key</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKey()
+ * @generated
+ * @ordered
+ */
+ protected static final Object KEY_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getKey() <em>Key</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKey()
+ * @generated
+ * @ordered
+ */
+ protected Object key = KEY_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getValue() <em>Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValue()
+ * @generated
+ * @ordered
+ */
+ protected static final String VALUE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getValue() <em>Value</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getValue()
+ * @generated
+ * @ordered
+ */
+ protected String value = VALUE_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected InternationalizationEntryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return InternationalizationPackage.Literals.INTERNATIONALIZATION_ENTRY;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setKey(Object newKey) {
+ Object oldKey = key;
+ key = newKey;
+ if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.SET,
+ InternationalizationPackage.INTERNATIONALIZATION_ENTRY__KEY, oldKey, key));
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void setValue(String newValue) {
+ String oldValue = value;
+ value = newValue;
+// if (eNotificationRequired()) {
+ eNotify(new ENotificationImpl(this, Notification.SET,
+ InternationalizationPackage.INTERNATIONALIZATION_ENTRY__VALUE, oldValue, value));
+// }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__KEY:
+ return getKey();
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__VALUE:
+ return getValue();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__KEY:
+ setKey(newValue);
+ return;
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__VALUE:
+ setValue((String) newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__KEY:
+ setKey(KEY_EDEFAULT);
+ return;
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__VALUE:
+ setValue(VALUE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__KEY:
+ return KEY_EDEFAULT == null ? key != null : !KEY_EDEFAULT.equals(key);
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY__VALUE:
+ return VALUE_EDEFAULT == null ? value != null : !VALUE_EDEFAULT.equals(value);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) {
+ return super.toString();
+ }
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (key: "); //$NON-NLS-1$
+ result.append(key);
+ result.append(", value: "); //$NON-NLS-1$
+ result.append(value);
+ result.append(')');
+ return result.toString();
+ }
+
+} //InternationalizationEntryImpl
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationFactoryImpl.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationFactoryImpl.java
new file mode 100644
index 00000000000..e9b99631670
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationFactoryImpl.java
@@ -0,0 +1,120 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+import org.eclipse.papyrus.infra.internationalization.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class InternationalizationFactoryImpl extends EFactoryImpl implements InternationalizationFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static InternationalizationFactory init() {
+ try {
+ InternationalizationFactory theInternationalizationFactory = (InternationalizationFactory) EPackage.Registry.INSTANCE
+ .getEFactory(InternationalizationPackage.eNS_URI);
+ if (theInternationalizationFactory != null) {
+ return theInternationalizationFactory;
+ }
+ } catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new InternationalizationFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InternationalizationFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case InternationalizationPackage.INTERNATIONALIZATION_LIBRARY:
+ return createInternationalizationLibrary();
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY:
+ return createInternationalizationEntry();
+ 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 InternationalizationLibrary createInternationalizationLibrary() {
+ InternationalizationLibraryImpl internationalizationLibrary = new InternationalizationLibraryImpl();
+ return internationalizationLibrary;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public InternationalizationEntry createInternationalizationEntry() {
+ InternationalizationEntryImpl internationalizationEntry = new InternationalizationEntryImpl();
+ return internationalizationEntry;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public InternationalizationPackage getInternationalizationPackage() {
+ return (InternationalizationPackage) getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static InternationalizationPackage getPackage() {
+ return InternationalizationPackage.eINSTANCE;
+ }
+
+} //InternationalizationFactoryImpl
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationLibraryImpl.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationLibraryImpl.java
new file mode 100644
index 00000000000..d8bc0cd67a4
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationLibraryImpl.java
@@ -0,0 +1,146 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
+
+import org.eclipse.emf.ecore.util.EObjectResolvingEList;
+
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Library</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * </p>
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.internationalization.impl.InternationalizationLibraryImpl#getEntries <em>Entries</em>}</li>
+ * </ul>
+ *
+ * @generated
+ */
+public class InternationalizationLibraryImpl extends MinimalEObjectImpl.Container
+ implements InternationalizationLibrary {
+ /**
+ * The cached value of the '{@link #getEntries() <em>Entries</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getEntries()
+ * @generated
+ * @ordered
+ */
+ protected EList<InternationalizationEntry> entries;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected InternationalizationLibraryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return InternationalizationPackage.Literals.INTERNATIONALIZATION_LIBRARY;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EList<InternationalizationEntry> getEntries() {
+ if (entries == null) {
+ entries = new EObjectResolvingEList<>(InternationalizationEntry.class, this,
+ InternationalizationPackage.INTERNATIONALIZATION_LIBRARY__ENTRIES);
+ }
+ return entries;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_LIBRARY__ENTRIES:
+ return getEntries();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_LIBRARY__ENTRIES:
+ getEntries().clear();
+ getEntries().addAll((Collection<? extends InternationalizationEntry>) newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_LIBRARY__ENTRIES:
+ getEntries().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_LIBRARY__ENTRIES:
+ return entries != null && !entries.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+
+} //InternationalizationLibraryImpl
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationPackageImpl.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationPackageImpl.java
new file mode 100644
index 00000000000..197e2e23368
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/impl/InternationalizationPackageImpl.java
@@ -0,0 +1,252 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationFactory;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class InternationalizationPackageImpl extends EPackageImpl implements InternationalizationPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass internationalizationLibraryEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass internationalizationEntryEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private InternationalizationPackageImpl() {
+ super(eNS_URI, InternationalizationFactory.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 InternationalizationPackage#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 InternationalizationPackage init() {
+ if (isInited) {
+ return (InternationalizationPackage) EPackage.Registry.INSTANCE
+ .getEPackage(InternationalizationPackage.eNS_URI);
+ }
+
+ // Obtain or create and register package
+ InternationalizationPackageImpl theInternationalizationPackage = (InternationalizationPackageImpl) (EPackage.Registry.INSTANCE
+ .get(eNS_URI) instanceof InternationalizationPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI)
+ : new InternationalizationPackageImpl());
+
+ isInited = true;
+
+ // Create package meta-data objects
+ theInternationalizationPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theInternationalizationPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theInternationalizationPackage.freeze();
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(InternationalizationPackage.eNS_URI, theInternationalizationPackage);
+ return theInternationalizationPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EClass getInternationalizationLibrary() {
+ return internationalizationLibraryEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EReference getInternationalizationLibrary_Entries() {
+ return (EReference) internationalizationLibraryEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EClass getInternationalizationEntry() {
+ return internationalizationEntryEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EAttribute getInternationalizationEntry_Key() {
+ return (EAttribute) internationalizationEntryEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EAttribute getInternationalizationEntry_Value() {
+ return (EAttribute) internationalizationEntryEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public InternationalizationFactory getInternationalizationFactory() {
+ return (InternationalizationFactory) getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) {
+ return;
+ }
+ isCreated = true;
+
+ // Create classes and their features
+ internationalizationLibraryEClass = createEClass(INTERNATIONALIZATION_LIBRARY);
+ createEReference(internationalizationLibraryEClass, INTERNATIONALIZATION_LIBRARY__ENTRIES);
+
+ internationalizationEntryEClass = createEClass(INTERNATIONALIZATION_ENTRY);
+ createEAttribute(internationalizationEntryEClass, INTERNATIONALIZATION_ENTRY__KEY);
+ createEAttribute(internationalizationEntryEClass, INTERNATIONALIZATION_ENTRY__VALUE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) {
+ return;
+ }
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+
+ // Initialize classes, features, and operations; add parameters
+ initEClass(internationalizationLibraryEClass, InternationalizationLibrary.class, "InternationalizationLibrary", //$NON-NLS-1$
+ !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getInternationalizationLibrary_Entries(), this.getInternationalizationEntry(), null, "entries", //$NON-NLS-1$
+ null, 0, -1, InternationalizationLibrary.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE,
+ !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(internationalizationEntryEClass, InternationalizationEntry.class, "InternationalizationEntry", //$NON-NLS-1$
+ !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getInternationalizationEntry_Key(), ecorePackage.getEJavaObject(), "key", null, 1, 1, //$NON-NLS-1$
+ InternationalizationEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
+ IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getInternationalizationEntry_Value(), ecorePackage.getEString(), "value", null, 1, 1, //$NON-NLS-1$
+ InternationalizationEntry.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID,
+ IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //InternationalizationPackageImpl
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/util/InternationalizationAdapterFactory.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/util/InternationalizationAdapterFactory.java
new file mode 100644
index 00000000000..9bb7a09f475
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/util/InternationalizationAdapterFactory.java
@@ -0,0 +1,147 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.papyrus.infra.internationalization.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage
+ * @generated
+ */
+public class InternationalizationAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static InternationalizationPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InternationalizationAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = InternationalizationPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject) object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected InternationalizationSwitch<Adapter> modelSwitch = new InternationalizationSwitch<Adapter>() {
+ @Override
+ public Adapter caseInternationalizationLibrary(InternationalizationLibrary object) {
+ return createInternationalizationLibraryAdapter();
+ }
+
+ @Override
+ public Adapter caseInternationalizationEntry(InternationalizationEntry object) {
+ return createInternationalizationEntryAdapter();
+ }
+
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject) target);
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary <em>Library</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary
+ * @generated
+ */
+ public Adapter createInternationalizationLibraryAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.internationalization.InternationalizationEntry <em>Entry</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationEntry
+ * @generated
+ */
+ public Adapter createInternationalizationEntryAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //InternationalizationAdapterFactory
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/util/InternationalizationSwitch.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/util/InternationalizationSwitch.java
new file mode 100644
index 00000000000..8b059e257c4
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src-gen/org/eclipse/papyrus/infra/internationalization/util/InternationalizationSwitch.java
@@ -0,0 +1,145 @@
+/**
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ */
+package org.eclipse.papyrus.infra.internationalization.util;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+import org.eclipse.papyrus.infra.internationalization.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.internationalization.InternationalizationPackage
+ * @generated
+ */
+public class InternationalizationSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static InternationalizationPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public InternationalizationSwitch() {
+ if (modelPackage == null) {
+ modelPackage = InternationalizationPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case InternationalizationPackage.INTERNATIONALIZATION_LIBRARY: {
+ InternationalizationLibrary internationalizationLibrary = (InternationalizationLibrary) theEObject;
+ T result = caseInternationalizationLibrary(internationalizationLibrary);
+ if (result == null) {
+ result = defaultCase(theEObject);
+ }
+ return result;
+ }
+ case InternationalizationPackage.INTERNATIONALIZATION_ENTRY: {
+ InternationalizationEntry internationalizationEntry = (InternationalizationEntry) theEObject;
+ T result = caseInternationalizationEntry(internationalizationEntry);
+ if (result == null) {
+ result = defaultCase(theEObject);
+ }
+ return result;
+ }
+ default:
+ return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Library</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Library</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseInternationalizationLibrary(InternationalizationLibrary object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Entry</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Entry</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseInternationalizationEntry(InternationalizationEntry object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //InternationalizationSwitch
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/Activator.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/Activator.java
new file mode 100644
index 00000000000..05322b0895b
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/Activator.java
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.internationalization"; //$NON-NLS-1$
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The log helper.
+ */
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/InternationalizationPreferenceCommandFactory.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/InternationalizationPreferenceCommandFactory.java
new file mode 100644
index 00000000000..5e7dd422b96
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/InternationalizationPreferenceCommandFactory.java
@@ -0,0 +1,211 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.commands;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationAnnotationResourceUtils;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationPreferenceModel;
+import org.eclipse.papyrus.infra.internationalization.utils.InternationalizationPreferenceModelUtils;
+
+/**
+ * The internationalization preference command factory that allows to manage the
+ * legacy of the storage.
+ */
+public class InternationalizationPreferenceCommandFactory {
+
+ /**
+ * The model set.
+ */
+ private final ModelSet modelSet;
+
+ /**
+ * Constructor.
+ *
+ * @param modelSet
+ * The model set.
+ */
+ public InternationalizationPreferenceCommandFactory(final ModelSet modelSet) {
+ super();
+
+ this.modelSet = modelSet;
+ }
+
+ /**
+ * Creates a command that toggles whether the sash model is stored in the
+ * private workspace metadata area or in the shared {@code *.di} file.
+ *
+ * @return a toggle command for the private layout storage
+ */
+ public Command createTogglePrivateStorageCommand() {
+ Command result = UnexecutableCommand.INSTANCE;
+
+ final InternationalizationPreferenceModel internationalizationPrefModel = InternationalizationPreferenceModelUtils
+ .getInternationalizationPreferenceModel(modelSet);
+ if (null != internationalizationPrefModel) {
+ result = new AbstractToggleCommand("Toggle Private Editor Layout") { //$NON-NLS-1$
+
+ @Override
+ public void execute() {
+
+ final EAnnotation annotationToMove = InternationalizationAnnotationResourceUtils
+ .getInternationalizationAnnotation(internationalizationPrefModel.getResource());
+
+ // We don't record changes in the internationalization
+ // preference model for undo/redo,
+ // so we cannot assume that any changes to the current page
+ // selections are undoable in the usual way
+ if (!internationalizationPrefModel.isLegacyMode()) {
+ final Resource internationalizationPrefResource = annotationToMove.eResource();
+ final URI sharedURI = internationalizationPrefModel.getPrivateResourceURI();
+
+ // Move the contents into the notation model. If the
+ // notation resource isn't loaded, give up because
+ // something is seriously wrong in that case
+ final Resource notationResource = modelSet.getResource(sharedURI, false);
+ if (null != notationResource && notationResource.isLoaded()) {
+ moveContents(internationalizationPrefResource, notationResource, annotationToMove);
+
+ if (internationalizationPrefResource.getContents().isEmpty()) {
+ // Schedule deletion on save
+ modelSet.getResourcesToDeleteOnSave().add(internationalizationPrefResource.getURI());
+ }
+ }
+ } else {
+ Resource internationalizationPrefResource;
+ final URI privateURI = internationalizationPrefModel.getSharedResourceURI();
+
+ // Move the contents into the internationalization
+ // preference model. If the internationalization
+ // preference resource isn't loaded or doesn't exist, it
+ // will have to be handled
+ if (modelSet.getURIConverter().exists(privateURI, null)) {
+ internationalizationPrefResource = modelSet.getResource(privateURI, true);
+ } else {
+ internationalizationPrefResource = modelSet.createResource(privateURI);
+ }
+
+ // In case we had marked it for deletion, earlier
+ modelSet.getResourcesToDeleteOnSave().remove(privateURI);
+
+ final Resource notationResource = annotationToMove.eResource();
+ moveContents(notationResource, internationalizationPrefResource, annotationToMove);
+ }
+
+ // Re-load from the new resource. Snippets might find this
+ // odd, but it would be even more odd for there to be any
+ // snippets on this model
+ internationalizationPrefModel.loadModel(modelSet.getURIWithoutExtension());
+ }
+ };
+ }
+
+ return result;
+ }
+
+ /**
+ * Move the annotation from the first resource into the second one.
+ *
+ * @param fromResource
+ * The resource containing the annotation to move into the second
+ * resource.
+ * @param toResource
+ * The resource where move the annotation.
+ * @param annotation
+ * The annotation to move from first resource into the second
+ * one.
+ */
+ protected void moveContents(final Resource fromResource, final Resource toResource, final EAnnotation annotation) {
+ EObject toReplace = null;
+
+ final Collection<EObject> existingAnnotations = EcoreUtil.getObjectsByType(toResource.getContents(),
+ annotation.eClass());
+ if (null != existingAnnotations && existingAnnotations.isEmpty()) {
+ for (final EObject existingAnnotation : existingAnnotations) {
+ if (existingAnnotation instanceof EAnnotation && ((EAnnotation) existingAnnotation).getSource()
+ .equals(InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL)) {
+ toReplace = existingAnnotation;
+ }
+ }
+ }
+
+ if (null != toReplace) {
+ EcoreUtil.replace(toReplace, annotation);
+ } else {
+ toResource.getContents().add(annotation);
+ }
+ }
+
+ /**
+ * The command for the toggle action. We don't need recording command here
+ * because this is managed by properties API that will be wrapped as
+ * recording command.
+ */
+ private static abstract class AbstractToggleCommand extends AbstractCommand {
+
+ /**
+ * Constructor.
+ *
+ * @param label
+ * The label of the command.
+ */
+ public AbstractToggleCommand(final String label) {
+ super(label);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
+ */
+ @Override
+ protected boolean prepare() {
+ // Nothing to prepare
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#undo()
+ */
+ @Override
+ public void undo() {
+ // The command modified a boolean value so the undo will do the
+ // contrary of the previous command
+ execute();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ */
+ @Override
+ public void redo() {
+ execute();
+ }
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/ResetNameCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/ResetNameCommand.java
new file mode 100644
index 00000000000..246f8de4201
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/ResetNameCommand.java
@@ -0,0 +1,108 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.commands;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.EMFEditPlugin;
+import org.eclipse.emf.edit.command.AbstractOverrideableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+
+/**
+ * This allows to define a command to reset the feature value needed.
+ */
+public class ResetNameCommand extends AbstractOverrideableCommand {
+
+ /**
+ * The owner to modify.
+ */
+ private EObject owner;
+
+ /**
+ * The feature tu reset.
+ */
+ private EStructuralFeature feature;
+
+ /**
+ * This caches the label.
+ */
+ protected static final String LABEL = EMFEditPlugin.INSTANCE.getString("_UI_SetCommand_label");
+
+ /**
+ * This caches the description.
+ */
+ protected static final String DESCRIPTION = EMFEditPlugin.INSTANCE.getString("_UI_SetCommand_description");
+
+ /**
+ * Constructor.
+ *
+ * @param domain
+ * The current editing domain.
+ * @param owner
+ * The owner to modify.
+ * @param feature
+ * The feature to reset.
+ */
+ public ResetNameCommand(final EditingDomain domain, final EObject owner, final EStructuralFeature feature) {
+ super(domain, LABEL, DESCRIPTION);
+
+ this.owner = owner;
+ this.feature = feature;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
+ */
+ @Override
+ protected boolean prepare() {
+ return null != this.owner.eClass().getEStructuralFeature(feature.getFeatureID())
+ && null != this.owner.eGet(this.feature);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.AbstractOverrideableCommand#doExecute()
+ */
+ @Override
+ public void doExecute() {
+ final Object oldValue = this.owner.eGet(this.feature);
+ this.owner.eSet(feature, null);
+ this.owner.eSet(feature, oldValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.AbstractOverrideableCommand#doUndo()
+ */
+ @Override
+ public void doUndo() {
+ final Object oldValue = this.owner.eGet(this.feature);
+ this.owner.eSet(feature, null);
+ this.owner.eSet(feature, oldValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.command.AbstractOverrideableCommand#doRedo()
+ */
+ @Override
+ public void doRedo() {
+ doExecute();
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/ResetNameTransactionalCommand.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/ResetNameTransactionalCommand.java
new file mode 100644
index 00000000000..c473974144e
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/commands/ResetNameTransactionalCommand.java
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.EMFEditPlugin;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+
+/**
+ * This allows to define a command to reset the feature value needed.
+ */
+public class ResetNameTransactionalCommand extends AbstractTransactionalCommand {
+
+ /**
+ * The owner to modify.
+ */
+ private EObject owner;
+
+ /**
+ * The feature tu reset.
+ */
+ private EStructuralFeature feature;
+
+ /**
+ * This caches the label.
+ */
+ protected static final String LABEL = EMFEditPlugin.INSTANCE.getString("_UI_SetCommand_label");
+
+ /**
+ * Constructor.
+ *
+ * @param domain
+ * The current editing domain.
+ * @param owner
+ * The owner to modify.
+ * @param feature
+ * The feature to reset.
+ */
+ public ResetNameTransactionalCommand(final TransactionalEditingDomain domain, final EObject owner,
+ final EStructuralFeature feature) {
+ super(domain, LABEL, null);
+
+ this.owner = owner;
+ this.feature = feature;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.core.commands.operations.AbstractOperation#canExecute()
+ */
+ @Override
+ public boolean canExecute() {
+ return null != this.owner.eClass().getEStructuralFeature(feature.getFeatureID())
+ && null != this.owner.eGet(this.feature);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info)
+ throws ExecutionException {
+ final Object oldValue = this.owner.eGet(this.feature);
+ this.owner.eSet(feature, null);
+ this.owner.eSet(feature, oldValue);
+ return CommandResult.newOKCommandResult(this.owner);
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/AbstractInternationalizationPreferenceModelProvider.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/AbstractInternationalizationPreferenceModelProvider.java
new file mode 100644
index 00000000000..f733e324b07
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/AbstractInternationalizationPreferenceModelProvider.java
@@ -0,0 +1,78 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.modelresource;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.ISashModelProvider;
+
+/**
+ * A partial implementation of the {@link ISashModelProvider} protocol.
+ */
+public abstract class AbstractInternationalizationPreferenceModelProvider
+ implements IInternationalizationPreferenceModelProvider {
+
+ /**
+ * The model set managed.
+ */
+ private ModelSet modelSet;
+
+ /**
+ * Constructor.
+ */
+ public AbstractInternationalizationPreferenceModelProvider() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.internationalization.modelresource.IInternationalizationPreferenceModelProvider#initialize(org.eclipse.papyrus.infra.core.resource.ModelSet)
+ */
+ @Override
+ public void initialize(final ModelSet modelSet) {
+ this.modelSet = modelSet;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.internationalization.modelresource.IInternationalizationPreferenceModelProvider#dispose()
+ */
+ @Override
+ public void dispose() {
+ modelSet = null;
+ }
+
+ /**
+ * Get the model set.
+ *
+ * @return The model set.
+ */
+ protected ModelSet getModelSet() {
+ return modelSet;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.internationalization.modelresource.IInternationalizationPreferenceModelProvider#loadInternationalizationPreferenceModel(org.eclipse.emf.common.util.URI)
+ */
+ @Override
+ public Resource loadInternationalizationPreferenceModel(final URI internationalizationPrefModelURI) {
+ return modelSet.getResource(internationalizationPrefModelURI, true);
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/IInternationalizationPreferenceModelProvider.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/IInternationalizationPreferenceModelProvider.java
new file mode 100644
index 00000000000..7d70008b620
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/IInternationalizationPreferenceModelProvider.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.modelresource;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+
+/**
+ * This is the IInternationalizationPreferenceModelProvider type.
+ */
+public interface IInternationalizationPreferenceModelProvider {
+
+ /**
+ * Get the internationalization preference model URI from the user model
+ * URI.
+ *
+ * @param userModelURI
+ * The initial user model URI.
+ * @return The internationalization preference model URI.
+ */
+ public URI getInternationalizationPreferenceModelURI(final URI userModelURI);
+
+ /**
+ * This allows to initialize the model provider.
+ *
+ * @param modelSet
+ * The current model set.
+ */
+ public void initialize(final ModelSet modelSet);
+
+ /**
+ * This allows to load the internationalization preference model.
+ *
+ * @param internationalizationPrefModelURI
+ * The internationalization preference model URI.
+ * @return The loaded resource.
+ */
+ public Resource loadInternationalizationPreferenceModel(final URI internationalizationPrefModelURI);
+
+ /**
+ * This allows to manage the dispose of the model provider.
+ */
+ public void dispose();
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java
new file mode 100644
index 00000000000..1158f1e67f0
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationModelResource.java
@@ -0,0 +1,1494 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.modelresource;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+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.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.emf.commands.AddToResourceCommand;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.internationalization.Activator;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationFactory;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationLibrary;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage;
+import org.eclipse.papyrus.infra.internationalization.commands.ResetNameCommand;
+import org.eclipse.papyrus.infra.internationalization.commands.ResetNameTransactionalCommand;
+import org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.internationalization.common.utils.LocaleNameResolver;
+import org.eclipse.papyrus.infra.internationalization.utils.EntryPartLabelSynchronizer;
+import org.eclipse.papyrus.infra.internationalization.utils.PreferencePartLabelSynchronizer;
+import org.eclipse.papyrus.infra.internationalization.utils.PropertiesFilesUtils;
+import org.eclipse.papyrus.infra.internationalization.utils.QualifiedNameUtils;
+import org.eclipse.papyrus.infra.internationalization.utils.ResourceBundleAndURI;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableconfiguration.NattableconfigurationPackage;
+
+/**
+ * This allows to manage the internationalization resource.
+ */
+public class InternationalizationModelResource extends AbstractModelWithSharedResource<InternationalizationLibrary>
+ implements IModel {
+
+ /**
+ * Model ID.
+ */
+ public static final String MODEL_ID = "org.eclipse.papyrus.infra.internationalization.resource.InternationalizationModel"; //$NON-NLS-1$
+
+ /**
+ * The '_labelDiagram_' prefix of each diagram entry.
+ */
+ protected static final String LABEL_DIAGRAM_PREFIX_QN = "_labelDiagram_"; //$NON-NLS-1$
+
+ /**
+ * The '_labelTable_' prefix of each table entry.
+ */
+ protected static final String LABEL_TABLE_PREFIX_QN = "_labelTable_"; //$NON-NLS-1$
+
+ /**
+ * The '_label_' prefix of each entry.
+ */
+ public static final String LABEL_PREFIX = "_label_"; //$NON-NLS-1$
+
+ /**
+ * The notation extension file (cannot use the
+ * NotationModel.NOTATION_FILE_EXTENSION because of dependencies cycle).
+ */
+ protected static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
+
+ /**
+ * The map of the loaded resource by the initial URI and by locale.
+ */
+ protected Map<URI, Map<Locale, Resource>> propertiesByLocale = null;
+
+ /**
+ * Set to keep deleted objects. Those ones must be ignored at the
+ * {{@link #saveModel()} to avoid exceptions.
+ *
+ * The delete of objects does not remove the entries corresponding because
+ * at the undo, the internationalization values must be not retrieve.
+ */
+ protected Set<EObject> deletedObjects = null;
+
+ /**
+ * The adapter for the object (to avoid multiple creation for the same
+ * object).
+ */
+ protected Map<EObject, Adapter> adapters = null;
+
+ /**
+ * This map allows to keep the editor part for an EObject when it is needed
+ * to create the InternationalizationEntry and finally the
+ * PartLabelSynchronizer.
+ */
+ protected Map<EObject, IInternationalizationEditor> editorPartByEObject = null;
+
+ /**
+ * Save of the created PartLabelSynchronizer to manage the dispose of those
+ * ones.
+ */
+ protected Map<EObject, Map<InternationalizationEntry, EntryPartLabelSynchronizer>> entriesLabelSynchronizerByEObject = null;
+
+ /**
+ * Save the preference part label synchronizer corresponding to the object
+ * of editor part.
+ */
+ protected Map<EObject, PreferencePartLabelSynchronizer> preferencePartLabelSynchronizers = null;
+
+ /**
+ * Constructor.
+ */
+ public InternationalizationModelResource() {
+ super();
+ propertiesByLocale = new HashMap<URI, Map<Locale, Resource>>();
+
+ Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
+
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getProperty().equals(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE)) {
+ Iterator<Resource> resourcesIterator = new HashSet<Resource>(getResources()).iterator();
+ while (resourcesIterator.hasNext()) {
+ final Resource resource = resourcesIterator.next();
+ loadModel(getInitialURIForResource(resource).trimFileExtension());
+ }
+ }
+ }
+
+ });
+ deletedObjects = new HashSet<EObject>();
+ adapters = new HashMap<EObject, Adapter>();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#loadModel(org.eclipse.emf.common.util.URI)
+ */
+ @Override
+ public void loadModel(final URI uriWithoutExtension) {
+ loadModel(uriWithoutExtension, true);
+ }
+
+ /**
+ * Attach the model to its resource if this is not already done.
+ *
+ * @param uriWithoutExtension
+ * The uri of the resource to manage.
+ * @param needToLoadOtherProperties
+ * Boolean to determinate if the other properties in the project
+ * have to bo loaded or not.
+ */
+ public void loadModel(final URI uriWithoutExtension, final boolean needToLoadOtherProperties) {
+ // Compute model URI
+ final URI uri = uriWithoutExtension.appendFileExtension(getModelFileExtension());
+
+ if (needToBeLoaded(uri)) {
+
+ resourceURI = uri;
+
+ final Locale locale = InternationalizationPreferencesUtils.getLocalePreference(uriWithoutExtension);
+
+ try {
+
+ resource = loadResource(uri, locale);
+
+ // We need to do even if the resource is null
+ if (needToLoadOtherProperties) {
+ resourceURI = uri;
+
+ String existingResourceLoadedName = "";
+ if (null != resource) {
+ existingResourceLoadedName = resource.getURI().lastSegment();
+ }
+
+ // We need to load other properties files in the same
+ // folders
+ loadOthersPropertiesFiles(uri, existingResourceLoadedName);
+ }
+
+ } catch (final Exception ex) {
+ Activator.log.error(ex);
+ }
+ }
+ }
+
+ /**
+ * This allows to define if the uri file was already loaded.
+ *
+ * @param uri
+ * The uri of the file to load.
+ * @return <code>true</code> if the file was already loaded.
+ * <code>false</code> otherwise.
+ */
+ protected boolean needToBeLoaded(final URI uri) {
+ return !propertiesByLocale.containsKey(uri);
+ }
+
+ /**
+ * This allows to add the resource in parameter in the model resources.
+ *
+ * @param uri
+ * The uri of the resource.
+ * @param resource
+ * The resource to add.
+ * @param locale
+ * The locale to use.
+ */
+ public void addResourceToModel(final URI uri, final Resource resource, final Locale locale) {
+ resourceURI = uri.trimFileExtension().appendFileExtension(getModelFileExtension());
+ configureResource(resource, locale);
+ }
+
+ /**
+ * This allows to load others properties files in the project.
+ *
+ * @param uri
+ * The {@link URI}.
+ * @param loadedResourceFile
+ * The properties file already loaded.
+ */
+ protected void loadOthersPropertiesFiles(final URI uri, final String loadedResourceFile) {
+ final URI uriWithoutExtension = uri.trimFileExtension();
+ final String modelName = uriWithoutExtension.segment(uriWithoutExtension.segmentCount() - 1);
+ final URI folderURI = uriWithoutExtension.trimSegments(1);
+
+ // Calculate the project folder
+ IProject projectFolder = null;
+ if (folderURI.isPlatformResource()) {
+ final String uriPlatformString = folderURI.toPlatformString(true);
+ projectFolder = ResourcesPlugin.getWorkspace().getRoot().getProject(uriPlatformString.substring(1));
+ }
+
+ if (null != projectFolder) {
+ final String extension = "." + getModelFileExtension(); //$NON-NLS-1$
+ try {
+ // Loop on project resources to check about other properties
+ // file
+ for (final IResource resourceEntry : projectFolder.members()) {
+ // Check if the file starts with the name of the model and
+ // finish with properties
+ if (resourceEntry.getName().startsWith(modelName) && resourceEntry.getName().endsWith(extension)) { // $NON-NLS-1$
+
+ // Remove the extension of the file
+ final String fileNAmeWithoutExtension = resourceEntry.getName().substring(0,
+ resourceEntry.getName().length() - extension.length());
+ // Remove the model name
+ String possibleLocale = fileNAmeWithoutExtension.substring(modelName.length());
+
+ // Check this is not the current loaded file of locale
+ if (!resourceEntry.getName().equals(loadedResourceFile) || possibleLocale.isEmpty()) {
+
+ // This is modelName.properties
+ if (possibleLocale.isEmpty() && null == getResourceForURIAndLocale(uri, new Locale(""))) { //$NON-NLS-1$
+ final URI newURI = folderURI.appendSegment(fileNAmeWithoutExtension)
+ .appendFileExtension(getModelFileExtension());
+ loadResource(newURI, new Locale("")); //$NON-NLS-1$
+ // This can be a possible properties locale file
+ } else if (possibleLocale.startsWith(LocaleNameResolver.UNDERSCORE)) { // $NON-NLS-1$
+ possibleLocale = possibleLocale.substring(1);
+ Locale localeFound = null;
+
+ // Check about possible locale in available
+ // locales
+ final Iterator<Locale> availableLocales = Arrays.asList(Locale.getAvailableLocales())
+ .iterator();
+ while (availableLocales.hasNext() && null == localeFound) {
+ final Locale currentAvailableLocale = availableLocales.next();
+
+ if (currentAvailableLocale.toString().equals(possibleLocale)) {
+ localeFound = currentAvailableLocale;
+ }
+ }
+
+ // The file contains a locale, load it
+ if (null != localeFound) {
+ loadResource(uri, localeFound);
+ }
+ }
+
+ }
+ }
+ }
+ } catch (final CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ /**
+ * This method allows to load the resource (or create it if necessary) and
+ * load the internationalization content.
+ *
+ * @param uri
+ * The {@link URI}.
+ * @param locale
+ * The current locale to use.
+ * @return The resource loaded.
+ */
+ protected Resource loadResource(final URI uri, final Locale locale) {
+ Resource resource = null;
+
+ final ResourceBundleAndURI resourceBundleAndURI = PropertiesFilesUtils.getResourceBundle(uri, locale);
+ if (null != resourceBundleAndURI) {
+
+ // Look for the resource
+ resource = getResourceSet().getResource(resourceBundleAndURI.getUri(), false);
+
+ // Check if model is loaded.
+ if (null != resource) {
+ configureResource(resource, locale);
+ } else {
+ // model is not loaded, do it.
+ // Create Resource of appropriate type
+ resource = modelSet.createResource(resourceBundleAndURI.getUri());
+
+ configureResource(resource, locale);
+
+ // call registered snippets
+ startSnippets();
+ }
+
+ loadInternationalizationContent(uri, locale);
+ }
+
+ return resource;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#createModel(org.eclipse.emf.common.util.URI)
+ */
+ @Override
+ public void createModel(final URI uriWithoutExtension) {
+ super.createModel(uriWithoutExtension);
+
+ final URI uri = uriWithoutExtension.appendFileExtension(getModelFileExtension());
+ final Locale locale = InternationalizationPreferencesUtils.getLocalePreference(this.resource.getURI());
+ final Resource resource = this.resource;
+
+ // Fill the properties by locale map
+ if (null == propertiesByLocale.get(resourceURI)) {
+ propertiesByLocale.put(resourceURI, new HashMap<Locale, Resource>());
+ }
+ propertiesByLocale.get(resourceURI).put(locale, resource);
+
+ // Calculate the internationalization content
+ loadInternationalizationContent(uri, locale);
+
+ resource.setModified(true);
+
+ try {
+ saveResource(resource);
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ /**
+ * This allows to configure the resource.
+ *
+ * @param resourceToConfigure
+ * The resource to configure.
+ * @param locale
+ * The locale to manage.
+ */
+ protected void configureResource(final Resource resourceToConfigure, final Locale locale) {
+ super.configureResource(resourceToConfigure);
+ // Add the resource to the resource properties classified by their
+ // locale
+ if (null == propertiesByLocale.get(resourceURI)) {
+ propertiesByLocale.put(resourceURI, new HashMap<Locale, Resource>());
+ }
+ propertiesByLocale.get(resourceURI).put(locale, resourceToConfigure);
+ }
+
+ /**
+ * This allows to load internationalization content of properties file into
+ * the current resource.
+ *
+ * @param uri
+ * The URI of the properties file with the extension.
+ * @param locale
+ * The locale to use.
+ */
+ protected void loadInternationalizationContent(final URI uri, final Locale locale) {
+ final Resource resource = getResourceForURIAndLocale(uri, locale);
+
+ if (null != resource && resource.getContents().isEmpty()) {
+ final ResourceBundleAndURI resourceBundleAndURI = PropertiesFilesUtils
+ .getResourceBundle(uri.trimFileExtension().appendFileExtension(getModelFileExtension()), locale);
+ if (null != resourceBundleAndURI && null != resourceBundleAndURI.getResourceBundle()) {
+ // Create the internationalization library to set to the
+ // resource contents
+ final InternationalizationLibrary library = InternationalizationFactory.eINSTANCE
+ .createInternationalizationLibrary();
+ final Enumeration<String> keys = resourceBundleAndURI.getResourceBundle().getKeys();
+
+ // Loop on existing keys
+ while (keys.hasMoreElements()) {
+ // Create an entry for each key
+ final InternationalizationEntry entry = InternationalizationFactory.eINSTANCE
+ .createInternationalizationEntry();
+ String key = (String) keys.nextElement();
+ if (key.startsWith(LABEL_DIAGRAM_PREFIX_QN)) {
+ final String keyWithoutPrefix = key.substring(LABEL_DIAGRAM_PREFIX_QN.length());
+ final String qualifiedName = keyWithoutPrefix.substring(0,
+ keyWithoutPrefix.indexOf(LABEL_PREFIX));
+ final String diagramName = keyWithoutPrefix
+ .substring(keyWithoutPrefix.indexOf(LABEL_PREFIX) + LABEL_PREFIX.length());
+
+ final Resource notationResource = modelSet.getResource(
+ uri.trimFileExtension().appendFileExtension(NOTATION_FILE_EXTENSION), true);
+
+ if (null != notationResource && null != notationResource.getContents()
+ && !notationResource.getContents().isEmpty()) {
+ final Diagram foundDiagram = QualifiedNameUtils.getDiagram(notationResource, diagramName,
+ qualifiedName);
+ entry.setKey(foundDiagram);
+ addModifiedAdapter(foundDiagram, resource);
+ }
+
+ } else if (key.startsWith(LABEL_TABLE_PREFIX_QN)) {
+ final String keyWithoutPrefix = key.substring(LABEL_TABLE_PREFIX_QN.length());
+ final String qualifiedName = keyWithoutPrefix.substring(0,
+ keyWithoutPrefix.indexOf(LABEL_PREFIX));
+ final String tableName = keyWithoutPrefix
+ .substring(keyWithoutPrefix.indexOf(LABEL_PREFIX) + LABEL_PREFIX.length());
+
+ final Resource umlResource = modelSet.getResource(
+ uri.trimFileExtension().appendFileExtension(NOTATION_FILE_EXTENSION), true);
+
+ if (null != umlResource && null != umlResource.getContents()
+ && !umlResource.getContents().isEmpty()) {
+ final Table foundTable = QualifiedNameUtils.getTable(umlResource, tableName, qualifiedName);
+ entry.setKey(foundTable);
+ addModifiedAdapter(foundTable, resource);
+ }
+ } else {
+ entry.setKey(key);
+ }
+ entry.setValue(resourceBundleAndURI.getResourceBundle().getString(key));
+ // Add the entry to the library
+ library.getEntries().add(entry);
+ }
+
+ final GMFtoEMFCommandWrapper command = new GMFtoEMFCommandWrapper(new AddToResourceCommand(
+ ((ModelSet) resource.getResourceSet()).getTransactionalEditingDomain(), resource, library));
+ command.execute();
+ }
+ resource.setModified(false);
+ }
+ }
+
+ /**
+ * This allows to create the properties resource corresponding to the uri in
+ * parameter.
+ *
+ * @param uri
+ * The URI of the properties resource to create.
+ * @param locale
+ * The locale to manage.
+ * @return The created resource.
+ */
+ protected Resource createResource(final URI uri, final Locale locale) {
+ // The properties uri (cast the file extension to the needed one)
+ URI propertiesURI = uri.trimFileExtension().appendFileExtension(getModelFileExtension());
+ resourceURI = propertiesURI;
+
+ // The created properties resource need to have the locale in last
+ // segment (example: test_en_EN.properties)
+ String lastSegment = propertiesURI.trimFileExtension().lastSegment();
+ lastSegment = lastSegment + LocaleNameResolver.UNDERSCORE + locale.toString();
+ propertiesURI = propertiesURI.trimSegments(1);
+ propertiesURI = propertiesURI.appendSegment(lastSegment);
+ propertiesURI = propertiesURI.appendFileExtension(getModelFileExtension());
+
+ // Create the resource needed
+ final Resource resultResource = modelSet.createResource(propertiesURI);
+ configureResource(resultResource, locale);
+
+ // Create the internationalization library in the resource content
+ createInternationalizationContent(resultResource);
+
+ // call registered snippets
+ startSnippets();
+
+ resource = resultResource;
+
+ return resultResource;
+ }
+
+ /**
+ * This allows to create the internationalization library for the resource
+ * content.
+ *
+ * @param resource
+ * The resource where add the internationalization library.
+ */
+ protected void createInternationalizationContent(final Resource resource) {
+ if (null != resource) {
+ // Create the library
+ final InternationalizationLibrary library = InternationalizationFactory.eINSTANCE
+ .createInternationalizationLibrary();
+
+ // Create the resource content command and execute it
+ final GMFtoEMFCommandWrapper command = new GMFtoEMFCommandWrapper(new AddToResourceCommand(
+ ((ModelSet) resource.getResourceSet()).getTransactionalEditingDomain(), resource, library));
+ command.execute();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#saveModel()
+ */
+ @Override
+ public void saveModel() throws IOException {
+ // Save into the properties files
+
+ for (final Resource resource : getResources()) {
+ saveResource(resource);
+ }
+ }
+
+ /**
+ * This allows to save the resource.
+ *
+ * @param resource
+ * The resource to save.
+ * @throws IOException
+ * The input output file exception.
+ */
+ protected void saveResource(final Resource resource) throws IOException {
+ final ModelSet set = getModelManager();
+ if (null != resource && set.shouldSave(resource) && !resource.getContents().isEmpty()) {
+ // It is needed to manage the save of properties by a simple output
+ // stream because the resource bundle cannot be modified
+ final Properties properties = new Properties();
+
+ final InternationalizationLibrary library = (InternationalizationLibrary) resource.getContents().get(0);
+
+ // Add all the entries into properties (need this properties to save
+ // easier the properties file)
+ for (final InternationalizationEntry entry : library.getEntries()) {
+ if (!deletedObjects.contains(entry.getKey()) && !entry.getValue().isEmpty()) {
+ properties.setProperty(getKey(entry), entry.getValue());
+ }
+ }
+
+ final Locale locale = getLocaleForResource(resource);
+
+ // Get the URI of properties file used (with locale or not)
+ final URI resourceURI = PropertiesFilesUtils.getResourceBundleURIFromResourceURI(resource.getURI(), locale);
+
+ // This allows to save the properties into the properties file
+ final URIConverter uriConverter = new ExtensibleURIConverterImpl();
+ properties.store(uriConverter.createOutputStream(resourceURI), null);
+ resource.setModified(false);
+ }
+ }
+
+ /**
+ * This allows to add an adapter to the EOBject to modified the properties
+ * resource when the EObject has changed.
+ *
+ * @param eObject
+ * The EObject.
+ * @param resource
+ * The associated resource.
+ */
+ protected void addModifiedAdapter(final EObject eObject, final Resource resource) {
+ if (!adapters.containsKey(eObject)) {
+ Adapter modifiedAdapter = new Adapter() {
+
+ @Override
+ public void setTarget(final Notifier newTarget) {
+ // Do nothing
+ }
+
+ @Override
+ public void notifyChanged(final Notification notification) {
+ // If this is a remove, add the old value to the deleted
+ // objects
+ if (Notification.REMOVE == notification.getEventType()
+ || Notification.REMOVE_MANY == notification.getEventType()) {
+ Object oldValue = notification.getOldValue();
+
+ if (oldValue instanceof EObject) {
+ deletedObjects.add((EObject) oldValue);
+ }
+ // If this is an add, remove the new value from the
+ // deleted objects if existing
+ } else if (Notification.ADD == notification.getEventType()
+ || Notification.ADD_MANY == notification.getEventType()) {
+ Object newValue = notification.getNewValue();
+
+ if (newValue instanceof EObject && deletedObjects.contains(newValue)) {
+ deletedObjects.remove((EObject) newValue);
+ }
+ }
+
+ // The resource is modified (not directly but need to be
+ // saved)
+ if (null != eObject.eResource()
+ && null != getLocalesAndResourcesForURI(eObject.eResource().getURI())) {
+ for (final Resource res : getLocalesAndResourcesForURI(eObject.eResource().getURI()).values()) {
+ res.setModified(true);
+ }
+ } else {
+ resource.setModified(true);
+ }
+ }
+
+ @Override
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ @Override
+ public Notifier getTarget() {
+ return null;
+ }
+ };
+ eObject.eAdapters().add(modifiedAdapter);
+ adapters.put(eObject, modifiedAdapter);
+ }
+ }
+
+ /**
+ * This allows to get the entry key (can be override to get element string
+ * identifier instead of string key).
+ *
+ * @param entry
+ * The internationalization entry.
+ * @return The key as String.
+ */
+ protected String getKey(final InternationalizationEntry entry) {
+ final StringBuilder result = new StringBuilder();
+ if (entry.getKey() instanceof Diagram) {
+ result.append(LABEL_DIAGRAM_PREFIX_QN);
+ final Diagram diagram = (Diagram) entry.getKey();
+ final EObject diagramContainer = diagram.getElement();
+ result.append(QualifiedNameUtils.getQualifiedName(diagramContainer));
+ result.append(LABEL_PREFIX);
+ result.append(diagram.getName());
+ } else if (entry.getKey() instanceof Table) {
+ result.append(LABEL_TABLE_PREFIX_QN);
+ final Table table = (Table) entry.getKey();
+ final EObject tableContainer = table.getOwner();
+ result.append(QualifiedNameUtils.getQualifiedName(tableContainer));
+ result.append(LABEL_PREFIX);
+ result.append(table.getName());
+ } else {
+ result.append((String) entry.getKey());
+ }
+ return result.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ protected boolean isModelRoot(final EObject object) {
+ return object instanceof InternationalizationLibrary;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
+ */
+ @Override
+ public String getModelFileExtension() {
+ return PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION;
+ }
+
+ /**
+ * Open this method. {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModel#getModelManager()
+ */
+ @Override
+ public ModelSet getModelManager() {
+ return super.getModelManager();
+ }
+
+ /**
+ * Open this method. {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.EMFLogicalModel#isRelatedResource(org.eclipse.emf.ecore.resource.Resource)
+ */
+ @Override
+ public boolean isRelatedResource(final Resource resource) {
+ return super.isRelatedResource(resource);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModel#getIdentifier()
+ */
+ @Override
+ public String getIdentifier() {
+ return MODEL_ID;
+ }
+
+ /**
+ * Get the value for the key in parameter.
+ *
+ * @param uri
+ * The uri of the resource where search the key.
+ * @param key
+ * The key to search.
+ * @param locale
+ * The locale of which to get value.
+ * @return The value of the key.
+ */
+ public String getValueForEntryKey(final URI uri, final Object key, final Locale locale) {
+ InternationalizationEntry entry = getEntryForKey(uri, key, locale);
+ return null != entry ? entry.getValue() : null;
+ }
+
+ /**
+ * Get the value for the key in parameter.
+ *
+ * @param uri
+ * The uri of the resource where search the key.
+ * @param key
+ * The key to search.
+ * @return The value of the key.
+ */
+ public String getValueForEntryKey(final URI uri, final EObject key) {
+ InternationalizationEntry entry = getEntryForKey(uri, key,
+ InternationalizationPreferencesUtils.getLocalePreference(key));
+ return null != entry ? entry.getValue() : null;
+ }
+
+ /**
+ * Get the entry for the key in parameter.
+ *
+ * @param uri
+ * The uri of the resource where search the key.
+ * @param key
+ * The key to search.
+ * @param locale
+ * The locale of which to get value.
+ * @return The entry of the key.
+ */
+ public InternationalizationEntry getEntryForKey(final URI uri, final Object key, final Locale locale) {
+ InternationalizationEntry result = null;
+
+ Resource resource = getResourceForURIAndLocale(uri, locale);
+
+ // If the resource for the locale is not found, search for a properties
+ // without locale
+ if (null == resource) {
+ resource = getResourceForURIAndLocale(uri, new Locale("")); //$NON-NLS-1$
+ }
+
+ if (null != resource) {
+ final InternationalizationLibrary library = getModelRoot(resource);
+
+ if (null != library) {
+ final Iterator<InternationalizationEntry> entries = library.getEntries().iterator();
+
+ // Iterate on entries to get the value of the key in parameter
+ while (entries.hasNext() && null == result) {
+ final InternationalizationEntry entry = entries.next();
+ if (entry.getKey().equals(key)) {
+ result = entry;
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * This allows to get the command to set internationalization value.
+ *
+ * @param domain
+ * The current editing domain.
+ * @param uri
+ * The uri of the resource where search the key.
+ * @param key
+ * The key to search.
+ * @param value
+ * The new value.
+ * @param locale
+ * The locale for which to set the value.
+ * @return The command to set the internationalization value.
+ */
+ public Command getSetValueCommand(final EditingDomain domain, final URI uri, final EObject key, final String value,
+ final Locale locale) {
+ Command resultCommand = null;
+
+ // Get the resource where add/modify the entry corresponding to the key
+ final Resource resource = getResourceForURIAndLocale(uri, locale);
+ final InternationalizationLibrary library = getModelRoot(resource);
+
+ if (null != library) {
+ final Iterator<InternationalizationEntry> entries = library.getEntries().iterator();
+
+ // Search on existing entries if the key already exists.
+ // In this case, just modify the value
+ while (entries.hasNext() && null == resultCommand) {
+ final InternationalizationEntry entry = entries.next();
+ if (entry.getKey().equals(key)) {
+ if (null == value || value.isEmpty()) {
+ // If the value is null or empty, remove the entry
+ resultCommand = new CompoundCommand("Remove entry"); //$NON-NLS-1$
+ ((CompoundCommand) resultCommand).append(new RemoveCommand(domain, library,
+ InternationalizationPackage.eINSTANCE.getInternationalizationLibrary_Entries(), entry));
+ if (entry.getKey() instanceof EObject) {
+ Command setNameValueCommand = getSetNameValueCommand(domain, (EObject) entry.getKey());
+ if (null != setNameValueCommand) {
+ ((CompoundCommand) resultCommand).append(setNameValueCommand);
+ }
+ }
+ resource.setModified(true);
+ } else {
+ resultCommand = new CompoundCommand("Set entry value"); //$NON-NLS-1$
+ ((CompoundCommand) resultCommand).append(new SetCommand(domain, entry,
+ InternationalizationPackage.eINSTANCE.getInternationalizationEntry_Value(), value));
+ if (entry.getKey() instanceof EObject) {
+ Command setNameValueCommand = getSetNameValueCommand(domain, (EObject) entry.getKey());
+ if (null != setNameValueCommand) {
+ ((CompoundCommand) resultCommand).append(setNameValueCommand);
+ }
+ }
+ resource.setModified(true);
+ }
+ }
+ }
+ }
+
+ // If the key does not exist, create an entry
+ if (null == resultCommand) {
+ final InternationalizationEntry entry = InternationalizationFactory.eINSTANCE
+ .createInternationalizationEntry();
+ entry.setKey(key);
+ entry.setValue(value);
+
+ if (null == resource) {
+ // If the resource does not exist, create it and add entry to
+ // the library
+ resultCommand = new CompoundCommand("Create entry"); //$NON-NLS-1$
+ ((CompoundCommand) resultCommand).append(new CreatePropertiesResourceCommand(uri, entry,
+ InternationalizationPreferencesUtils.getLocalePreference(key)));
+ Command setNameValueCommand = getSetNameValueCommand(domain, (EObject) entry.getKey());
+ if (null != setNameValueCommand) {
+ ((CompoundCommand) resultCommand).append(setNameValueCommand);
+ }
+ } else {
+ resultCommand = new CompoundCommand("Create entry"); //$NON-NLS-1$
+ ((CompoundCommand) resultCommand).append(new AddCommand(domain, library,
+ InternationalizationPackage.eINSTANCE.getInternationalizationLibrary_Entries(), entry));
+ Command setNameValueCommand = getSetNameValueCommand(domain, (EObject) entry.getKey());
+ if (null != setNameValueCommand) {
+ ((CompoundCommand) resultCommand).append(setNameValueCommand);
+ }
+ resource.setModified(true);
+ }
+
+ // If the created entry is an entry corresponding to an object who's
+ // depending to Editor part, we need to create the
+ // PartLabelSynchronizer
+ if (null != editorPartByEObject && editorPartByEObject.containsKey(key)) {
+ if (null != resultCommand) {
+ final Command tmpCommand = resultCommand;
+ resultCommand = new CompoundCommand("Change label value"); //$NON-NLS-1$
+ ((CompoundCommand) resultCommand).append(tmpCommand);
+ ((CompoundCommand) resultCommand).append(new AbstractCommand() {
+
+ @Override
+ public void execute() {
+ addPartLabelSynchronizerForEntry(key, entry);
+ }
+
+ @Override
+ protected boolean prepare() {
+ return true;
+ }
+
+ @Override
+ public void undo() {
+ // Do nothing
+ }
+
+ @Override
+ public void redo() {
+ // Do nothing
+ }
+ });
+ }
+ }
+ }
+
+ return resultCommand;
+ }
+
+ /**
+ * This allows to add or update value of property with key in parameter.
+ *
+ * @param uri
+ * The uri of the resource where search the key.
+ * @param key
+ * The key to search.
+ * @param value
+ * The new value.
+ * @param locale
+ * The locale for which set the value.
+ */
+ public void setValue(final URI uri, final EObject key, final String value, final Locale locale) {
+
+ // Get the resource where add/modify the entry corresponding to the key
+ Resource resource = getResourceForURIAndLocale(uri, locale);
+ if (null == resource) {
+ // If the resource does not exist, create it
+ resource = createResource(uri, InternationalizationPreferencesUtils.getLocalePreference(key));
+ }
+
+ final InternationalizationLibrary library = getModelRoot(resource);
+
+ final Iterator<InternationalizationEntry> entries = library.getEntries().iterator();
+ boolean hasFound = false;
+
+ // Search on existing entries if the key already exists.
+ // In this case, just modify the value
+ while (entries.hasNext() && !hasFound) {
+ final InternationalizationEntry entry = entries.next();
+ if (entry.getKey().equals(key)) {
+ if (null == value || value.isEmpty()) {
+ // If the value is null or empty, remove the entry
+ entries.remove();
+ } else {
+ entry.setValue(value);
+ if (entry.getKey() instanceof EObject) {
+ setNameValue((EObject) entry.getKey());
+ }
+ }
+ hasFound = true;
+ }
+ }
+
+ // If the key does not exist, create an entry
+ if (!hasFound) {
+ final InternationalizationEntry entry = InternationalizationFactory.eINSTANCE
+ .createInternationalizationEntry();
+ entry.setKey(key);
+ entry.setValue(value);
+ library.getEntries().add(entry);
+ setNameValue(entry);
+
+ // If the created entry is an entry corresponding to an object who's
+ // depending to Editor part, we need to create the
+ // PartLabelSynchronizer
+ if (editorPartByEObject.containsKey(key)) {
+ addPartLabelSynchronizerForEntry(key, entry);
+ }
+ }
+ resource.setModified(true);
+ }
+
+ /**
+ * This allows to modify the name of the entry object when the label value
+ * is modified to notify all the name listeners. When the label change, all
+ * the name listeners need to be called.
+ *
+ * @param domain
+ * The current editing domain.
+ * @param eObject
+ * The eObject of the label to modify.
+ * @return The command modifying the name value.
+ */
+ protected Command getSetNameValueCommand(final EditingDomain domain, final EObject eObject) {
+ Command result = null;
+
+ // Change name for diagram
+ if (domain instanceof TransactionalEditingDomain) {
+ if (eObject instanceof Diagram) {
+ result = new GMFtoEMFCommandWrapper(new ResetNameTransactionalCommand(
+ (TransactionalEditingDomain) domain, eObject, NotationPackage.eINSTANCE.getDiagram_Name()));
+
+ // Change name for table
+ } else if (eObject instanceof Table) {
+ result = new GMFtoEMFCommandWrapper(
+ new ResetNameTransactionalCommand((TransactionalEditingDomain) domain, eObject,
+ NattableconfigurationPackage.eINSTANCE.getTableNamedElement_Name()));
+ }
+ } else {
+ if (eObject instanceof Diagram) {
+ result = new ResetNameCommand(domain, eObject, NotationPackage.eINSTANCE.getDiagram_Name());
+
+ // Change name for table
+ } else if (eObject instanceof Table) {
+ result = new ResetNameCommand(domain, eObject,
+ NattableconfigurationPackage.eINSTANCE.getTableNamedElement_Name());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * This allows to modify the name of the entry object when the label value
+ * is modified to notify all the name listeners. When the label change, all
+ * the name listeners need to be called.
+ *
+ * @param eObject
+ * The eObject of the label to modify.
+ */
+ protected void setNameValue(final EObject eObject) {
+
+ // Change name for diagram
+ if (eObject instanceof Diagram) {
+ final String oldName = ((Diagram) eObject).getName();
+ ((Diagram) eObject).setName(""); //$NON-NLS-1$
+ ((Diagram) eObject).setName(oldName);
+
+ // Change name for table
+ } else if (eObject instanceof Table) {
+ final String oldName = ((Table) eObject).getName();
+ ((Table) eObject).setName(""); //$NON-NLS-1$
+ ((Table) eObject).setName(oldName);
+ }
+ }
+
+ /**
+ * Get the root of this model. Lookup in the associated {@link Resource} for
+ * the root.
+ *
+ * @param resource
+ * The resource to search.
+ * @return The root of the model, or null if no root exist.
+ */
+ public InternationalizationLibrary getModelRoot(final Resource resource) {
+ if (null != resource) {
+ for (final EObject object : resource.getContents()) {
+
+ if (isModelRoot(object)) {
+ return (InternationalizationLibrary) object;
+ }
+ }
+ }
+
+ // Not found
+ return null;
+ }
+
+ /**
+ * This allows to determinate the properties locales files loaded for the
+ * uri.
+ *
+ * @param uri
+ * The [{@link URI} to search.
+ * @return The set of the locales.
+ */
+ public Set<Locale> getAvailablePropertiesLocales(final URI uri) {
+ final URI uriWithCorrectExtension = uri.trimFileExtension().appendFileExtension(getModelFileExtension());
+ return propertiesByLocale.containsKey(uriWithCorrectExtension)
+ ? propertiesByLocale.get(uriWithCorrectExtension).keySet()
+ : new HashSet<Locale>(0);
+ }
+
+ /**
+ * Get the locales and resources corresponding to the uri.
+ *
+ * @param uri
+ * The uri to search.
+ * @return The collection of the resources corresponding to the uri or
+ * <code>null</code>.
+ */
+ public Map<Locale, Resource> getLocalesAndResourcesForURI(final URI uri) {
+ Map<Locale, Resource> result = null;
+
+ final URI propertiesURI = uri.trimFileExtension().appendFileExtension(getModelFileExtension());
+
+ if (propertiesByLocale.containsKey(propertiesURI)) {
+ result = propertiesByLocale.get(propertiesURI);
+ }
+
+ return result;
+ }
+
+ /**
+ * Get the resource corresponding to the URI and the locale.
+ *
+ * @param uri
+ * The initial URI.
+ * @param locale
+ * The locale to use.
+ * @return The resource corresponding.
+ */
+ public Resource getResourceForURIAndLocale(final URI uri, final Locale locale) {
+ Resource resultResource = null;
+
+ final URI propertiesURI = uri.trimFileExtension().appendFileExtension(getModelFileExtension());
+
+ if (propertiesByLocale.containsKey(propertiesURI)) {
+ final Map<Locale, Resource> resourceByLocale = propertiesByLocale.get(propertiesURI);
+ if (resourceByLocale.containsKey(locale)) {
+ resultResource = resourceByLocale.get(locale);
+ }
+ }
+
+ return resultResource;
+ }
+
+ /**
+ * Get the resource corresponding to the URI and the locale.
+ *
+ * @param uri
+ * The initial URI.
+ * @param Resource
+ * The resource to search.
+ * @return The resource corresponding.
+ */
+ public Locale getLocaleForResource(final Resource resource) {
+ Locale resultLocale = null;
+
+ for (final URI uri : propertiesByLocale.keySet()) {
+ final Map<Locale, Resource> resourceByLocale = propertiesByLocale.get(uri);
+ for (Entry<Locale, Resource> entry : resourceByLocale.entrySet()) {
+ if (entry.getValue().equals(resource)) {
+ resultLocale = entry.getKey();
+ }
+ }
+ }
+
+ return resultLocale;
+ }
+
+ /**
+ * Get the initial URI for the resource in parameter.
+ *
+ * @param resource
+ * The resource to search.
+ * @return The initial URI of the resource in parameter.
+ */
+ protected URI getInitialURIForResource(final Resource resource) {
+ URI initialURI = null;
+
+ for (final Iterator<URI> uriIterator = propertiesByLocale.keySet().iterator(); uriIterator.hasNext()
+ && null == initialURI;) {
+ final URI uri = uriIterator.next();
+ if (propertiesByLocale.get(uri).values().contains(resource)) {
+ initialURI = uri;
+ }
+ }
+
+ return initialURI;
+ }
+
+ /**
+ * Returns <code>true</code> if the URI was already loaded,
+ * <code>false</code> otherwise.
+ *
+ * @param uri
+ * The URI to search.
+ * @return <code>true</code> if the URI was already loaded,
+ * <code>false</code> otherwise.
+ */
+ public boolean isLoadedResourcesForURI(final URI uri) {
+ return propertiesByLocale.containsKey(uri.trimFileExtension().appendFileExtension(getModelFileExtension()));
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.EMFLogicalModel#unload()
+ */
+ @Override
+ public void unload() {
+ for (final Resource resource : getResources()) {
+ final URI initialUri = getInitialURIForResource(resource);
+ if (null != initialUri) {
+ unload(initialUri);
+ }
+ resource.unload();
+ }
+
+ // Remove adapters
+ for (final EObject eObject : adapters.keySet()) {
+ Adapter adapter = adapters.get(eObject);
+ eObject.eAdapters().remove(adapter);
+ adapter = null;
+ }
+ adapters.clear();
+
+ // Remove the editor parts
+ if (null != editorPartByEObject) {
+ editorPartByEObject.clear();
+ editorPartByEObject = null;
+ }
+
+ // Dispose and remove the part label synchronizer
+ if (null != entriesLabelSynchronizerByEObject) {
+ for (final Entry<EObject, Map<InternationalizationEntry, EntryPartLabelSynchronizer>> entry : entriesLabelSynchronizerByEObject
+ .entrySet()) {
+ for (final EntryPartLabelSynchronizer partLabelSynchronizer : entry.getValue().values()) {
+ partLabelSynchronizer.dispose();
+ }
+ }
+ entriesLabelSynchronizerByEObject.clear();
+ entriesLabelSynchronizerByEObject = null;
+ }
+
+ // Dispose and remove the preference part label synchronizer
+ if (null != preferencePartLabelSynchronizers) {
+ for (final PreferencePartLabelSynchronizer preferenceStynchronizer : preferencePartLabelSynchronizers
+ .values()) {
+ preferenceStynchronizer.dispose();
+ }
+ preferencePartLabelSynchronizers.clear();
+ preferencePartLabelSynchronizers = null;
+ }
+
+ super.unload();
+ }
+
+ /**
+ * This allows to unload the resource of the URI in parameter.
+ *
+ * @param uri
+ * The URI of the resource.
+ */
+ public void unload(final URI uri) {
+ PropertiesFilesUtils.removeResourceBundle(uri);
+ if (propertiesByLocale.containsKey(uri)) {
+ propertiesByLocale.remove(uri);
+ }
+ }
+
+ /**
+ * This allows to unload the resource from the properties by locale.
+ *
+ * @param resource
+ * The resource to unload.
+ */
+ public void unload(final Resource resource) {
+ PropertiesFilesUtils.removeResourceBundle(resource.getURI());
+ final URI initialUri = getInitialURIForResource(resource);
+
+ if (propertiesByLocale.containsKey(initialUri)) {
+ Iterator<Entry<Locale, Resource>> entriesIterator = propertiesByLocale.get(initialUri).entrySet()
+ .iterator();
+ while (entriesIterator.hasNext()) {
+ final Entry<Locale, Resource> entry = entriesIterator.next();
+ if (entry.getValue().equals(resource)) {
+ entriesIterator.remove();
+ }
+ }
+ }
+ }
+
+ /**
+ * This allows to create a properties resource by command.
+ */
+ private class CreatePropertiesResourceCommand extends AbstractCommand {
+
+ /**
+ * The URI of the resource to create.
+ */
+ protected URI uri;
+
+ /**
+ * The entry to add to the resource internationalization library if not
+ * <code>null</code>.
+ */
+ protected InternationalizationEntry entryToAdd;
+
+ /**
+ * The created resource result.
+ */
+ protected Resource createdResource;
+
+ /**
+ * The locale of the file to create.
+ */
+ protected Locale locale;
+
+ /**
+ * Constructor.
+ *
+ * @param uri
+ * The URI of the resource to create.
+ * @param entry
+ * The entry to add to the resource internationalization
+ * library if not <code>null</code>.
+ */
+ public CreatePropertiesResourceCommand(final URI uri, final InternationalizationEntry entry,
+ final Locale locale) {
+ super("Create properties resource"); //$NON-NLS-1$
+ this.uri = uri.trimFileExtension().appendFileExtension(getModelFileExtension());
+ this.entryToAdd = entry;
+ this.locale = locale;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
+ */
+ @Override
+ protected boolean prepare() {
+ return uri.fileExtension().equals(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#execute()
+ */
+ @Override
+ public void execute() {
+ createdResource = createResource(uri, locale);
+
+ if (null != entryToAdd) {
+ final InternationalizationLibrary library = getModelRoot(createdResource);
+ library.getEntries().add(entryToAdd);
+ }
+
+ if (modelSet.getResourcesToDeleteOnSave().contains(createdResource.getURI())) {
+ modelSet.getResourcesToDeleteOnSave().remove(createdResource.getURI());
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#undo()
+ */
+ @Override
+ public void undo() {
+ unload(uri);
+ createdResource.unload();
+ getResources().remove(createdResource);
+ modelSet.getResourcesToDeleteOnSave().add(createdResource.getURI());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ */
+ @Override
+ public void redo() {
+ execute();
+ }
+ }
+
+ /**
+ * This must be called when an Editor Part that contains the label
+ * internationalization will be opened. This allows to add the object and
+ * the editor part corresponding to the object.
+ *
+ * @param eObject
+ * The object corresponding to a part which manage the label
+ * modification.
+ * @param editorPart
+ * The editor part corresponding to the object.
+ */
+ public void addEditorPartForEObject(final EObject eObject, final IInternationalizationEditor editorPart) {
+ // Create the map if not existing
+ if (null == editorPartByEObject) {
+ editorPartByEObject = new HashMap<EObject, IInternationalizationEditor>();
+ }
+
+ // Add the eObject and editor part correspondance if not already
+ // existing
+ if (!editorPartByEObject.containsKey(eObject)) {
+ editorPartByEObject.put(eObject, editorPart);
+ }
+
+ // Call the part label synchronizer for the entries corresponding to the
+ // object
+ final URI uri = eObject.eResource().getURI();
+ for (final Locale locale : getAvailablePropertiesLocales(uri)) {
+ final InternationalizationEntry entry = getEntryForKey(uri, eObject, locale);
+ addPartLabelSynchronizerForEntry(eObject, entry);
+ }
+
+ // Create the part label synchronizer for the preference store
+ // modification for the object
+ addPartLabelSynchronizerForPreferenceStore(eObject);
+ }
+
+ /**
+ * This allows to add a {@link EntryPartLabelSynchronizer} for the
+ * {@link EObject} in parameter.
+ *
+ * @param eObject
+ * The object corresponding to a part which manage the label
+ * modification.
+ * @param entry
+ * The entry corresponding to the {@link EObject} which be called
+ * for the label modification.
+ */
+ protected void addPartLabelSynchronizerForEntry(final EObject eObject, final InternationalizationEntry entry) {
+ // Create the map if not existing
+ if (null == entriesLabelSynchronizerByEObject) {
+ entriesLabelSynchronizerByEObject = new HashMap<EObject, Map<InternationalizationEntry, EntryPartLabelSynchronizer>>();
+ }
+
+ // Get the map of entries and part label synchronizer for the
+ // corresponding object
+ Map<InternationalizationEntry, EntryPartLabelSynchronizer> entriesLabelSynchronizer = null;
+ if (entriesLabelSynchronizerByEObject.containsKey(eObject)) {
+ entriesLabelSynchronizer = entriesLabelSynchronizerByEObject.get(eObject);
+ } else {
+ entriesLabelSynchronizer = new HashMap<InternationalizationEntry, EntryPartLabelSynchronizer>();
+ entriesLabelSynchronizerByEObject.put(eObject, entriesLabelSynchronizer);
+ }
+
+ // If the entry if not already managed, create the part label
+ // synchronizer
+ if (!entriesLabelSynchronizer.containsKey(entry)) {
+ entriesLabelSynchronizer.put(entry,
+ new EntryPartLabelSynchronizer(entry, editorPartByEObject.get(eObject), this));
+ }
+ }
+
+ /**
+ * This allows to manage a part label synchronizer for the object label when
+ * the internationalization preference change.
+ *
+ * @param eObject
+ * The {@link EObject} corresponding to a part which manage the
+ * label modification.
+ */
+ protected void addPartLabelSynchronizerForPreferenceStore(final EObject eObject) {
+ // Create the map if not existing
+ if (null == preferencePartLabelSynchronizers) {
+ preferencePartLabelSynchronizers = new HashMap<EObject, PreferencePartLabelSynchronizer>();
+ }
+
+ // If the object is not already managed, create the part label
+ // synchronizer for the preference
+ if (!preferencePartLabelSynchronizers.containsKey(eObject)) {
+ final IPreferenceStore preferenceStore = InternationalizationPreferencesUtils.getPreferenceStore(eObject);
+
+ if (null != preferenceStore) {
+ preferencePartLabelSynchronizers.put(eObject, new PreferencePartLabelSynchronizer(preferenceStore,
+ eObject, editorPartByEObject.get(eObject), this));
+ }
+ }
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModel.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModel.java
new file mode 100644
index 00000000000..14bc82c98f7
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModel.java
@@ -0,0 +1,606 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.modelresource;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.papyrus.infra.core.resource.EMFLogicalModel;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.emf.commands.AddToResourceCommand;
+import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.internationalization.Activator;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationAnnotationResourceUtils;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+
+/**
+ * The model for the internationalization preference. It must be managed as
+ * legacy (platform:/resource/model/model.notation) or not
+ * (file:/~workspace/.metadata/.plugins/org.eclipse.papyrus.infra.core/model/model.internationalization).
+ * The internationalization preference will be managed as EAnnotation.
+ */
+public class InternationalizationPreferenceModel extends EMFLogicalModel implements IModel {
+
+ /**
+ * Model ID.
+ */
+ public static final String MODEL_ID = "org.eclipse.papyrus.infra.internationalization.InternationalizationPreferenceModel"; //$NON-NLS-1$
+
+ /**
+ * The private resource URI property.
+ */
+ public static final String PROPERTY_PRIVATE_RESOURCE_URI = "privateResourceURI"; //$NON-NLS-1$
+
+ /**
+ * The shared resource URI property.
+ */
+ public static final String PROPERTY_SHARED_RESOURCE_URI = "sharedResourceURI"; //$NON-NLS-1$
+
+ /**
+ * The legacy mode property.
+ */
+ public static final String PROPERTY_LEGACY_MODE = "legacyMode"; //$NON-NLS-1$
+
+ /**
+ * File extension for the internationalization preference model.
+ */
+ public static final String INTERNATIONALIZATION_PREFERENCE_FILE_EXTENSION = "internationalization"; //$NON-NLS-1$
+
+ /**
+ * The notation extension file (cannot use the
+ * NotationModel.NOTATION_FILE_EXTENSION because of dependencies cycle).
+ */
+ public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
+
+ /**
+ * The provider manager of the internationalization preference.
+ */
+ private InternationalizationPreferenceModelProviderManager providerManager;
+
+ /**
+ * The property change support for the legacy mode.
+ */
+ private final PropertyChangeSupport bean = new PropertyChangeSupport(this);
+
+ /**
+ * The model storage adapter for the internationalization preference
+ */
+ private Adapter internationalizationPreferenceModelStorageAdapter;
+
+ /**
+ * Boolean to determinate if the resource is managed as legacy.
+ */
+ private volatile Boolean legacyMode;
+
+ /**
+ * Constructor.
+ */
+ public InternationalizationPreferenceModel() {
+ super();
+
+ internationalizationPreferenceModelStorageAdapter = new AdapterImpl() {
+ @Override
+ public void notifyChanged(final Notification msg) {
+ if (getResources().contains(msg.getNotifier())) {
+ switch (msg.getFeatureID(Resource.class)) {
+ case Resource.RESOURCE__CONTENTS:
+ invalidateLegacyMode();
+ break;
+ }
+ }
+ }
+ };
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModel#init(org.eclipse.papyrus.infra.core.resource.ModelSet)
+ */
+ @Override
+ public void init(final ModelSet modelSet) {
+ super.init(modelSet);
+
+ this.providerManager = new InternationalizationPreferenceModelProviderManager(modelSet);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.EMFLogicalModel#unload()
+ */
+ @Override
+ public void unload() {
+ if (null != providerManager) {
+ providerManager.dispose();
+ providerManager = null;
+ }
+
+ getResources().forEach(res -> res.eAdapters().remove(internationalizationPreferenceModelStorageAdapter));
+
+ super.unload();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.EMFLogicalModel#isRelatedResource(org.eclipse.emf.ecore.resource.Resource)
+ */
+ @Override
+ public boolean isRelatedResource(final Resource resource) {
+ boolean result = false;
+
+ if (null != resource) {
+ // We only handle the main internationalization preference resource.
+ // Imported *.internationalization are not relevant
+ if (resource == getResource()) {
+ result = true;
+ } else {
+ // We can only calculate these related URIs if the ModelSet is
+ // initialized
+ result = resource.getURI().equals(getSharedResourceURI())
+ || resource.getURI().equals(getPrivateResourceURI());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Just open this method to public.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModel#getModelManager()
+ */
+ @Override
+ public ModelSet getModelManager() {
+ return super.getModelManager();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.EMFLogicalModel#configureResource(org.eclipse.emf.ecore.resource.Resource)
+ */
+ @Override
+ protected void configureResource(final Resource resourceToConfigure) {
+ super.configureResource(resourceToConfigure);
+
+ if (null != resourceToConfigure) {
+ resourceToConfigure.eAdapters().add(internationalizationPreferenceModelStorageAdapter);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#loadModel(org.eclipse.emf.common.util.URI)
+ */
+ @Override
+ public void loadModel(final URI uriWithoutExtension) {
+ final URI sashModelURI = getInternationalizationPreferenceModelURI(uriWithoutExtension);
+ this.resourceURI = sashModelURI;
+
+ try {
+ super.loadModel(sashModelURI.trimFileExtension());
+ loadInternationalizationPreference(sashModelURI);
+ } catch (final Exception ex) {
+ // Unload it and try again by creating it
+ final Resource resource = getModelManager().getResource(sashModelURI, false);
+ if (null != resource) {
+ resource.unload();
+ resource.getResourceSet().getResources().remove(resource);
+ }
+
+ // This will create the private internationalization preference
+ // model if that's what we need
+ createModel(uriWithoutExtension);
+ }
+
+ if (null == resource) {
+ // This will create the private internationalization preference
+ // model if that's what we need
+ createModel(uriWithoutExtension);
+ }
+ }
+
+ /**
+ * This allows to load the internationalization preference as annotation in
+ * the root content.
+ *
+ * @param uri
+ * The URI of the properties file with the extension.
+ */
+ protected void loadInternationalizationPreference(final URI uri) {
+ if (null != resource && null != resource.getContents() && !resource.getContents().isEmpty()) {
+
+ boolean useInternationalizationValue = false;
+ String languagePreference = null;
+
+ // Get the internationalization annotation
+ final EAnnotation annotation = InternationalizationAnnotationResourceUtils
+ .getInternationalizationAnnotation(resource);
+
+ // Get the details values
+ if (null != annotation) {
+ // Get the 'use' details value
+ final String useInternationalizationStringValue = annotation.getDetails()
+ .get(InternationalizationPreferencesConstants.USE_DETAIL_ANNOTATION_LABEL);
+ useInternationalizationValue = Boolean.parseBoolean(useInternationalizationStringValue);
+
+ // Get the 'language' details value
+ final String languageValue = annotation.getDetails()
+ .get(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE);
+
+ languagePreference = languageValue;
+ }
+
+ // Set values into the preference store corresponding to the
+ // papyrus model
+ URI sharedResource = getPrivateResourceURI();
+ InternationalizationPreferencesUtils.setInternationalizationPreference(sharedResource,
+ useInternationalizationValue);
+ if (null != languagePreference) {
+ InternationalizationPreferencesUtils.setLanguagePreference(sharedResource,
+ languagePreference.toString());
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#createModel(org.eclipse.emf.common.util.URI)
+ */
+ @Override
+ public void createModel(final URI uriWithoutExtension) {
+ if (isLegacy(uriWithoutExtension)) {
+ final URI internationalizationPrefURI = getInternationalizationPreferenceModelStoreURI(uriWithoutExtension);
+ try {
+ super.createModel(internationalizationPrefURI.trimFileExtension());
+ intantiateTemplate(internationalizationPrefURI);
+ loadInternationalizationPreference(uriWithoutExtension);
+ } catch (final IOException e) {
+ Activator.log.error("Failed to initialize workspace private internationalization model", e); //$NON-NLS-1$
+ super.createModel(internationalizationPrefURI.trimFileExtension());
+ }
+ } else {
+ super.createModel(uriWithoutExtension);
+ }
+ }
+
+ /**
+ * Intantiates the internationalization preference resource template on the
+ * given URI.
+ *
+ * @param internationalizationPrefResourceURI
+ * The new internationalization preference resource URI.
+ * @throws IOException
+ * on failure to copy the template to this URI for any reason
+ */
+ protected void intantiateTemplate(final URI internationalizationPrefResourceURI) throws IOException {
+
+ // Create the internationalization annotation with
+ // - Use internationalization preference to true
+ // - Language preference to default language
+ final EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ annotation.setSource(InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL);
+ annotation.getDetails().put(InternationalizationPreferencesConstants.USE_DETAIL_ANNOTATION_LABEL,
+ Boolean.toString(true));
+ annotation.getDetails().put(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE,
+ Locale.getDefault().toString());
+
+ // The command to add the annotation in resource content
+ final GMFtoEMFCommandWrapper command = new GMFtoEMFCommandWrapper(new AddToResourceCommand(
+ ((ModelSet) resource.getResourceSet()).getTransactionalEditingDomain(), resource, annotation));
+ command.execute();
+
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.EMFLogicalModel#setModelURI(org.eclipse.emf.common.util.URI)
+ */
+ @Override
+ public void setModelURI(final URI uriWithoutExtension) {
+ final URI oldPrivateURI = getSharedResourceURI();
+ final URI oldSharedURI = getPrivateResourceURI();
+
+ URI newURI;
+ if ((null != resourceURI) && isLegacy(resourceURI.trimFileExtension())) {
+ newURI = getLegacyURI(uriWithoutExtension);
+ } else {
+ newURI = getInternationalizationPreferenceModelStoreURI(uriWithoutExtension);
+ }
+
+ super.setModelURI(newURI.trimFileExtension());
+
+ bean.firePropertyChange(PROPERTY_PRIVATE_RESOURCE_URI, oldPrivateURI, getSharedResourceURI());
+ bean.firePropertyChange(PROPERTY_SHARED_RESOURCE_URI, oldSharedURI, getPrivateResourceURI());
+ }
+
+ /**
+ * Determinates if this is the legacy URI.
+ *
+ * @param uriWithoutExtension
+ * The uri to check.
+ * @return <code>true</code> if the uri is corresponding to the legacy mode,
+ * <code>false</code> otherwise.
+ */
+ protected boolean isLegacy(final URI uriWithoutExtension) {
+ boolean result = false;
+ if (null != uriWithoutExtension) {
+ result = Objects.equals(uriWithoutExtension, getModelManager().getURIWithoutExtension());
+ }
+ return result;
+ }
+
+ /**
+ * Returns the internationalization preference model URI (With file
+ * extension)
+ *
+ * It may be either the Legacy URI (platform:/resource/model/model.notation)
+ * or the 1.0.0 URI
+ * (file:/~workspace/.metadata/.plugins/org.eclipse.papyrus.infra.core/model/model.internationalization)
+ *
+ * @param uriWithoutExtension
+ * The initial URI.
+ * @return The internationalization preference model URI.
+ */
+ protected URI getInternationalizationPreferenceModelURI(final URI uriWithoutExtension) {
+ final URIConverter converter = getModelManager().getURIConverter();
+ final URI legacyURI = getLegacyURI(uriWithoutExtension);
+
+ // If the notation file exists and contains the internationalization
+ // annotation, this is a
+ // legacy model
+ if (converter.exists(legacyURI, Collections.emptyMap())) {
+ try {
+ final Resource notationResource = getModelManager().getResource(legacyURI, true);
+ if (null != InternationalizationAnnotationResourceUtils
+ .getInternationalizationAnnotation(notationResource)) {
+ return legacyURI;
+ }
+ } catch (final Exception ex) {
+ // Temporary workaround: the notation file may exist and be
+ // empty
+ // Log the error and continue
+ Activator.log.error(ex);
+ }
+ }
+
+ return getInternationalizationPreferenceModelStoreURI(uriWithoutExtension);
+ }
+
+ /**
+ * Get the legacy URI. It must be like
+ * platform:/resource/model/model.notation.
+ *
+ * @param uriWithoutExtension
+ * The initial uri.
+ * @return The legacy URI.
+ */
+ protected URI getLegacyURI(final URI uriWithoutExtension) {
+ return uriWithoutExtension.appendFileExtension(NOTATION_FILE_EXTENSION);
+ }
+
+ /**
+ * Get the internationalization preference model store URI. It must be like
+ * file:/~workspace/.metadata/.plugins/org.eclipse.papyrus.infra.core/model/model.internationalization.
+ *
+ * @param uriWithoutExtension
+ * The initial URI.
+ * @return The non-legacy URI.
+ */
+ protected URI getInternationalizationPreferenceModelStoreURI(final URI uriWithoutExtension) {
+ URI fullURI = uriWithoutExtension.appendFileExtension(INTERNATIONALIZATION_PREFERENCE_FILE_EXTENSION);
+ return providerManager.getInternationalizationPreferenceModelProvider(fullURI)
+ .getInternationalizationPreferenceModelURI(fullURI);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getSaveOptions()
+ */
+ @Override
+ protected Map<Object, Object> getSaveOptions() {
+ final Map<Object, Object> saveOptions = super.getSaveOptions();
+
+ saveOptions.put(XMIResource.OPTION_USE_XMI_TYPE, Boolean.FALSE);
+ saveOptions.put(XMLResource.OPTION_SAVE_TYPE_INFORMATION, Boolean.FALSE);
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+
+ return saveOptions;
+ }
+
+ /**
+ * Get the legacy mode.
+ *
+ * @return <code>true</code> if this is the legacy mode, <code>false</code>
+ * otherwise.
+ */
+ public boolean isLegacyMode() {
+ if (null == legacyMode) {
+ legacyMode = false; // Assume not
+
+ // Does the shared DI resource contain the sash layout?
+ final URI sharedURI = getPrivateResourceURI();
+ if (null != sharedURI) {
+ for (final Resource next : getResources()) {
+ if (sharedURI.equals(next.getURI())) {
+ legacyMode = null != InternationalizationAnnotationResourceUtils
+ .getInternationalizationAnnotation(next);
+ break;
+ }
+ }
+ }
+ }
+
+ return legacyMode;
+ }
+
+ /**
+ * This allows to recalculate the legacy mode.
+ */
+ protected void invalidateLegacyMode() {
+ final boolean oldValue = isLegacyMode();
+
+ legacyMode = null;
+
+ final boolean newValue = isLegacyMode();
+
+ if (oldValue != newValue) {
+ bean.firePropertyChange(PROPERTY_LEGACY_MODE, oldValue, newValue);
+ }
+ }
+
+ /**
+ * Gets the URI of the internationalization preference model resource in the
+ * shared (collocated with the user model) area, irrespective of whether
+ * that actually is the resource that currently stores the
+ * internationalization preference model.
+ *
+ * @return the shared internationalization preference model resource URI
+ */
+ public URI getSharedResourceURI() {
+ URI modelURI = (null == getModelManager()) ? null : getModelManager().getURIWithoutExtension();
+ return (null == modelURI) ? null : getInternationalizationPreferenceModelStoreURI(modelURI);
+ }
+
+ /**
+ * Gets the URI of the internationalization preference model resource in the
+ * user private area, irrespective of whether that actually is the resource
+ * that currently stores the internationalization preference model.
+ *
+ * @return the private sash-model resource URI
+ */
+ public URI getPrivateResourceURI() {
+ URI modelURI = (null == getModelManager()) ? null : getModelManager().getURIWithoutExtension();
+ return (null == modelURI) ? null : modelURI.appendFileExtension(NOTATION_FILE_EXTENSION);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#isRootElement(org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ protected boolean isRootElement(final EObject object) {
+ return super.isRootElement(object) && object instanceof EAnnotation
+ && InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL
+ .equals(((EAnnotation) object).getSource());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.EMFLogicalModel#isSupportedRoot(org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ protected boolean isSupportedRoot(final EObject object) {
+ return object instanceof EAnnotation
+ && InternationalizationPreferencesConstants.INTERNATIONALIZATION_ANNOTATION_LABEL
+ .equals(((EAnnotation) object).getSource());
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
+ */
+ @Override
+ public String getModelFileExtension() {
+ if (isLegacy((null == resourceURI) ? resourceURI : resourceURI.trimFileExtension())) {
+ return NOTATION_FILE_EXTENSION;
+ } else {
+ return INTERNATIONALIZATION_PREFERENCE_FILE_EXTENSION;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModel#getIdentifier()
+ */
+ @Override
+ public String getIdentifier() {
+ return MODEL_ID;
+ }
+
+ /**
+ * This allows to add a property change listener.
+ *
+ * @param listener
+ * The property change listener to add.
+ */
+ public void addPropertyChangeListener(final PropertyChangeListener listener) {
+ bean.addPropertyChangeListener(listener);
+ }
+
+ /**
+ * This allows to remove a property change listener.
+ *
+ * @param listener
+ * The property change listener to remove.
+ */
+ public void removePropertyChangeListener(final PropertyChangeListener listener) {
+ bean.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * This allows to add a property change listener for a property name..
+ *
+ * @param propertyName
+ * The property name for which one add the property change
+ * listener.
+ * @param listener
+ * The property change listener to add.
+ */
+ public void addPropertyChangeListener(final String propertyName, final PropertyChangeListener listener) {
+ bean.addPropertyChangeListener(propertyName, listener);
+ }
+
+ /**
+ * This allows to remove a property change listener for a property name..
+ *
+ * @param propertyName
+ * The property name for which one remove the property change
+ * listener.
+ * @param listener
+ * The property change listener to remove.
+ */
+ public void removePropertyChangeListener(final String propertyName, final PropertyChangeListener listener) {
+ bean.removePropertyChangeListener(propertyName, listener);
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java
new file mode 100644
index 00000000000..eb2713c3e81
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelresource/InternationalizationPreferenceModelProviderManager.java
@@ -0,0 +1,252 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.modelresource;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.internationalization.Activator;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Strings;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+
+/**
+ * This is the InternationalizationPreferenceModelProviderManager type.
+ */
+class InternationalizationPreferenceModelProviderManager {
+
+ /**
+ * The provider identifier for the extension point of the internationalization preference model provider.
+ */
+ private static final String E_PROVIDER = "internationalizationPreferenceModelProvider"; //$NON-NLS-1$
+
+ /**
+ * The extension point identifier.
+ */
+ private static final String EXT_PT = Activator.PLUGIN_ID + "." + E_PROVIDER; //$NON-NLS-1$
+
+ /**
+ * The current model set.
+ */
+ private final ModelSet modelSet;
+
+ /**
+ * The default internationalization preference model provider.
+ */
+ private final IInternationalizationPreferenceModelProvider defaultInternationalizationPrefModelProvider;
+
+ /**
+ * The descriptors.
+ */
+ private final List<ProviderDescriptor> descriptors;
+
+ /**
+ * Constructor.
+ *
+ * @param modelSet The current model set.
+ */
+ public InternationalizationPreferenceModelProviderManager(final ModelSet modelSet) {
+ super();
+
+ this.modelSet = modelSet;
+ this.defaultInternationalizationPrefModelProvider = createDefaultInternationalizationPrefModelProvider();
+ this.descriptors = new CopyOnWriteArrayList<InternationalizationPreferenceModelProviderManager.ProviderDescriptor>(createDescriptors());
+ }
+
+ /**
+ * This allows to dispose the objects in the class.
+ */
+ protected void dispose() {
+ for (final ProviderDescriptor next : descriptors) {
+ next.dispose();
+ }
+ }
+
+ /**
+ * Obtains the most appropriate sash model provider for the specified URI.
+ *
+ * @param userModelURI The initial user model URI.
+ *
+ * @return the sash model provider, never {@code null} (there is always a default available)
+ */
+ protected IInternationalizationPreferenceModelProvider getInternationalizationPreferenceModelProvider(final URI userModelURI) {
+ IInternationalizationPreferenceModelProvider result = null;
+
+ // We know at least the back-stop descriptor will match
+ ProviderDescriptor descriptor = Iterables.find(descriptors, new Predicate<Predicate<URI>>() {
+
+ @Override
+ public boolean apply(Predicate<URI> input) {
+ return input.apply(userModelURI);
+ }
+ });
+
+ try {
+ result = descriptor.getProvider();
+ } catch (CoreException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ result = defaultInternationalizationPrefModelProvider;
+
+ // Remove the offending descriptor
+ descriptors.remove(descriptor);
+ }
+
+ return result;
+ }
+
+ /**
+ * This allows to create the descriptors.
+ *
+ * @return The list of created descriptors.
+ */
+ private List<ProviderDescriptor> createDescriptors() {
+ List<ProviderDescriptor> result = Lists.newArrayListWithExpectedSize(1);
+
+ for (final IConfigurationElement next : Platform.getExtensionRegistry().getConfigurationElementsFor(EXT_PT)) {
+ if (E_PROVIDER.equals(next.getName())) {
+ try {
+ result.add(new ProviderDescriptor(next));
+ } catch (final CoreException e) {
+ Activator.getDefault().getLog().log(e.getStatus());
+ }
+ }
+ }
+
+ // The back-stop that will match any URI not previously matched
+ result.add(new ProviderDescriptor(defaultInternationalizationPrefModelProvider));
+
+ return result;
+ }
+
+ /**
+ * This allows to create the default internationalization preference model provider.
+ *
+ * @return The created {@link IInternationalizationPreferenceModelProvider}.
+ */
+ private IInternationalizationPreferenceModelProvider createDefaultInternationalizationPrefModelProvider() {
+ return new AbstractInternationalizationPreferenceModelProvider() {
+
+ @Override
+ public URI getInternationalizationPreferenceModelURI(final URI userModelURI) {
+ final URI uriWithoutExtension = userModelURI.trimFileExtension();
+
+ IPath stateLocation = Activator.getDefault().getStateLocation();
+
+ if (uriWithoutExtension.isPlatform()) {
+ stateLocation = stateLocation.append(uriWithoutExtension.toPlatformString(true));
+ } else {
+ stateLocation = stateLocation.append(URI.decode(uriWithoutExtension.toString()));
+ }
+
+ URI workspaceFileURI = URI.createFileURI(stateLocation.toString()).appendFileExtension(InternationalizationPreferenceModel.INTERNATIONALIZATION_PREFERENCE_FILE_EXTENSION);
+
+ return workspaceFileURI;
+ }
+ };
+ }
+
+ //
+ // Nested types
+ //
+
+ private class ProviderDescriptor implements Predicate<URI> {
+
+ private static final String A_SCHEME = "scheme"; //$NON-NLS-1$
+
+ private static final String A_PATTERN = "pattern"; //$NON-NLS-1$
+
+ private static final String A_CLASS = "class"; //$NON-NLS-1$
+
+ private final IConfigurationElement config;
+
+ private final String scheme;
+
+ private final Pattern pattern;
+
+ private IInternationalizationPreferenceModelProvider provider;
+
+ ProviderDescriptor(IInternationalizationPreferenceModelProvider provider) {
+ this.provider = provider;
+
+ this.config = null;
+ this.scheme = null;
+ this.pattern = null;
+ }
+
+ ProviderDescriptor(IConfigurationElement config) throws CoreException {
+ this.config = config;
+
+ this.scheme = config.getAttribute(A_SCHEME);
+ String pattern = config.getAttribute(A_PATTERN);
+
+ if (Strings.isNullOrEmpty(scheme) && Strings.isNullOrEmpty(pattern)) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Sash model provider missing both scheme and pattern filter.")); //$NON-NLS-1$
+ }
+
+ try {
+ this.pattern = (pattern == null) ? null : Pattern.compile(pattern);
+ } catch (PatternSyntaxException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid sash model provider URI pattern filter.", e)); //$NON-NLS-1$
+ }
+ }
+
+ @Override
+ public boolean apply(URI input) {
+ return ((scheme == null) || scheme.equals(input.scheme())) // Scheme filter
+ && ((pattern == null) || pattern.matcher(input.toString()).find()); // Pattern filter
+ }
+
+ IInternationalizationPreferenceModelProvider getProvider() throws CoreException {
+ if (provider == null) {
+ try {
+ provider = (IInternationalizationPreferenceModelProvider) config.createExecutableExtension(A_CLASS);
+ provider.initialize(modelSet);
+ } catch (CoreException e) {
+ throw e;
+ } catch (ClassCastException e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Invalid sash model provider implementation.", e)); //$NON-NLS-1$
+ } catch (Exception e) {
+ throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to initialize sash model provider implementation.", e)); //$NON-NLS-1$
+ }
+ }
+
+ return provider;
+ }
+
+ void dispose() {
+ if (provider != null) {
+ try {
+ provider.dispose();
+ } catch (Exception e) {
+ Activator.log.error("Failed to initialize sash model provider implementation.", e); //$NON-NLS-1$
+ }
+
+ provider = null;
+ }
+ }
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelsnippet/PropertiesAdjunctResourceModelSnippet.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelsnippet/PropertiesAdjunctResourceModelSnippet.java
new file mode 100644
index 00000000000..a2642aeab0e
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/modelsnippet/PropertiesAdjunctResourceModelSnippet.java
@@ -0,0 +1,119 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.modelsnippet;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.papyrus.infra.core.resource.AdjunctResourceModelSnippet;
+import org.eclipse.papyrus.infra.core.resource.EMFLogicalModel;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.core.resource.ResourceAdapter;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+import org.eclipse.papyrus.infra.internationalization.utils.PropertiesFilesUtils;
+
+/**
+ * The adjunct resource model snippet for the properties files.
+ */
+public class PropertiesAdjunctResourceModelSnippet extends AdjunctResourceModelSnippet {
+
+ /**
+ * The internationalization model.
+ */
+ private InternationalizationModelResource model;
+
+ /**
+ * The adapter.
+ */
+ private Adapter adapter;
+
+ /**
+ * Constructor.
+ */
+ public PropertiesAdjunctResourceModelSnippet() {
+ super();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AdjunctResourceModelSnippet#loadResource(org.eclipse.papyrus.infra.core.resource.EMFLogicalModel,
+ * org.eclipse.emf.ecore.resource.ResourceSet,
+ * org.eclipse.emf.common.util.URI)
+ */
+ @Override
+ protected void loadResource(final EMFLogicalModel model, final ResourceSet resourceSet, final URI adjunctURI) {
+ if (adjunctURI.fileExtension().equals(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION)) {
+ model.loadModel(adjunctURI.trimFileExtension());
+ } else {
+ super.loadResource(model, resourceSet, adjunctURI);
+ }
+ }
+
+ /**
+ * Redefined to manage the load of adjunct resource. {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AdjunctResourceModelSnippet#start(org.eclipse.papyrus.infra.core.resource.IModel)
+ */
+ @Override
+ public void start(final IModel startingModel) {
+ if (startingModel instanceof InternationalizationModelResource) {
+ model = (InternationalizationModelResource) startingModel;
+
+ adapter = new ResourceAdapter() {
+ @Override
+ protected void handleResourceLoaded(Resource resource) {
+ loadAdjunctResource(resource);
+ }
+ };
+
+ model.getModelManager().eAdapters().add(adapter);
+ }
+ }
+
+ /**
+ * Load the adjunct resource.
+ *
+ * @param resource
+ * The resource to load.
+ */
+ protected void loadAdjunctResource(final Resource resource) {
+ // If the parameter resource is the model's own kind of resource,
+ // then there is nothing to do
+ if ((null != model) && !model.isRelatedResource(resource)) {
+ final URI adjunctURI = resource.getURI().trimFileExtension()
+ .appendFileExtension(model.getModelFileExtension());
+ final ResourceSet resourceSet = resource.getResourceSet();
+
+ if (!model.isLoadedResourcesForURI(adjunctURI)) {
+ loadResource(model, resourceSet, adjunctURI);
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AdjunctResourceModelSnippet#dispose(org.eclipse.papyrus.infra.core.resource.IModel)
+ */
+ @Override
+ public void dispose(final IModel stoppingModel) {
+ if ((stoppingModel == model) && (null != adapter)) {
+ model.getModelManager().eAdapters().remove(adapter);
+ adapter = null;
+ model = null;
+ }
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/EntryPartLabelSynchronizer.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/EntryPartLabelSynchronizer.java
new file mode 100644
index 00000000000..cc009312427
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/EntryPartLabelSynchronizer.java
@@ -0,0 +1,167 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationEntry;
+import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage;
+import org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ * A class taking in charge the synchronization of the partName and the label.
+ * When label change, the other is automatically updated.
+ */
+public class EntryPartLabelSynchronizer {
+
+ /**
+ * The internationalization entry.
+ */
+ private InternationalizationEntry entry;
+
+ /**
+ * The corresponding editor part (implementing
+ * {@link IInternationalizationEditor} for the internationalization).
+ */
+ private IInternationalizationEditor editorPart;
+
+ /**
+ * The {@link internationalizationModelResource} to get the labels needed.
+ */
+ private InternationalizationModelResource modelResource;
+
+ /**
+ * Listener on label change.
+ */
+ private final Adapter labelListener = new AdapterImpl() {
+
+ /**
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ *
+ * @param notification
+ */
+ @Override
+ public void notifyChanged(final Notification notification) {
+ if (notification.getFeature() == InternationalizationPackage.eINSTANCE
+ .getInternationalizationEntry_Value()) {
+ editorPart.modifyPartName(getLabel(entry.getKey()));
+ }
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param entry
+ * The internationalization entry to manage.
+ * @param editorPart
+ * The editor part to change label.
+ * @param modelResource
+ * The model resource corresponding to the internationalization.
+ */
+ public EntryPartLabelSynchronizer(final InternationalizationEntry entry,
+ final IInternationalizationEditor editorPart, final InternationalizationModelResource modelResource) {
+ this.editorPart = editorPart;
+ this.modelResource = modelResource;
+ setEntry(entry);
+ }
+
+ /**
+ * Change the associated entry.
+ *
+ * @param entry
+ * The internationalization entry.
+ */
+ public void setEntry(final InternationalizationEntry entry) {
+ if (null != entry && null != entry.getKey()) {
+ entry.eAdapters().remove(this.labelListener);
+
+ // Set new table internationalization entry
+ this.entry = entry;
+
+ // Set editor name
+ editorPart.modifyPartName(getLabel(entry.getKey()));
+
+ // Listen to name change
+ entry.eAdapters().add(this.labelListener);
+ }
+ }
+
+ /**
+ * This allows to dispose the synchronizer.
+ */
+ public void dispose() {
+ this.editorPart = null;
+ this.modelResource = null;
+ if (null != entry) {
+ this.entry.eAdapters().remove(this.labelListener);
+ }
+ }
+
+ /**
+ * This allows to get the object label from the model resource.
+ *
+ * @param object
+ * The object to get its label.
+ * @return The object label.
+ */
+ protected String getLabel(final Object object) {
+ String value = ""; //$NON-NLS-1$
+ if (object instanceof Table) {
+ value = getTableLabel((Table) entry.getKey());
+ } else if (object instanceof Diagram) {
+ value = getDiagramLabel((Diagram) entry.getKey());
+ }
+ return value;
+ }
+
+ /**
+ * This allows to get the table label from the model resource.
+ *
+ * @param table
+ * The table to get its label (name if label returns
+ * <code>null</code>).
+ * @return The table label of table name if label returns <code>null</code>.
+ */
+ protected String getTableLabel(final Table table) {
+ String result = null;
+ if (InternationalizationPreferencesUtils.getInternationalizationPreference(table)) {
+ result = modelResource.getValueForEntryKey(table.eResource().getURI(), table);
+ }
+ return null != result ? result : table.getName();
+ }
+
+ /**
+ * This allows to get the diagram label from the model resource.
+ *
+ * @param diagram
+ * The diagram to get its label (name if label returns
+ * <code>null</code>).
+ * @return The diagram label of diagram name if label returns
+ * <code>null</code>.
+ */
+ protected String getDiagramLabel(final Diagram diagram) {
+ String result = null;
+ if (InternationalizationPreferencesUtils.getInternationalizationPreference(diagram)) {
+ result = modelResource.getValueForEntryKey(diagram.eResource().getURI(), diagram);
+ }
+ return null != result ? result : diagram.getName();
+ }
+} \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/InternationalizationPreferenceModelUtils.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/InternationalizationPreferenceModelUtils.java
new file mode 100644
index 00000000000..77ec76f5d07
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/InternationalizationPreferenceModelUtils.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils;
+
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.ModelUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationPreferenceModel;
+
+/**
+ * Set of utility methods for the InternationalizationPreferenceModel.
+ */
+public class InternationalizationPreferenceModelUtils {
+
+ /**
+ * Gets the InternationalizationPreferenceModel from the {@link ModelSet}.
+ * <br>
+ *
+ * @param modelsManager
+ * The modelManager containing the requested model.
+ *
+ * @return The {@link InternationalizationPreferenceModel} registered in
+ * modelManager, or null if not found.
+ */
+ public static InternationalizationPreferenceModel getInternationalizationPreferenceModel(ModelSet modelsManager) {
+ return (InternationalizationPreferenceModel) modelsManager
+ .getModel(InternationalizationPreferenceModel.MODEL_ID);
+ }
+
+ /**
+ * Gets the InternationalizationPreferenceModel from the {@link ModelSet}.
+ * <br>
+ *
+ * @param ServicesRegistry
+ * The servie registry under which the ModelSet is registered.
+ *
+ * @return The {@link InternationalizationPreferenceModel} registered in
+ * modelManager, or null if not found.
+ */
+ public static InternationalizationPreferenceModel getInternationalizationPreferenceModel(
+ ServicesRegistry servicesRegistry) {
+ try {
+ return (InternationalizationPreferenceModel) ModelUtils.getModelSetChecked(servicesRegistry)
+ .getModel(InternationalizationPreferenceModel.MODEL_ID);
+ } catch (ServiceException e) {
+ return null;
+ }
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/PreferencePartLabelSynchronizer.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/PreferencePartLabelSynchronizer.java
new file mode 100644
index 00000000000..cc01609c041
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/PreferencePartLabelSynchronizer.java
@@ -0,0 +1,171 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesConstants;
+import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils;
+import org.eclipse.papyrus.infra.internationalization.modelresource.InternationalizationModelResource;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ * A class taking in charge the synchronization of the partName and the label.
+ * When label change, the other is automatically updated.
+ */
+public class PreferencePartLabelSynchronizer {
+
+ /**
+ * The preference store.
+ */
+ private IPreferenceStore preferenceStore;
+
+ /**
+ * The EObject corresponding to the graphical editor part.
+ */
+ private EObject graphicalEObject;
+
+ /**
+ * The corresponding editor part (implementing
+ * {@link IInternationalizationEditor} for the internationalization).
+ */
+ private IInternationalizationEditor editorPart;
+
+ /**
+ * The {@link internationalizationModelResource} to get the labels needed.
+ */
+ private InternationalizationModelResource modelResource;
+
+ /**
+ * Listener on label change.
+ */
+ private final IPropertyChangeListener propertyListener = new IPropertyChangeListener() {
+
+ public void propertyChange(final PropertyChangeEvent event) {
+ if (event.getProperty().equals(InternationalizationPreferencesConstants.USE_INTERNATIONALIZATION_PREFERENCE)
+ || event.getProperty().equals(InternationalizationPreferencesConstants.LANGUAGE_PREFERENCE)) {
+ // Modify the part name
+ editorPart.modifyPartName(getLabel(graphicalEObject));
+ // Refresh the editor part
+ editorPart.refreshEditorPart();
+ }
+ }
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param preferenceStore
+ * The preference store to manage.
+ * @param graphicalEObject
+ * The EObject corresponding to the owner of the editor part.
+ * @param editorPart
+ * The editor part to change label.
+ * @param modelResource
+ * The model resource corresponding to the internationalization.
+ */
+ public PreferencePartLabelSynchronizer(final IPreferenceStore preferenceStore, final EObject graphicalEObject,
+ final IInternationalizationEditor editorPart, final InternationalizationModelResource modelResource) {
+ this.editorPart = editorPart;
+ this.modelResource = modelResource;
+ this.graphicalEObject = graphicalEObject;
+ setPreferenceStore(preferenceStore);
+ }
+
+ /**
+ * Change the associated entry.
+ *
+ * @param preferenceStore
+ * The preference store
+ */
+ public void setPreferenceStore(final IPreferenceStore preferenceStore) {
+ if (null != preferenceStore) {
+ preferenceStore.removePropertyChangeListener(this.propertyListener);
+
+ // Set new table internationalization entry
+ this.preferenceStore = preferenceStore;
+
+ // Set editor name
+ editorPart.modifyPartName(getLabel(graphicalEObject));
+
+ // Listen to name change
+ preferenceStore.addPropertyChangeListener(propertyListener);
+ }
+ }
+
+ /**
+ * This allows to dispose the synchronizer.
+ */
+ public void dispose() {
+ this.editorPart = null;
+ this.modelResource = null;
+ if (null != preferenceStore) {
+ this.preferenceStore.removePropertyChangeListener(this.propertyListener);
+ }
+ }
+
+ /**
+ * This allows to get the object label from the model resource.
+ *
+ * @param object
+ * The object to get its label.
+ * @return The object label.
+ */
+ protected String getLabel(final EObject object) {
+ String value = ""; //$NON-NLS-1$
+ if (object instanceof Table) {
+ value = getTableLabel((Table) object);
+ } else if (object instanceof Diagram) {
+ value = getDiagramLabel((Diagram) object);
+ }
+ return value;
+ }
+
+ /**
+ * This allows to get the table label from the model resource.
+ *
+ * @param table
+ * The table to get its label (name if label returns
+ * <code>null</code>).
+ * @return The table label or table name if label returns <code>null</code>.
+ */
+ protected String getTableLabel(final Table table) {
+ String result = null;
+ if (InternationalizationPreferencesUtils.getInternationalizationPreference(table)) {
+ result = modelResource.getValueForEntryKey(table.eResource().getURI(), table);
+ }
+ return null != result ? result : table.getName();
+ }
+
+ /**
+ * This allows to get the diagram label from the model resource.
+ *
+ * @param diagram
+ * The diagram to get its label (name if label returns
+ * <code>null</code>).
+ * @return The diagram label or diagram name if label returns
+ * <code>null</code>.
+ */
+ protected String getDiagramLabel(final Diagram diagram) {
+ String result = null;
+ if (InternationalizationPreferencesUtils.getInternationalizationPreference(diagram)) {
+ result = modelResource.getValueForEntryKey(diagram.eResource().getURI(), diagram);
+ }
+ return null != result ? result : diagram.getName();
+ }
+} \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/PropertiesFilesUtils.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/PropertiesFilesUtils.java
new file mode 100644
index 00000000000..797fded226e
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/PropertiesFilesUtils.java
@@ -0,0 +1,353 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+import java.util.WeakHashMap;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.EMFPlugin;
+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.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
+import org.osgi.framework.Bundle;
+
+/**
+ * This needed methods was copied from UML2Util because we can't use it (because of visibility).
+ */
+public class PropertiesFilesUtils {
+
+ /**
+ * The default URI converter for resource bundle look-ups.
+ */
+ protected static final URIConverter DEFAULT_URI_CONVERTER = new ExtensibleURIConverterImpl();
+
+ /**
+ * A cache of resource bundles.
+ */
+ protected static final Map<URI, Map<Locale, ResourceBundleAndURI>> RESOURCE_BUNDLES = Collections
+ .synchronizedMap(new WeakHashMap<URI, Map<Locale, ResourceBundleAndURI>>());
+
+ /**
+ * The empty string.
+ */
+ public static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+ /**
+ * The platform line separator.
+ */
+ protected static final String LINE_SEPARATOR = System.getProperty(Platform.PREF_LINE_SEPARATOR);
+
+ /**
+ * The scheme for platform URIs.
+ */
+ public static final String URI_SCHEME_PLATFORM = "platform"; //$NON-NLS-1$
+
+ /**
+ * The first segment for platform plugin URIs.
+ */
+ public static final String URI_SEGMENT_PLUGIN = "plugin"; //$NON-NLS-1$
+
+ /**
+ * The first segment for platform resource URIs.
+ */
+ public static final String URI_SEGMENT_RESOURCE = "resource"; //$NON-NLS-1$
+
+ /**
+ * The standard extension for properties files.
+ */
+ public static final String PROPERTIES_FILE_EXTENSION = "properties"; //$NON-NLS-1$
+
+ /**
+ * Retrieves the candidate resource bundle URIs based on the specified base
+ * URI and base segment in the specified locale.
+ *
+ * @param baseURI
+ * The base URI (i.e. without the last segment) for the candidate
+ * resource bundle URIs.
+ * @param locale
+ * The locale within which to base the candidate resource bundle
+ * URIs.
+ * @param baseSegment
+ * The base segment (i.e. the last segment without the extension)
+ * for the candidate resource bundle URIs.
+ * @return The candidate resource bundle URIs with the base URI and base
+ * segment in the locale.
+ */
+ protected static List<URI> getResourceBundleURIs(final URI baseURI, final Locale locale, final String initialBaseSegment) {
+ String baseSegment = initialBaseSegment;
+ final List<URI> resourceBundleURIs = new ArrayList<URI>();
+ final String language = locale.getLanguage();
+
+ if (language.length() > 0) {
+ baseSegment += ('_' + language);
+ resourceBundleURIs.add(0,
+ baseURI.appendSegment(baseSegment).appendFileExtension(PROPERTIES_FILE_EXTENSION));
+
+ String country = locale.getCountry();
+
+ if (country.length() > 0) {
+ baseSegment += ('_' + country);
+ resourceBundleURIs.add(0,
+ baseURI.appendSegment(baseSegment).appendFileExtension(PROPERTIES_FILE_EXTENSION));
+
+ String variant = locale.getVariant();
+
+ if (variant.length() > 0) {
+ baseSegment += ('_' + variant);
+ resourceBundleURIs.add(0,
+ baseURI.appendSegment(baseSegment).appendFileExtension(PROPERTIES_FILE_EXTENSION));
+ }
+ }
+ }
+
+ return resourceBundleURIs;
+ }
+
+ /**
+ * Retrieves the candidate resource bundle URIs for the specified URI in the
+ * specified locale (if specified).
+ *
+ * @param uri
+ * The URI upon which to base the candidate resource bundle URIs.
+ * @param locale
+ * The locale within which to base the candidate resource bundle
+ * URIs, or <code>null</code>.
+ * @return The candidate resource bundle URIs for the URI in the locale (if
+ * specified).
+ */
+ protected static List<URI> getResourceBundleURIs(final URI uri, final Locale locale) {
+ final List<URI> resourceBundleURIs = new ArrayList<URI>();
+ final URI baseURI = uri.trimSegments(1);
+ final String baseSegment = uri.trimFileExtension().lastSegment();
+
+ if (null != baseSegment) {
+ resourceBundleURIs.add(baseURI.appendSegment(baseSegment).appendFileExtension(PROPERTIES_FILE_EXTENSION));
+
+ if (null != locale && !locale.toString().isEmpty()) {
+ resourceBundleURIs.addAll(0, getResourceBundleURIs(baseURI, locale, baseSegment));
+ }
+ }
+
+ return resourceBundleURIs;
+ }
+
+ /**
+ * Retrieves the (cached) resource bundle for the specified object,
+ * localized in the default locale if indicated.
+ *
+ * @param eObject
+ * The object for which to retrieve the resource bundle.
+ * @param localize
+ * Whether to retrieve the resource bundle based on (the default)
+ * locale.
+ * @return The resource bundle for the object (in the default locale).
+ */
+ public static ResourceBundleAndURI getResourceBundle(final EObject eObject, final boolean localize) {
+ return getResourceBundle(eObject, localize ? Locale.getDefault() : null);
+ }
+
+ /**
+ * Retrieves the (cached) resource bundle for the specified object in the
+ * specified locale (if specified).
+ *
+ * @param eObject
+ * The object for which to retrieve the resource bundle.
+ * @param locale
+ * The locale in which to retrieve the resource bundle, or
+ * <code>null</code>.
+ * @return The resource bundle for the object in the locale (if specified).
+ */
+ public static ResourceBundleAndURI getResourceBundle(final EObject eObject, final Locale locale) {
+ final Resource resource = eObject.eResource();
+
+ if (null != resource) {
+ return getResourceBundle(resource.getURI(), locale);
+ }
+ return null;
+ }
+
+ /**
+ * Retrieves the (cached) resource bundle for the specified object,
+ * localized in the default locale if indicated.
+ *
+ * @param uri
+ * The URI of the object to manage.
+ * @param localize
+ * Whether to retrieve the resource bundle based on (the default)
+ * locale.
+ * @return The resource bundle for the object (in the default locale).
+ */
+ public static ResourceBundleAndURI getResourceBundle(final URI uri, final boolean localize) {
+ return getResourceBundle(uri, localize ? Locale.getDefault() : null);
+ }
+
+ /**
+ * Retrieves the (cached) resource bundle for the specified object in the
+ * specified locale (if specified).
+ *
+ * @param uri
+ * The URI of the object to manage.
+ * @param locale
+ * The locale in which to retrieve the resource bundle, or
+ * <code>null</code>.
+ * @return The resource bundle for the object in the locale (if specified).
+ */
+ public static ResourceBundleAndURI getResourceBundle(final URI uri, final Locale locale) {
+ if (null != uri) {
+ Map<Locale, ResourceBundleAndURI> resourceBundles = RESOURCE_BUNDLES.get(uri);
+
+ if (null == resourceBundles) {
+ resourceBundles = Collections.synchronizedMap(new HashMap<Locale, ResourceBundleAndURI>());
+ RESOURCE_BUNDLES.put(uri, resourceBundles);
+ }
+
+ if (!resourceBundles.containsKey(locale)) {
+ URIConverter uriConverter = DEFAULT_URI_CONVERTER;
+
+ List<URI> resourceBundleURIs = getResourceBundleURIs(uri, locale);
+
+ if (EMFPlugin.IS_ECLIPSE_RUNNING) {
+ URI normalizedURI = uriConverter.normalize(uri);
+ int segmentCount = normalizedURI.segmentCount();
+
+ if (URI_SCHEME_PLATFORM.equals(normalizedURI.scheme()) && segmentCount > 2
+ && URI_SEGMENT_PLUGIN.equals(normalizedURI.segment(0))) {
+
+ Bundle bundle = Platform.getBundle(normalizedURI.segment(1));
+
+ if (null != bundle) {
+ Bundle[] fragments = Platform.getFragments(bundle);
+
+ if (null != fragments) {
+ String[] trailingSegments = normalizedURI.segmentsList().subList(2, segmentCount)
+ .toArray(new String[] {});
+
+ for (int f = 0; f < fragments.length; f++) {
+ resourceBundleURIs.addAll(0,
+ getResourceBundleURIs(normalizedURI.trimSegments(segmentCount - 1)
+ .appendSegment(fragments[f].getSymbolicName())
+ .appendSegments(trailingSegments), locale));
+ }
+ }
+ }
+ }
+ }
+
+ ResourceBundle resourceBundle = null;
+ ResourceBundleAndURI resourceBundleAndURI = null;
+
+ for (final Iterator<URI> rbu = resourceBundleURIs.iterator(); rbu.hasNext();) {
+
+ try {
+ final URI nextURI = rbu.next();
+ InputStream inputStream = uriConverter.createInputStream(nextURI);
+ try {
+ resourceBundle = new PropertyResourceBundle(inputStream);
+ resourceBundleAndURI = new ResourceBundleAndURI(resourceBundle, nextURI);
+ } finally {
+ inputStream.close();
+ }
+ break;
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+
+ resourceBundles.put(locale, resourceBundleAndURI);
+ }
+
+ return resourceBundles.get(locale);
+ }
+
+ return null;
+ }
+
+ public static URI getResourceBundleURIFromResourceURI(final URI resourceURI, final boolean localize){
+ return getResourceBundleURIFromResourceURI(resourceURI, localize ? Locale.getDefault() : null);
+ }
+
+ public static URI getResourceBundleURIFromResourceURI(final URI resourceURI, final Locale locale){
+ URI resultURI = null;
+
+ if (null != resourceURI) {
+ final Map<Locale, ResourceBundleAndURI> resourceBundlesUrisUsed = RESOURCE_BUNDLES.get(resourceURI);
+
+ if(null != resourceBundlesUrisUsed){
+ if(resourceBundlesUrisUsed.containsKey(locale)){
+ resultURI = resourceBundlesUrisUsed.get(locale).getUri();
+ }
+ }
+ }
+
+ return null != resultURI ? resultURI : resourceURI;
+ }
+
+ /**
+ * Retrieves a string for the specified object, localized if indicated.
+ *
+ * @param eObject
+ * The object for which to retrieve a (localized) string.
+ * @param key
+ * The key in the resource bundle.
+ * @param defaultString
+ * The string to return if no string for the given key can be
+ * found.
+ * @param localize
+ * Whether the string should be localized.
+ * @return The (localized) string.
+ */
+ public static String getString(EObject eObject, String key, String defaultString, boolean localize) {
+ String string = defaultString;
+
+ if (null != eObject) {
+
+ try {
+ ResourceBundleAndURI resourceBundleAndURI = getResourceBundle(eObject, localize);
+
+ if (null != resourceBundleAndURI) {
+ string = resourceBundleAndURI.getResourceBundle().getString(key);
+ }
+ } catch (MissingResourceException mre) {
+ // ignore
+ }
+ }
+
+ return string;
+ }
+
+ /**
+ * This allows to remove of the map the resource bundle.
+ *
+ * @param uri The URI of the resource to remove.
+ */
+ public static void removeResourceBundle(final URI uri){
+ if(RESOURCE_BUNDLES.containsKey(uri)){
+ RESOURCE_BUNDLES.remove(uri);
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/QualifiedNameUtils.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/QualifiedNameUtils.java
new file mode 100644
index 00000000000..c0d1d04accd
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/QualifiedNameUtils.java
@@ -0,0 +1,162 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ * The utils methods corresponding to the qualified name calculation for the
+ * {@linl EObject}.
+ */
+public class QualifiedNameUtils {
+
+ /**
+ * The separator for the qualified name for the properties file.
+ */
+ public static final String QN_SEPARATOR_FOR_PROPERTIES = "__"; //$NON-NLS-1$
+
+ /**
+ * The qualified name for the {@link EObject} in parameter.
+ *
+ * @param eObject
+ * The {@link EObject} to calculate qualified name.
+ * @return The qualified name for the EObject or the XMI:id if no feature
+ * name.
+ */
+ public static String getQualifiedName(final EObject eObject) {
+ StringBuilder result = new StringBuilder();
+
+ EObject parent = eObject;
+ boolean hasNotFoundName = false;
+
+ // Loop until no more parent to calculate qualified name
+ while (null != parent && !hasNotFoundName) {
+ hasNotFoundName = true;
+
+ // Get the name feature if existing
+ final EStructuralFeature feature = parent.eClass().getEStructuralFeature("name"); //$NON-NLS-1$
+ if (null != feature) {
+ Object featureValue = parent.eGet(feature);
+ if (featureValue instanceof String) {
+ result = appendQualifiedName(result, (String) featureValue);
+ hasNotFoundName = false;
+ }
+ }
+
+ parent = parent.eContainer();
+ }
+
+ // The feature name was not found for an EObject in hierarchy, return
+ // the xmi:id of the object
+ if (hasNotFoundName) {
+ if (eObject.eResource() instanceof XMIResource) {
+ result = new StringBuilder();
+ result.append(((XMIResource) eObject.eResource()).getID(eObject));
+ }
+ }
+
+ return result.toString();
+ }
+
+ /**
+ * This allows to append a string to the StringBuilder in parameter.
+ *
+ * @param initialStringBuilder
+ * The initial string builder.
+ * @param toAdd
+ * The string to add to string builder.
+ * @return The modified string builder.
+ */
+ private static StringBuilder appendQualifiedName(final StringBuilder initialStringBuilder, final String toAdd) {
+ StringBuilder result = new StringBuilder();
+ result.append(toAdd);
+ // If the initial string builder is not empty, add the qualified name
+ // separator
+ if (!initialStringBuilder.toString().isEmpty()) {
+ result.append(QN_SEPARATOR_FOR_PROPERTIES);
+ }
+ result.append(initialStringBuilder);
+ return result;
+ }
+
+ /**
+ * Get a diagram by its name.
+ *
+ * @param The
+ * EMF logical model.
+ * @param diagramName
+ * Name of the diagram. This is the name set by the user.
+ * @param qualifiedName
+ * The qualified name representing the diagram element or
+ * <code>null</code>.
+ * @return The found diagram or <code>null</code>.
+ */
+ public static Diagram getDiagram(final Resource resource, final String diagramName, final String qualifiedName) {
+ if (null != diagramName && !diagramName.isEmpty()) {
+ for (final EObject element : resource.getContents()) {
+ if (element instanceof Diagram) {
+ final Diagram diagram = (Diagram) element;
+
+ if (diagramName.equals(diagram.getName())) {
+ if (null == qualifiedName || qualifiedName.isEmpty()
+ || getQualifiedName(diagram.getElement()).equals(qualifiedName)) {
+ // Found
+ return diagram;
+ }
+ }
+ }
+ }
+ }
+
+ // not found
+ return null;
+ }
+
+ /**
+ * Get a table by its name.
+ *
+ * @param model
+ * The EMF logical model.
+ * @param tableName
+ * Name of the table. This is the name set by the user.
+ * @param qualifiedName
+ * The qualified name representing the table owner or
+ * <code>null</code>.
+ * @return The found diagram or <code>null</code>.
+ */
+ public static Table getTable(final Resource resource, final String tableName, final String qualifiedName) {
+ if (null != tableName && !tableName.isEmpty()) {
+ for (final EObject element : resource.getContents()) {
+ if (element instanceof Table) {
+ final Table table = (Table) element;
+
+ if (tableName.equals(table.getName())) {
+ // Found
+ if (null == qualifiedName || qualifiedName.isEmpty()
+ || getQualifiedName(table.getOwner()).equals(qualifiedName)) {
+ return table;
+ }
+ }
+ }
+ }
+ }
+ // not found
+ return null;
+ }
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/ResourceBundleAndURI.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/ResourceBundleAndURI.java
new file mode 100644
index 00000000000..3117ef5e238
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/org/eclipse/papyrus/infra/internationalization/utils/ResourceBundleAndURI.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST and others.
+ *
+ * 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 FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.internationalization.utils;
+
+import java.util.ResourceBundle;
+
+import org.eclipse.emf.common.util.URI;
+
+/**
+ * This class allows to store the resource bundle with the real uri
+ * corresponding.
+ */
+public class ResourceBundleAndURI {
+
+ /**
+ * The resource bundle.
+ */
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The uri of the resource.
+ */
+ private URI uri;
+
+ /**
+ * Constructor.
+ *
+ * @param resourceBundle
+ * The resource bundle.
+ * @param uri
+ * The uri of the resource.
+ */
+ public ResourceBundleAndURI(final ResourceBundle resourceBundle, final URI uri) {
+ this.resourceBundle = resourceBundle;
+ this.uri = uri;
+ }
+
+ /**
+ * Get the resource bundle.
+ *
+ * @return The resource bundle.
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ /**
+ * Set the resource bundle.
+ *
+ * @param resourceBundle
+ * The resource bundle.
+ */
+ public void setResourceBundle(final ResourceBundle resourceBundle) {
+ this.resourceBundle = resourceBundle;
+ }
+
+ /**
+ * Get the resource uri.
+ *
+ * @return The resource uri.
+ */
+ public URI getUri() {
+ return uri;
+ }
+
+ /**
+ * Set the resource uri.
+ *
+ * @param uri
+ * The resource uri.
+ */
+ public void setUri(final URI uri) {
+ this.uri = uri;
+ }
+
+}
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/InternationalizationPreferences.png b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/InternationalizationPreferences.png
new file mode 100644
index 00000000000..a3796931ef1
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/InternationalizationPreferences.png
Binary files differ
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/LabelsInternationalizationExample.png b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/LabelsInternationalizationExample.png
new file mode 100644
index 00000000000..9d4147d9d1a
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/LabelsInternationalizationExample.png
Binary files differ
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/PropertiesModelExplorer.png b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/PropertiesModelExplorer.png
new file mode 100644
index 00000000000..064464dcf77
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/images/PropertiesModelExplorer.png
Binary files differ
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev-toc.xml b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev-toc.xml
new file mode 100644
index 00000000000..555b1dbf2b2
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev-toc.xml
@@ -0,0 +1,22 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<toc label="internationalizationDev" link_to="../org.eclipse.papyrus.infra.doc/toc.xml#PapyrusDocDev" topic="src/site/mediawiki/internationalizationDev.html">
+ <topic href="src/site/mediawiki/internationalizationDev.html" label="Internationalization">
+ <topic href="src/site/mediawiki/internationalizationDev.html#Plugins" label="Plugins"></topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#How_to_use_internationalization" label="How to use internationalization">
+ <topic href="src/site/mediawiki/internationalizationDev.html#How_the_labels_are_managed_in_properties_file" label="How the labels are managed in properties file"></topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#Infra_.28Diagrams_and_Tables.29" label="Infra (Diagrams and Tables)"></topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#UML_Named_Elements" label="UML Named Elements"></topic>
+ </topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#Internationalization_preferences" label="Internationalization preferences"></topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#Control_mode" label="Control mode">
+ <topic href="src/site/mediawiki/internationalizationDev.html#What_is_it_managed" label="What is it managed"></topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#How_is_it_managed" label="How is it managed"></topic>
+ </topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#Specificities" label="Specificities">
+ <topic href="src/site/mediawiki/internationalizationDev.html#Loading_properties_resources" label="Loading properties resources"></topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#InternationalizationUMLItemProviderAdapterFactory" label="InternationalizationUMLItemProviderAdapterFactory"></topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#Diagram_and_Table_owner_QualifiedName" label="Diagram and Table owner QualifiedName"></topic>
+ <topic href="src/site/mediawiki/internationalizationDev.html#Editors" label="Editors"></topic>
+ </topic>
+ </topic>
+</toc>
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev.html b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev.html
new file mode 100644
index 00000000000..0e65f08f962
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev.html
@@ -0,0 +1,266 @@
+<?xml version='1.0' encoding='utf-8' ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+ </head>
+ <body>
+ <h1 id="Internationalization">Internationalization</h1>
+ <p>The internationalization is the way to manage your model with a specific language by labels. Like Eclipse, the internationalization is managed by the 'properties' file which are defined depending language as following (with for example, english language in US country):</p>
+ <ul>
+ <li>
+ <i>modelName</i>
+ <b>_en_US.properties</b>
+ </li>
+ <li>
+ <i>modelName</i>
+ <b>_en.properties</b>
+ </li>
+ <li>
+ <i>modelName</i>
+ <b>.properties</b>
+ </li>
+ </ul>
+ <p>
+ <img title="Properties files in Model Explorer" alt="Properties files in Model Explorer" border="1" src="images/PropertiesModelExplorer.png"/>
+ </p>
+ <h2 id="Plugins">Plugins</h2>
+ <p>The plugins for the internationalization are the following:</p>
+ <ul>
+ <li><code>org.eclipse.papyrus.infra.internationalization</code>: it contains:
+ <ul>
+ <li>Internationalization Meta-model</li>
+ <li>Generated code from the Meta-model</li>
+ <li>The model resources for the internationalization entries (key and label of internationalized objects) and internationalization preferences</li>
+ <li>Utils classes to manage the labels and the preferences</li>
+ </ul>
+ </li>
+ <li><code>org.eclipse.papyrus.infra.internationalization.edit</code>: contains generated edit code from the Meta-model</li>
+ <li><code>org.eclipse.papyrus.infra.internationalization.common</code>: contains all the common classes to manage command modification and some utils for the internationalization preferences. It contains the <code>IInternationalizationEditor</code> interface too which allows to define the editor that can be internationalized.</li>
+ <li><code>org.eclipse.papyrus.infra.internationalization.controlmode</code>: contains the needed elements to manage the control mode for the properties and the preferences files</li>
+ <li><code>org.eclipse.papyrus.infra.internationalization.ui</code>: contains the needed ui classes especially for the internationalization preferences</li>
+ <li><code>org.eclipse.papyrus.infra.internationalization.utils</code>: contains all the needed utils classes to manage the label which can be used to get the diagrams and tables labels</li>
+ <li><code>org.eclipse.papyrus.infra.editor.welcome.internationalization</code>: contains the needed classes to manage the preferences in the welcome page</li>
+ <li><code>org.eclipse.papyrus.uml.internationalization</code>: contains the UML internationalization model resource which can manage the UML elements in the properties file</li>
+ <li><code>org.eclipse.papyrus.uml.internationalization.edit</code>: contains the <code>InternationalizationUMLItemProviderAdapterFactory</code> which define the ItemProvider of UML elements to use the Papyrus getLabel function instead of UML getLabel function</li>
+ <li><code>org.eclipse.papyrus.uml.internationalization.utils</code>: contains all the needed utils classes to manage the label which can be used to get the named elements labels</li>
+ </ul>
+ <h2 id="How_to_use_internationalization">How to use internationalization</h2>
+ <p>Instead of name, the label of objects must be displayed in Papyrus.</p>
+ <h3 id="How_the_labels_are_managed_in_properties_file">How the labels are managed in properties file</h3>
+ <p>Each element which have a label must be written in the properties file like following:</p>
+ <ul>
+ <li>If this is a diagram:
+ <ul>
+ <li>
+ <b>_labelDiagram_</b>
+ <i>DiagramOwnerQualifiedName</i>
+ <b>_label_</b>
+ <i>DiagramName</i>
+ <b>=</b>
+ <i>DiagramLabel</i>
+ </li>
+ </ul>
+ </li>
+ <li>If this is a table:
+ <ul>
+ <li>
+ <b>_labelTable_</b>
+ <i>TableOwnerQualifiedName</i>
+ <b>_label_</b>
+ <i>TableName</i>
+ <b>=</b>
+ <i>TableLabel</i>
+ </li>
+ </ul>
+ </li>
+ <li>If this is an UML NamedElement:
+ <ul>
+ <li>
+ <b>_label_</b>
+ <i>NamedElementQualifiedName</i>
+ <b>=</b>
+ <i>NamedElementLabel</i>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ <p>
+ <img title="Example of internationalization labels" alt="Example of internationalization labels" border="1" src="images/LabelsInternationalizationExample.png"/>
+ </p>
+ <h3 id="Infra_.28Diagrams_and_Tables.29">Infra (Diagrams and Tables)</h3>
+ <p>For the Diagrams and the Tables, UML is not needed. So to use the internationalization, you just need to:</p>
+ <ul>
+ <li>add the org.eclipse.papyrus.infra.internationalization.utils dependency</li>
+ <li>use methods/functions of <code>LabelInternationalization</code></li>
+ </ul>
+ <p>The <code>LabelInternationalization</code> class contains the following needed methods/functions:</p>
+ <table class="wikitable" border="1">
+ <tr>
+ <th style="text-align: center;">Method/Function</th>
+ <th style="text-align: center;">Parameters</th>
+ <th style="text-align: center;">Description</th>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getInstance</th>
+ <td></td>
+ <td>The the instance of LabelInternationalization</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getDiagramLabelWithoutName</th>
+ <td>Diagram</td>
+ <td>Get the label of the diagram without getting its name if label is not available</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getDiagramLabel</th>
+ <td>Diagram</td>
+ <td>Get the label of the diagram or the name if the diagram label is not available</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">setDiagramLabel</th>
+ <td>Diagram, String, Locale</td>
+ <td>Set the label (in prameter) of the Diagram for the locale needed (if <code>null</code>, the current must be used) without using command</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getSetDiagramLabelCommand</th>
+ <td>EditingDomain, Diagram, String, Locale</td>
+ <td>Get the command to set the label (in prameter) of the Diagram for the locale needed (if <code>null</code>, the current must be used)</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getTableLabelWithoutName</th>
+ <td>Table</td>
+ <td>Get the label of the Table without getting its name if label is not available</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getTableLabel</th>
+ <td>Table</td>
+ <td>Get the label of the Table or the name if the Table label is not available</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">setDiagramLabel</th>
+ <td>Table, String, Locale</td>
+ <td>Set the label (in prameter) of the Table for the locale needed (if <code>null</code>, the current must be used) without using command</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getSetTableLabelCommand</th>
+ <td>EditingDomain, Table, String, Locale</td>
+ <td>Get the command to set the label (in prameter) of the Table for the locale needed (if <code>null</code>, the current must be used)</td>
+ </tr>
+ </table>
+ <h3 id="UML_Named_Elements">UML Named Elements</h3>
+ <p>For the UML NamedElement, to use the internationalization, you just need to:</p>
+ <ul>
+ <li>add the org.eclipse.papyrus.uml.internationalization.utils dependency</li>
+ <li>use the <code>UMLLabelInternationalization</code></li>
+ </ul>
+ <p>The <code>UMLLabelInternationalization</code> class contains following needed methods/functions:</p>
+ <table class="wikitable" border="1">
+ <tr>
+ <th style="text-align: center;">Method/Function</th>
+ <th style="text-align: center;">Parameters</th>
+ <th style="text-align: center;">Description</th>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getInstance</th>
+ <td></td>
+ <td>The the instance of LabelInternationalization</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getLabelWithoutName</th>
+ <td>NamedElement</td>
+ <td>Get the label of the NamedElement without getting its name if label is not available</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getLabel</th>
+ <td>NamedElement</td>
+ <td>Get the label of the NamedElement or the name if the NamedElement label is not available</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">setLabel</th>
+ <td>NamedElement, String, Locale</td>
+ <td>Set the label (in prameter) of the NamedElement for the locale needed (if <code>null</code>, the current must be used) without using command</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getSetLabelCommand</th>
+ <td>EditingDomain, NamedElement, String, Locale</td>
+ <td>Get the command to set the label (in prameter) of the NamedElement for the locale needed (if <code>null</code>, the current must be used)</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getKeywordWithoutName</th>
+ <td>Stereotype</td>
+ <td>Get the keyword of the Stereotype without getting its name if keyword is not available</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getKeyword</th>
+ <td>Stereotype</td>
+ <td>Get the keyword of the Stereotype or the name if the Stereotype keyword is not available</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">setKeyword</th>
+ <td>Stereotype, String, Locale</td>
+ <td>Set the keyword (in prameter) of the Stereotype for the locale needed (if <code>null</code>, the current must be used) without using command</td>
+ </tr>
+ <tr>
+ <th style="font-weight: bold;">getSetKeywordCommand</th>
+ <td>EditingDomain, Stereotype, String, Locale</td>
+ <td>Get the command to set the keyword (in prameter) of the Stereotype for the locale needed (if <code>null</code>, the current must be used)</td>
+ </tr>
+ </table>
+ <h2 id="Internationalization_preferences">Internationalization preferences</h2>
+ <p>Two preferences are managed in the papyrus model:</p>
+ <ul>
+ <li>useInternationalization: Boolean to determinate if the internationalization must be used</li>
+ <li>language: String to define the selected language for the internationalization</li>
+ </ul>
+ <p>The preferences are stored as EAnnotation:</p>
+ <ul>
+ <li>in the notation file in this is a private storage</li>
+ <li>in the metadata in this is not a private storage</li>
+ </ul>
+ <p>
+ <img title="Internationalization preferences management" alt="Internationalization preferences management" border="1" src="images/InternationalizationPreferences.png"/>
+ </p>
+ <p>Those preferences are managed in a <code>PreferenceStore</code> in the activator of org.eclipse.papyrus.infra.internationalization.common plugin.</p>
+ <h2 id="Control_mode">Control mode</h2>
+ <p>The sub-models are managed with the properties files.
+ Indeed, when an object is created as sub-model, the key representing this object or its descendance in the properties files must be moved in sub-properties files corresponding to the controlled object.
+ During this sub-model creation, the qualified names of the keys that are moved change, the new qualified names are calculated from the root of the sub-model.</p>
+ <h3 id="What_is_it_managed">What is it managed</h3>
+ <p>The managed files/objects are:</p>
+ <ul>
+ <li>The properties files and their keys</li>
+ <li>The notation and the internationalization preferences if this is private storage</li>
+ </ul>
+ <h3 id="How_is_it_managed">How is it managed</h3>
+ <p>The <code>org.eclipse.papyrus.infra.internationalization.controlmode</code> manage all the control mode for the internationalization.</p>
+ <p>The properties files are managed by:</p>
+ <ul>
+ <li><code>PropertiesControlParticipant</code> and <code>PropertiesUncontrolParticipant</code> for the participants</li>
+ <li><code>CreatePropertiesControlResourceCommand</code> which define the command to create the controlled properties file</li>
+ <li><code>RemovePropertiesControlResourceCommand</code> which define the command to delete the controlled properties file</li>
+ <li><code>ControlPropertiesCommand</code> which define the command to manage the internationalization entries to move into the controlled properties</li>
+ </ul>
+ <p>The notation and the internationalization preference storage are managed by:</p>
+ <ul>
+ <li><code>InternationalizationAnnotationControlParticipant</code> for the participant (uncontrolled is not needed because the parent is priority)</li>
+ <li><code>InternationalizationAnnotationCommand</code> which define the command to create the internationalization preference into the controlled notation file</li>
+ </ul>
+ <h2 id="Specificities">Specificities</h2>
+ <h3 id="Loading_properties_resources">Loading properties resources</h3>
+ <p>The properties resources are loaded and managed by the <code>UMLInternationalizationModelResource</code> class.
+ This <code>UMLInternationalizationModelResource</code> class inherit from <code>InternationalizationModelResource</code> from infra plugins.
+ The load is managed as 2 steps:</p>
+ <ol>
+ <li>Load the file and read the content to create the <code>InternationalizationLibrary</code> with diagrams and tables labels reconciliation with existing diagrams and tables.</li>
+ <li>Loop on content to resolve the UML dependencies in properties files to reference the existing UML objects.</li>
+ </ol>
+ <p>So, after the load, the resolveable properties are managed as UML object, diagram or table as key of <code>InternationalizationLibrary</code></p>
+ <h3 id="InternationalizationUMLItemProviderAdapterFactory">InternationalizationUMLItemProviderAdapterFactory</h3>
+ <p>The <code>InternationalizationUMLItemProviderAdapterFactory</code> extends <code>UMLItemProviderAdapterFactory</code> and allows to redefine the ItemProvider of UML elements to get the papyrus internationalization getLabel instead of UML getLabel.</p>
+ <p>If an ItemProvider of UML element need to be redefined, the ItemProviderAdapterFactory must ihnerit from this class instead of <code>UMLItemProviderAdapterFactory</code>.</p>
+ <h3 id="Diagram_and_Table_owner_QualifiedName">Diagram and Table owner QualifiedName</h3>
+ <p>The diagrams and the tables are managed in the infra plugins, however, the owner of the diagram or table must be serialized in the properties file by its QualifiedName. So the owner QualifiedName is managed by the class <code>QualifiedNameUtils</code> and calculated manually.</p>
+ <h3 id="Editors">Editors</h3>
+ <p>The diagrams and tables are managed by the internationalization. To do this, the diagram and table editor must inherit from <code>IInternationalizationEditor</code> which allows to modify part name and refresh the editor with the label.
+ If any new editor is comming with internationalization management, this one must ihnerit from <code>IInternationalizationEditor</code> too.</p>
+ </body>
+</html> \ No newline at end of file
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev.mediawiki b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev.mediawiki
new file mode 100644
index 00000000000..608b244fa9b
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.internationalization/src/site/mediawiki/internationalizationDev.mediawiki
@@ -0,0 +1,197 @@
+= Internationalization =
+The internationalization is the way to manage your model with a specific language by labels. Like Eclipse, the internationalization is managed by the 'properties' file which are defined depending language as following (with for example, english language in US country):
+* ''modelName'''''_en_US.properties'''
+* ''modelName'''''_en.properties'''
+* ''modelName'''''.properties'''
+
+[[Image:images/PropertiesModelExplorer.png|frame|none|Properties files in Model Explorer]]
+
+== Plugins ==
+The plugins for the internationalization are the following:
+* <code>org.eclipse.papyrus.infra.internationalization</code>: it contains:
+** Internationalization Meta-model
+** Generated code from the Meta-model
+** The model resources for the internationalization entries (key and label of internationalized objects) and internationalization preferences
+** Utils classes to manage the labels and the preferences
+* <code>org.eclipse.papyrus.infra.internationalization.edit</code>: contains generated edit code from the Meta-model
+* <code>org.eclipse.papyrus.infra.internationalization.common</code>: contains all the common classes to manage command modification and some utils for the internationalization preferences. It contains the <code>IInternationalizationEditor</code> interface too which allows to define the editor that can be internationalized.
+* <code>org.eclipse.papyrus.infra.internationalization.controlmode</code>: contains the needed elements to manage the control mode for the properties and the preferences files
+* <code>org.eclipse.papyrus.infra.internationalization.ui</code>: contains the needed ui classes especially for the internationalization preferences
+* <code>org.eclipse.papyrus.infra.internationalization.utils</code>: contains all the needed utils classes to manage the label which can be used to get the diagrams and tables labels
+* <code>org.eclipse.papyrus.infra.editor.welcome.internationalization</code>: contains the needed classes to manage the preferences in the welcome page
+* <code>org.eclipse.papyrus.uml.internationalization</code>: contains the UML internationalization model resource which can manage the UML elements in the properties file
+* <code>org.eclipse.papyrus.uml.internationalization.edit</code>: contains the <code>InternationalizationUMLItemProviderAdapterFactory</code> which define the ItemProvider of UML elements to use the Papyrus getLabel function instead of UML getLabel function
+* <code>org.eclipse.papyrus.uml.internationalization.utils</code>: contains all the needed utils classes to manage the label which can be used to get the named elements labels
+
+== How to use internationalization ==
+Instead of name, the label of objects must be displayed in Papyrus.
+
+=== How the labels are managed in properties file ===
+Each element which have a label must be written in the properties file as following:
+* If this is a diagram:
+** '''_labelDiagram_'''''DiagramOwnerQualifiedName'''''_label_'''''DiagramName'' '''=''' ''DiagramLabel''
+* If this is a table:
+** '''_labelTable_'''''TableOwnerQualifiedName'''''_label_'''''TableName'' '''=''' ''TableLabel''
+* If this is an UML NamedElement:
+** '''_label_'''''NamedElementQualifiedName'' '''=''' ''NamedElementLabel''
+
+[[Image:images/LabelsInternationalizationExample.png|frame|none|Example of internationalization labels]]
+
+=== Infra (Diagrams and Tables) ===
+For the Diagrams and the Tables, UML is not needed. So to use the internationalization, you just need to:
+* add the org.eclipse.papyrus.infra.internationalization.utils dependency
+* use methods/functions of <code>LabelInternationalization</code>
+
+The <code>LabelInternationalization</code> class contains the following needed methods/functions:
+{| class="wikitable" border="1"
+! style="text-align: center;" | Method/Function
+! style="text-align: center;" | Parameters
+! style="text-align: center;" | Description
+|-
+! style="font-weight: bold;" | getInstance
+|
+| The the instance of LabelInternationalization
+|-
+! style="font-weight: bold;" | getDiagramLabelWithoutName
+| Diagram
+| Get the label of the diagram without getting its name if label is not available
+|-
+! style="font-weight: bold;" | getDiagramLabel
+| Diagram
+| Get the label of the diagram or the name if the diagram label is not available
+|-
+! style="font-weight: bold;" | setDiagramLabel
+| Diagram, String, Locale
+| Set the label (in parameter) of the Diagram for the locale needed (if <code>null</code>, the current must be used) without using command
+|-
+! style="font-weight: bold;" | getSetDiagramLabelCommand
+| EditingDomain, Diagram, String, Locale
+| Get the command to set the label (in parameter) of the Diagram for the locale needed (if <code>null</code>, the current must be used)
+|-
+! style="font-weight: bold;" | getTableLabelWithoutName
+| Table
+| Get the label of the Table without getting its name if label is not available
+|-
+! style="font-weight: bold;" | getTableLabel
+| Table
+| Get the label of the Table or the name if the Table label is not available
+|-
+! style="font-weight: bold;" | setDiagramLabel
+| Table, String, Locale
+| Set the label (in prameter) of the Table for the locale needed (if <code>null</code>, the current must be used) without using command
+|-
+! style="font-weight: bold;" | getSetTableLabelCommand
+| EditingDomain, Table, String, Locale
+| Get the command to set the label (in parameter) of the Table for the locale needed (if <code>null</code>, the current must be used)
+|}
+
+=== UML Named Elements ===
+For the UML NamedElement, to use the internationalization, you just need to:
+* add the org.eclipse.papyrus.uml.internationalization.utils dependency
+* use the <code>UMLLabelInternationalization</code>
+
+The <code>UMLLabelInternationalization</code> class contains following needed methods/functions:
+{| class="wikitable" border="1"
+! style="text-align: center;" | Method/Function
+! style="text-align: center;" | Parameters
+! style="text-align: center;" | Description
+|-
+! style="font-weight: bold;" | getInstance
+|
+| The the instance of LabelInternationalization
+|-
+! style="font-weight: bold;" | getLabelWithoutName
+| NamedElement
+| Get the label of the NamedElement without getting its name if label is not available
+|-
+! style="font-weight: bold;" | getLabel
+| NamedElement
+| Get the label of the NamedElement or the name if the NamedElement label is not available
+|-
+! style="font-weight: bold;" | setLabel
+| NamedElement, String, Locale
+| Set the label (in parameter) of the NamedElement for the locale needed (if <code>null</code>, the current must be used) without using command
+|-
+! style="font-weight: bold;" | getSetLabelCommand
+| EditingDomain, NamedElement, String, Locale
+| Get the command to set the label (in parameter) of the NamedElement for the locale needed (if <code>null</code>, the current must be used)
+|-
+! style="font-weight: bold;" | getKeywordWithoutName
+| Stereotype
+| Get the keyword of the Stereotype without getting its name if keyword is not available
+|-
+! style="font-weight: bold;" | getKeyword
+| Stereotype
+| Get the keyword of the Stereotype or the name if the Stereotype keyword is not available
+|-
+! style="font-weight: bold;" | setKeyword
+| Stereotype, String, Locale
+| Set the keyword (in parameter) of the Stereotype for the locale needed (if <code>null</code>, the current must be used) without using command
+|-
+! style="font-weight: bold;" | getSetKeywordCommand
+| EditingDomain, Stereotype, String, Locale
+| Get the command to set the keyword (in parameter) of the Stereotype for the locale needed (if <code>null</code>, the current must be used)
+|}
+
+== Internationalization preferences ==
+Two preferences are managed in the Papyrus model:
+* useInternationalization: Boolean to determinate if the internationalization must be used
+* language: String to define the selected language for the internationalization
+
+
+The preferences are stored as EAnnotation:
+* in the notation file in this is a private storage
+* in the metadata in this is not a private storage
+
+
+[[Image:images/InternationalizationPreferences.png|frame|none|Internationalization preferences management]]
+
+
+Those preferences are managed in a <code>PreferenceStore</code> in the activator of org.eclipse.papyrus.infra.internationalization.common plugin.
+
+The <code>PapyrusProjectScope</code> allows to manage the preferences for the Eclipse project with Papyrus model name.
+
+== Control mode ==
+The sub-models are managed with the properties files.
+Indeed, when an object is created as sub-model, the key representing this object or its descendance in the properties files must be moved in sub-properties files corresponding to the controlled object.
+During this sub-model creation, the qualified names of the keys that are moved change, the new qualified names are calculated from the root of the sub-model.
+
+=== What is it managed ===
+The managed files/objects are:
+* The properties files and their keys
+* The notation and the internationalization preferences if this is private storage
+
+=== How is it managed ===
+The <code>org.eclipse.papyrus.infra.internationalization.controlmode</code> manage all the control mode for the internationalization.
+
+The properties files are managed by:
+* <code>PropertiesControlParticipant</code> and <code>PropertiesUncontrolParticipant</code> for the participants
+* <code>CreatePropertiesControlResourceCommand</code> which define the command to create the controlled properties file
+* <code>RemovePropertiesControlResourceCommand</code> which define the command to delete the controlled properties file
+* <code>ControlPropertiesCommand</code> which define the command to manage the internationalization entries to move into the controlled properties
+
+The notation and the internationalization preference storage are managed by:
+* <code>InternationalizationAnnotationControlParticipant</code> for the participant (uncontrolled is not needed because the parent is priority)
+* <code>InternationalizationAnnotationCommand</code> which define the command to create the internationalization preference into the controlled notation file
+
+== Specificities ==
+=== Loading properties resources ===
+The properties resources are loaded and managed by the <code>UMLInternationalizationModelResource</code> class.
+This <code>UMLInternationalizationModelResource</code> class inherit from <code>InternationalizationModelResource</code> from infra plugins.
+The load is managed as 2 steps:
+# Load the file and read the content to create the <code>InternationalizationLibrary</code> with diagrams and tables labels reconciliation with existing diagrams and tables.
+# Loop on content to resolve the UML dependencies in properties files to reference the existing UML objects.
+
+So, after the load, the resolveable properties are managed as UML object, diagram or table as key of <code>InternationalizationLibrary</code>
+
+=== InternationalizationUMLItemProviderAdapterFactory ===
+The <code>InternationalizationUMLItemProviderAdapterFactory</code> extends <code>UMLItemProviderAdapterFactory</code> and allows to redefine the ItemProvider of UML elements to get the Papyrus internationalization getLabel instead of UML getLabel.
+
+If an ItemProvider of UML element needs to be redefined, the ItemProviderAdapterFactory must ihnerit from this class instead of <code>UMLItemProviderAdapterFactory</code>.
+
+=== Diagram and Table owner QualifiedName ===
+The diagrams and the tables are managed in the infra plugins, however, the owner of the diagram or table must be serialized in the properties file by its QualifiedName. So the owner QualifiedName is managed by the class <code>QualifiedNameUtils</code> and calculated manually.
+
+=== Editors ===
+The diagrams and tables are managed by the internationalization. To do this, the diagram and table editor must inherit from <code>IInternationalizationEditor</code> which allows to modify part name and refresh the editor with the label.
+If any new editor is comming with internationalization management, this one must ihnerit from <code>IInternationalizationEditor</code> too. \ No newline at end of file
diff --git a/plugins/infra/internationalization/pom.xml b/plugins/infra/internationalization/pom.xml
new file mode 100644
index 00000000000..7c0b3134b06
--- /dev/null
+++ b/plugins/infra/internationalization/pom.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra-internationalization</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>Papyrus Internationalization</name>
+ <description>Papyrus Internationalization plugins.</description>
+
+ <modules>
+ <module>org.eclipse.papyrus.infra.internationalization</module>
+ <module>org.eclipse.papyrus.infra.internationalization.edit</module>
+ <module>org.eclipse.papyrus.infra.internationalization.utils</module>
+ <module>org.eclipse.papyrus.infra.internationalization.ui</module>
+ <module>org.eclipse.papyrus.infra.internationalization.controlmode</module>
+ <module>org.eclipse.papyrus.infra.internationalization.common</module>
+ <module>org.eclipse.papyrus.infra.editor.welcome.internationalization</module>
+ </modules>
+
+
+</project> \ No newline at end of file

Back to the top