Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-01-17 17:28:49 +0000
committerChristian W. Damus2016-01-22 15:57:12 +0000
commit652333238a0a1651c1b69a4563b72961250c5398 (patch)
tree36c503855e644803f2baeec27c47bb6d6ac56085 /plugins/infra/emf
parentb089eab1fca586752027404cc398a173237337f8 (diff)
downloadorg.eclipse.papyrus-652333238a0a1651c1b69a4563b72961250c5398.tar.gz
org.eclipse.papyrus-652333238a0a1651c1b69a4563b72961250c5398.tar.xz
org.eclipse.papyrus-652333238a0a1651c1b69a4563b72961250c5398.zip
Bug 485220: [Architecture] Provide a more modular architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485220 Move UI-dependent APIs from the org.eclipse.papyrus.infra.emf bundle to a new org.eclipse.papyrus.infra.ui.emf bundle. Accordingly move tests into a new org.eclipse.papyrus.infra.ui.emf.tests bundle. Now that we have an UI EMF bundle, move the editor-page advices from the infra.ui bundle into it, which is a more appropriate home for them. One UI dependency is removed by reordering of code in the EMFHelper::getEObject(Object) API: * the EMF Facet tree elements are once again IAdaptables, providing their encapsulated EObjects or EReferences as adapters. So, the case handling IAdaptable is moved ahead of the test for is-an-EObject because these tree elements are also EObjects but are not interesting in themselves Also, the dialog-settings for the EMF Facet customization manager are moved into the infra.ui.emf bundle, as is the lazy initialization of the manager from those settings. Clients are refactored to get the customization manager from this new bundle (via a new ProviderHelper API) to ensure this lazy initialization. Various UI-dependent ServiceUtilsForXyz classes that were in the infra.emf bundle but had nothing to do with EMF are moved into the infra.ui bundle. UI-dependent classes from the org.eclipse.papyrus.infra.emf.readonly bundle are moved into the org.eclipse.papyrus.infra.ui.emf, also. These include extraction of the editor reload listener from the ReadOnlyManager class by means of a new general-purpose IReadOnlyManagerProcessor OSGi service interface. Tests all still pass (inasmuch as they do in the nightly master builds). Change-Id: Ieb0993b2ed1a7a49890d3471c7b42bc4f218fec6
Diffstat (limited to 'plugins/infra/emf')
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.classpath14
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF9
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/build.properties3
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml96
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java20
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java1
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java116
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java22
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/ControlledResourceTracker.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ControlledResourceTracker.java)20
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/Messages.java34
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/messages.properties14
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/spi/IReadOnlyManagerProcessor.java41
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/.classpath2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF13
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml25
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java196
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java15
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties9
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFFileUtil.java2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java19
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java118
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForIEvaluationContext.java107
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java59
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.classpath7
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.project28
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.settings/org.eclipse.jdt.core.prefs291
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/META-INF/MANIFEST.MF38
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/about.html28
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/build.properties10
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/icons/enable_write.png (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/icons/enable_write.png)bin3321 -> 3321 bytes
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/plugin.properties13
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/plugin.xml153
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/pom.xml14
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/adapters/EObjectAdapterFactory.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/EObjectAdapterFactory.java)18
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/AnnotationObservableValue.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/AnnotationObservableValue.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/EMFObservableList.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java)810
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/EMFObservableValue.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableValue.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/dialog/CommandCreationProgressMonitorDialog.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/CommandCreationProgressMonitorDialog.java)204
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/dialog/NestedEditingDialogContext.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/NestedEditingDialogContext.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/AdapterFactoryHierarchicContentProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/AdapterFactoryHierarchicContentProvider.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/AnyTypeLabelProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/AnyTypeLabelProvider.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFContentProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java)6
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFEnumeratorContentProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFEnumeratorContentProvider.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFFilteredLabelProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFGraphicalContentProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java)4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFLabelProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java)4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/HistoryContentProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/HistoryContentProvider.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/MoDiscoContentProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java)4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/ResourceFilteredLabelProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ResourceFilteredLabelProvider.java)6
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/SemanticFromModelExplorer.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/SemanticFromModelExplorer.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/StandardEMFLabelProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/strategy/ContainmentBrowseStrategy.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/ContainmentBrowseStrategy.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/strategy/SemanticEMFContentProvider.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/SemanticEMFContentProvider.java)4
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/utils/ProviderHelper.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java)132
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/Activator.java196
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/expressions/ReadOnlyTester.java39
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/messages/Messages.java47
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/messages/messages.properties22
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/EditorReloadProcessor.java131
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/EnableWriteCommandHandler.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteCommandHandler.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/FSReadOnlyHandler.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java)2
-rw-r--r--plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/ReferencedModelReadOnlyHandler.java (renamed from plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java)10
66 files changed, 1878 insertions, 1404 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
index 65cc2685b15..ae4978c24d0 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.diagram.common/src/org/eclipse/papyrus/infra/emf/diagram/common/handler/CreateDiagramHandler.java
@@ -27,9 +27,9 @@ import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
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.ServiceUtilsForHandlers;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.ui.extension.diagrameditor.IPluggableEditorFactory;
+import org.eclipse.papyrus.infra.ui.util.ServiceUtilsForHandlers;
/**
* Base class for create diagram Handlers.
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.classpath b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.classpath
index 2d1a4302f04..eca7bdba8f0 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.classpath
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?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/emf/org.eclipse.papyrus.infra.emf.readonly/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.settings/org.eclipse.jdt.core.prefs
index 4759947300a..62a08f4494d 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.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.5
+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
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF
index 5f652aca106..ea8d0941c57 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF
@@ -1,18 +1,17 @@
Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.infra.emf.readonly,
- org.eclipse.papyrus.infra.emf.readonly.handlers
+ org.eclipse.papyrus.infra.emf.readonly.internal;x-friends:="org.eclipse.papyrus.infra.ui.emf",
+ org.eclipse.papyrus.infra.emf.readonly.spi
Require-Bundle: org.eclipse.papyrus.infra.onefile;bundle-version="1.2.0",
org.eclipse.core.expressions;bundle-version="3.4.300",
org.eclipse.emf.workspace;bundle-version="1.4.0",
org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
- org.eclipse.ui,
org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.infra.tools;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.ui;bundle-version="1.2.0"
+ org.eclipse.papyrus.infra.tools;bundle-version="1.2.0"
Bundle-Vendor: %providerName
Bundle-ActivationPolicy: lazy
Bundle-Version: 1.2.0.qualifier
@@ -21,4 +20,4 @@ Bundle-Localization: plugin
Bundle-ManifestVersion: 2
Bundle-Activator: org.eclipse.papyrus.infra.emf.readonly.Activator
Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.readonly;singleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/build.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/build.properties
index f4a44a8a2a1..89c53054ee2 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/build.properties
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/build.properties
@@ -5,6 +5,5 @@ bin.includes = META-INF/,\
plugin.xml,\
plugin.properties,\
about.html,\
- schema/,\
- icons/
+ schema/
src.includes = about.html
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
index 3d9bc8ca18f..9d985cdebac 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/plugin.xml
@@ -5,22 +5,6 @@
<extension
point="org.eclipse.papyrus.infra.emf.readonly.readOnlyHandler">
<readOnlyHandler
- class="org.eclipse.papyrus.infra.emf.readonly.ReferencedModelReadOnlyHandler"
- id="org.eclipse.papyrus.infra.emf.readonly.ReferencedModelReadOnlyHandler"
- priority="15">
- <affinity
- axis="discretion">
- </affinity>
- </readOnlyHandler>
- <readOnlyHandler
- class="org.eclipse.papyrus.infra.emf.readonly.FSReadOnlyHandler"
- id="org.eclipse.papyrus.infra.emf.readonly.FSReadOnlyHandler"
- priority="10">
- <affinity
- axis="permission">
- </affinity>
- </readOnlyHandler>
- <readOnlyHandler
class="org.eclipse.papyrus.infra.emf.readonly.EMFReadOnlyHandler"
id="org.eclipse.papyrus.infra.emf.readonly.EMFReadOnlyHandler"
priority="5">
@@ -36,84 +20,6 @@
</affinity>
</readOnlyHandler>
</extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.infra.emf.readonly.handlers.EnableWriteCommandHandler"
- commandId="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand">
- <enabledWhen>
- <and>
- <with variable="activeEditorId">
- <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/>
- </with>
- <with
- variable="selection">
- <test
- property="org.eclipse.papyrus.infra.emf.readonly.tester.isReadOnly"
- value="true">
- </test>
- <count
- value="1">
- </count>
- </with>
- </and>
- </enabledWhen>
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- description="Enable write"
- categoryId="org.eclipse.papyrus.editor.category"
- id="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand"
- name="Enable write">
- </command>
- </extension>
-
-<extension
- point="org.eclipse.ui.menus">
-
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup?after=tools">
- <command commandId="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand"
- icon="icons/enable_write.png"
- label="Enable write"
- style="push"
- tooltip="Enable write">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
- <menuContribution locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?endof=fileMenu"
- allPopups="false">
- <command commandId="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand"
- icon="icons/enable_write.png"
- label="Enable write"
- style="push"
- tooltip="Enable write">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </menuContribution>
-
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
- <toolbar id="org.eclipse.papyrus.infra.emf.readonly.toolbar">
- <command commandId="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand"
- icon="icons/enable_write.png"
- label="Enable write"
- style="push"
- tooltip="Enable write">
- <visibleWhen>
- <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
- </visibleWhen>
- </command>
- </toolbar>
- </menuContribution>
- </extension>
<extension
point="org.eclipse.papyrus.infra.core.transactionalEditingDomainProvider">
<transactionalEditingDomainProvider
@@ -128,7 +34,7 @@
id="org.eclipse.papyrus.infra.emf.readonly.tester"
namespace="org.eclipse.papyrus.infra.emf.readonly.tester"
properties="isReadOnly,canMakeWritable"
- type="org.eclipse.jface.viewers.IStructuredSelection">
+ type="org.eclipse.emf.ecore.EObject">
</propertyTester>
</extension>
<extension
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java
index eebb9793f98..5edfee6fab2 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/Activator.java
@@ -14,13 +14,17 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.concurrent.Executor;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.papyrus.infra.core.log.LogHelper;
import org.eclipse.papyrus.infra.core.resource.AbstractReadOnlyHandler;
+import org.eclipse.papyrus.infra.emf.readonly.spi.IReadOnlyManagerProcessor;
import org.eclipse.papyrus.infra.tools.util.CoreExecutors;
import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
/**
* The activator class controls the plug-in life cycle
@@ -37,8 +41,12 @@ public class Activator extends Plugin {
public static LogHelper log;
+ private static final IReadOnlyManagerProcessor[] NO_PROCESSORS = {};
+
private Executor readOnlyCacheExecutor;
+ private ServiceTracker<IReadOnlyManagerProcessor, IReadOnlyManagerProcessor> roManagerProcessorTracker;
+
/**
* The constructor
*/
@@ -50,10 +58,16 @@ public class Activator extends Plugin {
super.start(context);
plugin = this;
log = new LogHelper(this);
+
+ roManagerProcessorTracker = new ServiceTracker<>(context, IReadOnlyManagerProcessor.class, null);
+ roManagerProcessorTracker.open();
}
@Override
public void stop(BundleContext context) throws Exception {
+ roManagerProcessorTracker.close();
+ roManagerProcessorTracker = null;
+
plugin = null;
super.stop(context);
}
@@ -97,4 +111,10 @@ public class Activator extends Plugin {
return result;
}
+
+ Iterable<IReadOnlyManagerProcessor> getReadOnlyManagerProcessors() {
+ IReadOnlyManagerProcessor[] processors = roManagerProcessorTracker.getServices(NO_PROCESSORS);
+
+ return (processors == null) ? Collections.emptyList() : Arrays.asList(processors);
+ }
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
index b8423baf54d..80912555eb0 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/PapyrusROTransactionalEditingDomain.java
@@ -61,6 +61,7 @@ import org.eclipse.papyrus.infra.core.resource.ResourceAdapter;
import org.eclipse.papyrus.infra.core.resource.RollbackStatus;
import org.eclipse.papyrus.infra.core.utils.TransactionHelper;
import org.eclipse.papyrus.infra.emf.edit.domain.PapyrusTransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.readonly.internal.ControlledResourceTracker;
import org.eclipse.papyrus.infra.onefile.model.IPapyrusFile;
import org.eclipse.papyrus.infra.onefile.model.PapyrusModelHelper;
import org.eclipse.papyrus.infra.onefile.utils.OneFileUtils;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
index 1377317e949..83d35ab9af5 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyManager.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011, 2015 Atos Origin, CEA, Christian W. Damus, and others.
- *
+ * Copyright (c) 2011, 2016 Atos Origin, CEA, 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
@@ -10,12 +9,8 @@
* Contributors:
* Mathieu Velten (Atos Origin) mathieu.velten@atosorigin.com - Initial API and implementation
* Christian W. Damus (CEA) - support non-IFile resources and object-level permissions (CDO)
- * Christian W. Damus (CEA) - bug 323802
- * Christian W. Damus (CEA) - bug 429826
- * Christian W. Damus (CEA) - bug 422257
- * Christian W. Damus (CEA) - bug 437217
- * Christian W. Damus - bug 457560
- * Christian W. Damus - bug 463564
+ * Christian W. Damus (CEA) - bugs 323802, 429826, 422257, 437217
+ * Christian W. Damus - bugs 457560, 463564, 485220
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf.readonly;
@@ -24,6 +19,7 @@ import static org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis.permissionAxe
import java.lang.reflect.Constructor;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.EnumMap;
import java.util.EnumSet;
@@ -41,29 +37,20 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.infra.core.resource.AbstractReadOnlyHandler;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyListener;
import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
import org.eclipse.papyrus.infra.core.resource.ReadOnlyEvent;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.utils.AdapterUtils;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
-import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor;
-import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadEvent;
-import org.eclipse.papyrus.infra.ui.editor.reload.IEditorReloadListener;
-import org.eclipse.papyrus.infra.ui.editor.reload.IReloadContextProvider;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
import com.google.common.collect.MapMaker;
-import com.google.common.collect.Maps;
-public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener {
+public class ReadOnlyManager implements IReadOnlyHandler2 {
// Use weak values because the values otherwise retain the keys (indirectly)
protected static final ConcurrentMap<EditingDomain, IReadOnlyHandler2> roHandlers = new MapMaker().weakKeys().weakValues().makeMap();
@@ -81,6 +68,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
roHandler = roHandlers.get(editingDomain);
if (roHandler == null) {
roHandler = new ReadOnlyManager(editingDomain);
+ process((ReadOnlyManager) roHandler, editingDomain);
IReadOnlyHandler2 existing = roHandlers.putIfAbsent(editingDomain, roHandler);
if (existing != null) {
// Another thread beat us to it since we checked for an existing instance
@@ -93,6 +81,10 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
return roHandler;
}
+ private static void process(ReadOnlyManager manager, EditingDomain domain) {
+ Activator.getDefault().getReadOnlyManagerProcessors().forEach(p -> p.processReadOnlyManager(manager, domain));
+ }
+
protected static class HandlerPriorityPair implements Comparable<HandlerPriorityPair> {
public Class<?> handlerClass;
@@ -101,6 +93,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
public Set<ReadOnlyAxis> axes;
+ @Override
public int compareTo(HandlerPriorityPair o) {
if (o.priority > priority) {
return 1;
@@ -216,6 +209,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
final Map<ReadOnlyAxis, List<IReadOnlyHandler2>> handlers = new EnumMap<ReadOnlyAxis, List<IReadOnlyHandler2>>(ReadOnlyAxis.class);
cache.run(new Runnable() {
+ @Override
public void run() {
for (Map.Entry<Class<?>, Set<ReadOnlyAxis>> roClass : orderedHandlerClasses.entrySet()) {
IReadOnlyHandler2 h = create(roClass.getKey(), editingDomain);
@@ -245,21 +239,9 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
orderedHandlersByAxis.put(axis, list.toArray(new IReadOnlyHandler2[list.size()]));
}
}
-
- // Is this editing domain associated with an editor?
- try {
- IMultiDiagramEditor editor = ServiceUtilsForResourceSet.getInstance().getService(IMultiDiagramEditor.class, editingDomain.getResourceSet());
- if (editor != null) {
- IReloadableEditor reloadable = IReloadableEditor.Adapter.getAdapter(editor);
- if (reloadable != null) {
- reloadable.addEditorReloadListener(this);
- }
- }
- } catch (ServiceException e) {
- // That's OK. We're not in the context of an editor
- }
}
+ @Override
public Optional<Boolean> anyReadOnly(Set<ReadOnlyAxis> axes, URI[] uris) {
final Set<URI> uriSet = ImmutableSet.copyOf(uris);
Optional<Boolean> result = cache.getResources(axes, uriSet);
@@ -297,6 +279,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
return result.isPresent() ? result : Optional.of(Boolean.FALSE);
}
+ @Override
public Optional<Boolean> isReadOnly(Set<ReadOnlyAxis> axes, EObject eObject) {
Optional<Boolean> result = cache.getObject(axes, eObject);
if (result == null) {
@@ -332,6 +315,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
return result.isPresent() ? result : Optional.of(Boolean.FALSE);
}
+ @Override
public Optional<Boolean> makeWritable(Set<ReadOnlyAxis> axes, URI[] uris) {
Boolean finalResult = true;
@@ -370,6 +354,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
return finalResult;
}
+ @Override
public Optional<Boolean> makeWritable(Set<ReadOnlyAxis> axes, EObject eObject) {
Boolean finalResult = true;
@@ -408,6 +393,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
return finalResult;
}
+ @Override
public Optional<Boolean> canMakeWritable(Set<ReadOnlyAxis> axes, URI[] uris) {
Boolean result = false;
@@ -440,6 +426,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
return result;
}
+ @Override
public Optional<Boolean> canMakeWritable(Set<ReadOnlyAxis> axes, EObject object) {
Boolean result = false;
@@ -472,10 +459,12 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
return result;
}
+ @Override
public void addReadOnlyListener(IReadOnlyListener listener) {
listeners.addIfAbsent(listener);
}
+ @Override
public void removeReadOnlyListener(IReadOnlyListener listener) {
listeners.remove(listener);
}
@@ -484,6 +473,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
if (forwardingListener == null) {
forwardingListener = new IReadOnlyListener() {
+ @Override
public void readOnlyStateChanged(ReadOnlyEvent event) {
ReadOnlyEvent myEvent;
@@ -516,74 +506,44 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
}
}
- public void editorAboutToReload(EditorReloadEvent event) {
- Map<Class<? extends IReadOnlyHandler2>, Object> reloadContexts = Maps.newHashMap();
-
- for (IReadOnlyHandler2[] partition : orderedHandlersByAxis.values()) {
- for (IReadOnlyHandler2 next : partition) {
- if (!reloadContexts.containsKey(next.getClass())) {
- IReloadContextProvider provider = AdapterUtils.adapt(next, IReloadContextProvider.class, null);
- if (provider != null) {
- reloadContexts.put(next.getClass(), provider.createReloadContext());
- }
- }
- }
- }
-
- if (!reloadContexts.isEmpty()) {
- event.putContext(reloadContexts);
- }
- }
+ /**
+ * Obtains a snapshot of the read-only handlers currently registered with me.
+ *
+ * @return my read-only handlers, by axis of affiliation. Changes to this collection
+ * do not affect my registered handlers
+ */
+ public final Map<ReadOnlyAxis, Collection<IReadOnlyHandler2>> getReadOnlyHandlers() {
+ Map<ReadOnlyAxis, Collection<IReadOnlyHandler2>> result = new HashMap<>();
- public void editorReloaded(EditorReloadEvent event) {
- // I will have been replaced by a new read-only manager
- ReadOnlyManager manager = this;
- try {
- manager = (ReadOnlyManager) getReadOnlyHandler(event.getEditor().getServicesRegistry().getService(TransactionalEditingDomain.class));
- IReloadableEditor reloadable = IReloadableEditor.Adapter.getAdapter(event.getEditor());
- reloadable.removeEditorReloadListener(this);
- reloadable.addEditorReloadListener(manager);
- } catch (ServiceException e) {
- Activator.log.error(e);
- }
+ // Be sure not to provide lists that are actually backed by the arrays!
+ orderedHandlersByAxis.forEach((axis, handlers) -> result.put(axis, Lists.newArrayList(handlers)));
- Object context = event.getContext();
- if (context instanceof Map<?, ?>) {
- @SuppressWarnings("unchecked")
- Map<Class<? extends IReadOnlyHandler2>, Object> reloadContexts = (Map<Class<? extends IReadOnlyHandler2>, Object>) context;
- for (IReadOnlyHandler2[] partition : manager.orderedHandlersByAxis.values()) {
- for (IReadOnlyHandler2 next : partition) {
- Object reloadContext = reloadContexts.get(next.getClass());
- if (reloadContext != null) {
- IReloadContextProvider provider = AdapterUtils.adapt(next, IReloadContextProvider.class, null);
- if (provider != null) {
- provider.restore(reloadContext);
- }
- }
- }
- }
- }
+ return result;
}
//
// Deprecated API
//
+ @Override
@Deprecated
public Optional<Boolean> anyReadOnly(URI[] uris) {
return anyReadOnly(permissionAxes(), uris);
}
+ @Override
@Deprecated
public Optional<Boolean> isReadOnly(EObject eObject) {
return isReadOnly(permissionAxes(), eObject);
}
+ @Override
@Deprecated
public Optional<Boolean> makeWritable(URI[] uris) {
return makeWritable(permissionAxes(), uris);
}
+ @Override
@Deprecated
public Optional<Boolean> makeWritable(EObject eObject) {
return makeWritable(permissionAxes(), eObject);
@@ -604,6 +564,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
this.delegate = handler;
}
+ @Override
public Optional<Boolean> anyReadOnly(Set<ReadOnlyAxis> axes, URI[] uris) {
// the old API contract is that handlers only return true if they
@@ -613,6 +574,7 @@ public class ReadOnlyManager implements IReadOnlyHandler2, IEditorReloadListener
return delegateResult ? Optional.of(Boolean.TRUE) : Optional.<Boolean> absent();
}
+ @Override
public Optional<Boolean> makeWritable(Set<ReadOnlyAxis> axes, URI[] uris) {
// the old API contract is that handlers only return false if they
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
index b476fd095b7..60e0f213ce9 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReadOnlyTester.java
@@ -21,13 +21,13 @@ import java.util.Iterator;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
import org.eclipse.papyrus.infra.emf.utils.BusinessModelResolver;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import com.google.common.base.Objects;
+import com.google.common.collect.Iterators;
public class ReadOnlyTester extends PropertyTester {
@@ -35,15 +35,21 @@ public class ReadOnlyTester extends PropertyTester {
public static final String CAN_MAKE_WRITABLE = "canMakeWritable"; //$NON-NLS-1$
+ @Override
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof IStructuredSelection) {
- Iterator<?> objects = ((IStructuredSelection) receiver).iterator();
+ Iterator<?> objects;
+ if (receiver instanceof Iterator<?>) {
+ objects = (Iterator<?>) receiver;
+ } else if (receiver instanceof Iterable<?>) {
+ objects = ((Iterable<?>) receiver).iterator();
+ } else {
+ objects = Iterators.singletonIterator(receiver);
+ }
- if (IS_READ_ONLY.equals(property)) {
- return testIsReadOnly(objects, asBoolean(expectedValue));
- } else if (CAN_MAKE_WRITABLE.equals(property)) {
- return canMakeWritable(objects, asBoolean(expectedValue));
- }
+ if (IS_READ_ONLY.equals(property)) {
+ return testIsReadOnly(objects, asBoolean(expectedValue));
+ } else if (CAN_MAKE_WRITABLE.equals(property)) {
+ return canMakeWritable(objects, asBoolean(expectedValue));
}
return false;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ControlledResourceTracker.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/ControlledResourceTracker.java
index 4903cc6ba44..d99fc22337e 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ControlledResourceTracker.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/ControlledResourceTracker.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others.
+ * Copyright (c) 2014, 2016 CEA, 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
@@ -8,10 +8,10 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
- * Christian W. Damus - bug 463631
+ * Christian W. Damus - bugs 463631, 485220
*
*/
-package org.eclipse.papyrus.infra.emf.readonly;
+package org.eclipse.papyrus.infra.emf.readonly.internal;
import java.util.Collection;
import java.util.Queue;
@@ -45,7 +45,7 @@ import com.google.common.collect.Sets;
* is necessary to ensure that the ephemeral states during controlling and uncontrolling a sub-model don't fool the editing domain into thinking
* we're making changes to a read-only resource, triggering roll-back.
*/
-class ControlledResourceTracker extends AdapterImpl implements TransactionalEditingDomainListener {
+public class ControlledResourceTracker extends AdapterImpl implements TransactionalEditingDomainListener {
// A resource may be a sub-unit of multiple parent units (it can have multiple roots that are
// cross-resource-contained by elements in multiple other resources, or all in the same resource,
@@ -65,7 +65,7 @@ class ControlledResourceTracker extends AdapterImpl implements TransactionalEdit
*
* @return its tracker
*/
- static ControlledResourceTracker getInstance(EditingDomain domain) {
+ public static ControlledResourceTracker getInstance(EditingDomain domain) {
ControlledResourceTracker result = null;
for (Object next : domain.getResourceSet().eAdapters()) {
@@ -101,7 +101,7 @@ class ControlledResourceTracker extends AdapterImpl implements TransactionalEdit
*
* @return the URI of the corresponding resource in the model's root unit, which could be the same {@code uri} if this is the root unit
*/
- Set<URI> getRootResourceURIs(URI uri) {
+ public Set<URI> getRootResourceURIs(URI uri) {
Set<URI> result = Sets.newHashSet();
Queue<URI> units = Lists.newLinkedList();
units.add(uri.trimFileExtension());
@@ -238,7 +238,7 @@ class ControlledResourceTracker extends AdapterImpl implements TransactionalEdit
* @param crossResourceContained
* an object that is in the contents list of a resource and also has a container
*/
- protected void handleCrossResourceContainment(InternalEObject crossResourceContained) {
+ public void handleCrossResourceContainment(InternalEObject crossResourceContained) {
URI resourceURI = crossResourceContained.eIsProxy() ? crossResourceContained.eProxyURI().trimFragment() : crossResourceContained.eDirectResource().getURI();
InternalEObject container = crossResourceContained.eInternalContainer();
URI parentURI = container.eIsProxy() ? container.eProxyURI().trimFragment() : container.eResource().getURI();
@@ -317,6 +317,7 @@ class ControlledResourceTracker extends AdapterImpl implements TransactionalEdit
// TransactionalEditingDomainListener protocol
//
+ @Override
public void transactionClosed(TransactionalEditingDomainEvent event) {
if (event.getTransaction().getStatus().getSeverity() >= IStatus.ERROR) {
// Transaction rolled back
@@ -327,22 +328,27 @@ class ControlledResourceTracker extends AdapterImpl implements TransactionalEdit
}
}
+ @Override
public void editingDomainDisposing(TransactionalEditingDomainEvent event) {
removeAdapter(event.getSource().getResourceSet());
}
+ @Override
public void transactionStarting(TransactionalEditingDomainEvent event) {
// pass
}
+ @Override
public void transactionInterrupted(TransactionalEditingDomainEvent event) {
// pass
}
+ @Override
public void transactionStarted(TransactionalEditingDomainEvent event) {
// pass
}
+ @Override
public void transactionClosing(TransactionalEditingDomainEvent event) {
// pass
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/Messages.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/Messages.java
deleted file mode 100644
index e856765739a..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/Messages.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2014 CEA 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 (CEA) - Initial API and implementation
- *
- */
-package org.eclipse.papyrus.infra.emf.readonly.internal.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * This is the Messages type. Enjoy.
- */
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.readonly.internal.messages.messages"; //$NON-NLS-1$
-
- public static String ReferencedModelReadOnlyHandler_promptMsg;
-
- public static String ReferencedModelReadOnlyHandler_promptTitle;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/messages.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/messages.properties
deleted file mode 100644
index 92baf6bdc1c..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/messages/messages.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-#
-# Copyright (c) 2014 CEA 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 (CEA) - Initial API and implementation
-#
-
-ReferencedModelReadOnlyHandler_promptMsg=Do you want to make these referenced library model files writable?\n\n
-ReferencedModelReadOnlyHandler_promptTitle=Enable Write
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/spi/IReadOnlyManagerProcessor.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/spi/IReadOnlyManagerProcessor.java
new file mode 100644
index 00000000000..e56620c8fec
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/spi/IReadOnlyManagerProcessor.java
@@ -0,0 +1,41 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.emf.readonly.spi;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager;
+
+/**
+ * <p>
+ * An OSGi service interface for hooks to process the a new {@link ReadOnlyManager}
+ * upon its creation. There is no special provision for notification of when the
+ * manager is no longer being used.
+ * </p>
+ * <p>
+ * Any number of of implementations of this service may be registered; all will be
+ * invoked for each read-only manager.
+ * </p>
+ */
+@FunctionalInterface
+public interface IReadOnlyManagerProcessor {
+ /**
+ * Process a newly instantiated read-only manager.
+ *
+ * @param readOnlyManager
+ * the new read-only manager
+ * @param editingDomain
+ * the editing domain for which the manager provides read-only services
+ */
+ void processReadOnlyManager(ReadOnlyManager readOnlyManager, EditingDomain editingDomain);
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/.classpath b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/.classpath
index 098194ca4b7..eca7bdba8f0 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/.classpath
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/.classpath
@@ -1,6 +1,6 @@
<?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.7"/>
+ <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"/>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/.settings/org.eclipse.jdt.core.prefs
index 9ca8e68231b..62a08f4494d 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/.settings/org.eclipse.jdt.core.prefs
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/.settings/org.eclipse.jdt.core.prefs
@@ -1,10 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+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.7
+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
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
index 95ded3a267b..a12f69a073d 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/META-INF/MANIFEST.MF
@@ -3,29 +3,18 @@ Export-Package: org.eclipse.papyrus.infra.emf,
org.eclipse.papyrus.infra.emf.adapters,
org.eclipse.papyrus.infra.emf.advice,
org.eclipse.papyrus.infra.emf.commands,
- org.eclipse.papyrus.infra.emf.databinding,
- org.eclipse.papyrus.infra.emf.dialog,
org.eclipse.papyrus.infra.emf.edit.domain,
- org.eclipse.papyrus.infra.emf.providers,
- org.eclipse.papyrus.infra.emf.providers.strategy,
org.eclipse.papyrus.infra.emf.requests,
org.eclipse.papyrus.infra.emf.resource,
org.eclipse.papyrus.infra.emf.resource.index,
org.eclipse.papyrus.infra.emf.utils
Require-Bundle: org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- org.eclipse.emf.edit.ui;bundle-version="2.8.0",
- org.eclipse.emf.databinding;bundle-version="1.2.0",
org.eclipse.papyrus.infra.tools;bundle-version="1.2.0",
org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
org.eclipse.core.expressions;bundle-version="3.4.400",
org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.7.0",
com.google.guava;bundle-version="11.0.0",
- org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0",
org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.2.0",
org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0"
Bundle-Vendor: Eclipse Modeling Project
Bundle-ActivationPolicy: lazy
@@ -35,4 +24,4 @@ Bundle-Activator: org.eclipse.papyrus.infra.emf.Activator
Bundle-ManifestVersion: 2
Bundle-Description: %pluginDescription
Bundle-SymbolicName: org.eclipse.papyrus.infra.emf;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
index bf405510fb0..da851f5c7b3 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/plugin.xml
@@ -19,21 +19,6 @@
<plugin>
<extension-point id="dependencyUpdateParticipant" name="Dependency Update Participants" schema="schema/dependencyUpdateParticipant.exsd"/>
<extension
- point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
- <labelProvider
- priority="110"
- provider="org.eclipse.papyrus.infra.emf.providers.ResourceFilteredLabelProvider">
- </labelProvider>
- <labelProvider
- priority="100"
- provider="org.eclipse.papyrus.infra.emf.providers.EMFFilteredLabelProvider">
- </labelProvider>
- <labelProvider
- priority="50"
- provider="org.eclipse.papyrus.infra.emf.providers.AnyTypeLabelProvider">
- </labelProvider>
- </extension>
- <extension
point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
<metamodel
nsURI="http://www.eclipse.org/emf/2002/Ecore">
@@ -71,15 +56,5 @@
</advice>
</binding>
</extension>
- <extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.emf.ecore.EObject"
- class="org.eclipse.papyrus.infra.emf.adapters.EObjectAdapterFactory">
- <adapter
- type="org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor">
- </adapter>
- </factory>
- </extension>
</plugin>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java
index 3165476293b..4841a9fd239 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/Activator.java
@@ -1,6 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
- *
+ * Copyright (c) 2013, 2016 CEA LIST, 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
@@ -9,35 +8,27 @@
*
* Contributors:
* Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ * Christian W. Damus - bug 485220
*
*****************************************************************************/
package org.eclipse.papyrus.infra.emf;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.Plugin;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.jface.dialogs.DialogSettings;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManager;
-import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManagerFactory;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManagerFactory;
-import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
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 {
+public class Activator extends Plugin {
/**
* The plug-in ID
@@ -62,11 +53,6 @@ public class Activator extends AbstractUIPlugin {
public Activator() {
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
@Override
public void start(final BundleContext context) throws Exception {
super.start(context);
@@ -74,11 +60,6 @@ public class Activator extends AbstractUIPlugin {
log = new LogHelper(this);
}
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
@Override
public void stop(final BundleContext context) throws Exception {
plugin = null;
@@ -101,179 +82,10 @@ public class Activator extends AbstractUIPlugin {
public ICustomizationManager getCustomizationManager() {
if (this.fCustomizationManager == null) {
this.fCustomizationManager = ICustomizationManagerFactory.DEFAULT.getOrCreateICustomizationManager(facetRecsourceSet);
- init(this.fCustomizationManager);
}
return this.fCustomizationManager;
}
- /**
- * Saves the current Customization Manager settings to the preferences
- */
- public void saveCustomizationManagerState() {
- IDialogSettings dialogSettings = getBrowserCustomizationDialogSettings();
- List<Customization> appliedCustomizations = getCustomizationManager().getManagedCustomizations();
-
- final List<Customization> registeredCustomizations = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(getCustomizationManager().getResourceSet()).getRegisteredCustomizations();
-
- for (Customization customization : registeredCustomizations) {
-
- boolean isApplied = appliedCustomizations.contains(customization);
- String settingKey = getSettingKey(customization);
-
- dialogSettings.put(settingKey, isApplied);
- }
- }
-
- private String getSettingKey(Customization customization) {
- // do not exist anymore
- return customization.eResource().getURI().toString();
- // return "";
- }
-
- protected IDialogSettings getBrowserCustomizationDialogSettings() {
- String sectionId = CUSTOMIZATION_MANAGER_SECTION;
-
- IDialogSettings settings = Activator.getDefault().getDialogSettings().getSection(sectionId);
- if (settings == null) {
- settings = Activator.getDefault().getDialogSettings().addNewSection(sectionId);
- }
- return settings;
- }
-
- private void init(final ICustomizationManager customizationManager) {
- // the appearance can be customized here:
-
- IDialogSettings settings = getBrowserCustomizationDialogSettings();
-
- try {
-
- // load customizations defined as default through the customization
- // extension
- ICustomizationCatalogManager customCatalog = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(customizationManager.getResourceSet());
- // no possibility to get default customization
-
- List<Customization> registryAllCustomizations = customCatalog.getRegisteredCustomizations();
- ArrayList<Customization> orderedCustomizationList = new ArrayList<Customization>();
- for (Customization customization : registryAllCustomizations) {
- String settingKey = getSettingKey(customization);
-
- boolean isActive = false;
- if (settings.get(settingKey) == null) { // Never customized
- isActive = customization.isMustBeLoadedByDefault(); // Loaded by default
-
- } else {
- isActive = settings.getBoolean(settingKey);
- }
-
- if (isActive) {
- orderedCustomizationList.add(customization);
-
- }
- }
-
- Collections.sort(orderedCustomizationList, new CustomizationComparator());
- customizationManager.getManagedCustomizations().addAll(orderedCustomizationList);
-
-
-
- } catch (Throwable e) {
- Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
- }
- }
-
- /**
- * The section name of the Dialog Settings for storing Customization Manager settings
- */
- public static final String CUSTOMIZATION_MANAGER_SECTION = PLUGIN_ID + ".customizationManager";//$NON-NLS-1$
-
- /**
- * Restores the default Customization Manager configuration
- */
- public void restoreDefaultCustomizationManager() {
- ICustomizationManager manager = getCustomizationManager();
-
- DialogSettings settings = (DialogSettings) getDialogSettings();
- settings.removeSection(CUSTOMIZATION_MANAGER_SECTION);
-
- // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
- //
- // manager.clearCustomizations();
- // for(MetamodelView customization : registryDefaultCustomizations) {
- // manager.registerCustomization(customization);
- // }
- // manager.loadCustomizations();
- }
-
- /**
- * load the facets
- *
- * @param customizations
- * list of customization
- * @param customizationManager
- * the Customization Manager
- */
- // protected void loadFacetsForCustomizations(final List<MetamodelView> customizations, final CustomizationManager customizationManager) {
- // final Set<Facet> referencedFacets = new HashSet<Facet>();
- // final Collection<FacetSet> facetSets = FacetSetCatalog.getSingleton().getAllFacetSets();
- //
- // for(MetamodelView customization : customizations) {
- // String metamodelURI = customization.getMetamodelURI();
- // // find customized FacetSet
- // FacetSet customizedFacetSet = null;
- // if(metamodelURI != null) {
- // for(FacetSet facetSet : facetSets) {
- // if(metamodelURI.equals(facetSet.getNsURI())) {
- // customizedFacetSet = facetSet;
- // break;
- // }
- // }
- // }
- // if(customizedFacetSet == null) {
- // continue;
- // }
- //
- // // find customized Facets
- // EList<TypeView> types = customization.getTypes();
- // for(TypeView typeView : types) {
- // String metaclassName = typeView.getMetaclassName();
- // Facet facet = findFacetWithFullyQualifiedName(metaclassName, customizedFacetSet);
- // if(facet != null) {
- // referencedFacets.add(facet);
- // } else {
- // Activator.log.warn(String.format("Missing required facet \"%s\" in FacetSet \"%s\" for customization \"%s\"", metaclassName, customizedFacetSet.getName(), customization.getName()));
- // }
- // }
- //
- // for(Facet referencedFacet : referencedFacets) {
- // customizationManager.loadFacet(referencedFacet);
- // }
- // }
- //
- // //
- // // for modified facets
- // // customizationManager.getInstancesForMetaclasses().buildDerivationTree();
- // // customizationManager.getAppearanceConfiguration().touch();
- // // customizationManager.refreshDelayed(true);
- // }
-
- // /**
- // * fin a facet from
- // *
- // * @param metaclassName
- // * @param customizedFacetSet
- // * @return
- // */
- // private Facet findFacetWithFullyQualifiedName(final String metaclassName, final FacetSet customizedFacetSet) {
- // EList<Facet> facets = customizedFacetSet.getFacets();
- // for(Facet facet : facets) {
- // String facetName = getMetaclassQualifiedName(facet);
- // if(metaclassName.equals(facetName)) {
- // return facet;
- // }
- // }
- // return null;
- // }
-
/** @return the qualified name of the given metaclass */
public static String getMetaclassQualifiedName(final EClassifier eClass) {
final ArrayList<String> qualifiedNameParts = new ArrayList<String>();
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java
index 3b3f75dcb1b..96df1225f6b 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/Messages.java
@@ -1,5 +1,5 @@
/*************************************************************
- * Copyright (c) 2012, 2014 CEA and others.
+ * Copyright (c) 2012, 2016 CEA, 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
@@ -9,6 +9,7 @@
* Contributors:
* Vincent Lorenzo (CEA LIST) - Initial API and implementation
* Christian W. Damus (CEA) - bug 323802
+ * Christian W. Damus - bug 485220
*
*/
@@ -20,18 +21,6 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.messages.messages"; //$NON-NLS-1$
- public static String ResourceFilteredLabelProvider_local;
-
- public static String ResourceFilteredLabelProvider_localExt;
-
- public static String ResourceFilteredLabelProvider_system;
-
- public static String ResourceFilteredLabelProvider_systemExt;
-
- public static String ResourceFilteredLabelProvider_workspace;
-
- public static String ResourceFilteredLabelProvider_workspaceExt;
-
public static String UnsetCommand_UnsetCommand;
static {
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties
index 7a50929b818..379d3dfb6a6 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/messages/messages.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2012, 2014 CEA and others.
+# Copyright (c) 2012, 2016 CEA, 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
@@ -9,12 +9,7 @@
# Contributors:
# Vincent Lorenzo (CEA LIST) - Initial API and implementation
# Christian W. Damus (CEA) - bug 323802
+# Christian W. Damus - bug 485220
#
-ResourceFilteredLabelProvider_local=Local model file "{0}"
-ResourceFilteredLabelProvider_localExt=Local model file "{0}" ({1} component)
-ResourceFilteredLabelProvider_system=System resource "{0}"
-ResourceFilteredLabelProvider_systemExt=Resource "{0}"
-ResourceFilteredLabelProvider_workspace=Workspace model file "{0}"
-ResourceFilteredLabelProvider_workspaceExt=Workspace model file "{0}" ({1} component)
UnsetCommand_UnsetCommand=Unset Command
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFFileUtil.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFFileUtil.java
index cc62944a7a5..5acd8eeb22d 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFFileUtil.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFFileUtil.java
@@ -20,7 +20,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.papyrus.infra.emf.Activator;
//TODO
public class EMFFileUtil {
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java
index 49ea6eeb2d9..b0ebdee7994 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/EMFHelper.java
@@ -49,7 +49,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.xmi.XMIResource;
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.papyrus.emf.facet.custom.ui.CustomizedContentProviderUtils;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
@@ -221,24 +220,24 @@ public class EMFHelper {
*/
public static EObject getEObject(final Object source) {
- // Support for EMF 0.2 CustomizedTree: The TreeElements are EObjects, and do not implement IAdatapble.
- // FIXME: Use an AdapterFactory instead, to remove the dependency to EMF Facet 0.2
- Object resolved = CustomizedContentProviderUtils.resolve(source);
- if (resolved != source && isEMFModelElement(resolved)) {
- return (EObject) resolved;
- }
-
// General case
if (isEMFModelElement(source)) {
return (EObject) source;
- } else if (source instanceof IAdaptable) {
+ }
+
+ // Try to get an intrinsic adapter
+ if (source instanceof IAdaptable) {
EObject eObject = ((IAdaptable) source).getAdapter(EObject.class);
if (eObject == null) { // EMF Facet 0.1
eObject = ((IAdaptable) source).getAdapter(EReference.class);
}
- return asEMFModelElement(eObject); // in case the adapter is a CDOResource
+
+ if (eObject != null) {
+ return asEMFModelElement(eObject); // in case the adapter is a CDOResource
+ }
}
+ // External adapter (last ditch case)
if (source != null) {
return asEMFModelElement(Platform.getAdapterManager().getAdapter(source, EObject.class));
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java
deleted file mode 100644
index 6c853bfe9f2..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForHandlers.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012, 2016 CEA LIST, 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus - bug 485220
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.utils;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-
-/**
- * ServicesUtils based on the Handler's ExecutionEvent
- *
- * It first tests the current selection, then the IWorkbenchPart on which the handler is executed.
- * The IWorkbenchPart is expected to be adaptable to a ServiceRegistry.
- *
- * @author Camille Letavernier
- *
- * @see ServiceUtilsForSelection
- */
-public class ServiceUtilsForHandlers extends AbstractServiceUtils<ExecutionEvent> {
-
- private ServiceUtilsForHandlers() {
- // Singleton
- }
-
- /**
- * Gets the {@link IEditorPart} of the currently nested active editor.
- *
- * @param from
- * @return
- * @throws ServiceException
- * If an error occurs while getting the requested service.
- */
- public IEditorPart getNestedActiveIEditorPart(ExecutionEvent from) throws ServiceException {
- return getService(ISashWindowsContainer.class, from).getActiveEditor();
- }
-
- @Override
- public ServicesRegistry getServiceRegistry(ExecutionEvent from) throws ServiceException {
-
- Object context = from.getApplicationContext();
-
- if (context instanceof IEvaluationContext) {
- IEvaluationContext evaluationContext = (IEvaluationContext) context;
-
- // Search for the IWorkbenchPartSite from which the ExecutionEvent is sent (May be different that the Active one)
- Object workbenchPartSite = evaluationContext.getVariable("org.eclipse.ui.IWorkbenchPartSite");
- if (workbenchPartSite instanceof IWorkbenchPartSite) {
- IWorkbenchPartSite site = (IWorkbenchPartSite) workbenchPartSite;
- Object registry = site.getAdapter(ServicesRegistry.class);
- if (registry != null && registry instanceof ServicesRegistry) {
- return (ServicesRegistry) registry;
- }
-
- // Search for the IWorkbenchPart from which the ExecutionEvent is sent (May be different that the Active one)
- IWorkbenchPart workbenchPart = site.getPart();
- registry = workbenchPart.getAdapter(ServicesRegistry.class);
- if (registry != null && registry instanceof ServicesRegistry) {
- return (ServicesRegistry) registry;
- }
- }
-
- Object selection = evaluationContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
-
- ServicesRegistry registry;
-
- // Try to resolve the ServicesRegistry from the current selection
- if (selection instanceof ISelection && !((ISelection) selection).isEmpty()) {
- try {
- registry = ServiceUtilsForSelection.getInstance().getServiceRegistry((ISelection) selection);
- if (registry != null) {
- return registry;
- }
- } catch (ServiceException ex) {
- // Ignore and try another ServiceUtils
- }
- }
-
- // We couldn't retrieve the ServiceRegistry from the current selection.
-
- // Try to adapt the active part to the ServicesRegistry
- IWorkbenchPart part = (IWorkbenchPart) evaluationContext.getVariable(ISources.ACTIVE_PART_NAME);
- registry = (part).getAdapter(ServicesRegistry.class);
- if (registry != null) {
- return registry;
- }
- }
-
- throw new ServiceNotFoundException("The ServiceRegistry cannot be resolved"); //$NON-NLS-1$
- }
-
-
-
- public static ServiceUtilsForHandlers getInstance() {
- return instance;
- }
-
- private static final ServiceUtilsForHandlers instance = new ServiceUtilsForHandlers();
-}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForIEvaluationContext.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForIEvaluationContext.java
deleted file mode 100644
index 469d835f6fc..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForIEvaluationContext.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 Cedric Dumoulin.
- *
- * 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:
- * Cedric Dumoulin - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.utils;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.expressions.IEvaluationContext;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServiceNotFoundException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-
-/**
- * ServicesUtils based on the Handler's IEvaluationContext.
- * This class can be used for both the {@link AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)} and the {@link AbstractHandler#setEnabled(Object)} methods.
- *
- *
- * @author Cedric Dumoulin
- *
- */
-public class ServiceUtilsForIEvaluationContext extends AbstractServiceUtils<IEvaluationContext> {
-
- private ServiceUtilsForIEvaluationContext() {
- // Singleton
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils#getServiceRegistry(java.lang.Object)
- *
- * @param from
- * @return
- * @throws ServiceException
- */
- @Override
- public ServicesRegistry getServiceRegistry(IEvaluationContext from) throws ServiceException {
-
- IEvaluationContext evaluationContext = from;
-
- // Search for the IWorkbenchPartSite from which the ExecutionEvent is sent (May be different that the Active one)
- Object workbenchPartSite = evaluationContext.getVariable("org.eclipse.ui.IWorkbenchPartSite");
- if (workbenchPartSite instanceof IWorkbenchPartSite) {
- IWorkbenchPartSite site = (IWorkbenchPartSite) workbenchPartSite;
- Object registry = site.getAdapter(ServicesRegistry.class);
- if (registry != null && registry instanceof ServicesRegistry) {
- return (ServicesRegistry) registry;
- }
-
- // Search for the IWorkbenchPart from which the ExecutionEvent is sent (May be different that the Active one)
- IWorkbenchPart workbenchPart = site.getPart();
- registry = workbenchPart.getAdapter(ServicesRegistry.class);
- if (registry != null && registry instanceof ServicesRegistry) {
- return (ServicesRegistry) registry;
- }
- }
-
- Object selection = evaluationContext.getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
-
- ServicesRegistry registry;
-
- // Try to resolve the ServicesRegistry from the current selection
- if (selection instanceof ISelection && !((ISelection) selection).isEmpty()) {
- try {
- registry = ServiceUtilsForSelection.getInstance().getServiceRegistry((ISelection) selection);
- if (registry != null) {
- return registry;
- }
- } catch (ServiceException ex) {
- // Ignore and try another ServiceUtils
- }
- }
-
- // We couldn't retrieve the ServiceRegistry from the current selection.
-
- // Try to adapt the active part to the ServicesRegistry
- Object _part = evaluationContext.getVariable(ISources.ACTIVE_PART_NAME);
- if (_part instanceof IWorkbenchPart) {
- IWorkbenchPart part = (IWorkbenchPart) _part;
- registry = (ServicesRegistry) (part).getAdapter(ServicesRegistry.class);
- if (registry != null) {
- return registry;
- }
- }
-
-
- // nothing found
- throw new ServiceNotFoundException("The ServiceRegistry cannot be resolved"); //$NON-NLS-1$
- }
-
- public static ServiceUtilsForIEvaluationContext getInstance() {
- return instance;
- }
-
- private static final ServiceUtilsForIEvaluationContext instance = new ServiceUtilsForIEvaluationContext();
-}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java
deleted file mode 100644
index c79aba34c57..00000000000
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ServiceUtilsForSelection.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.utils;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.AbstractServiceUtils;
-
-/**
- * ServiceUtils based on an ISelection.
- *
- * Expects an IStructuredSelection containing at least one EObject (It then relies on ServiceUtilsForEObject to retrieve the ServicesRegistry)
- *
- * @author Camille Letavernier
- */
-public class ServiceUtilsForSelection extends AbstractServiceUtils<ISelection> {
-
- private ServiceUtilsForSelection() {
- // Singleton
- }
-
- private static ServiceUtilsForSelection instance = new ServiceUtilsForSelection();
-
- public static ServiceUtilsForSelection getInstance() {
- return instance;
- }
-
- @Override
- public ServicesRegistry getServiceRegistry(ISelection from) throws ServiceException {
- if (from instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) from;
- Iterator<?> selectionIterator = selection.iterator();
- while (selectionIterator.hasNext()) {
- Object selectedElement = selectionIterator.next();
- EObject selectedEObject = EMFHelper.getEObject(selectedElement);
- if (selectedEObject != null) {
- return ServiceUtilsForEObject.getInstance().getServiceRegistry(selectedEObject);
- }
- }
- }
-
- throw new ServiceException("Cannot retrieve the ServiceRegistry"); //$NON-NLS-1$
- }
-
-}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.classpath b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.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/emf/org.eclipse.papyrus.infra.ui.emf/.project b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.project
new file mode 100644
index 00000000000..16fd397042a
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.ui.emf</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.settings/org.eclipse.jdt.core.prefs b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..b3aa6d60f94
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,291 @@
+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
+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/emf/org.eclipse.papyrus.infra.ui.emf/.settings/org.eclipse.jdt.ui.prefs b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..954281dbc31
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/.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/emf/org.eclipse.papyrus.infra.ui.emf/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..cddde77a32d
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/META-INF/MANIFEST.MF
@@ -0,0 +1,38 @@
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.ui.emf.adapters,
+ org.eclipse.papyrus.infra.ui.emf.databinding,
+ org.eclipse.papyrus.infra.ui.emf.dialog,
+ org.eclipse.papyrus.infra.ui.emf.providers,
+ org.eclipse.papyrus.infra.ui.emf.providers.strategy,
+ org.eclipse.papyrus.infra.ui.emf.utils,
+ org.eclipse.papyrus.infra.ui.internal.emf;x-internal:=true,
+ org.eclipse.papyrus.infra.ui.internal.emf.expressions;x-internal:=true,
+ org.eclipse.papyrus.infra.ui.internal.emf.readonly.handlers
+Require-Bundle: org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
+ org.eclipse.emf.edit.ui;bundle-version="2.8.0",
+ org.eclipse.emf.databinding;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="1.2.0",
+ org.eclipse.gmf.runtime.notation;bundle-version="1.5.0",
+ org.eclipse.core.expressions;bundle-version="3.4.400",
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.7.0",
+ com.google.guava;bundle-version="11.0.0",
+ org.eclipse.papyrus.emf.facet.custom.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.emf.facet.custom.core;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.emf.readonly;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.onefile;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.ui;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="1.2.0",
+ org.eclipse.papyrus.infra.core.sashwindows.di;bundle-version="1.2.0"
+Bundle-Vendor: %pluginProvider
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-Activator: org.eclipse.papyrus.infra.ui.internal.emf.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.ui.emf;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/about.html b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/about.html
new file mode 100644
index 00000000000..dd3c089a94c
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/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/emf/org.eclipse.papyrus.infra.ui.emf/build.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/build.properties
new file mode 100644
index 00000000000..46a2df5a2a4
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ build.properties,\
+ plugin.xml,\
+ plugin.properties,\
+ icons/
+src.includes = about.html
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/icons/enable_write.png b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/icons/enable_write.png
index d4e55293f11..d4e55293f11 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/icons/enable_write.png
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/icons/enable_write.png
Binary files differ
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/plugin.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/plugin.properties
new file mode 100644
index 00000000000..d2fe5aea31d
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/plugin.properties
@@ -0,0 +1,13 @@
+#
+# Copyright (c) 2016 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
+#
+
+pluginName = Papyrus Infrastructural UI for EMF
+pluginProvider = Eclipse Modeling Project
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/plugin.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/plugin.xml
new file mode 100644
index 00000000000..05435f04a85
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/plugin.xml
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2012, 2016 CEA, 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:
+ CEA - Initial API and implementation
+ Christian W. Damus (CEA) - bug 323802
+ Christian W. Damus (CEA) - bug 408491
+ Christian W. Damus (CEA) - bug 431953 (pre-requisite refactoring of ModelSet service start-up)
+ Christian W. Damus - bug 485220
+
+-->
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
+ <labelProvider
+ priority="110"
+ provider="org.eclipse.papyrus.infra.ui.emf.providers.ResourceFilteredLabelProvider">
+ </labelProvider>
+ <labelProvider
+ priority="100"
+ provider="org.eclipse.papyrus.infra.ui.emf.providers.EMFFilteredLabelProvider">
+ </labelProvider>
+ <labelProvider
+ priority="50"
+ provider="org.eclipse.papyrus.infra.ui.emf.providers.AnyTypeLabelProvider">
+ </labelProvider>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.emf.ecore.EObject"
+ class="org.eclipse.papyrus.infra.ui.emf.adapters.EObjectAdapterFactory">
+ <adapter
+ type="org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor">
+ </adapter>
+ </factory>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="Enable write"
+ categoryId="org.eclipse.papyrus.editor.category"
+ id="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand"
+ name="Enable write">
+ </command>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup?after=tools">
+ <command commandId="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand"
+ icon="icons/enable_write.png"
+ label="Enable write"
+ style="push"
+ tooltip="Enable write">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?endof=fileMenu"
+ allPopups="false">
+ <command commandId="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand"
+ icon="icons/enable_write.png"
+ label="Enable write"
+ style="push"
+ tooltip="Enable write">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar id="org.eclipse.papyrus.infra.emf.readonly.toolbar">
+ <command commandId="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand"
+ icon="icons/enable_write.png"
+ label="Enable write"
+ style="push"
+ tooltip="Enable write">
+ <visibleWhen>
+ <reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
+ </visibleWhen>
+ </command>
+ </toolbar>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.infra.ui.internal.emf.readonly.handlers.EnableWriteCommandHandler"
+ commandId="org.eclipse.papyrus.infra.emf.readonly.EnableWriteCommand">
+ <enabledWhen>
+ <and>
+ <with variable="activeEditorId">
+ <equals value="org.eclipse.papyrus.infra.core.papyrusEditor"/>
+ </with>
+ <with
+ variable="selection">
+ <test
+ property="org.eclipse.papyrus.infra.emf.readonly.tester.isReadOnly"
+ value="true">
+ </test>
+ <count
+ value="1">
+ </count>
+ </with>
+ </and>
+ </enabledWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.papyrus.infra.ui.internal.emf.expressions.ReadOnlyTester"
+ id="org.eclipse.papyrus.infra.ui.emf.readonly.tester"
+ namespace="org.eclipse.papyrus.infra.emf.readonly.tester"
+ properties="isReadOnly,canMakeWritable"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
+ </extension>
+
+ <extension
+ point="org.eclipse.papyrus.infra.emf.readonly.readOnlyHandler">
+ <readOnlyHandler
+ class="org.eclipse.papyrus.infra.ui.internal.emf.readonly.handlers.ReferencedModelReadOnlyHandler"
+ id="org.eclipse.papyrus.infra.ui.emf.readonly.ReferencedModelReadOnlyHandler"
+ priority="15">
+ <affinity
+ axis="discretion">
+ </affinity>
+ </readOnlyHandler>
+ <readOnlyHandler
+ class="org.eclipse.papyrus.infra.ui.internal.emf.readonly.handlers.FSReadOnlyHandler"
+ id="org.eclipse.papyrus.infra.ui.emf.readonly.FSReadOnlyHandler"
+ priority="10">
+ <affinity
+ axis="permission">
+ </affinity>
+ </readOnlyHandler>
+ </extension>
+</plugin>
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/pom.xml b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/pom.xml
new file mode 100644
index 00000000000..8e34b9157d6
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/pom.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.releng</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.2.0-SNAPSHOT</version>
+ <relativePath>../../../../releng/main</relativePath>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.ui.emf</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>1.2.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/EObjectAdapterFactory.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/adapters/EObjectAdapterFactory.java
index 6db9f56e76c..68c7bac1f97 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/adapters/EObjectAdapterFactory.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/adapters/EObjectAdapterFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 CEA and others.
+ * Copyright (c) 2014, 2016 CEA, 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
@@ -8,9 +8,10 @@
*
* Contributors:
* Christian W. Damus (CEA) - Initial API and implementation
+ * Christian W. Damus - bug 485220
*
*/
-package org.eclipse.papyrus.infra.emf.adapters;
+package org.eclipse.papyrus.infra.ui.emf.adapters;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.emf.ecore.EObject;
@@ -18,7 +19,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.papyrus.infra.emf.dialog.NestedEditingDialogContext;
+import org.eclipse.papyrus.infra.ui.emf.dialog.NestedEditingDialogContext;
import org.eclipse.papyrus.infra.widgets.creation.IAtomicOperationExecutor;
@@ -33,8 +34,9 @@ public class EObjectAdapterFactory implements IAdapterFactory {
super();
}
- public Object getAdapter(Object adaptable, @SuppressWarnings("rawtypes") Class adapterType) {
- Object result = null;
+ @Override
+ public <T> T getAdapter(Object adaptable, Class<T> adapterType) {
+ T result = null;
if (adaptable instanceof EObject) {
if (adapterType == IAtomicOperationExecutor.class) {
@@ -46,7 +48,7 @@ public class EObjectAdapterFactory implements IAdapterFactory {
}
}
if (domain != null) {
- result = new EMFAtomicOperationExecutor(domain);
+ result = adapterType.cast(new EMFAtomicOperationExecutor(domain));
}
}
}
@@ -54,8 +56,8 @@ public class EObjectAdapterFactory implements IAdapterFactory {
return result;
}
- @SuppressWarnings("rawtypes")
- public Class[] getAdapterList() {
+ @Override
+ public Class<?>[] getAdapterList() {
return adapterTypes;
}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/AnnotationObservableValue.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/AnnotationObservableValue.java
index dda2b90e684..392dd431538 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/AnnotationObservableValue.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/AnnotationObservableValue.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.databinding;
+package org.eclipse.papyrus.infra.ui.emf.databinding;
import org.eclipse.core.databinding.observable.value.AbstractObservableValue;
import org.eclipse.emf.common.command.AbstractCommand;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/EMFObservableList.java
index 7e524ae2ded..97a5c2cca9b 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableList.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/EMFObservableList.java
@@ -1,405 +1,405 @@
-/*****************************************************************************
- * Copyright (c) 2010, 2014 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- * Christian W. Damus (CEA) - bug 402525
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.databinding;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.databinding.observable.ChangeEvent;
-import org.eclipse.core.databinding.observable.IChangeListener;
-import org.eclipse.core.databinding.observable.IObserving;
-import org.eclipse.core.databinding.observable.list.IObservableList;
-import org.eclipse.core.databinding.observable.list.ObservableList;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CompoundCommand;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.command.AddCommand;
-import org.eclipse.emf.edit.command.DeleteCommand;
-import org.eclipse.emf.edit.command.RemoveCommand;
-import org.eclipse.emf.edit.command.SetCommand;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
-import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
-
-/**
- * An ObservableList using EMF Commands to edit the underlying list.
- * The commands are executed when the {@link #commit(AbstractEditor)} method is called.
- * However, the read operations (such as get, size, ...) return up-to-date
- * results, even when {@link #commit(AbstractEditor)} hasn't been called.
- *
- * @author Camille Letavernier
- */
-@SuppressWarnings({ "unchecked", "rawtypes" })
-public class EMFObservableList extends ObservableList implements ICommitListener, IChangeListener, IObserving {
-
- /**
- * The list of commands that haven't been executed yet
- */
- protected List<Command> commands = new LinkedList<Command>();
-
- /**
- * The editing domain on which the commands will be executed
- */
- protected EditingDomain editingDomain;
-
- /**
- * The edited EObject
- */
- protected EObject source;
-
- /**
- * The feature being edited
- */
- protected EStructuralFeature feature;
-
- /**
- * The list to be updated only on #commit() calls
- */
- protected List<?> concreteList;
-
- /**
- *
- * Constructor.
- *
- * @param wrappedList
- * The list to be edited when #commit() is called
- * @param domain
- * The editing domain on which the commands will be executed
- * @param source
- * The EObject from which the list will be retrieved
- * @param feature
- * The feature from which the list will be retrieved
- */
- public EMFObservableList(List<?> wrappedList, EditingDomain domain, EObject source, EStructuralFeature feature) {
- super(new LinkedList<Object>(wrappedList), Object.class);
- this.concreteList = wrappedList;
- this.editingDomain = domain;
- this.source = source;
- this.feature = feature;
-
- if (concreteList instanceof IObservableList) {
- ((IObservableList) concreteList).addChangeListener(this);
- }
- }
-
- protected boolean isCommitting;
-
- public void handleChange(ChangeEvent event) {
- if (isCommitting) {
- return; // We're modifying the wrapped Observable list, which sends us change events. Ignore them.
- }
-
- // Refresh if we don't have pending changes
- if (commands.isEmpty()) {
- refreshCacheList();
- }
- }
-
- public Object getObserved() {
- return source;
- }
-
- @Override
- public synchronized void dispose() {
- if (concreteList instanceof IObservableList) {
- ((IObservableList) concreteList).removeChangeListener(this);
- }
- super.dispose();
- }
-
- /**
- * Forces this list to commit all the pending commands. Only one composite command will
- * be executed, and can be undone in a single operation.
- *
- * @see org.eclipse.papyrus.infra.widgets.editors.ICommitListener#commit(AbstractEditor)
- *
- */
- public synchronized void commit(AbstractEditor editor) {
-
- isCommitting = true;
-
- if (commands.isEmpty()) {
- return;
- }
-
- CompoundCommand compoundCommand = new CompoundCommand() {
-
- @Override
- public void execute() {
- super.execute();
- refreshCacheList();
- }
-
- @Override
- public void undo() {
- super.undo();
- refreshCacheList();
- }
-
- @Override
- public void redo() {
- super.redo();
- refreshCacheList();
- }
-
- @Override
- protected boolean prepare() {
- if (commandList.isEmpty()) {
- return false;
- } else {
- // We only test the first command, as the following ones might depend
- // on the first command's execution. StrictCompoundCommands don't seem
- // to be compatible with emf transaction (execute() is called by
- // canExecute(), before the transaction is started)
- return commandList.get(0).canExecute();
- }
- }
- };
-
- for (Command cmd : commands) {
- compoundCommand.append(cmd);
- }
-
- editingDomain.getCommandStack().execute(compoundCommand);
- refreshCacheList();
- commands.clear();
-
- isCommitting = false;
- }
-
- /**
- * Refresh the cached list by copying the real list
- */
- protected void refreshCacheList() {
- if (isDisposed()) {
- // This observable can be disposed, but the commands might still be
- // in the command stack. Undo() or Redo() will call this method, which
- // should be ignored. The command should probably not call refresh directly ;
- // we should have listeners on the concrete list... but it is not necessarily
- // observable
- return;
- }
- wrappedList.clear();
- wrappedList.addAll(concreteList);
- fireListChange(null);
- }
-
- @Override
- public void add(int index, Object value) {
- Command command = getAddCommand(index, value);
- commands.add(command);
-
- wrappedList.add(index, value);
- fireListChange(null);
- }
-
- @Override
- public void clear() {
- Command command = getClearCommand();
- commands.add(command);
-
- wrappedList.clear();
- fireListChange(null);
- }
-
- @Override
- public boolean add(Object o) {
- Command command = getAddCommand(o);
- commands.add(command);
-
- boolean result = wrappedList.add(o);
- fireListChange(null);
- return result;
- }
-
- @Override
- public boolean remove(Object o) {
- Command command = getRemoveCommand(o);
-
- commands.add(command);
-
- boolean result = wrappedList.remove(o);
- fireListChange(null);
- return result;
- }
-
- @Override
- public boolean addAll(Collection c) {
- Command command = getAddAllCommand(c);
- commands.add(command);
-
- boolean result = wrappedList.addAll(c);
- fireListChange(null);
- return result;
- }
-
- @Override
- public boolean addAll(int index, Collection c) {
- Command command = getAddAllCommand(index, c);
- commands.add(command);
-
- boolean result = wrappedList.addAll(index, c);
- fireListChange(null);
- return result;
- }
-
- @Override
- public boolean removeAll(Collection c) {
- Command command = getRemoveCommand(c);
- commands.add(command);
-
- boolean result = wrappedList.removeAll(c);
- fireListChange(null);
- return result;
- }
-
- @Override
- public boolean retainAll(Collection c) {
- Command command = getRetainAllCommand(c);
- commands.add(command);
-
- boolean result = wrappedList.retainAll(c);
- fireListChange(null);
- return result;
- }
-
- @Override
- public Object set(int index, Object element) {
- Command command = getSetCommand(index, element);
- commands.add(command);
-
- Object result = wrappedList.set(index, element);
- fireListChange(null);
- return result;
- }
-
- @Override
- public Object move(int oldIndex, int newIndex) {
- commands.addAll(getMoveCommands(oldIndex, newIndex));
-
- Object value = get(oldIndex);
- wrappedList.remove(oldIndex);
- wrappedList.add(newIndex, value);
-
- fireListChange(null);
-
- return value;
- }
-
- @Override
- public Object remove(int index) {
- Object value = get(index);
- if (value != null) {
- Command command = getRemoveCommand(index);
- commands.add(command);
- }
-
- Object result = wrappedList.remove(index);
- fireListChange(null);
- return result;
- }
-
- public Command getAddCommand(int index, Object value) {
- return AddCommand.create(editingDomain, source, feature, value, index);
- }
-
- public Command getAddCommand(Object value) {
- return AddCommand.create(editingDomain, source, feature, value);
- }
-
- public Command getAddAllCommand(Collection<?> values) {
- return AddCommand.create(editingDomain, source, feature, values);
- }
-
- public Command getAddAllCommand(int index, Collection<?> values) {
- return AddCommand.create(editingDomain, source, feature, values, index);
- }
-
- public Command getClearCommand() {
- return getRemoveAllCommand(new LinkedList<Object>(wrappedList));
- }
-
- public Command getRemoveCommand(int index) {
- Object value = get(index);
- return getRemoveCommand(value);
- }
-
- public Command getRemoveCommand(Object value) {
- Command cmd = RemoveCommand.create(editingDomain, source, feature, value);
- if (value instanceof EObject && feature instanceof EReference && ((EReference) feature).isContainment()) {
- addDestroyCommand(cmd, (EObject) value);
- }
- return cmd;
- }
-
- public Command getRemoveAllCommand(Collection<?> values) {
- CompoundCommand cc = new CompoundCommand("Edit list");
-
- if (feature instanceof EReference && ((EReference) feature).isContainment() && values != null) {
- for (Object o : values) {
- if (o instanceof EObject) {
- addDestroyCommand(cc, (EObject) o);
- }
- }
- }
-
- cc.append(RemoveCommand.create(editingDomain, source, feature, values));
- return cc;
- }
-
- public List<Command> getMoveCommands(int oldIndex, int newIndex) {
- Object value = get(oldIndex);
- List<Command> commands = new LinkedList<Command>();
- commands.add(getRemoveCommand(value));
- commands.add(getAddCommand(newIndex, value));
- return commands;
- }
-
- public Command getRetainAllCommand(Collection<?> values) {
- List<Object> objectsToRemove = new LinkedList<Object>();
- for (Object object : values) {
- if (!contains(object)) {
- objectsToRemove.add(object);
- }
- }
- if (!objectsToRemove.isEmpty()) {
- return getRemoveAllCommand(objectsToRemove);
- } else {
- return null;
- }
- }
-
- public Command getSetCommand(int index, Object value) {
- Object oldValue = get(index);
- Command command = SetCommand.create(editingDomain, source, feature, value, index);
- if (oldValue instanceof EObject && feature instanceof EReference && ((EReference) feature).isContainment()) {
- addDestroyCommand(command, (EObject) oldValue);
- }
- return command;
- }
-
- protected void addDestroyCommand(Command cmd, EObject objToDestroy) {
- Command destroyCmd = DeleteCommand.create(editingDomain, objToDestroy);
-
- if (cmd instanceof CompoundCommand) {
- ((CompoundCommand) cmd).append(destroyCmd);
- } else {
- cmd.chain(destroyCmd);
- }
- }
-
-}
+/*****************************************************************************
+ * Copyright (c) 2010, 2014 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 402525
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.ui.emf.databinding;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.databinding.observable.ChangeEvent;
+import org.eclipse.core.databinding.observable.IChangeListener;
+import org.eclipse.core.databinding.observable.IObserving;
+import org.eclipse.core.databinding.observable.list.IObservableList;
+import org.eclipse.core.databinding.observable.list.ObservableList;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.edit.command.DeleteCommand;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
+import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
+
+/**
+ * An ObservableList using EMF Commands to edit the underlying list.
+ * The commands are executed when the {@link #commit(AbstractEditor)} method is called.
+ * However, the read operations (such as get, size, ...) return up-to-date
+ * results, even when {@link #commit(AbstractEditor)} hasn't been called.
+ *
+ * @author Camille Letavernier
+ */
+@SuppressWarnings({ "unchecked", "rawtypes" })
+public class EMFObservableList extends ObservableList implements ICommitListener, IChangeListener, IObserving {
+
+ /**
+ * The list of commands that haven't been executed yet
+ */
+ protected List<Command> commands = new LinkedList<Command>();
+
+ /**
+ * The editing domain on which the commands will be executed
+ */
+ protected EditingDomain editingDomain;
+
+ /**
+ * The edited EObject
+ */
+ protected EObject source;
+
+ /**
+ * The feature being edited
+ */
+ protected EStructuralFeature feature;
+
+ /**
+ * The list to be updated only on #commit() calls
+ */
+ protected List<?> concreteList;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param wrappedList
+ * The list to be edited when #commit() is called
+ * @param domain
+ * The editing domain on which the commands will be executed
+ * @param source
+ * The EObject from which the list will be retrieved
+ * @param feature
+ * The feature from which the list will be retrieved
+ */
+ public EMFObservableList(List<?> wrappedList, EditingDomain domain, EObject source, EStructuralFeature feature) {
+ super(new LinkedList<Object>(wrappedList), Object.class);
+ this.concreteList = wrappedList;
+ this.editingDomain = domain;
+ this.source = source;
+ this.feature = feature;
+
+ if (concreteList instanceof IObservableList) {
+ ((IObservableList) concreteList).addChangeListener(this);
+ }
+ }
+
+ protected boolean isCommitting;
+
+ public void handleChange(ChangeEvent event) {
+ if (isCommitting) {
+ return; // We're modifying the wrapped Observable list, which sends us change events. Ignore them.
+ }
+
+ // Refresh if we don't have pending changes
+ if (commands.isEmpty()) {
+ refreshCacheList();
+ }
+ }
+
+ public Object getObserved() {
+ return source;
+ }
+
+ @Override
+ public synchronized void dispose() {
+ if (concreteList instanceof IObservableList) {
+ ((IObservableList) concreteList).removeChangeListener(this);
+ }
+ super.dispose();
+ }
+
+ /**
+ * Forces this list to commit all the pending commands. Only one composite command will
+ * be executed, and can be undone in a single operation.
+ *
+ * @see org.eclipse.papyrus.infra.widgets.editors.ICommitListener#commit(AbstractEditor)
+ *
+ */
+ public synchronized void commit(AbstractEditor editor) {
+
+ isCommitting = true;
+
+ if (commands.isEmpty()) {
+ return;
+ }
+
+ CompoundCommand compoundCommand = new CompoundCommand() {
+
+ @Override
+ public void execute() {
+ super.execute();
+ refreshCacheList();
+ }
+
+ @Override
+ public void undo() {
+ super.undo();
+ refreshCacheList();
+ }
+
+ @Override
+ public void redo() {
+ super.redo();
+ refreshCacheList();
+ }
+
+ @Override
+ protected boolean prepare() {
+ if (commandList.isEmpty()) {
+ return false;
+ } else {
+ // We only test the first command, as the following ones might depend
+ // on the first command's execution. StrictCompoundCommands don't seem
+ // to be compatible with emf transaction (execute() is called by
+ // canExecute(), before the transaction is started)
+ return commandList.get(0).canExecute();
+ }
+ }
+ };
+
+ for (Command cmd : commands) {
+ compoundCommand.append(cmd);
+ }
+
+ editingDomain.getCommandStack().execute(compoundCommand);
+ refreshCacheList();
+ commands.clear();
+
+ isCommitting = false;
+ }
+
+ /**
+ * Refresh the cached list by copying the real list
+ */
+ protected void refreshCacheList() {
+ if (isDisposed()) {
+ // This observable can be disposed, but the commands might still be
+ // in the command stack. Undo() or Redo() will call this method, which
+ // should be ignored. The command should probably not call refresh directly ;
+ // we should have listeners on the concrete list... but it is not necessarily
+ // observable
+ return;
+ }
+ wrappedList.clear();
+ wrappedList.addAll(concreteList);
+ fireListChange(null);
+ }
+
+ @Override
+ public void add(int index, Object value) {
+ Command command = getAddCommand(index, value);
+ commands.add(command);
+
+ wrappedList.add(index, value);
+ fireListChange(null);
+ }
+
+ @Override
+ public void clear() {
+ Command command = getClearCommand();
+ commands.add(command);
+
+ wrappedList.clear();
+ fireListChange(null);
+ }
+
+ @Override
+ public boolean add(Object o) {
+ Command command = getAddCommand(o);
+ commands.add(command);
+
+ boolean result = wrappedList.add(o);
+ fireListChange(null);
+ return result;
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ Command command = getRemoveCommand(o);
+
+ commands.add(command);
+
+ boolean result = wrappedList.remove(o);
+ fireListChange(null);
+ return result;
+ }
+
+ @Override
+ public boolean addAll(Collection c) {
+ Command command = getAddAllCommand(c);
+ commands.add(command);
+
+ boolean result = wrappedList.addAll(c);
+ fireListChange(null);
+ return result;
+ }
+
+ @Override
+ public boolean addAll(int index, Collection c) {
+ Command command = getAddAllCommand(index, c);
+ commands.add(command);
+
+ boolean result = wrappedList.addAll(index, c);
+ fireListChange(null);
+ return result;
+ }
+
+ @Override
+ public boolean removeAll(Collection c) {
+ Command command = getRemoveCommand(c);
+ commands.add(command);
+
+ boolean result = wrappedList.removeAll(c);
+ fireListChange(null);
+ return result;
+ }
+
+ @Override
+ public boolean retainAll(Collection c) {
+ Command command = getRetainAllCommand(c);
+ commands.add(command);
+
+ boolean result = wrappedList.retainAll(c);
+ fireListChange(null);
+ return result;
+ }
+
+ @Override
+ public Object set(int index, Object element) {
+ Command command = getSetCommand(index, element);
+ commands.add(command);
+
+ Object result = wrappedList.set(index, element);
+ fireListChange(null);
+ return result;
+ }
+
+ @Override
+ public Object move(int oldIndex, int newIndex) {
+ commands.addAll(getMoveCommands(oldIndex, newIndex));
+
+ Object value = get(oldIndex);
+ wrappedList.remove(oldIndex);
+ wrappedList.add(newIndex, value);
+
+ fireListChange(null);
+
+ return value;
+ }
+
+ @Override
+ public Object remove(int index) {
+ Object value = get(index);
+ if (value != null) {
+ Command command = getRemoveCommand(index);
+ commands.add(command);
+ }
+
+ Object result = wrappedList.remove(index);
+ fireListChange(null);
+ return result;
+ }
+
+ public Command getAddCommand(int index, Object value) {
+ return AddCommand.create(editingDomain, source, feature, value, index);
+ }
+
+ public Command getAddCommand(Object value) {
+ return AddCommand.create(editingDomain, source, feature, value);
+ }
+
+ public Command getAddAllCommand(Collection<?> values) {
+ return AddCommand.create(editingDomain, source, feature, values);
+ }
+
+ public Command getAddAllCommand(int index, Collection<?> values) {
+ return AddCommand.create(editingDomain, source, feature, values, index);
+ }
+
+ public Command getClearCommand() {
+ return getRemoveAllCommand(new LinkedList<Object>(wrappedList));
+ }
+
+ public Command getRemoveCommand(int index) {
+ Object value = get(index);
+ return getRemoveCommand(value);
+ }
+
+ public Command getRemoveCommand(Object value) {
+ Command cmd = RemoveCommand.create(editingDomain, source, feature, value);
+ if (value instanceof EObject && feature instanceof EReference && ((EReference) feature).isContainment()) {
+ addDestroyCommand(cmd, (EObject) value);
+ }
+ return cmd;
+ }
+
+ public Command getRemoveAllCommand(Collection<?> values) {
+ CompoundCommand cc = new CompoundCommand("Edit list");
+
+ if (feature instanceof EReference && ((EReference) feature).isContainment() && values != null) {
+ for (Object o : values) {
+ if (o instanceof EObject) {
+ addDestroyCommand(cc, (EObject) o);
+ }
+ }
+ }
+
+ cc.append(RemoveCommand.create(editingDomain, source, feature, values));
+ return cc;
+ }
+
+ public List<Command> getMoveCommands(int oldIndex, int newIndex) {
+ Object value = get(oldIndex);
+ List<Command> commands = new LinkedList<Command>();
+ commands.add(getRemoveCommand(value));
+ commands.add(getAddCommand(newIndex, value));
+ return commands;
+ }
+
+ public Command getRetainAllCommand(Collection<?> values) {
+ List<Object> objectsToRemove = new LinkedList<Object>();
+ for (Object object : values) {
+ if (!contains(object)) {
+ objectsToRemove.add(object);
+ }
+ }
+ if (!objectsToRemove.isEmpty()) {
+ return getRemoveAllCommand(objectsToRemove);
+ } else {
+ return null;
+ }
+ }
+
+ public Command getSetCommand(int index, Object value) {
+ Object oldValue = get(index);
+ Command command = SetCommand.create(editingDomain, source, feature, value, index);
+ if (oldValue instanceof EObject && feature instanceof EReference && ((EReference) feature).isContainment()) {
+ addDestroyCommand(command, (EObject) oldValue);
+ }
+ return command;
+ }
+
+ protected void addDestroyCommand(Command cmd, EObject objToDestroy) {
+ Command destroyCmd = DeleteCommand.create(editingDomain, objToDestroy);
+
+ if (cmd instanceof CompoundCommand) {
+ ((CompoundCommand) cmd).append(destroyCmd);
+ } else {
+ cmd.chain(destroyCmd);
+ }
+ }
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableValue.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/EMFObservableValue.java
index 402ce4f1927..c054715c44e 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/databinding/EMFObservableValue.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/databinding/EMFObservableValue.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.databinding;
+package org.eclipse.papyrus.infra.ui.emf.databinding;
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.emf.common.command.Command;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/CommandCreationProgressMonitorDialog.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/dialog/CommandCreationProgressMonitorDialog.java
index 5cf29109ab7..0ad9634633a 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/CommandCreationProgressMonitorDialog.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/dialog/CommandCreationProgressMonitorDialog.java
@@ -1,102 +1,102 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.dialog;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.swt.widgets.Shell;
-
-
-/**
- *
- * This dialog allows to create a command using a progress bar dialog
- * Typical usage is:
- *
- * <pre>
- * CreationCommandProgressMonitorDialog commandCreationDialog = new CreationCommandProgressMonitorDialog(Display.getShell());
- *
- * try {
- * commandCreationDialog.run(true, true, new IRunnableWithProgress() {
- *
- * public void run(final IProgressMonitor cancelProvider) throws InvocationTargetException, InterruptedException {
- * final Command cmd = commandProvider.getCommand();
- * commandCreationDialog.setCreatedCommand(cmd);
- * }
- * });
- * } catch (final InvocationTargetException e) {
- * Activator.log.error(e);
- * } catch (final InterruptedException e) {
- * Activator.log.error(e);
- * }
- * final int returnCode = commandCreationDialog.getReturnCode();
- * if(returnCode == Window.OK) {
- * final Command createdCommand = commandCreationDialog.getCreatedCommand();
- * ...
- * }
- * </pre>
- */
-public class CommandCreationProgressMonitorDialog extends ProgressMonitorDialog {
-
- /** the created command */
- private Command createdCommand = null;
-
- /** an exception threw by the command creation */
- private Exception exception;
-
- /**
- *
- * Constructor.
- *
- * @param parent
- */
- public CommandCreationProgressMonitorDialog(final Shell parent) {
- super(parent);
-
- }
-
- /**
- * Setter for {@link #createdCommand}
- *
- * @param cmd
- * the created command
- */
- public void setCreatedCommand(final Command cmd) {
- this.createdCommand = cmd;
- }
-
- /**
- * Getter for {@link #createdCommand}
- *
- * @return
- * the created command
- */
- public Command getCreatedCommand() {
- return this.createdCommand;
- }
-
- public void setCaughtException(final Exception e) {
- this.exception = e;
- }
-
- /**
- *
- * @return
- * the exception throwed by the command creation
- */
- public Exception getCaughtException() {
- return this.exception;
- }
-
-
-}
+/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.ui.emf.dialog;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.swt.widgets.Shell;
+
+
+/**
+ *
+ * This dialog allows to create a command using a progress bar dialog
+ * Typical usage is:
+ *
+ * <pre>
+ * CreationCommandProgressMonitorDialog commandCreationDialog = new CreationCommandProgressMonitorDialog(Display.getShell());
+ *
+ * try {
+ * commandCreationDialog.run(true, true, new IRunnableWithProgress() {
+ *
+ * public void run(final IProgressMonitor cancelProvider) throws InvocationTargetException, InterruptedException {
+ * final Command cmd = commandProvider.getCommand();
+ * commandCreationDialog.setCreatedCommand(cmd);
+ * }
+ * });
+ * } catch (final InvocationTargetException e) {
+ * Activator.log.error(e);
+ * } catch (final InterruptedException e) {
+ * Activator.log.error(e);
+ * }
+ * final int returnCode = commandCreationDialog.getReturnCode();
+ * if(returnCode == Window.OK) {
+ * final Command createdCommand = commandCreationDialog.getCreatedCommand();
+ * ...
+ * }
+ * </pre>
+ */
+public class CommandCreationProgressMonitorDialog extends ProgressMonitorDialog {
+
+ /** the created command */
+ private Command createdCommand = null;
+
+ /** an exception threw by the command creation */
+ private Exception exception;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ */
+ public CommandCreationProgressMonitorDialog(final Shell parent) {
+ super(parent);
+
+ }
+
+ /**
+ * Setter for {@link #createdCommand}
+ *
+ * @param cmd
+ * the created command
+ */
+ public void setCreatedCommand(final Command cmd) {
+ this.createdCommand = cmd;
+ }
+
+ /**
+ * Getter for {@link #createdCommand}
+ *
+ * @return
+ * the created command
+ */
+ public Command getCreatedCommand() {
+ return this.createdCommand;
+ }
+
+ public void setCaughtException(final Exception e) {
+ this.exception = e;
+ }
+
+ /**
+ *
+ * @return
+ * the exception throwed by the command creation
+ */
+ public Exception getCaughtException() {
+ return this.exception;
+ }
+
+
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/NestedEditingDialogContext.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/dialog/NestedEditingDialogContext.java
index 2ba17a5167d..ae0965f85d2 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/dialog/NestedEditingDialogContext.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/dialog/NestedEditingDialogContext.java
@@ -10,7 +10,7 @@
* Christian W. Damus (CEA) - Initial API and implementation
*
*/
-package org.eclipse.papyrus.infra.emf.dialog;
+package org.eclipse.papyrus.infra.ui.emf.dialog;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/AdapterFactoryHierarchicContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/AdapterFactoryHierarchicContentProvider.java
index 5a1653e88c2..d7363e6fd1f 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/AdapterFactoryHierarchicContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/AdapterFactoryHierarchicContentProvider.java
@@ -10,7 +10,7 @@
* Christian W. Damus (CEA) - Initial API and implementation
*
*/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/AnyTypeLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/AnyTypeLabelProvider.java
index d6b55f7c363..d4336218ccf 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/AnyTypeLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/AnyTypeLabelProvider.java
@@ -11,7 +11,7 @@
* Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
*
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFContentProvider.java
index f2f3e4361a2..ebcfec4c357 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFContentProvider.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
@@ -19,9 +19,9 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
-import org.eclipse.papyrus.infra.emf.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.emf.utils.HistoryUtil;
+import org.eclipse.papyrus.infra.ui.emf.providers.strategy.ContainmentBrowseStrategy;
+import org.eclipse.papyrus.infra.ui.emf.providers.strategy.SemanticEMFContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.EmptyContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.EncapsulatedContentProvider;
import org.eclipse.papyrus.infra.widgets.strategy.IStrategyBasedContentProvider;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFEnumeratorContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFEnumeratorContentProvider.java
index aed1a94544f..5333a5ce5d1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFEnumeratorContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFEnumeratorContentProvider.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.ecore.EClassifier;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFFilteredLabelProvider.java
index c36d6592798..80f175559f3 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFFilteredLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFFilteredLabelProvider.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import java.util.Iterator;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFGraphicalContentProvider.java
index aa0761772e3..fe34bbb7d20 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFGraphicalContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFGraphicalContentProvider.java
@@ -14,7 +14,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - History integration
*
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import java.util.ArrayList;
import java.util.Arrays;
@@ -40,8 +40,8 @@ import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.papyrus.infra.emf.Activator;
import org.eclipse.papyrus.infra.services.labelprovider.service.IDetailLabelProvider;
+import org.eclipse.papyrus.infra.ui.internal.emf.Activator;
import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor;
import org.eclipse.papyrus.infra.widgets.editors.ICommitListener;
import org.eclipse.papyrus.infra.widgets.editors.StringEditor;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFLabelProvider.java
index 746d71885de..20e055e6a78 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/EMFLabelProvider.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import java.util.Collection;
import java.util.HashSet;
@@ -23,10 +23,10 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement;
import org.eclipse.papyrus.emf.facet.custom.ui.internal.DecoratingCustomizedLabelProvider;
import org.eclipse.papyrus.emf.facet.custom.ui.internal.ResolvingCustomizedLabelProvider;
-import org.eclipse.papyrus.infra.emf.Activator;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.services.labelprovider.service.IDetailLabelProvider;
import org.eclipse.papyrus.infra.services.labelprovider.service.IQualifierLabelProvider;
+import org.eclipse.papyrus.infra.ui.internal.emf.Activator;
import org.eclipse.swt.graphics.Image;
/**
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/HistoryContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/HistoryContentProvider.java
index e6691a33267..dbcab29ca92 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/HistoryContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/HistoryContentProvider.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import java.util.List;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/MoDiscoContentProvider.java
index 035bce4ac83..39aa8fe4a3e 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/MoDiscoContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/MoDiscoContentProvider.java
@@ -8,7 +8,7 @@
* Contributors:
* Nicolas Bros (Mia-Software) - initial API and implementation
*******************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import java.util.ArrayList;
import java.util.Iterator;
@@ -22,7 +22,7 @@ import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.ModelUtils;
import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.emf.Activator;
+import org.eclipse.papyrus.infra.ui.internal.emf.Activator;
/**
* the content provider that inherits of modisco properties
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ResourceFilteredLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/ResourceFilteredLabelProvider.java
index 6440770e64f..6b2c37d22d1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/ResourceFilteredLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/ResourceFilteredLabelProvider.java
@@ -10,7 +10,7 @@
* Christian W. Damus (CEA) - Initial API and implementation
*
*/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import java.io.IOException;
import java.util.Map;
@@ -26,9 +26,9 @@ import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.resource.LocalResourceManager;
import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.infra.emf.Activator;
-import org.eclipse.papyrus.infra.emf.messages.Messages;
import org.eclipse.papyrus.infra.services.labelprovider.service.IFilteredLabelProvider;
+import org.eclipse.papyrus.infra.ui.internal.emf.Activator;
+import org.eclipse.papyrus.infra.ui.internal.emf.messages.Messages;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.PlatformUI;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/SemanticFromModelExplorer.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/SemanticFromModelExplorer.java
index 3c69f464f68..440c5efd9a9 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/SemanticFromModelExplorer.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/SemanticFromModelExplorer.java
@@ -11,7 +11,7 @@
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
*
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.notation.Diagram;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/StandardEMFLabelProvider.java
index 96e25e91955..d659ec48007 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/StandardEMFLabelProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/StandardEMFLabelProvider.java
@@ -10,7 +10,7 @@
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Added support for enum literals
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Implementation of IDetailLabelProvider
*******************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers;
+package org.eclipse.papyrus.infra.ui.emf.providers;
import java.util.Arrays;
import java.util.HashMap;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/ContainmentBrowseStrategy.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/strategy/ContainmentBrowseStrategy.java
index 6306cf57dc4..f92cec5d8c4 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/ContainmentBrowseStrategy.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/strategy/ContainmentBrowseStrategy.java
@@ -9,7 +9,7 @@
* Contributors:
* Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers.strategy;
+package org.eclipse.papyrus.infra.ui.emf.providers.strategy;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/SemanticEMFContentProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/strategy/SemanticEMFContentProvider.java
index ab94a10c59c..7d3f273b9e1 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/strategy/SemanticEMFContentProvider.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/providers/strategy/SemanticEMFContentProvider.java
@@ -11,7 +11,7 @@
* Christian W. Damus (CEA) - bug 410346
*
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.providers.strategy;
+package org.eclipse.papyrus.infra.ui.emf.providers.strategy;
import java.util.Collections;
import java.util.LinkedList;
@@ -29,8 +29,8 @@ import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.internal.treeproxy.TreeElement;
import org.eclipse.papyrus.emf.facet.custom.ui.internal.CustomizedTreeContentProvider;
-import org.eclipse.papyrus.infra.emf.Activator;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.ui.internal.emf.Activator;
import org.eclipse.papyrus.infra.widgets.providers.IAdaptableContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IHierarchicContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/utils/ProviderHelper.java
index 52df1d82b23..77704b242af 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/utils/ProviderHelper.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/emf/utils/ProviderHelper.java
@@ -1,59 +1,73 @@
-/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.infra.emf.utils;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.papyrus.infra.emf.providers.EMFGraphicalContentProvider;
-import org.eclipse.papyrus.infra.emf.providers.strategy.ContainmentBrowseStrategy;
-import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
-import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
-import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
-
-
-public class ProviderHelper {
-
- /**
- * Encapsulates the given content provider in a higher-level content provider
- * The returned provider uses two different strategies to display and search
- * elements, and adds a pattern filter and an History
- *
- * @param provider
- * The ContentProvider to encapsulate
- * @return
- */
- public static EMFGraphicalContentProvider encapsulateProvider(ITreeContentProvider provider, ResourceSet resourceSet, String historyId) {
- TreeBrowseStrategy browseStrategy = new ProviderBasedBrowseStrategy(provider);
- TreeBrowseStrategy revealStrategy = new ContainmentBrowseStrategy(provider);
- IStructuredContentProvider strategyProvider = new StrategyBasedContentProvider(browseStrategy, revealStrategy);
- EMFGraphicalContentProvider graphicalProvider = new EMFGraphicalContentProvider(strategyProvider, resourceSet, historyId);
-
- return graphicalProvider;
- }
-
- /**
- * Encapsulates the given content provider in a higher-level content provider
- * The returned provider uses two different strategies to display and search
- * elements, and adds a pattern filter and an History
- *
- * @param provider
- * The ContentProvider to encapsulate
- * @return
- */
- public static EMFGraphicalContentProvider encapsulateProvider(ITreeContentProvider provider, EObject editedEObject, EStructuralFeature feature) {
- ResourceSet rs = editedEObject == null ? null : editedEObject.eResource() == null ? null : editedEObject.eResource().getResourceSet();
- return encapsulateProvider(provider, rs, HistoryUtil.getHistoryID(editedEObject, feature));
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2012, 2016 CEA LIST, 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:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.ui.emf.utils;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.papyrus.infra.emf.utils.HistoryUtil;
+import org.eclipse.papyrus.infra.ui.emf.providers.EMFGraphicalContentProvider;
+import org.eclipse.papyrus.infra.ui.emf.providers.strategy.ContainmentBrowseStrategy;
+import org.eclipse.papyrus.infra.ui.internal.emf.Activator;
+import org.eclipse.papyrus.infra.widgets.strategy.ProviderBasedBrowseStrategy;
+import org.eclipse.papyrus.infra.widgets.strategy.StrategyBasedContentProvider;
+import org.eclipse.papyrus.infra.widgets.strategy.TreeBrowseStrategy;
+
+
+public class ProviderHelper {
+
+ /**
+ * Obtains the customization manager used by Papyrus's EMFFacet-based content providers.
+ *
+ * @return the customization manager
+ */
+ public static ICustomizationManager getCustomizationManager() {
+ return Activator.getDefault().getCustomizationManager();
+ }
+
+ /**
+ * Encapsulates the given content provider in a higher-level content provider
+ * The returned provider uses two different strategies to display and search
+ * elements, and adds a pattern filter and an History
+ *
+ * @param provider
+ * The ContentProvider to encapsulate
+ * @return
+ */
+ public static EMFGraphicalContentProvider encapsulateProvider(ITreeContentProvider provider, ResourceSet resourceSet, String historyId) {
+ TreeBrowseStrategy browseStrategy = new ProviderBasedBrowseStrategy(provider);
+ TreeBrowseStrategy revealStrategy = new ContainmentBrowseStrategy(provider);
+ IStructuredContentProvider strategyProvider = new StrategyBasedContentProvider(browseStrategy, revealStrategy);
+ EMFGraphicalContentProvider graphicalProvider = new EMFGraphicalContentProvider(strategyProvider, resourceSet, historyId);
+
+ return graphicalProvider;
+ }
+
+ /**
+ * Encapsulates the given content provider in a higher-level content provider
+ * The returned provider uses two different strategies to display and search
+ * elements, and adds a pattern filter and an History
+ *
+ * @param provider
+ * The ContentProvider to encapsulate
+ * @return
+ */
+ public static EMFGraphicalContentProvider encapsulateProvider(ITreeContentProvider provider, EObject editedEObject, EStructuralFeature feature) {
+ ResourceSet rs = editedEObject == null ? null : editedEObject.eResource() == null ? null : editedEObject.eResource().getResourceSet();
+ return encapsulateProvider(provider, rs, HistoryUtil.getHistoryID(editedEObject, feature));
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/Activator.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/Activator.java
new file mode 100644
index 00000000000..ca3d404c299
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/Activator.java
@@ -0,0 +1,196 @@
+/*****************************************************************************
+ * Copyright (c) 2013, 2016 CEA LIST, 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:
+ * Camille Letavernier (camille.letavernier@cea.fr) - Initial API and implementation
+ * Christian W. Damus - bug 485220
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.ui.internal.emf;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.DialogSettings;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManager;
+import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationCatalogManagerFactory;
+import org.eclipse.papyrus.emf.facet.custom.core.ICustomizationManager;
+import org.eclipse.papyrus.emf.facet.custom.metamodel.v0_2_0.custom.Customization;
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.papyrus.infra.emf.CustomizationComparator;
+import org.eclipse.papyrus.infra.emf.readonly.spi.IReadOnlyManagerProcessor;
+import org.eclipse.papyrus.infra.ui.internal.emf.readonly.EditorReloadProcessor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * 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.ui.emf"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The plug-in's logger
+ */
+ public static LogHelper log;
+
+ private ServiceRegistration<IReadOnlyManagerProcessor> roManagerProcessorReg;
+
+ private ICustomizationManager customizationManager;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+
+ roManagerProcessorReg = context.registerService(IReadOnlyManagerProcessor.class, new EditorReloadProcessor(), null);
+ }
+
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ if (roManagerProcessorReg != null) {
+ roManagerProcessorReg.unregister();
+ roManagerProcessorReg = null;
+ }
+
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Saves the current Customization Manager settings to the preferences
+ */
+ public void saveCustomizationManagerState() {
+ IDialogSettings dialogSettings = getBrowserCustomizationDialogSettings();
+ List<Customization> appliedCustomizations = getCustomizationManager().getManagedCustomizations();
+
+ final List<Customization> registeredCustomizations = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(getCustomizationManager().getResourceSet()).getRegisteredCustomizations();
+
+ for (Customization customization : registeredCustomizations) {
+
+ boolean isApplied = appliedCustomizations.contains(customization);
+ String settingKey = getSettingKey(customization);
+
+ dialogSettings.put(settingKey, isApplied);
+ }
+ }
+
+ private String getSettingKey(Customization customization) {
+ // do not exist anymore
+ return customization.eResource().getURI().toString();
+ // return "";
+ }
+
+ protected IDialogSettings getBrowserCustomizationDialogSettings() {
+ String sectionId = CUSTOMIZATION_MANAGER_SECTION;
+
+ IDialogSettings settings = Activator.getDefault().getDialogSettings().getSection(sectionId);
+ if (settings == null) {
+ settings = Activator.getDefault().getDialogSettings().addNewSection(sectionId);
+ }
+ return settings;
+ }
+
+ private void init(final ICustomizationManager customizationManager) {
+ // the appearance can be customized here:
+
+ IDialogSettings settings = getBrowserCustomizationDialogSettings();
+
+ try {
+
+ // load customizations defined as default through the customization
+ // extension
+ ICustomizationCatalogManager customCatalog = ICustomizationCatalogManagerFactory.DEFAULT.getOrCreateCustomizationCatalogManager(customizationManager.getResourceSet());
+ // no possibility to get default customization
+
+ List<Customization> registryAllCustomizations = customCatalog.getRegisteredCustomizations();
+ ArrayList<Customization> orderedCustomizationList = new ArrayList<Customization>();
+ for (Customization customization : registryAllCustomizations) {
+ String settingKey = getSettingKey(customization);
+
+ boolean isActive = false;
+ if (settings.get(settingKey) == null) { // Never customized
+ isActive = customization.isMustBeLoadedByDefault(); // Loaded by default
+
+ } else {
+ isActive = settings.getBoolean(settingKey);
+ }
+
+ if (isActive) {
+ orderedCustomizationList.add(customization);
+
+ }
+ }
+
+ Collections.sort(orderedCustomizationList, new CustomizationComparator());
+ customizationManager.getManagedCustomizations().addAll(orderedCustomizationList);
+
+ } catch (Throwable e) {
+ log.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * The section name of the Dialog Settings for storing Customization Manager settings
+ */
+ public static final String CUSTOMIZATION_MANAGER_SECTION = PLUGIN_ID + ".customizationManager";//$NON-NLS-1$
+
+ /**
+ * Restores the default Customization Manager configuration
+ */
+ public void restoreDefaultCustomizationManager() {
+ // ICustomizationManager manager = getCustomizationManager();
+
+ DialogSettings settings = (DialogSettings) getDialogSettings();
+ settings.removeSection(CUSTOMIZATION_MANAGER_SECTION);
+
+ // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ //
+ // manager.clearCustomizations();
+ // for(MetamodelView customization : registryDefaultCustomizations) {
+ // manager.registerCustomization(customization);
+ // }
+ // manager.loadCustomizations();
+ }
+
+ public ICustomizationManager getCustomizationManager() {
+ if (customizationManager == null) {
+ customizationManager = org.eclipse.papyrus.infra.emf.Activator.getDefault().getCustomizationManager();
+ init(getCustomizationManager());
+ }
+ return customizationManager;
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/expressions/ReadOnlyTester.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/expressions/ReadOnlyTester.java
new file mode 100644
index 00000000000..eb503b636c0
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/expressions/ReadOnlyTester.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.ui.internal.emf.expressions;
+
+import java.util.Iterator;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ * A provider of the same properties as the core tester, for selections.
+ */
+public class ReadOnlyTester extends PropertyTester {
+
+ private final PropertyTester delegate = new org.eclipse.papyrus.infra.emf.readonly.ReadOnlyTester();
+
+ @Override
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ boolean result = false;
+
+ if (receiver instanceof IStructuredSelection) {
+ Iterator<?> objects = ((IStructuredSelection) receiver).iterator();
+
+ result = delegate.test(objects, property, args, expectedValue);
+ }
+
+ return result;
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/messages/Messages.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/messages/Messages.java
new file mode 100644
index 00000000000..15e09760eb5
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/messages/Messages.java
@@ -0,0 +1,47 @@
+/*************************************************************
+ * Copyright (c) 2012, 2016 CEA, 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:
+ * Vincent Lorenzo (CEA LIST) - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 323802
+ * Christian W. Damus - bug 485220
+ *
+ */
+
+package org.eclipse.papyrus.infra.ui.internal.emf.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.ui.internal.emf.messages.messages"; //$NON-NLS-1$
+
+ public static String ResourceFilteredLabelProvider_local;
+
+ public static String ResourceFilteredLabelProvider_localExt;
+
+ public static String ResourceFilteredLabelProvider_system;
+
+ public static String ResourceFilteredLabelProvider_systemExt;
+
+ public static String ResourceFilteredLabelProvider_workspace;
+
+ public static String ResourceFilteredLabelProvider_workspaceExt;
+
+ public static String ReferencedModelReadOnlyHandler_promptMsg;
+
+ public static String ReferencedModelReadOnlyHandler_promptTitle;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/messages/messages.properties b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/messages/messages.properties
new file mode 100644
index 00000000000..82ee5c28163
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/messages/messages.properties
@@ -0,0 +1,22 @@
+#
+# Copyright (c) 2012, 2016 CEA, 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:
+# Vincent Lorenzo (CEA LIST) - Initial API and implementation
+# Christian W. Damus (CEA) - bug 323802
+# Christian W. Damus - bug 485220
+#
+
+ResourceFilteredLabelProvider_local=Local model file "{0}"
+ResourceFilteredLabelProvider_localExt=Local model file "{0}" ({1} component)
+ResourceFilteredLabelProvider_system=System resource "{0}"
+ResourceFilteredLabelProvider_systemExt=Resource "{0}"
+ResourceFilteredLabelProvider_workspace=Workspace model file "{0}"
+ResourceFilteredLabelProvider_workspaceExt=Workspace model file "{0}" ({1} component)
+ReferencedModelReadOnlyHandler_promptMsg=Do you want to make these referenced library model files writable?\n\n
+ReferencedModelReadOnlyHandler_promptTitle=Enable Write
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/EditorReloadProcessor.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/EditorReloadProcessor.java
new file mode 100644
index 00000000000..20bd03ab22d
--- /dev/null
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/EditorReloadProcessor.java
@@ -0,0 +1,131 @@
+/*****************************************************************************
+ * Copyright (c) 2016 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
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.ui.internal.emf.readonly;
+
+import java.util.Map;
+
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler;
+import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.readonly.ReadOnlyManager;
+import org.eclipse.papyrus.infra.emf.readonly.spi.IReadOnlyManagerProcessor;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
+import org.eclipse.papyrus.infra.tools.util.PlatformHelper;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.ui.editor.IReloadableEditor;
+import org.eclipse.papyrus.infra.ui.editor.reload.EditorReloadEvent;
+import org.eclipse.papyrus.infra.ui.editor.reload.IEditorReloadListener;
+import org.eclipse.papyrus.infra.ui.editor.reload.IReloadContextProvider;
+import org.eclipse.papyrus.infra.ui.internal.emf.Activator;
+
+import com.google.common.collect.Maps;
+
+/**
+ * Implementation of the {@link ReadOnlyManager} processor service that attaches an
+ * editor reload listener that lets {@link IReadOnlyHandler}s contribute
+ * {@linkplain IReloadContextProvider reload contexts} to the editor re-load procedure.
+ */
+public class EditorReloadProcessor implements IReadOnlyManagerProcessor {
+
+ public EditorReloadProcessor() {
+ super();
+ }
+
+ @Override
+ public void processReadOnlyManager(ReadOnlyManager readOnlyManager, EditingDomain editingDomain) {
+ // Is this editing domain associated with an editor?
+ try {
+ IMultiDiagramEditor editor = ServiceUtilsForResourceSet.getInstance().getService(IMultiDiagramEditor.class, editingDomain.getResourceSet());
+ if (editor != null) {
+ IReloadableEditor reloadable = IReloadableEditor.Adapter.getAdapter(editor);
+ if (reloadable != null) {
+ reloadable.addEditorReloadListener(new ReadOnlyEditorReloadListener(readOnlyManager));
+ }
+ }
+ } catch (ServiceException e) {
+ // That's OK. We're not in the context of an editor
+ }
+ }
+
+ //
+ // Nested types
+ //
+
+ private static class ReadOnlyEditorReloadListener implements IEditorReloadListener {
+ private ReadOnlyManager readOnlyManager;
+
+ ReadOnlyEditorReloadListener(ReadOnlyManager readOnlyManager) {
+ super();
+
+ this.readOnlyManager = readOnlyManager;
+ }
+
+ //
+ // Get and store a reload context from each read-only handler that can provide one
+ //
+ @Override
+ public void editorAboutToReload(EditorReloadEvent event) {
+ Map<Class<? extends IReadOnlyHandler2>, Object> reloadContexts = Maps.newHashMap();
+
+ for (Iterable<IReadOnlyHandler2> partition : readOnlyManager.getReadOnlyHandlers().values()) {
+ for (IReadOnlyHandler2 next : partition) {
+ if (!reloadContexts.containsKey(next.getClass())) {
+ IReloadContextProvider provider = PlatformHelper.getAdapter(next, IReloadContextProvider.class);
+ if (provider != null) {
+ reloadContexts.put(next.getClass(), provider.createReloadContext());
+ }
+ }
+ }
+ }
+
+ if (!reloadContexts.isEmpty()) {
+ event.putContext(reloadContexts);
+ }
+ }
+
+ //
+ // Ask available read-only handlers to restore the reload contexts that their
+ // counterparts in the editor's previous manager had provided
+ //
+ @Override
+ public void editorReloaded(EditorReloadEvent event) {
+ // It will have been replaced by a new read-only manager
+ try {
+ readOnlyManager = (ReadOnlyManager) ReadOnlyManager.getReadOnlyHandler(event.getEditor().getServicesRegistry().getService(TransactionalEditingDomain.class));
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ Object context = event.getContext();
+ if (context instanceof Map<?, ?>) {
+ @SuppressWarnings("unchecked")
+ Map<Class<? extends IReadOnlyHandler2>, Object> reloadContexts = (Map<Class<? extends IReadOnlyHandler2>, Object>) context;
+ for (Iterable<IReadOnlyHandler2> partition : readOnlyManager.getReadOnlyHandlers().values()) {
+ for (IReadOnlyHandler2 next : partition) {
+ Object reloadContext = reloadContexts.get(next.getClass());
+ if (reloadContext != null) {
+ IReloadContextProvider provider = PlatformHelper.getAdapter(next, IReloadContextProvider.class);
+ if (provider != null) {
+ provider.restore(reloadContext);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+}
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteCommandHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/EnableWriteCommandHandler.java
index b8c8cc32f70..1d9c8eeb204 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/handlers/EnableWriteCommandHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/EnableWriteCommandHandler.java
@@ -12,7 +12,7 @@
* Christian W. Damus (CEA) - bug 429826
*
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.readonly.handlers;
+package org.eclipse.papyrus.infra.ui.internal.emf.readonly.handlers;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/FSReadOnlyHandler.java
index 034dabfa6a4..f4c5c82bfbf 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/FSReadOnlyHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/FSReadOnlyHandler.java
@@ -14,7 +14,7 @@
* Christian W. Damus - bug 463564
*
*****************************************************************************/
-package org.eclipse.papyrus.infra.emf.readonly;
+package org.eclipse.papyrus.infra.ui.internal.emf.readonly.handlers;
import java.io.File;
import java.util.LinkedHashMap;
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/ReferencedModelReadOnlyHandler.java
index 4f627676eff..d08fdc7296f 100644
--- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/ReferencedModelReadOnlyHandler.java
+++ b/plugins/infra/emf/org.eclipse.papyrus.infra.ui.emf/src/org/eclipse/papyrus/infra/ui/internal/emf/readonly/handlers/ReferencedModelReadOnlyHandler.java
@@ -11,7 +11,7 @@
* Christian W. Damus - bug 463631
*
*/
-package org.eclipse.papyrus.infra.emf.readonly;
+package org.eclipse.papyrus.infra.ui.internal.emf.readonly.handlers;
import java.util.ArrayList;
import java.util.HashSet;
@@ -27,8 +27,9 @@ import org.eclipse.papyrus.infra.core.resource.AbstractReadOnlyHandler;
import org.eclipse.papyrus.infra.core.resource.IReadOnlyHandler2;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.ReadOnlyAxis;
-import org.eclipse.papyrus.infra.emf.readonly.internal.messages.Messages;
+import org.eclipse.papyrus.infra.emf.readonly.internal.ControlledResourceTracker;
import org.eclipse.papyrus.infra.ui.editor.reload.IReloadContextProvider;
+import org.eclipse.papyrus.infra.ui.internal.emf.messages.Messages;
import org.eclipse.swt.widgets.Display;
import com.google.common.base.Optional;
@@ -71,6 +72,7 @@ public class ReferencedModelReadOnlyHandler extends AbstractReadOnlyHandler impl
this.interactive = interactive;
}
+ @Override
public Optional<Boolean> anyReadOnly(Set<ReadOnlyAxis> axes, URI[] uris) {
Optional<Boolean> result = Optional.absent();
@@ -115,6 +117,7 @@ public class ReferencedModelReadOnlyHandler extends AbstractReadOnlyHandler impl
return result;
}
+ @Override
public Optional<Boolean> makeWritable(Set<ReadOnlyAxis> axes, URI[] uris) {
Optional<Boolean> result = Optional.absent();
@@ -140,6 +143,7 @@ public class ReferencedModelReadOnlyHandler extends AbstractReadOnlyHandler impl
}
currentDisplay.syncExec(new Runnable() {
+ @Override
public void run() {
StringBuilder message = new StringBuilder(Messages.ReferencedModelReadOnlyHandler_promptMsg);
for (URI uri : toMakeWritable) {
@@ -206,10 +210,12 @@ public class ReferencedModelReadOnlyHandler extends AbstractReadOnlyHandler impl
return controlledResourceTracker.getRootResourceURIs(uri);
}
+ @Override
public Object createReloadContext() {
return writableReferencedModels;
}
+ @Override
@SuppressWarnings("unchecked")
public void restore(Object reloadContext) {
writableReferencedModels.addAll((Set<URI>) reloadContext);

Back to the top