Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-02-02 04:36:19 -0500
committervlorenzo2012-02-02 04:36:19 -0500
commit68807c32ce975b12d2bab793cb32aa2b5ab9749c (patch)
treea6c03fd7d11959a0e35d4d61784b567bc26d7834
parente64c89d46e7a95cdee399ea6167bb07f3b770f87 (diff)
downloadorg.eclipse.papyrus-68807c32ce975b12d2bab793cb32aa2b5ab9749c.tar.gz
org.eclipse.papyrus-68807c32ce975b12d2bab793cb32aa2b5ab9749c.tar.xz
org.eclipse.papyrus-68807c32ce975b12d2bab793cb32aa2b5ab9749c.zip
A save of my work
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.classpath7
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.project28
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs22
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.ui.prefs59
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/META-INF/MANIFEST.MF38
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/about.html28
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/build.properties17
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/PapyrusLogo16x16.gifbin0 -> 561 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gifbin0 -> 612 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/plugin.xml63
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/Activator.java158
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CustomizationAction.java104
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/AbstractEMFCompareHandler.java53
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/RedoHandler.java53
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/UndoHandler.java44
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/listeners/CloseEditorListener.java113
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/AbstractActionStateSourceProvider.java280
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ActionSourceProvider.java33
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ModelStructureLabelProvider.java99
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/PapyrusLabelProvider.java177
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/TransactionalActionSourceProvider.java76
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusParameterizedStructureMergeViewer.java74
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusStructureMergeViewerCreator.java39
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalContentMergeViewerCreator.java34
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeDiffTab.java127
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeTabFolder.java254
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeViewer.java277
27 files changed, 2257 insertions, 0 deletions
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.classpath b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.project b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.project
new file mode 100644
index 00000000000..01a33a9ae6f
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.emf.compare.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..5152edbd2ac
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,22 @@
+#Thu Dec 01 17:05:06 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.ui.prefs b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..4772e74af97
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,59 @@
+#Thu Dec 01 17:06:59 CET 2011
+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=true
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=false
+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=true
+cleanup.always_use_this_for_non_static_method_access=true
+cleanup.convert_to_enhanced_for_loop=true
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=true
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=true
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=true
+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=true
+cleanup.remove_private_constructors=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_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=false
+cleanup_profile=_CustomPapyrusCleanUpProfile
+cleanup_settings_version=2
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/META-INF/MANIFEST.MF b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..1a1059cff80
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,38 @@
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.emf.compare.ui.actions,org.e
+ clipse.papyrus.infra.emf.compare.ui.provider,org.eclipse.papyrus.infr
+ a.emf.compare.ui.structural.viewer,org.eclipse.papyrus.infra.emf.comp
+ are.ui.viewer
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.compare,
+ org.eclipse.emf.common,
+ org.eclipse.emf.workspace,
+ org.eclipse.emf.compare.ui,
+ org.eclipse.emf.facet.infra.browser.uicore,
+ org.eclipse.emf.compare.diff;bundle-version="1.3.0",
+ org.eclipse.emf.facet.infra.browser.custom,
+ org.eclipse.emf.facet.infra.browser.custom.core,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.emf.compare,
+ org.eclipse.emf.facet.infra.browser.custom.ui;bundle-version="0.1.1",
+ org.eclipse.emf.workspace.ui,
+ org.eclipse.core.expressions,
+ org.eclipse.team.ui,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.gmf.runtime.common.core,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.core;bundle-version="0.9.0",
+ org.eclipse.gmf.runtime.diagram.ui,
+ org.eclipse.papyrus.infra.emf.compare
+Bundle-Vendor: Eclipse Modeling Project
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.9.0.qualifier
+Bundle-Name: Papyrus Compare UI
+Bundle-Activator: org.eclipse.papyrus.infra.emf.compare.ui.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.compare.ui;singleto
+ n:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/about.html b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</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>
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/build.properties b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/build.properties
new file mode 100644
index 00000000000..f2fe747dc83
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/build.properties
@@ -0,0 +1,17 @@
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ schema/,\
+ icons/,\
+ about.html,\
+ resources/EMFCompareDiffElement.uiCustom,\
+ resources/EMFCompareDiffElementQueries.querySet
+src.includes = schema/,\
+ src/,\
+ META-INF/,\
+ icons/,\
+ plugin.xml,\
+ about.html
+source.. = src/
+src/ =
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/PapyrusLogo16x16.gif b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/PapyrusLogo16x16.gif
new file mode 100644
index 00000000000..8a31f458379
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/PapyrusLogo16x16.gif
Binary files differ
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gif b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gif
new file mode 100644
index 00000000000..bc86fbc897e
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gif
Binary files differ
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/plugin.xml b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/plugin.xml
new file mode 100644
index 00000000000..9d812915bb2
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/plugin.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse version="3.4"?>
+
+<plugin>
+ <extension point="org.eclipse.compare.contentMergeViewers">
+ <viewer class="org.eclipse.papyrus.infra.emf.compare.ui.viewer.TransactionalContentMergeViewerCreator" extensions="uml" id="org.eclipse.papyrus.infra.emf.compare.ui.papyrus.viewer" label="INFRA Papyrus Viewer">
+ </viewer>
+ </extension>
+ <extension point="org.eclipse.compare.structureMergeViewers">
+ <viewer class="org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer.PapyrusStructureMergeViewerCreator" extensions="uml" id="org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer" label="INFRA Papyrus Structure Merge Viewer">
+ </viewer>
+ </extension>
+ <extension point="org.eclipse.ui.handlers">
+ <handler class="org.eclipse.papyrus.infra.emf.compare.ui.handlers.UndoHandler" commandId="org.eclipse.ui.edit.undo">
+ <enabledWhen>
+ <with variable="activeEditorId">
+ <equals value="org.eclipse.compare.CompareEditor">
+ </equals>
+ </with>
+ </enabledWhen>
+ <activeWhen>
+ <with variable="activeEditorId">
+ <equals value="org.eclipse.compare.CompareEditor">
+ </equals>
+ </with>
+ </activeWhen>
+
+ </handler>
+ <handler class="org.eclipse.papyrus.infra.emf.compare.ui.handlers.RedoHandler" commandId="org.eclipse.ui.edit.redo">
+ <enabledWhen>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.compare.CompareEditor">
+ </equals>
+ </with>
+ </enabledWhen>
+ <activeWhen>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.compare.CompareEditor">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution allPopups="false" locationURI="menu:edit?before=cut">
+ <command commandId="org.eclipse.papyrus.infra.emf.compare.ui.customUndo" label="My Custom Undo" style="push">
+ </command>
+ <command commandId="org.eclipse.papyrus.infra.emf.compare.ui.customRedo" label="My Custom Redo" style="push">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension point="org.eclipse.ui.commands">
+ <command defaultHandler="org.eclipse.papyrus.infra.emf.compare.ui.handlers.UndoHandler" id="org.eclipse.papyrus.infra.emf.compare.ui.customUndo" name="Custom Undo Command">
+ </command>
+ <command defaultHandler="org.eclipse.papyrus.infra.emf.compare.ui.handlers.RedoHandler" id="org.eclipse.papyrus.infra.emf.compare.ui.customRedo" name="Custom Redo Command">
+ </command>
+ </extension>
+
+</plugin>
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/Activator.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/Activator.java
new file mode 100644
index 00000000000..c37dc4fe2d3
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/Activator.java
@@ -0,0 +1,158 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.facet.infra.browser.custom.MetamodelView;
+import org.eclipse.emf.facet.infra.browser.custom.core.CustomizationsCatalog;
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.papyrus.infra.emf.compare.ui.listeners.CloseEditorListener;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.emf.compare.ui"; //$NON-NLS-1$
+
+ /** the activator */
+ private static Activator plugin;
+
+ /** this map store a customization manager associted to an editor (a CompareEditor) */
+ private Map<IEditorPart, CustomizationManager> customizationMap;
+
+ /** this listener listen the closing editors to clean the previous map */
+ private IPartListener2 closingEditorlistener;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ this.customizationMap = new HashMap<IEditorPart, CustomizationManager>();
+ this.closingEditorlistener = new CloseEditorListener();
+ addListener();
+ }
+
+ /**
+ * add a listener on the part service
+ */
+ private void addListener() {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(this.closingEditorlistener);
+ }
+
+ /**
+ * remove the listener of the part service
+ */
+ private void removeListener() {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(this.closingEditorlistener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ this.customizationMap.clear();
+ removeListener();
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+
+ /**
+ *
+ * @param anEditor
+ * an editor
+ * @return
+ * a customization manager for this editor
+ */
+ public CustomizationManager getCustomizationManager(final IEditorPart anEditor) {
+ CustomizationManager manager = this.customizationMap.get(anEditor);
+ if(manager == null) {
+ manager = new CustomizationManager();
+ init(manager);
+ this.customizationMap.put(anEditor, manager);
+ }
+ return manager;
+ }
+
+ /**
+ * FIXME : duplicated code with modelExplorer, table, ...?
+ * init the customization manager
+ *
+ * @param customizationManager
+ */
+ private void init(final CustomizationManager customizationManager) {
+ // the appearance can be customized here:
+
+ customizationManager.setShowDerivedLinks(true);
+
+ try {
+
+ // load customizations defined as default through the customization
+ // extension
+ final List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ for(final MetamodelView metamodelView : registryDefaultCustomizations) {
+ customizationManager.registerCustomization(metamodelView);
+ }
+ customizationManager.loadCustomizations();
+ //TODO load the facets!
+ // loadFacetsForCustomizations(registryDefaultCustomizations,customizationManager);
+
+ } catch (final Throwable e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * remove the customization manager for the part
+ *
+ * @param part
+ */
+ public void remove(final IEditorPart part) {
+ this.customizationMap.remove(part);
+ }
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CustomizationAction.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CustomizationAction.java
new file mode 100644
index 00000000000..8883cb205d3
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CustomizationAction.java
@@ -0,0 +1,104 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.actions;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.facet.infra.browser.custom.MetamodelView;
+import org.eclipse.emf.facet.infra.browser.custom.ui.dialogs.LoadCustomizationsDialog;
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.utils.Utils;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ *
+ * @author VL222926
+ *
+ * This action allows to choose the customization to apply on the viewer
+ */
+public class CustomizationAction extends Action {
+
+ /**
+ * tooltip for this action
+ */
+ private static final String TOOLTIPTEXT = "Manage the applied customization";
+
+ //FIXME : avoid to duplicate this image?
+ private static final String CUSTOMIZATION_IMAGE_PATH = "icons/addUiCustom.gif";
+
+ // private IEditorPart currentEditor;
+
+ /**
+ * the registered metamodels for the customization manager
+ */
+ private final Collection<EPackage> registeredMetamodel;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param registeredMetamodel
+ * can be empty when the class is created
+ */
+ public CustomizationAction(final Collection<EPackage> registeredMetamodel) {
+ super(IAction.TOOL_TIP_TEXT, IAction.AS_PUSH_BUTTON);
+ setToolTipText(CustomizationAction.TOOLTIPTEXT);
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, CustomizationAction.CUSTOMIZATION_IMAGE_PATH));
+ // this.currentEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ this.registeredMetamodel = registeredMetamodel;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ */
+ //TODO duplicate code from ModelExplorer
+ //TODO vérifier que l'on n'a pas la même chose dans les tables également!
+ @Override
+ public void run() {
+ final IEditorPart currentEditor = Utils.getCurrentEditor();
+ final CustomizationManager customizationManager = Activator.getDefault().getCustomizationManager(currentEditor);
+ final List<MetamodelView> initiallySelectedCustomizations = customizationManager.getRegisteredCustomizations();
+ final LoadCustomizationsDialog loadCustomizationsDialog = new LoadCustomizationsDialog(Display.getCurrent().getActiveShell(), initiallySelectedCustomizations, this.registeredMetamodel);
+ //TODO : override the dialog to hide the checkbox for the facet
+ if(Window.OK == loadCustomizationsDialog.open()) {
+ customizationManager.clearCustomizations();
+ final List<MetamodelView> selectedCustomizations = loadCustomizationsDialog.getSelectedCustomizations();
+ //before loading, clean all facet to prevent to let not interesting facets.
+ customizationManager.clearFacets();
+ if(loadCustomizationsDialog.isLoadRequiredFacetsSelected()) {
+ // load facets corresponding to customizations
+ //we ignore the facet in this dialog
+ }
+ for(final MetamodelView metamodelView : selectedCustomizations) {
+ customizationManager.registerCustomization(metamodelView);
+ }
+ customizationManager.loadCustomizations();
+ }
+ //dialog.s
+
+ //TODO
+ // TODO Auto-generated method stub
+ // super.run();
+ }
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/AbstractEMFCompareHandler.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/AbstractEMFCompareHandler.java
new file mode 100644
index 00000000000..ce8fa891310
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/AbstractEMFCompareHandler.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.compare.utils.CompareEditorConfiguration;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+//import AbstractHandler;
+
+
+public abstract class AbstractEMFCompareHandler extends AbstractHandler {
+
+ @Override
+ public boolean isEnabled() {
+ return getEditingDomain() != null;
+ }
+
+ protected IEditorPart getCurrentEditor() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ }
+
+ // protected Viewer getCurrentMergeViewer(){
+ // IEditorPart currentEditor = getCurrentEditor();
+ // if(currentEditor!=null && currentEditor instanceof CompareEditor){
+ // Viewer viewer = ViewerUIInformation.INSTANCE.getMergeViewer(getCurrentEditor());
+ // return viewer;
+ // }
+ // return null;
+ // }
+
+ protected TransactionalEditingDomain getEditingDomain() {
+ final CompareEditorConfiguration config = org.eclipse.papyrus.infra.emf.compare.Activator.getDefault().getConfigurationFor(getCurrentEditor());
+ if(config != null) {
+ return config.getEditingDomain();
+ }
+ return null;
+ }
+
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/RedoHandler.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/RedoHandler.java
new file mode 100644
index 00000000000..0019b45fcc8
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/RedoHandler.java
@@ -0,0 +1,53 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+
+public class RedoHandler extends AbstractEMFCompareHandler {
+
+
+ public RedoHandler() {
+ int d = 0;
+ d++;
+ }
+
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ final boolean enabled = super.isEnabled();
+ if(enabled) {
+ final boolean state = getEditingDomain().getCommandStack().canRedo();
+ System.out.println("redo state = " + state);
+
+ return getEditingDomain().getCommandStack().canUndo();
+ }
+ return false;
+ }
+ //
+ // @Override
+ // public boolean isEnabled() {
+ // // TODO Auto-generated method stub
+ // return true;
+ // }
+
+ // public booleanisActive()
+
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/UndoHandler.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/UndoHandler.java
new file mode 100644
index 00000000000..f45b7c20ef4
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/UndoHandler.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+
+
+public class UndoHandler extends AbstractEMFCompareHandler {
+
+
+ public UndoHandler() {
+ int d = 0;
+ d++;
+ }
+
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ getEditingDomain().getCommandStack().undo();
+ return CommandResult.newOKCommandResult();
+ }
+
+ @Override
+ public boolean isEnabled() {
+ final boolean enabled = super.isEnabled();
+ if(enabled) {
+ final boolean state = getEditingDomain().getCommandStack().canUndo();
+ System.out.println("undo state = " + state);
+ return getEditingDomain().getCommandStack().canUndo();
+ }
+ return false;
+ }
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/listeners/CloseEditorListener.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/listeners/CloseEditorListener.java
new file mode 100644
index 00000000000..e2e4edc8be8
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/listeners/CloseEditorListener.java
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.listeners;
+
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+
+/**
+ *
+ * This listener listens the close of the editors and remove the customization manager associated to the closed editor from the map in the
+ * {@link Activator}
+ *
+ */
+public class CloseEditorListener implements IPartListener2 {
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param partRef
+ */
+ public void partActivated(final IWorkbenchPartReference partRef) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param partRef
+ */
+ public void partBroughtToTop(final IWorkbenchPartReference partRef) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param partRef
+ */
+ public void partClosed(final IWorkbenchPartReference partRef) {
+ final IWorkbenchPart part = partRef.getPart(false);
+ if(part instanceof IEditorPart) {
+ Activator.getDefault().remove((IEditorPart)part);
+ }
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param partRef
+ */
+ public void partDeactivated(final IWorkbenchPartReference partRef) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param partRef
+ */
+ public void partOpened(final IWorkbenchPartReference partRef) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param partRef
+ */
+ public void partHidden(final IWorkbenchPartReference partRef) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param partRef
+ */
+ public void partVisible(final IWorkbenchPartReference partRef) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param partRef
+ */
+ public void partInputChanged(final IWorkbenchPartReference partRef) {
+ //nothing to do
+ }
+
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/AbstractActionStateSourceProvider.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/AbstractActionStateSourceProvider.java
new file mode 100644
index 00000000000..e08b9b9e13d
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/AbstractActionStateSourceProvider.java
@@ -0,0 +1,280 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.provider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.AbstractSourceProvider;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IPartService;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+
+/**
+ * This abstract class is used to provide the state of the actions. It's used to
+ * refresh the status of these actions in the menu. (in toolbar and popup, it's
+ * not needed)
+ *
+ * To get the status, we listen the selection service AND the part service! The
+ * part service is used to know if the selection is in the Model Explorer or
+ * not! When the selection is not in the model explorer, the handlers listening
+ * the variable need to be disabled
+ */
+//TODO : duplicate class from uml.diagram.common
+public abstract class AbstractActionStateSourceProvider extends AbstractSourceProvider {
+
+ /**
+ * The enabled state value.
+ */
+ public static final String ENABLED = "enabled"; //$NON-NLS-
+
+ /**
+ * The disabled state value.
+ */
+ public static final String DISABLED = "disabled"; //$NON-NLS-1$
+
+ /**
+ * Map used to register the state of the actions
+ */
+ protected HashMap<String, String> currentState;
+
+ /**
+ * The selection service
+ */
+ private static ISelectionService selectionService;
+
+ /**
+ * the listener for the part service
+ */
+ private static IPartService partService;
+
+ /**
+ * The listener for the selection service
+ */
+ private ISelectionListener listener; // we can't set the listener as a
+ // static field -> doesn't work
+
+ /**
+ * The listener for the part service
+ */
+ private IPartListener partListener; // we can't set the listener as a static
+ // field -> doesn't work
+
+ /**
+ * The activated part
+ */
+ private static IWorkbenchPart workbenchPart = null;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public AbstractActionStateSourceProvider() {
+ currentState = new HashMap<String, String>();
+ listener = new SelectionListener();
+ partListener = new PartListener();
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.ISourceProvider#dispose()
+ *
+ */
+ public void dispose() {
+ if(selectionService != null) {
+ selectionService.removeSelectionListener(listener);
+ }
+ if(partService != null) {
+ partService.removePartListener(partListener);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.ISourceProvider#getCurrentState()
+ *
+ * @return
+ */
+ public Map<String, String> getCurrentState() {
+ addSelectionListener();
+ addPartListener();
+ return currentState;
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.ISourceProvider#getProvidedSourceNames()
+ *
+ * @return
+ */
+
+ public abstract String[] getProvidedSourceNames();
+
+ // public String[] getProvidedSourceNames() {
+ // return new String[]{};
+ // }
+
+ /**
+ * Adds a listener on the selection service if the field {@link #selectionService} is <code>null</code>
+ */
+ protected void addSelectionListener() {
+ if(selectionService == null) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ // selectionService =
+ // (ISelectionService)workbench.getService(ISelectionService.class);
+ IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
+ if(activeWorkbench != null) {
+ selectionService = activeWorkbench.getSelectionService();
+ if(selectionService != null) {
+ selectionService.addSelectionListener(listener);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Adds a listener on the part service
+ */
+ protected void addPartListener() {
+ if(partService == null) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ // partService =
+ // (IPartService)workbench.getService(IPartService.class);
+ IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
+ if(activeWorkbench != null) {
+ partService = activeWorkbench.getPartService();
+ if(partService != null) {
+ partService.addPartListener(partListener);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Test if the current ActivePart is the Model Explorer
+ *
+ * @return <code>true</code> if the current activePart is the Model Explorer <code>false</code> if not
+ */
+ protected boolean isSelectionInDiagram() {
+ return (workbenchPart instanceof CoreMultiDiagramEditor);
+ }
+
+ /**
+ *
+ * The class {@link PartListener}
+ *
+ *
+ */
+ public class PartListener implements IPartListener {
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partOpened(IWorkbenchPart part) {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partDeactivated(IWorkbenchPart part) {
+ // TODO Auto-generated method stub
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partClosed(IWorkbenchPart part) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partBroughtToTop(IWorkbenchPart part) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partActivated(IWorkbenchPart part) {
+ workbenchPart = part;
+ refreshActions();
+ }
+
+ }
+
+ /**
+ *
+ * This class provides the listener for the selection service
+ *
+ */
+ protected class SelectionListener implements ISelectionListener {
+
+ /**
+ *
+ * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
+ *
+ * @param part
+ * @param selection
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ workbenchPart = part;
+ refreshActions();
+ }
+ }
+
+ /**
+ * This method refresh the status of the variables listened by the actions
+ */
+ protected abstract void refreshActions();
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ActionSourceProvider.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ActionSourceProvider.java
new file mode 100644
index 00000000000..d8e12489ce2
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ActionSourceProvider.java
@@ -0,0 +1,33 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.provider;
+
+import org.eclipse.compare.internal.CompareEditor;
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+public class ActionSourceProvider extends PropertyTester{
+
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ if(property.equals("isEnabled")){
+ IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(editor instanceof CompareEditor){
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ModelStructureLabelProvider.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ModelStructureLabelProvider.java
new file mode 100644
index 00000000000..dc8420ff77a
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ModelStructureLabelProvider.java
@@ -0,0 +1,99 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.provider;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.util.AdapterUtils;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+//FIXME : duplicated code from ModelStructureMergeViewer::ModelStructureLabelProvider
+/**
+ * {@link LabelProvider} of this viewer.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+ public class ModelStructureLabelProvider extends LabelProvider {
+ /**
+ * We use this generic label provider, but we want to customize some aspects that's why we choose to
+ * aggregate it.
+ */
+ /* package */AdapterFactoryLabelProvider adapterProvider;
+
+ /**
+ * Default constructor.
+ */
+ public ModelStructureLabelProvider() {
+ adapterProvider = new AdapterFactoryLabelProvider(AdapterUtils.getAdapterFactory());
+
+ }
+
+ /**
+ * Returns the platform icon for a given {@link IFile}. If not an {@link IFile}, delegates to the
+ * {@link AdapterFactoryLabelProvider} to get the {@link Image}.
+ *
+ * @param object
+ * Object to get the {@link Image} for.
+ * @return The platform icon for the given object.
+ * @see AdapterFactoryLabelProvider#getImage(Object)
+ */
+ @Override
+ public Image getImage(Object object) {
+ Image image = null;
+ if (object instanceof AbstractDiffExtension) {
+ image = (Image)((AbstractDiffExtension)object).getImage();
+ } else if (object instanceof IFile) {
+ image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+ }
+
+ // fallback to ItemProvider
+ if (image == null) {
+ image = adapterProvider.getImage(object);
+ }
+
+ return image;
+ }
+
+ /**
+ * Returns the name of the given {@link IFile}, delegates to
+ * {@link AdapterFactoryLabelProvider#getText(Object)} if not an {@link IFile}.
+ *
+ * @param object
+ * Object we seek the name for.
+ * @return The name of the given object.
+ * @see AdapterFactoryLabelProvider#getText(Object)
+ */
+ @Override
+ public String getText(Object object) {
+ String text = null;
+ if (object instanceof AbstractDiffExtension) {
+ text = ((AbstractDiffExtension)object).getText();
+ } else if (object instanceof IFile) {
+ text = ((IFile)object).getName();
+ } else if (object instanceof Resource) {
+ text = ((Resource)object).getURI().lastSegment();
+ }
+
+ // fallback to ItemProvider
+ if (text == null || "".equals(text)) { //$NON-NLS-1$
+ text = adapterProvider.getText(object);
+ }
+
+ return text;
+ }
+ }
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/PapyrusLabelProvider.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/PapyrusLabelProvider.java
new file mode 100644
index 00000000000..726f2b5421a
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/PapyrusLabelProvider.java
@@ -0,0 +1,177 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tatiana Fesenko (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.provider;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizableModelLabelProvider;
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.emf.facet.infra.browser.uicore.internal.AppearanceConfiguration;
+import org.eclipse.emf.facet.infra.browser.uicore.internal.model.ITreeElement;
+import org.eclipse.emf.facet.infra.browser.uicore.internal.model.ModelElementItem;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Device;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+
+/**
+ * PapyrusLabelProvider provides the same labels and icons as one can find in the Model Explorer.
+ */
+// Not placed in the UI plugin because it is used in the subclasses of AbstractDiffExtension, in getText() method
+public class PapyrusLabelProvider extends CustomizableModelLabelProvider {
+
+
+ /** The configuration. */
+ private final AppearanceConfiguration configuration;
+
+ //TODO merge ModelStructureLabelProvider with this provider!
+ private final ModelStructureLabelProvider provider = new ModelStructureLabelProvider();
+
+ /**
+ * Constructor.
+ *
+ * @param customizationManager
+ * the customization manager
+ */
+ public PapyrusLabelProvider(final CustomizationManager customizationManager) {
+ super(customizationManager);
+ this.configuration = getAppearanceConfiguration(customizationManager);
+ }
+
+ // /**
+ // * Instantiates a new papyrus label provider.
+ // */
+ // public PapyrusLabelProvider() {
+ // this(initCustomizationManager());
+ // }
+
+ // /**
+ // * Inits the customization manager.
+ // *
+ // * @return the customization manager
+ // */
+ // private static CustomizationManager initCustomizationManager() {
+ // CustomizationManager manager = new CustomizationManager();
+ // try {
+ // List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ // for(MetamodelView metamodelView : registryDefaultCustomizations) {
+ // manager.registerCustomization(metamodelView);
+ // }
+ // manager.loadCustomizations();
+ //
+ // } catch (Throwable e) {
+ // //TODO
+ //// Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
+ // }
+ // manager.setShowFullQualifiedNames(false);
+ // manager.setShowURI(true);
+ // manager.setShowDerivedLinks(false);
+ // return manager;
+ // }
+
+ /**
+ * Gets the appearance configuration.
+ *
+ * @param customizationManager2
+ * the customization manager2
+ * @return the appearance configuration
+ */
+ private AppearanceConfiguration getAppearanceConfiguration(final CustomizationManager customizationManager2) {
+ Method getApperanceConfigurationMethod;
+ try {
+ getApperanceConfigurationMethod = CustomizationManager.class.getDeclaredMethod("getAppearanceConfiguration"); //$NON-NLS-1$
+ if(getApperanceConfigurationMethod != null) {
+ getApperanceConfigurationMethod.setAccessible(true);
+ return (AppearanceConfiguration)getApperanceConfigurationMethod.invoke(customizationManager2);
+ }
+ } catch (final SecurityException e) {
+ //TODO
+ // Activator.logError(e);
+ } catch (final NoSuchMethodException e) {
+ // Activator.logError(e);
+ } catch (final IllegalArgumentException e) {
+ // Activator.logError(e);
+ } catch (final IllegalAccessException e) {
+ // Activator.logError(e);
+ } catch (final InvocationTargetException e) {
+ // Activator.logError(e);
+ }
+ return new AppearanceConfiguration(null); // default one.
+ }
+
+ /**
+ * Gets the text.
+ *
+ * @param element
+ * the element
+ * @return the text {@inheritDoc}
+ */
+ @Override
+ public String getText(final Object element) {
+ if(element == null) {
+ return ""; //$NON-NLS-1$
+ }
+ if(element instanceof EObject) {
+ final ITreeElement treeElement = getTreeElement((EObject)element);
+ return super.getText(treeElement);
+ }
+ return super.getText(element);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.facet.infra.browser.uicore.CustomizableModelLabelProvider#getImage(java.lang.Object)
+ */
+ @Override
+ public Image getImage(final Object element) {
+ if(element == null) {
+ return null;
+ }
+ if(element instanceof EObject) {
+ final ITreeElement treeElement = getTreeElement((EObject)element);
+ return super.getImage(treeElement);
+ }
+ return super.getImage(element);
+ }
+
+
+ /**
+ * Gets the tree element.
+ *
+ * @param eObject
+ * the e object
+ * @return the tree element
+ */
+ private ITreeElement getTreeElement(final EObject eObject) {
+ if(eObject == null) {
+ return null;
+ }
+ return new ModelElementItem(eObject, getTreeElement(eObject.eContainer()), this.configuration);
+ }
+
+ //TODO for test only!
+ @Override
+ public Color getBackground(final Object element) {
+ final RGB rgb = new RGB(255, 0, 0);
+ final Device device = Display.getDefault();
+ final Color color = new Color(device, rgb);
+ // TODO Auto-generated method stub
+ return color;
+ }
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/TransactionalActionSourceProvider.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/TransactionalActionSourceProvider.java
new file mode 100644
index 00000000000..e7d71e1f28e
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/TransactionalActionSourceProvider.java
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.provider;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.papyrus.infra.emf.compare.ui.handlers.RedoHandler;
+import org.eclipse.papyrus.infra.emf.compare.ui.handlers.UndoHandler;
+import org.eclipse.ui.ISources;
+
+
+public class TransactionalActionSourceProvider extends AbstractActionStateSourceProvider{
+
+ public static final String UNDO_ACTION = "undoAction";
+ public static final String REDO_ACTION = "redoAction";
+ public TransactionalActionSourceProvider() {
+ super();
+ currentState.put(UNDO_ACTION, DISABLED);
+ currentState.put(REDO_ACTION, DISABLED);
+ }
+
+ @Override
+ public String[] getProvidedSourceNames() {
+
+ return new String[]{UNDO_ACTION,REDO_ACTION};
+ }
+public void refresh(){
+ refreshActions();
+}
+ @Override
+ protected void refreshActions() {
+ refresh(UNDO_ACTION, new UndoHandler());
+ refresh(REDO_ACTION, new RedoHandler());
+
+ }
+ /**
+ * Refresh the state of the handlers
+ *
+ * @param key
+ * the key used to refresh the handler status
+ * @param handler
+ * the handler to refresh
+ */
+ protected void refresh(String key, AbstractHandler handler) {
+ String oldState = currentState.get(key);
+ String newState = (test(handler) ? ENABLED : DISABLED);
+
+// if(oldState != newState) {
+ //currentState.put(key, newState);
+ currentState.put(key, ENABLED);
+ fireSourceChanged(ISources.WORKBENCH, key, newState);
+// }
+ }
+
+ /**
+ *
+ * @param handler
+ * the handler to refresh
+ * @return
+ * <code>true</code> if the status of the handler is enabled
+ */
+ protected boolean test(AbstractHandler handler) {
+ return /*isSelectionInDiagram() && */handler.isEnabled();
+ }
+
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusParameterizedStructureMergeViewer.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusParameterizedStructureMergeViewer.java
new file mode 100644
index 00000000000..ad1ce5b13f2
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusParameterizedStructureMergeViewer.java
@@ -0,0 +1,74 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer;
+
+import java.util.Collections;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareViewerPane;
+import org.eclipse.emf.compare.ui.viewer.structure.ParameterizedStructureMergeViewer;
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.ui.actions.CustomizationAction;
+import org.eclipse.papyrus.infra.emf.compare.ui.provider.PapyrusLabelProvider;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+
+public class PapyrusParameterizedStructureMergeViewer extends ParameterizedStructureMergeViewer {
+
+ public PapyrusParameterizedStructureMergeViewer(final Composite parent, final CompareConfiguration compareConfiguration) {
+ super(parent, compareConfiguration);
+ setLabelProvider(createMyLabelProvider(compareConfiguration));
+ }
+
+ @Override
+ protected void createToolItems() {
+ final ToolBarManager tbm = CompareViewerPane.getToolBarManager(getControl().getParent());
+ tbm.removeAll();
+ super.createToolItems();
+
+ //we add an action to change the applied cuztomization
+ final IAction customizationAction = new CustomizationAction(Collections.EMPTY_SET);
+ final ActionContributionItem customizationContributionItem = new ActionContributionItem(customizationAction);
+ tbm.insert(1, customizationContributionItem);
+ tbm.update(true);
+ }
+
+ // /**
+ // * Creates this viewer's label provider.
+ // *
+ // * @param compareConfiguration
+ // * Compare configuration that's been fed this viewer.
+ // * @return This viewer's label provider.
+ // * @since 1.1
+ // */
+ // @Override
+ protected LabelProvider createMyLabelProvider(@SuppressWarnings("unused") final CompareConfiguration compareConfiguration) {
+ final IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ Activator.getDefault().getCustomizationManager(activeEditor);
+ final CustomizationManager manager = Activator.getDefault().getCustomizationManager(activeEditor);
+ //TODO : I think that we need to provide the metamodel to the customization manager in order to display correctly the element in the viewer
+ //Warning : there are 2 viewers (merge and structure), we need to provide the metamodels in 2 times!
+ return new PapyrusLabelProvider(manager);
+ }
+
+
+
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusStructureMergeViewerCreator.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusStructureMergeViewerCreator.java
new file mode 100644
index 00000000000..a986d59cefa
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusStructureMergeViewerCreator.java
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.IViewerCreator;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ *
+ *
+ * this class creates the MergeViewer
+ */
+public class PapyrusStructureMergeViewerCreator implements IViewerCreator {
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param parent
+ * @param config
+ * @return
+ */
+ public Viewer createViewer(final Composite parent, final CompareConfiguration config) {
+ return new PapyrusParameterizedStructureMergeViewer(parent, config);
+ }
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalContentMergeViewerCreator.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalContentMergeViewerCreator.java
new file mode 100644
index 00000000000..4e371690bfb
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalContentMergeViewerCreator.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.viewer;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.IViewerCreator;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class TransactionalContentMergeViewerCreator implements IViewerCreator {
+
+ public TransactionalContentMergeViewerCreator() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Viewer createViewer(Composite parent, CompareConfiguration config) {
+ //return new ModelContentMergeViewer(parent,config);
+ return new TransactionalModelContentMergeViewer(parent, config);
+ }
+// CompareConfiguration
+
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeDiffTab.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeDiffTab.java
new file mode 100644
index 00000000000..909fd56bb5d
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeDiffTab.java
@@ -0,0 +1,127 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tatiana Fesenko (CEA LIST) - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.viewer;
+
+import org.eclipse.compare.internal.CompareEditor;
+import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder;
+import org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.AbstractSelectionService;
+
+
+/**
+ * The Structure Tab in the Merge Viewer.
+ */
+//duplicate code from tatiana
+//TODO : verify the super class
+public class TransactionalModelContentMergeDiffTab extends ModelContentMergeDiffTab {
+
+ IEditorPart currentEditor;
+
+ /**
+ * Instantiates a new uML model content merge diff tab.
+ *
+ * @param parentComposite
+ * the parent composite
+ * @param side
+ * the side
+ * @param parentFolder
+ * the parent folder
+ */
+ public TransactionalModelContentMergeDiffTab(Composite parentComposite, int side, ModelContentMergeTabFolder parentFolder) {
+ super(parentComposite, side, parentFolder);
+ currentEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+ // service.
+ ISelectionProvider selectionprovider = currentEditor.getEditorSite().getSelectionProvider();
+ // org.eclipse.emf.compare.ui.viewer.structure.ParameterizedStructureMergeViewer
+ // selectionprovider.setSelection(selection)addSelectionChangedListener(listener)SelectionChangedListener(this);
+ }
+
+ @Override
+ protected void fireSelectionChanged(SelectionChangedEvent event) {
+ // TODO Auto-generated method stub
+ super.fireSelectionChanged(event);
+ if(currentEditor instanceof ISelectionProvider){
+// ((ISelectionProvider)currentEditor).getSelection()
+ ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+
+ }
+ if(currentEditor instanceof CompareEditor){
+ ISelectionProvider selectionprovider = currentEditor.getSite().getSelectionProvider();
+ ISelectionService service = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService();
+// ((AbstractSelectionService)service).
+ selectionprovider.setSelection(null);
+ int d=0;
+ d++;
+ }
+
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+ super.dispose();
+ }
+
+ // /*
+ // * (non-Javadoc)
+ // *
+ // * @see org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab#setSelectionToWidget(java.util.List, boolean)
+ // */
+ // @Override
+ // protected void setSelectionToWidget(List l, boolean reveal) {
+ // // tfesenko filter stereotype applications
+ // List result = new ArrayList();
+ // for(Object next : l) {
+ // if(next instanceof EObject && UMLCompareUtils.isStereotypeApplication((EObject)next)) {
+ // EObject stereotypeApplication = (EObject)next;
+ // result.add(UMLUtil.getBaseElement(stereotypeApplication));
+ // } else {
+ // result.add(next);
+ // }
+ // }
+ // super.setSelectionToWidget(result, reveal);
+ // }
+ //
+ // /*
+ // * (non-Javadoc)
+ // *
+ // * @see org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab#setReflectiveInput(java.lang.Object)
+ // */
+ // @Override
+ // public void setReflectiveInput(Object object) {
+ // // tfesenko 336361 - [UML Compare] Compare two elements: show right element as root
+ // if(object instanceof EObject) {
+ // clearCaches();
+ // // tfesenko default implementation sets object.eResource here
+ // setInput(object);
+ // setupCaches();
+ // needsRedraw = true;
+ // }
+ // super.setReflectiveInput(object);
+ // }
+
+ @Override
+ protected void firePostSelectionChanged(SelectionChangedEvent event) {
+ // TODO Auto-generated method stub
+ super.firePostSelectionChanged(event);
+ }
+
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeTabFolder.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeTabFolder.java
new file mode 100644
index 00000000000..1b22913ebb5
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeTabFolder.java
@@ -0,0 +1,254 @@
+/*****************************************************************************
+ * Copyright (c) 2010 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tatiana Fesenko (CEA LIST) - Initial API and implementation
+ * Vincent Lorenzo (CEA LIST) - 349650: [Papyrus Merge] IndexOfBoundException
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.viewer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot;
+import org.eclipse.emf.compare.ui.TypedElementWrapper;
+import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
+import org.eclipse.emf.compare.ui.viewer.content.part.IModelContentMergeViewerTab;
+import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder;
+import org.eclipse.emf.compare.util.AdapterUtils;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.ui.provider.PapyrusLabelProvider;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * The Class UMLModelContentMergeTabFolder.
+ */
+//duplicate code from tatiana
+//TODO verify the super class
+public class TransactionalModelContentMergeTabFolder extends ModelContentMergeTabFolder {
+
+ /** The my uml viewer. */
+ protected final TransactionalModelContentMergeViewer myUMLViewer;
+
+ /**
+ * Instantiates a new uML model content merge tab folder.
+ *
+ * @param viewer the viewer
+ * @param composite the composite
+ * @param side the side
+ */
+ public TransactionalModelContentMergeTabFolder(ModelContentMergeViewer viewer, Composite composite, int side) {
+ super(viewer, composite, side);
+ myUMLViewer = (TransactionalModelContentMergeViewer)viewer;
+ }
+
+
+ @Override
+ protected IModelContentMergeViewerTab createModelContentMergeDiffTab(Composite parent) {
+// IModelContentMergeViewerTab tab = super.createModelContentMergeDiffTab(parent);
+ TransactionalModelContentMergeDiffTab diffTab = new TransactionalModelContentMergeDiffTab(parent, partSide, this);
+ diffTab.setContentProvider(createDiffTabContentProvider());
+ IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ CustomizationManager manager = Activator.getDefault().getCustomizationManager(activeEditor);
+ diffTab.setLabelProvider(new PapyrusLabelProvider(manager));
+ return diffTab;
+
+ }
+
+ @Override
+ public void dispose() {
+// Activator.getDefault().
+ super.dispose();
+ }
+//
+// /* (non-Javadoc)
+// * @see org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder#createModelContentMergeViewerTab(org.eclipse.swt.widgets.Composite)
+// */
+// @Override
+// protected IModelContentMergeViewerTab createModelContentMergeViewerTab(Composite parent) {
+// ModelContentMergePropertyTab propertyTab = new ModelContentMergePropertyTab(parent, partSide, this);
+// propertyTab.setContentProvider(new UMLPropertyContentProvider());
+// return propertyTab;
+// }
+//
+// /**
+// * Creates the diff tab content provider.
+// *
+// * @return the i content provider
+// */
+// protected IContentProvider createDiffTabContentProvider() {
+// ComposedAdapterFactory adapterFactory = new UMLAdapterFactory();
+// AdapterFactoryContentProvider result = new AdapterFactoryContentProvider(adapterFactory) {
+//
+// @Override
+// public Object[] getElements(Object object) {
+// if(object instanceof RootObject) {
+// return new Object[]{ ((RootObject)object).object };
+// }
+// return super.getElements(object);
+// }
+// };
+//
+// return result;
+// }
+//
+// /* (non-Javadoc)
+// * @see org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder#findMatchFromElement(org.eclipse.emf.ecore.EObject)
+// */
+// protected EObject findMatchFromElement(EObject element) {
+// EObject matchElement = super.findMatchFromElement(element);
+// if(!myUMLViewer.isShowAllProperties() && matchElement instanceof Match2Elements) {
+// if(myUMLViewer.getCurrentSelection().size()!=0){//see bug 349650
+// return new Match2ElementsWithDiff((Match2Elements)matchElement, myUMLViewer.getCurrentSelection().get(0));
+// }
+// }
+// return matchElement;
+// }
+//
+// /**
+// * Gets the selected tab.
+// *
+// * @return the selected tab
+// */
+// public int getSelectedTab() {
+// return tabFolder.getSelectionIndex();
+// }
+//
+// /**
+// * Checks if is property tab.
+// *
+// * @param index the index
+// * @return true, if is property tab
+// */
+// public boolean isPropertyTab(int index) {
+// final IModelContentMergeViewerTab currentTab = tabs.get(index);
+// return (currentTab == getPropertyPart());
+// }
+
+//TODO : use the content provider from the new EMF-Compare
+ protected IContentProvider createDiffTabContentProvider() {
+// private ModelContentMergeDiffTabContentProvider createContentProvider() {
+
+ return new ModelContentMergeDiffTabContentProvider(AdapterUtils.getAdapterFactory());
+// }
+
+ // ComposedAdapterFactory adapterFactory = new UMLAdapterFactory();
+// ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory();
+// AdapterFactoryContentProvider result = new AdapterFactoryContentProvider(adapterFactory) {
+//
+// @Override
+// public Object[] getElements(Object object) {
+//// if(object instanceof RootObject) {
+//// return new Object[]{ ((RootObject)object).object };
+//// }
+// return super.getElements(object);
+// }
+// }
+
+// return result;
+ }
+
+
+ /**
+ * This implementation of an {@link AdapterFactoryContentProvider} will strip ComparisonSnapshots out of
+ * the view.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+ //duplicate code from EMF-Compare :ModelContentMergeDiffTab.ModelContentMergeDiffTabContentProvider
+ public class ModelContentMergeDiffTabContentProvider extends AdapterFactoryContentProvider {
+ /**
+ * Default constructor. Delegates to the super implementation.
+ *
+ * @param factory
+ * Factory to get labels and icons from.
+ */
+ public ModelContentMergeDiffTabContentProvider(AdapterFactory factory) {
+ super(factory);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#getElements(java.lang.Object)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object[] getElements(Object object) {
+ // overwritten to ensure contents of ResourceSets, List<Resource>, and Resource are correclty
+ // returned.
+ Object[] result = null;
+ if (object instanceof ResourceSet) {
+ final List<Resource> resources = ((ResourceSet)object).getResources();
+ final List<Resource> elements = new ArrayList<Resource>(resources.size());
+ for (final Resource resource : resources) {
+ if (resource.getContents().isEmpty()
+ || !(resource.getContents().get(0) instanceof ComparisonSnapshot)) {
+ elements.add(resource);
+ }
+ }
+ result = elements.toArray();
+ } else if (object instanceof TypedElementWrapper) {
+ result = new Object[] {((EObject)object).eResource(), };
+ } else if (object instanceof List) {
+ // we may also display a list of resources
+ result = ((List)object).toArray();
+ } else if (object instanceof Resource) {
+ // return contents of resource
+ result = ((Resource)object).getContents().toArray();
+ } else {
+ result = super.getElements(object);
+ }
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#getChildren(java.lang.Object)
+ */
+ @Override
+ public Object[] getChildren(Object object) {
+ if (object instanceof Resource) {
+ return ((Resource)object).getContents().toArray();
+ }
+ return super.getChildren(object);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#hasChildren(java.lang.Object)
+ */
+ @Override
+ public boolean hasChildren(Object object) {
+ if (object instanceof Resource) {
+ return ((Resource)object).getContents().size() > 0;
+ }
+ return super.hasChildren(object);
+ }
+ }
+
+ @Override
+ protected void fireSelectionChanged(SelectionChangedEvent event) {
+ // TODO Auto-generated method stub
+ super.fireSelectionChanged(event);
+ }
+}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeViewer.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeViewer.java
new file mode 100644
index 00000000000..bd25116ba51
--- /dev/null
+++ b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeViewer.java
@@ -0,0 +1,277 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.viewer;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoableOperation;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
+import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.emf.workspace.EMFOperationCommand;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.ui.actions.CustomizationAction;
+import org.eclipse.papyrus.infra.emf.compare.utils.CompareEditorConfiguration;
+import org.eclipse.papyrus.infra.emf.compare.utils.Utils;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+public class TransactionalModelContentMergeViewer extends ModelContentMergeViewer {
+
+ /** the action to know if we use the Papyrus Edit Service or not for the merge action */
+ private IAction useEditServiceAction;
+
+ //FIXME : avoid to duplicate this string...
+ private static final String SYNCHRONIZATION_IMAGE_PATH = "icons/PapyrusLogo16x16.gif";
+
+ //FIXME
+ private static final ImageDescriptor diagramSynchronizationImage = Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, TransactionalModelContentMergeViewer.SYNCHRONIZATION_IMAGE_PATH);
+
+ /** the list of the metamodels referenced in the compared files. this field is used by the Customization Manager */
+ private Set<EPackage> metamodels;
+
+ /** the configuration for the merge action using this viewer */
+ private CompareEditorConfiguration configuration;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * @param config
+ */
+ public TransactionalModelContentMergeViewer(final Composite parent, final CompareConfiguration config) {
+ super(parent, config);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param input
+ * the input
+ */
+ @Override
+ public void setInput(final Object input) {
+ super.setInput(input);
+ createCompareConfiguration();
+ initizalizeMetamodels();
+ updateToolItems();
+ }
+
+ /**
+ * Create the configuration for the merge using this viewer. The configuration will be store in
+ * {@link org.eclipse.papyrus.infra.emf.compare.Activator}
+ */
+ private void createCompareConfiguration() {
+ final IMergeViewerContentProvider contentProvider = (IMergeViewerContentProvider)getContentProvider();
+
+ //the left :
+ Object content = contentProvider.getLeftContent(getInput());
+ Resource leftUMLResource = null;
+ if(content instanceof Resource) {
+ leftUMLResource = (Resource)content;
+ }
+
+ //the right
+ content = contentProvider.getRightContent(getInput());
+ Resource rightUMLResource = null;
+ if(content instanceof Resource) {
+ rightUMLResource = (Resource)content;
+ }
+ final IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if(rightUMLResource != null || leftUMLResource != null) {
+ this.configuration = new CompareEditorConfiguration(editor, leftUMLResource, rightUMLResource);
+ org.eclipse.papyrus.infra.emf.compare.Activator.getDefault().addConfiguration(editor, this.configuration);
+ }
+ }
+
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param composite
+ * @param side
+ * @return
+ */
+ @Override
+ protected ModelContentMergeTabFolder createModelContentMergeTabFolder(final Composite composite, final int side) {
+ return new TransactionalModelContentMergeTabFolder(this, composite, side);
+ }
+
+ /**
+ * Undoes the changes implied by the currently selected {@link DiffElement diff}.
+ */
+ @Override
+ protected void copyDiffLeftToRight() {
+ if(this.currentSelection != null) {
+ doCopy(this.currentSelection, true);
+ }
+ this.currentSelection.clear();
+ switchCopyState(false);
+ }
+
+ /**
+ * Applies the changes implied by the currently selected {@link DiffElement diff}.
+ */
+ @Override
+ protected void copyDiffRightToLeft() {
+ if(this.currentSelection != null) {
+ doCopy(this.currentSelection, false);
+ }
+ this.currentSelection.clear();
+ switchCopyState(false);
+ }
+
+
+ protected void doCopy(final List<DiffElement> diffs, final boolean leftToRight) {
+ //leftUMLResource.load(options) TODO!
+ final TransactionalEditingDomain domain = this.configuration.getEditingDomain();
+
+ final Map<?, ?> transactionOptions = Collections.EMPTY_MAP;
+ final Runnable runnable = new Runnable() {
+
+ public void run() {
+ // TODO Auto-generated method stub
+ TransactionalModelContentMergeViewer.this.copy(diffs, leftToRight);
+ }
+ };
+
+ final IUndoableOperation operation = new AbstractEMFOperation(domain, "copy action", transactionOptions) {
+
+ @Override
+ protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ runnable.run();
+ return Status.OK_STATUS;
+ }
+
+
+ };
+
+ final Command command = new EMFOperationCommand(domain, operation);
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(operation, new NullProgressMonitor(), null);
+ } catch (final ExecutionException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ // domain.getCommandStack().execute(command);
+ }
+
+ /**
+ *
+ * {@inheritDoc} Add a toogle button to the toolbar to do the synchronization with the diagram
+ *
+ * @param tbm
+ * the toolbar manager
+ */
+ @Override
+ protected void createToolItems(final ToolBarManager tbm) {
+ //we add an action for the diagram synchronization
+ this.useEditServiceAction = new Action("Diagram Synchronisation", IAction.AS_CHECK_BOX) {
+
+ /**
+ * {@inheritDoc}
+ *
+ */
+ @Override
+ public void run() {
+ TransactionalModelContentMergeViewer.this.configuration.setUseEditService(isChecked());
+ }
+ };
+
+ this.useEditServiceAction.setImageDescriptor(TransactionalModelContentMergeViewer.diagramSynchronizationImage);
+ final ActionContributionItem actionContributionItem = new ActionContributionItem(this.useEditServiceAction);
+ this.useEditServiceAction.setToolTipText("Remove the inconsistent views on the Papyrus Model");
+ tbm.insert(0, actionContributionItem);
+
+ //we add an action to change the applied customization
+ final IAction customizationAction = new CustomizationAction(getMetamodels());
+ final ActionContributionItem customizationContributionItem = new ActionContributionItem(customizationAction);
+ tbm.insert(1, customizationContributionItem);
+ super.createToolItems(tbm);
+
+ }
+
+ /**
+ *
+ * {@inheritDoc} Update {@link #useEditServiceAction}
+ */
+ @Override
+ protected void updateToolItems() {
+ super.updateToolItems();
+ if(this.useEditServiceAction != null && this.configuration != null) {
+ this.useEditServiceAction.setEnabled(this.configuration.manageDiResource());//null pointer
+ }
+ }
+
+ /**
+ * initialize the list of the metamodel referenced in the compared files.
+ */
+ private void initizalizeMetamodels() {
+ getMetamodels().addAll(this.configuration.getMetamodels());
+ }
+
+ /**
+ *
+ * @return
+ * a set with the metamodels. This list will be used by the Customization Manager
+ */
+ private Set<EPackage> getMetamodels() {
+ if(this.metamodels == null) {
+ this.metamodels = new HashSet<EPackage>();
+ }
+ return this.metamodels;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param event
+ */
+ @Override
+ protected void handleDispose(final DisposeEvent event) {
+ final IEditorPart editor = Utils.getCurrentEditor();
+ org.eclipse.papyrus.infra.emf.compare.Activator.getDefault().removeConfiguration(editor);
+ this.configuration.dispose();
+ super.handleDispose(event);
+ }
+}

Back to the top