Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/PapyrusEMFCompareV1')
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.classpath7
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.project28
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/META-INF/MANIFEST.MF25
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/build.properties9
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/icons/PapyrusLogo16x16.gifbin561 -> 0 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/icons/papyrus_compare_editor.gifbin956 -> 0 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/plugin.xml60
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/Activator.java77
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/BasicCompareAction.java262
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/FileCompareAction.java98
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusCompareEditor.java370
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusModelCompareActionBarContributor.java231
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusModelElementCompareEditorInput.java357
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/EcorePlatformUtil.java1982
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/EcoreResourceUtil.java1148
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/WorkspaceEditingDomainUtil.java321
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/WorkspaceTransactionUtil.java198
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/PapyrusCompareAction.java154
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/PapyrusSaveablesCompareEditorInput.java70
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/TransactionalActionBarContributor.java111
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/TransactionalCompareEditor.java428
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.classpath6
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.project28
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/META-INF/MANIFEST.MF10
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/about.html28
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/build.properties15
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/icons/sysml.gifbin1032 -> 0 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin-doc.pdoc5
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin.properties4
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin.xml20
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/todo/dummySysML.uiCustom2
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.classpath7
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.project34
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/META-INF/MANIFEST.MF25
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/build.properties6
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/icons/PapyrusLogo16x16.gifbin561 -> 0 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/icons/papyrus_compare_editor.gifbin956 -> 0 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.xml51
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/resources/emfcompare.uiCustom2
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Activator.java110
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/PapyrusContentMergeViewerCreator.java22
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeDiffTab.java82
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeTabFolder.java234
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeViewer.java49
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/provider/PapyrusLabelProvider.java174
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/structure/viewer/UMLStructureMergeViewerCreator.java39
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalContentMergeViewerCreator.java22
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeDiffTab.java82
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeTabFolder.java234
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeViewer.java169
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/testSWT/MyViewer.java90
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.classpath6
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.project28
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/META-INF/MANIFEST.MF10
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/about.html28
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/build.properties15
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/icons/uml_notation.gifbin897 -> 0 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin-doc.pdoc5
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin.properties4
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin.xml18
-rw-r--r--sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/todo/dummyUML.uiCustom2
-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.gifbin561 -> 0 bytes
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gifbin612 -> 0 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
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.classpath7
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.project28
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.settings/org.eclipse.jdt.ui.prefs108
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/META-INF/MANIFEST.MF26
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/build.properties5
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/plugin.xml27
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/Activator.java126
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/actions/CompareTwoElementsAction.java193
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AbstractPapyrusDefaultMerger.java60
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeChangeLeftTargetMerger.java80
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeChangeRightTargetMerger.java80
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeOrderChangeMerger.java227
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/DiffExtensionMerger.java69
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/DiffGroupMerger.java49
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ModelElementChangeRightTargetMerger.java146
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/MoveModelElementMerger.java103
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/PapyrusModelElementChangeLeftTargetMerger.java167
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/PapyrusUpdateAttributeMerger.java77
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceChangeLeftTargetMerger.java149
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceChangeRightTargetMerger.java150
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceOrderChangeMerger.java83
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/UpdateReferenceMerger.java93
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/MergeCommandProvider.java230
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/PapyrusMergeCommandProvider.java56
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/PapyrusMergerProvider.java86
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/service/SaveEMFCompareListener.java107
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/utils/CompareEditorConfiguration.java261
-rw-r--r--sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/utils/Utils.java55
121 files changed, 0 insertions, 12747 deletions
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.classpath b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.project b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.project
deleted file mode 100644
index 9bed46d4a5f..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.emf.compare.transactional.editor</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/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.settings/org.eclipse.jdt.core.prefs b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index fd1db489110..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Thu Oct 13 17:09:29 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/META-INF/MANIFEST.MF b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/META-INF/MANIFEST.MF
deleted file mode 100644
index 1ea91756792..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,25 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: EMF-Compare With Command
-Bundle-SymbolicName: org.eclipse.papyrus.emf.compare.transactional.editor;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.emf.compare.transactional.editor.Activator
-Bundle-Vendor: Eclipse Modeling Project
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf.ecore;bundle-version="2.7.0",
- org.eclipse.emf.compare;bundle-version="1.2.1",
- org.eclipse.compare;bundle-version="3.5.201",
- org.eclipse.emf.compare.diff;bundle-version="1.3.0",
- org.eclipse.emf.compare.ui,
- org.eclipse.emf.compare.match,
- org.eclipse.core.resources,
- org.eclipse.emf.transaction,
- org.eclipse.sphinx.emf.compare.ui,
- org.eclipse.sphinx.platform.ui,
- org.eclipse.sphinx.emf,
- org.eclipse.papyrus.log;bundle-version="0.8.2",
- org.eclipse.papyrus.uml.compare.ui;bundle-version="1.0.0",
- org.eclipse.pde;bundle-version="3.6.100"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/build.properties b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/build.properties
deleted file mode 100644
index 2aaf819ba36..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- icons/
-src.includes = icons/,\
- plugin.xml,\
- src/
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/icons/PapyrusLogo16x16.gif b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/icons/PapyrusLogo16x16.gif
deleted file mode 100644
index 8a31f458379..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/icons/PapyrusLogo16x16.gif
+++ /dev/null
Binary files differ
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/icons/papyrus_compare_editor.gif b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/icons/papyrus_compare_editor.gif
deleted file mode 100644
index e817df6ff0c..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/icons/papyrus_compare_editor.gif
+++ /dev/null
Binary files differ
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/plugin.xml b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/plugin.xml
deleted file mode 100644
index 70dec336661..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/plugin.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- class="org.eclipse.papyrus.emf.compare.transactional.editor.PapyrusCompareEditor"
- contributorClass="org.eclipse.papyrus.emf.compare.transactional.editor.PapyrusModelCompareActionBarContributor"
- default="true"
- id="org.eclipse.papyrus.emf.compare.editor"
- name="EMF-Compare Editor With Command">
- <contentTypeBinding
- contentTypeId="org.eclipse.uml2.uml">
- </contentTypeBinding>
- </editor>
- <editor
- class="org.eclipse.papyrus.emf.compare.transactional.editor.v2.TransactionalCompareEditor"
- contributorClass="org.eclipse.papyrus.emf.compare.transactional.editor.v2.TransactionalActionBarContributor"
- default="true"
- id="org.eclipse.papyrus.emf.compare.transactional.editor"
- name="Transactional EMF-Compare Editor ">
- <contentTypeBinding
- contentTypeId="org.eclipse.uml2.uml">
- </contentTypeBinding>
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="false"
- id="org.eclipse.papyrus.uml.compare.ui"
- objectClass="org.eclipse.core.resources.IFile">
- <action
- class="org.eclipse.papyrus.emf.compare.transactional.editor.FileCompareAction"
- enablesFor="2+"
- id="PapyrusCompareWithEachOther"
- label="Papyrus Compare"
- menubarPath="compareWithMenu/compareWithGroup"
- tooltip="Papyrus Compare">
- </action>
- </objectContribution>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="false"
- id="org.eclipse.papyrus.emf.compare.transactional.editor.objectContribution1"
- objectClass="org.eclipse.core.resources.IFile">
- <action
- class="org.eclipse.papyrus.emf.compare.transactional.editor.v2.PapyrusCompareAction"
- enablesFor="2+"
- id="org.eclipse.papyrus.emf.compare.transactional.editor.action1"
- label="Papyrus Compare Action V2"
- menubarPath="compareWithMenu/compareWithGroup"
- tooltip="Papyrus Compare V2">
- </action>
- </objectContribution>
- </extension>
-
-</plugin>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/Activator.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/Activator.java
deleted file mode 100644
index 82704ec8c6b..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/Activator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.papyrus.emf.compare.transactional.editor;
-
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.papyrus.log.LogHelper;
-import org.eclipse.swt.graphics.Image;
-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.emf.compare.transactional.editor"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /**
- * Returns the image from the given path.
- *
- * @param path the path the image to be displayed
- * @return the image found
- * FIXME
- */
- public static Image getImage(String path) {
- final ImageRegistry registry = getDefault().getImageRegistry();
- Image image = registry.get(path);
- if(image == null) {
- registry.put(path, Activator.imageDescriptorFromPlugin(PLUGIN_ID, path));
- image = registry.get(path);
- }
- return image;
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(plugin);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /** The log service */
- public static LogHelper log;
-
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/BasicCompareAction.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/BasicCompareAction.java
deleted file mode 100644
index df31cd7c653..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/BasicCompareAction.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2008-2010 See4sys and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * See4sys - Initial API and implementation
- *
- * </copyright>
- */
-package org.eclipse.papyrus.emf.compare.transactional.editor;
-
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.internal.ComparePreferencePage;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSnapshot;
-import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot;
-import org.eclipse.emf.compare.diff.metamodel.DiffFactory;
-import org.eclipse.emf.compare.diff.metamodel.DiffModel;
-import org.eclipse.emf.compare.diff.service.DiffService;
-import org.eclipse.emf.compare.match.metamodel.MatchModel;
-import org.eclipse.emf.compare.match.service.MatchService;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.emf.compare.transactional.editor.sphinx.EcorePlatformUtil;
-import org.eclipse.sphinx.emf.metamodel.MetaModelDescriptorRegistry;
-
-import org.eclipse.sphinx.platform.ui.util.ExtendedPlatformUI;
-import org.eclipse.sphinx.platform.util.PlatformLogUtil;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.IReusableEditor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.BaseSelectionListenerAction;
-import org.eclipse.sphinx.emf.compare.ui.internal.messages.Messages;
-
-/**
- * Duplicate code from Sphinx
- */
-@SuppressWarnings("restriction")
-public class BasicCompareAction extends BaseSelectionListenerAction implements ISelectionChangedListener {
-
- /**
- * The comparison snapshot owning the match and diff models. This snapshot is needed in order to create the compare
- * editor input.
- */
- protected ComparisonSnapshot comparisonSnapshot;
-
- /**
- * The selected objects that must be compared.
- */
- protected List<WeakReference<EObject>> selectedObjects = null;
- /**
- * The selected files that must be compared.
- */
- protected List<WeakReference<IFile>> selectedFiles = null;
-
- /**
- * Constructor.
- */
- public BasicCompareAction() {
- //super(Messages.action_compareWithEachOther);
- super("With Each Other");
- // TODO Add action description
- // setDescription(TO BE DEFINED);
- }
-
- /**
- * @param selection
- * The selection in the viewer onto which this action should perform an operation.
- * @return <ul>
- * <li><tt><b>true</b>&nbsp;&nbsp;</tt> if compare action is available (i.e. if {@link IStructuredSelection
- * selection} matches enablement criteria);</li>
- * <li><tt><b>false</b>&nbsp;</tt> otherwise.</li>
- * </ul>
- */
- @Override
- public boolean updateSelection(IStructuredSelection selection) {
- Assert.isNotNull(selection);
-
- if (selection.size() != 2) {
- return false;
- }
-
- // Reset attributes
- comparisonSnapshot = null;
- selectedFiles = null;
- selectedObjects = null;
-
- for (Iterator<?> it = selection.iterator(); it.hasNext();) {
- Object obj = it.next();
-
- if (obj instanceof EObject) {
- if (selectedObjects == null) {
- selectedObjects = new ArrayList<WeakReference<EObject>>();
- }
- selectedObjects.add(new WeakReference<EObject>((EObject) obj));
- } else if (obj instanceof IFile) {
- IFile file = (IFile) obj;
- if (MetaModelDescriptorRegistry.INSTANCE.getDescriptor(file) != null) {
- if (selectedFiles == null) {
- selectedFiles = new ArrayList<WeakReference<IFile>>();
- }
- selectedFiles.add(new WeakReference<IFile>(file));
- }
- }
- }
- return selectedFiles != null ? selectedFiles.size() == 2 : false ^ selectedObjects != null ? selectedObjects.size() == 2 : false;
- }
-
- @Override
- public void run() {
- EObject leftObject = null;
- EObject rightObject = null;
- if (selectedObjects != null && selectedObjects.size() == 2) {
- leftObject = selectedObjects.get(0).get();
- rightObject = selectedObjects.get(1).get();
- } else if (selectedFiles != null && selectedFiles.size() == 2) {
- leftObject = getModelRoot(selectedFiles.get(0).get());
- rightObject = getModelRoot(selectedFiles.get(1).get());
- }
- if (leftObject == null || rightObject == null) {
- return;
- }
- try {
- MatchModel matchModel = MatchService.doContentMatch(leftObject, rightObject, Collections.EMPTY_MAP);
- DiffModel diffModel = DiffService.doDiff(matchModel);
-
- comparisonSnapshot = createComparisonSnapshot(matchModel, diffModel);
-
- CompareEditorInput input = getCompareEditorInput();
- IWorkbenchPage page = ExtendedPlatformUI.getActivePage();
- IReusableEditor editor = getReusableEditor();
-
- openCompareEditor(input, page, editor);
-
- } catch (InterruptedException ex) {
- Activator.log.error(ex);//PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- } finally {
- }
- }
-
- /**
- * @param file
- * The file whose root model object must be returned.
- * @return The root object of the model contained in the specified {@link IFile file}.
- */
- protected EObject getModelRoot(IFile file) {
- Assert.isNotNull(file);
-
- // Get model from workspace file and force it to be loaded in case that this has not been done yet
- return EcorePlatformUtil.loadModelRoot(file);
- }
-
- protected ComparisonSnapshot createComparisonSnapshot(MatchModel matchModel, DiffModel diffModel) {
- ComparisonResourceSnapshot snapshot = DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
- snapshot.setDate(Calendar.getInstance().getTime());
- snapshot.setDiff(diffModel);
- snapshot.setMatch(matchModel);
- return snapshot;
- }
-
- protected CompareEditorInput getCompareEditorInput() {
- CompareEditorInput input = new PapyrusModelElementCompareEditorInput(comparisonSnapshot);
-
- CompareConfiguration configuration = input.getCompareConfiguration();
- if (configuration != null) {
- IPreferenceStore ps = configuration.getPreferenceStore();
- if (ps != null) {
- configuration.setProperty(CompareConfiguration.USE_OUTLINE_VIEW, Boolean.valueOf(ps
- .getBoolean(ComparePreferencePage.USE_OUTLINE_VIEW)));
- }
- }
- return input;
- }
-
- protected IReusableEditor getReusableEditor() {
- return null;
- }
-
- /**
- * Performs the comparison described by the given input and opens a compare editor on the result.
- *
- * @param input
- * the input on which to open the compare editor
- * @param page
- * the workbench page on which to create a new compare editor
- * @param editor
- * if not null the input is opened in this editor
- * @see CompareEditorInput
- */
- protected void openCompareEditor(final CompareEditorInput input, final IWorkbenchPage page, final IReusableEditor editor) {
- Runnable runnable = new Runnable() {
- public void run() {
- if (editor != null && !editor.getSite().getShell().isDisposed()) {
- // Reuse the given editor
- editor.setInput(input);
- return;
- }
- if (page != null) {
- // Open new CompareEditor on page
- try {
- page.openEditor(input, getCompareEditorId(input));
- } catch (PartInitException e) {
- Activator.log.error(e);
-// PlatformLogUtil.logAsError(Activator.getPlugin(), e);
- MessageDialog.openError(ExtendedPlatformUI.getActiveShell(), Messages.error_openEditorError, e.getMessage());
- }
- } else {
- String msg = Messages.error_noActiveWorkbenchPage;
- Activator.log.error(new NullPointerException(msg));//TODO bad, no?
- //PlatformLogUtil.logAsError(Activator.getPlugin(), new NullPointerException(msg));
- MessageDialog.openError(ExtendedPlatformUI.getActiveShell(), Messages.error_openEditorError, msg);
- }
- }
- };
-
- Display display = ExtendedPlatformUI.getDisplay();
- if (display != null) {
- display.syncExec(runnable);
- } else {
- runnable.run();
- }
- }
-
- /**
- * Returns the identifier of the compare editor to open.
- * <p>
- * Inheriting clients may override this method in order to specify the identifier of another compare editor (e.g.
- * according to the type of the specified input).
- *
- * @param input
- * The {@linkplain CompareEditorInput editor input} for which a compare editor is supposed to be opened.
- * @return The identifier of the compare editor to open.
- */
- protected String getCompareEditorId(CompareEditorInput input) {
- // Use our own ModelCompareEditor rather than Eclipse's org.eclipse.compare.CompareEditor
- return PapyrusCompareEditor.ID;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- // TODO Auto-generated method stub
- super.setEnabled(enabled);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/FileCompareAction.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/FileCompareAction.java
deleted file mode 100644
index 0b469cdfd98..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/FileCompareAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2008-2010 See4sys and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * See4sys - Initial API and implementation
- *
- * </copyright>
- */
-package org.eclipse.papyrus.emf.compare.transactional.editor;
-
-import org.eclipse.compare.internal.CompareEditor;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-//import org.eclipse.sphinx.emf.compare.ui.editor.ModelCompareEditor;
-import org.eclipse.sphinx.platform.ui.util.SelectionUtil;
-import org.eclipse.sphinx.platform.util.ExtendedPlatform;
-import org.eclipse.sphinx.platform.util.ReflectUtil;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Action for comparing {@link IFile file}s in the workspace. Overrides Eclipse-defined action behind "Compare With >
- * Each Other" popup menu to make sure that {@link ModelCompareEditor} rather than Eclipse's {@link CompareEditor} is
- * opened when selected {@link IFile file}s are model files.
- *
- * @see ModelCompareEditor
- */
-@SuppressWarnings("restriction")
-public class FileCompareAction implements IObjectActionDelegate {
-
- private BasicCompareAction modelCompareActionDelegate = new BasicCompareAction();
- private IObjectActionDelegate eclipseCompareActionDelegate;
-
- @SuppressWarnings("unchecked")
- public FileCompareAction() {
- // Ensure backward compatibility with Eclipse 3.4.x and earlier
- try {
- String eclipseCompareActionClassName;
- if (ExtendedPlatform.getFeatureVersionOrdinal() >= 35) {
- eclipseCompareActionClassName = "org.eclipse.team.internal.ui.actions.CompareAction"; //$NON-NLS-1$
- } else {
- eclipseCompareActionClassName = "org.eclipse.compare.internal.CompareAction"; //$NON-NLS-1$
- }
- Class<IObjectActionDelegate> eclipseCompareActionClass = (Class<IObjectActionDelegate>) getClass().getClassLoader().loadClass(
- eclipseCompareActionClassName);
- eclipseCompareActionDelegate = eclipseCompareActionClass.newInstance();
- } catch (Exception ex) {
- // Ignore exception
- }
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- if (eclipseCompareActionDelegate != null) {
- eclipseCompareActionDelegate.setActivePart(action, targetPart);
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // Propagate selection to delegates
- if (eclipseCompareActionDelegate != null) {
- eclipseCompareActionDelegate.selectionChanged(action, selection);
- }
- modelCompareActionDelegate.selectionChanged(SelectionUtil.getStructuredSelection(selection));
-
- // Update enablement state
- if (action != null) {
- action.setEnabled(isEclipseCompareActionEnabled() | modelCompareActionDelegate.isEnabled());
- }
- }
-
- public void run(IAction action) {
- if (modelCompareActionDelegate.isEnabled()) {
- modelCompareActionDelegate.run();
- } else if (isEclipseCompareActionEnabled()) {
- eclipseCompareActionDelegate.run(action);
- }
- }
-
- private boolean isEclipseCompareActionEnabled() {
- try {
- // Retrieve Eclipse compare action enablement state reflectively to be compatible with Eclipse 3.4.x and
- // Eclipse 3.5.x
- if (eclipseCompareActionDelegate != null) {
- return (Boolean) ReflectUtil.invokeMethod(eclipseCompareActionDelegate, "isEnabled"); //$NON-NLS-1$
- }
- } catch (Exception ex) {
- // Ignore exception
- }
- return false;
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusCompareEditor.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusCompareEditor.java
deleted file mode 100644
index 33c05176f71..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusCompareEditor.java
+++ /dev/null
@@ -1,370 +0,0 @@
-package org.eclipse.papyrus.emf.compare.transactional.editor;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.internal.CompareEditor;
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.IOperationHistoryListener;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.ObjectUndoContext;
-import org.eclipse.core.commands.operations.OperationHistoryEvent;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.emf.workspace.IWorkspaceCommandStack;
-import org.eclipse.emf.workspace.ResourceUndoContext;
-import org.eclipse.papyrus.emf.compare.transactional.editor.sphinx.WorkspaceEditingDomainUtil;
-import org.eclipse.sphinx.emf.workspace.ui.saving.BasicModelSaveablesProvider.SiteNotifyingSaveablesLifecycleListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.ISaveablesLifecycleListener;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.SaveablesLifecycleEvent;
-
-
-/**
- *
- * Duplicate code from ModelCompareEditor
- *
- */
-@SuppressWarnings("restriction")//we suppres the warning for CompareEditor
-public class PapyrusCompareEditor extends CompareEditor implements IEditingDomainProvider{
-
- /**
- * The identifier of this editor (as contributed).
- */
- public static String ID = "org.eclipse.papyrus.emf.compare.editor"; //$NON-NLS-1$
-
- /**
- * The undo context for this compare editor.
- */
- protected IUndoContext undoContext;
-
- private IOperationHistoryListener affectedObjectsListener;
-
- /**
- * Default constructor.
- */
- public PapyrusCompareEditor() {
- // Create undo context
- undoContext = new ObjectUndoContext(this, ID);
-
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- super.init(site, input);
-
- // First do not keep duplicated editing domain entries
- Set<TransactionalEditingDomain> editingDomains = new HashSet<TransactionalEditingDomain>();
- for (TransactionalEditingDomain editingDomain : getEditingDomains()) {
- if (editingDomain != null) {
- editingDomains.add(editingDomain);
- }
- }
- if (editingDomains.isEmpty()) {
- Activator.log.error(new RuntimeException("Editing domain not found"));
-// PlatformLogUtil.logAsError(Activator.getPlugin(), new RuntimeException(EMFMessages.error_notFound_editingDomain));
- }
- // Then creates and registers listeners on resulting editing domains
- for (TransactionalEditingDomain editingDomain : editingDomains) {
- addTransactionalEditingDomainListeners(editingDomain);
- }
- }
-
- @Override
- public void dispose() {
- for (TransactionalEditingDomain editingDomain : getEditingDomains()) {
- if (editingDomain != null) {
- removeTransactionalEditingDomainListeners(editingDomain);
- }
- }
-
- for (IOperationHistory operationHistory : getOperationHistories()) {
- if (operationHistory != null) {
- operationHistory.dispose(getUndoContext(), true, true, true);
- }
- }
- super.dispose();
- }
-
- protected void addTransactionalEditingDomainListeners(TransactionalEditingDomain editingDomain) {
- if (editingDomain != null) {
- // Create and register IOperationHistoryListener that detects changed objects
- affectedObjectsListener = createAffectedObjectsListener();
- Assert.isNotNull(affectedObjectsListener);
- ((IWorkspaceCommandStack) editingDomain.getCommandStack()).getOperationHistory().addOperationHistoryListener(affectedObjectsListener);
- }
- }
-
- protected void removeTransactionalEditingDomainListeners(TransactionalEditingDomain editingDomain) {
- if (editingDomain != null) {
- if (affectedObjectsListener != null) {
- IOperationHistory operationHistory = ((IWorkspaceCommandStack) editingDomain.getCommandStack()).getOperationHistory();
- operationHistory.removeOperationHistoryListener(affectedObjectsListener);
- }
- }
- }
-
- /**
- * Creates and returns the {@linkplain IOperationHistoryListener listener} to add on the
- * {@linkplain IOperationHistory operation history} of {@linkplain TransactionalEditingDomain editing domain}'s
- * {@linkplain IWorkspaceCommandStack command stack}.
- * <p>
- * The listener's implementation that is provided here aims at updating {@linkplain IUndoableOperation operation}'s
- * context by first removing default {@linkplain IUndoContext undo context} and second by adding
- * {@linkplain IUndoContext undo context} encapsulated by this editor.
- * <p>
- * Clients may override this default implementation.
- *
- * @return The {@linkplain IOperationHistoryListener operation history listener} to register on the command stack of
- * the concerned editing domain.
- */
- protected IOperationHistoryListener createAffectedObjectsListener() {
- return new IOperationHistoryListener() {
-
- public void historyNotification(final OperationHistoryEvent event) {
- IUndoableOperation operation = event.getOperation();
- if (event.getEventType() == OperationHistoryEvent.ABOUT_TO_EXECUTE) {
- handleOperationAboutToExecute(operation);
- } else if (event.getEventType() == OperationHistoryEvent.DONE || event.getEventType() == OperationHistoryEvent.UNDONE
- || event.getEventType() == OperationHistoryEvent.REDONE) {
- Set<?> affectedResources = ResourceUndoContext.getAffectedResources(operation);
- Resource[] resources = getModelRootsResources();
- boolean isLeftResourceAffected = resources[0] != null ? affectedResources.contains(resources[0]) : false;
- boolean isRightResourceAffected = resources[1] != null ? affectedResources.contains(resources[1]) : false;
- if (isLeftResourceAffected || isRightResourceAffected) {
- handleOperationFinished(operation);
- }
- }
- }
-
- private void handleOperationAboutToExecute(final IUndoableOperation operation) {
- if (operation.canUndo()) {
- IWorkbenchPartSite site = getSite();
- if (site != null) {
- site.getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- if (isActivePart()) {
- Resource[] resources = getModelRootsResources();
- for (Resource resource : resources) {
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resource);
- if (editingDomain != null && editingDomain.getCommandStack() instanceof IWorkspaceCommandStack) {
- IWorkspaceCommandStack cmdStack = (IWorkspaceCommandStack) editingDomain.getCommandStack();
- IUndoContext defaultUndoContext = cmdStack.getDefaultUndoContext();
- if (defaultUndoContext != null) {
- // Remove default undo context and this editor's undo context
- operation.removeContext(defaultUndoContext);
- }
- }
- }
- operation.addContext(getUndoContext());
- }
- }
- });
- }
- }
- }
-
- private void handleOperationFinished(final IUndoableOperation operation) {
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- // Update editor part name
- // FIXME Not needed for the moment.
- // setPartName(getModelRootsNames());
- }
- });
- }
- };
- }
-
- /**
- * @return
- */
- public ISaveablesLifecycleListener createModelSaveablesLifecycleListener() {
- return new SiteNotifyingSaveablesLifecycleListener(this) {
- @Override
- public void handleLifecycleEvent(SaveablesLifecycleEvent event) {
- super.handleLifecycleEvent(event);
-
- if (event.getEventType() == SaveablesLifecycleEvent.DIRTY_CHANGED) {
- firePropertyChange(PROP_DIRTY);
- }
- }
- };
- }
-
- @Override
- public boolean isSaveOnCloseNeeded() {
- // Model-based editors don't need to be saved when being closed even if the model is dirty, because they don't
- // own the model. The model is loaded, managed, and saved globally, i.e. it is not destroyed but stays there
- // when editors are being closed.
- return false;
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- // TODO Modify implementation as soon as saving as diff model would be available.
- return false;
- }
-
- @Override
- public Object getAdapter(@SuppressWarnings("rawtypes") Class key) {
- if (key.equals(IUndoContext.class)) {
- // Used by undo/redo actions to get their undo context
- return getUndoContext();
- } else {
- return super.getAdapter(key);
- }
- }
-
- /**
- * @return The {@linkplain IUndoContext undo context} associated to this compare editor.
- */
- public IUndoContext getUndoContext() {
- return undoContext;
- }
-
- /**
- * @return An array of {@linkplain TransactionalEditingDomain editing domain}s which size is 2 and where at index 0
- * is editing domain from left, at index 1 is editing domain from right.
- */
- public TransactionalEditingDomain[] getEditingDomains() {
- TransactionalEditingDomain[] editingDomains = new TransactionalEditingDomain[2];
- EObject[] modelRoots = getModelRoots();
- if (modelRoots[0] != null) {
- editingDomains[0] = WorkspaceEditingDomainUtil.getEditingDomain(modelRoots[0]);
- }
- if (modelRoots[1] != null) {
- editingDomains[1] = WorkspaceEditingDomainUtil.getEditingDomain(modelRoots[1]);
- }
- if (editingDomains[0] == null && editingDomains[1] == null) {
- Activator.log.error(new RuntimeException("No editing domain found")); //$NON-NLS-1$
-// PlatformLogUtil.logAsError(Activator.getPlugin(), new RuntimeException("No editing domain found")); //$NON-NLS-1$
- }
- return editingDomains;
- }
-
- protected IOperationHistory[] getOperationHistories() {
- IOperationHistory[] operationHistories = new IOperationHistory[2];
- TransactionalEditingDomain[] editingDomains = getEditingDomains();
- for (int i = 0; i < 2; i++) {
- if (editingDomains[i] != null) {
- operationHistories[i] = ((IWorkspaceCommandStack) editingDomains[i].getCommandStack()).getOperationHistory();
- }
- }
- return operationHistories;
- }
-
- /**
- * @return The root objects of the model part that are currently being compared in this editor or an empty array if
- * no such objects are available. Anyway, always returns an array of {@linkplain EObject}s which size is 2
- * and where at index 0 is the left root and at index 1 is the right root.
- */
- public EObject[] getModelRoots() {
- EObject[] modelRoots = new EObject[2];
- IEditorInput editorInput = getEditorInput();
- if (editorInput instanceof PapyrusModelElementCompareEditorInput) {
- modelRoots = ((PapyrusModelElementCompareEditorInput) editorInput).getModelRoots();
- }
- return modelRoots;
- }
-
- /**
- * <p>
- * <table>
- * <tr valign=top>
- * <td><b>Note</b>&nbsp;&nbsp;</td>
- * <td>Whatever the model roots are (i.e. if <code>null</code> or not), this method returns an array of
- * {@linkplain Resource}s whose size is 2.</td>
- * </tr>
- * </table>
- *
- * @return
- */
- protected Resource[] getModelRootsResources() {
- Resource[] resources = new Resource[2];
- EObject[] modelRoots = getModelRoots();
- for (int i = 0; i < 2; i++) {
- EObject modelRoot = modelRoots[i];
- if (modelRoot != null) {
- resources[i] = modelRoot.eResource();
- }
- }
- return resources;
- }
-
- protected String getModelRootsNames() {
- String[] labels = new String[2];
- EObject[] modelRoots = getModelRoots();
- AdapterFactoryItemDelegator[] itemDelegators = getItemDelegators();
- for (int i = 0; i < 2; i++) {
- if (modelRoots[i] != null && itemDelegators[i] != null) {
- // Label of model root
- labels[i] = itemDelegators[i].getText(modelRoots[i]);
- }
- }
- if (labels[0] != null && labels[1] != null) {
- return labels[0] + " <---> " + labels[1]; //$NON-NLS-1$
- } else {
- return ((CompareEditorInput) getEditorInput()).getTitle();
- }
- }
-
- protected AdapterFactory[] getAdapterFactories() {
- AdapterFactory[] adapterFactories = new AdapterFactory[2];
- TransactionalEditingDomain[] editingDomains = getEditingDomains();
- for (int i = 0; i < 2; i++) {
- TransactionalEditingDomain editingDomain = editingDomains[i];
- if (editingDomain != null) {
- adapterFactories[i] = ((AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
- }
- }
- return adapterFactories;
- }
-
- protected AdapterFactoryItemDelegator[] getItemDelegators() {
- AdapterFactoryItemDelegator[] itemDelegators = new AdapterFactoryItemDelegator[2];
- AdapterFactory[] adapterFactories = getAdapterFactories();
- for (int i = 0; i < 2; i++) {
- AdapterFactory adapterFactory = adapterFactories[i];
- if (adapterFactory != null) {
- itemDelegators[i] = new AdapterFactoryItemDelegator(adapterFactory);
- }
- }
- return itemDelegators;
- }
-
- protected boolean isActivePart() {
- return this == getSite().getWorkbenchWindow().getPartService().getActivePart();
- }
-
- @Override
- public void setInput(IEditorInput input) {
- if (input instanceof PapyrusModelElementCompareEditorInput) {
- super.setInput(input);
- } else {
- Activator.log.error(new RuntimeException("Invalid editor input (must be an instance of ModelElementCompareEditorInput)"));
-// PlatformLogUtil.logAsError(Activator.getPlugin(), new RuntimeException(Messages.error_invalidEditorInput));
- }
- Image im = org.eclipse.papyrus.emf.compare.transactional.editor.Activator.getImage("/icons/PapyrusLogo16x16.gif");
- //TODO
- setTitleImage(im);
- setPartName("Papyrus Compare");
- }
-
- public TransactionalEditingDomain getEditingDomain() {
- return getEditingDomains()[0];
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusModelCompareActionBarContributor.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusModelCompareActionBarContributor.java
deleted file mode 100644
index 97e1787804c..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusModelCompareActionBarContributor.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2008-2010 See4sys and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * See4sys - Initial API and implementation
- *
- * </copyright>
- */
-package org.eclipse.papyrus.emf.compare.transactional.editor;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.commands.operations.IOperationHistoryListener;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.OperationHistoryEvent;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
-import org.eclipse.emf.edit.ui.action.RedoAction;
-import org.eclipse.emf.edit.ui.action.UndoAction;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.IWorkspaceCommandStack;
-import org.eclipse.emf.workspace.ResourceUndoContext;
-import org.eclipse.emf.workspace.ui.actions.RedoActionWrapper;
-import org.eclipse.emf.workspace.ui.actions.UndoActionWrapper;
-import org.eclipse.papyrus.emf.compare.transactional.editor.sphinx.WorkspaceEditingDomainUtil;
-import org.eclipse.sphinx.emf.compare.ui.editor.ModelCompareEditor;
-import org.eclipse.sphinx.emf.workspace.domain.WorkspaceEditingDomainManager;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * An implementation of {@linkplain IEditorActionBarContributor action bar contributor} that is dedicated to
- * {@linkplain ModelCompareEditor model compare editor}s.
- * <p>
- * Brings support for undo/redo actions.
- */
-public class PapyrusModelCompareActionBarContributor extends EditingDomainActionBarContributor {
-
- /**
- * The {@linkplain IOperationHistoryListener operation history listener} responsible for setting editing domain on
- * <em>undo</em>/<em>redo</em> actions as soon as an operation (on the command stack of that precise editing domain)
- * has been finished.
- */
- protected IOperationHistoryListener historyListener;
-
- /**
- * Default constructor that creates a new instance of this contributor.
- */
- public PapyrusModelCompareActionBarContributor() {
- super(ADDITIONS_LAST_STYLE);
- }
-
- /**
- * Creates the {@linkplain IOperationHistoryListener operation history listener} that is responsible for setting
- * editing domain on <em>undo</em>/<em>redo</em> actions as soon as an operation (on the command stack of that
- * precise editing domain) has been finished.
- *
- * @return The {@linkplain IOperationHistoryListener operation history listener} to add on the concerned editing
- * domain's command stack.
- */
- protected IOperationHistoryListener createOperationHistoryListener() {
- return new IOperationHistoryListener() {
- public void historyNotification(OperationHistoryEvent event) {
- if (event.getEventType() == OperationHistoryEvent.DONE || event.getEventType() == OperationHistoryEvent.UNDONE
- || event.getEventType() == OperationHistoryEvent.REDONE) {
- IUndoContext[] contexts = event.getOperation().getContexts();
- for (IUndoContext context : contexts) {
- if (PapyrusCompareEditor.ID.equals(context.getLabel())) {
- Set<Resource> affectedResources = ResourceUndoContext.getAffectedResources(event.getOperation());
- TransactionalEditingDomain editingDomain = null;
- for (Resource resource : affectedResources) {
- TransactionalEditingDomain domain = WorkspaceEditingDomainUtil.getEditingDomain(resource);
- if (editingDomain != null && editingDomain != domain) {
- //
- // !! Important Note !!
- // For the moment, the case where two elements from different editing domain are
- // compared is not really supported because we do not know very well the expected
- // behavior of such a kind of comparison.
- //
- UnsupportedOperationException ex = new UnsupportedOperationException("Several editing domains"); //$NON-NLS-1$
- //PlatformLogUtil.logAsWarning(Activator.getPlugin(), ex);
- Activator.log.error(ex);
- editingDomain = null;
- break;
- } else {
- editingDomain = domain;
- }
- }
- if (editingDomain != null) {
- // Set editing domain on Undo/Redo actions
- if (undoAction != null) {
- undoAction.setEditingDomain(editingDomain);
- }
- if (redoAction != null) {
- redoAction.setEditingDomain(editingDomain);
- }
- }
- break;
- }
- }
- }
- }
- };
- }
-
- @Override
- public void init(IActionBars actionBars) {
- super.init(actionBars);
-
- historyListener = createOperationHistoryListener();
-
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
-
- // Override the superclass implementation of these actions
- undoAction = createUndoAction();
- undoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
- actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
-
- redoAction = createRedoAction();
- redoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
- actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
- }
-
- /**
- * Returns the {@linkplain RedoAction} this action bar contributor must provide. Default implementation creates a
- * new instance of {@linkplain RedoActionWrapper}; clients may override this method in order to create another kind
- * of action instead.
- *
- * @return The {@linkplain RedoAction} this action bar contributor must provide.
- */
- // FIXME Uncomment @Override once we don't need to support Eclipse 3.5 any longer
- // @Override
- protected RedoAction createRedoAction() {
- return new RedoActionWrapper();
- }
-
- /**
- * Returns the {@linkplain UndoAction} this action bar contributor must provide. Default implementation creates a
- * new instance of {@linkplain UndoActionWrapper}; clients may override this method in order to create another kind
- * of action instead.
- *
- * @return The {@linkplain UndoAction} this action bar contributor must provide.
- */
- // FIXME Uncomment @Override once we don't need to support Eclipse 3.5 any longer
- // @Override
- protected UndoAction createUndoAction() {
- return new UndoActionWrapper();
- }
-
- @Override
- public void setActiveEditor(IEditorPart part) {
- if (part != activeEditor) {
- if (activeEditor != null) {
- deactivate();
- }
- if (part instanceof PapyrusCompareEditor) {
- activeEditor = part;
- activate();
- }
- }
- }
-
- @Override
- public void dispose() {
- super.dispose();
-
- if (historyListener != null) {
- List<TransactionalEditingDomain> editingDomains = WorkspaceEditingDomainManager.INSTANCE.getEditingDomainMapping().getEditingDomains();
- for (TransactionalEditingDomain editingDomain : editingDomains) {
- ((IWorkspaceCommandStack) editingDomain.getCommandStack()).getOperationHistory().removeOperationHistoryListener(historyListener);
- }
- }
- historyListener = null;
- }
-
- @Override
- public void deactivate() {
- activeEditor.removePropertyListener(this);
-
- undoAction.setActiveWorkbenchPart(null);
- redoAction.setActiveWorkbenchPart(null);
- }
-
- /**
- * @return The {@linkplain TransactionalEditingDomain editing domain}s of the objects being compared (retrieves them
- * directly from {@linkplain ModelCompareEditor}).
- */
- protected Set<TransactionalEditingDomain> getEditingDomainsFromCompareEditor() {
- Set<TransactionalEditingDomain> editingDomains = new HashSet<TransactionalEditingDomain>();
- for (TransactionalEditingDomain editingDomain : ((PapyrusCompareEditor) activeEditor).getEditingDomains()) {
- if (editingDomain != null) {
- editingDomains.add(editingDomain);
- }
- }
- return editingDomains;
- }
-
- @Override
- public void activate() {
- if (historyListener != null) {
- for (TransactionalEditingDomain editingDomain : getEditingDomainsFromCompareEditor()) {
- ((IWorkspaceCommandStack) editingDomain.getCommandStack()).getOperationHistory().addOperationHistoryListener(historyListener);
- }
- }
-
- activeEditor.addPropertyListener(this);
-
- undoAction.setActiveWorkbenchPart(activeEditor);
- redoAction.setActiveWorkbenchPart(activeEditor);
-
- update();
- }
-
- @Override
- public void update() {
- undoAction.update();
- redoAction.update();
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusModelElementCompareEditorInput.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusModelElementCompareEditorInput.java
deleted file mode 100644
index ff110f9030d..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/PapyrusModelElementCompareEditorInput.java
+++ /dev/null
@@ -1,357 +0,0 @@
-package org.eclipse.papyrus.emf.compare.transactional.editor;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.CompareViewerPane;
-import org.eclipse.compare.IViewerCreator;
-import org.eclipse.compare.Splitter;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSetSnapshot;
-import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSnapshot;
-import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot;
-import org.eclipse.emf.compare.match.metamodel.MatchModel;
-import org.eclipse.emf.compare.ui.ModelCompareInput;
-import org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput;
-import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
-import org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.emf.compare.transactional.editor.sphinx.EcoreResourceUtil;
-import org.eclipse.papyrus.uml.compare.ui.merge.viewer.PapyrusContentMergeViewerCreator;
-import org.eclipse.papyrus.uml.compare.ui.structure.viewer.UMLStructureMergeViewerCreator;
-import org.eclipse.sphinx.emf.compare.ui.ModelElementCompareInput;
-import org.eclipse.sphinx.emf.compare.ui.editor.ModelCompareEditor;
-import org.eclipse.sphinx.emf.compare.ui.internal.Activator;
-import org.eclipse.sphinx.emf.compare.ui.internal.messages.Messages;
-import org.eclipse.sphinx.emf.compare.ui.viewer.content.ModelElementContentMergeViewer;
-import org.eclipse.sphinx.emf.resource.ExtendedResource;
-import org.eclipse.sphinx.emf.workspace.saving.ModelSaveManager;
-import org.eclipse.sphinx.emf.workspace.ui.saving.BasicModelSaveablesProvider;
-import org.eclipse.sphinx.platform.util.PlatformLogUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.ISaveablesLifecycleListener;
-import org.eclipse.ui.ISaveablesSource;
-import org.eclipse.ui.Saveable;
-import org.eclipse.ui.navigator.SaveablesProvider;
-
-/**
- * Duplicate code from ModelElementCompareEditorInput
- */
-public class PapyrusModelElementCompareEditorInput extends ModelCompareEditorInput implements ISaveablesSource {
-
- /**
- * The two {@linkplain EObject}s that are currently being compared.
- * <p>
- * <code>modelRoots[0]</code> is the <b>left</b> model root object;<br>
- * <code>modelRoots[1]</code> is the <b>right</b> model root object.
- */
- private EObject[] modelRoots;
-
- protected SaveablesProvider modelSaveablesProvider;
-
- /**
- * This is a temporary editing domain used to load distant files.
- */
- protected TransactionalEditingDomain editingDomain;
-
- /**
- * This constructor takes a {@link ModelInputSnapshot} as input.
- *
- * @param snapshot
- * The {@link ComparisonSnapshot} loaded from an emfdiff.
- */
- public PapyrusModelElementCompareEditorInput(ComparisonSnapshot snapshot) {
- super(snapshot);
- }
-
- /**
- * Internal convenient method allowing to easily retrieve the match model for this compare editor input.
- *
- * @return The {@linkplain MatchModel match model} provided by the {@linkplain ModelCompareInput} encapsulated in
- * this {@linkplain ModelCompareEditorInput compare editor input}.
- */
- protected MatchModel getMatchModel() {
- Object matchModel = null;
- if(preparedInput != null) {
- matchModel = preparedInput.getMatch();
- } else if(inputSnapshot != null) {
- if(inputSnapshot instanceof ComparisonResourceSnapshot) {
- matchModel = ((ComparisonResourceSnapshot)inputSnapshot).getMatch();
- } else if(inputSnapshot instanceof ComparisonResourceSetSnapshot) {
- matchModel = ((ComparisonResourceSetSnapshot)inputSnapshot).getMatchResourceSet();
- }
- } else {
- IStatus warning = new Status(IStatus.WARNING, Activator.getPlugin().getSymbolicName(), Messages.warning_inputsNull, new NullPointerException());
- PlatformLogUtil.logAsWarning(Activator.getPlugin(), warning);
- }
- return matchModel instanceof MatchModel ? (MatchModel)matchModel : null;
- }
-
- /**
- * Returns the save options to consider while saving the underlying model being edited. Default implementation
- * returns the default save options provided by the Sphinx EMF platform utility {@linkplain EcoreResourceUtil}.
- * Clients may override this method in order to specify custom options.
- *
- * @return The save options to consider while saving the underlying model being edited.
- */
- protected Map<?, ?> getSaveOptions() {
- return EcoreResourceUtil.getDefaultSaveOptions();
- }
-
- @Override
- public boolean isDirty() {
- boolean isDirty = false;
- for(Object modelRoot : getModelRoots()) {
- if(modelRoot instanceof EObject) {
- // Return true if the model, this editor or both are dirty
- isDirty = isDirty || ModelSaveManager.INSTANCE.isDirty(((EObject)modelRoot).eResource());
- }
- }
- return isDirty;
- }
-
- protected void init() {
- if(modelSaveablesProvider == null) {
- modelSaveablesProvider = createModelSaveablesProvider();
- if(getWorkbenchPart() instanceof PapyrusCompareEditor) {
- ISaveablesLifecycleListener modelSaveablesLifecycleListener = ((PapyrusCompareEditor)getWorkbenchPart()).createModelSaveablesLifecycleListener();
- modelSaveablesProvider.init(modelSaveablesLifecycleListener);
- } else {
- if(getWorkbenchPart() == null) {
- PlatformLogUtil.logAsWarning(Activator.getPlugin(), new NullPointerException(Messages.warning_workbenchPartNull));
- } else {
- PlatformLogUtil.logAsWarning(Activator.getPlugin(), new RuntimeException(Messages.warning_workbenchPartInstanceofModelCompareEditor));
- }
- }
- }
- }
-
- /**
- * @return The root object of the model part that is currently being edited in this editor or <code>null</code> if
- * no such is available.
- */
- public EObject[] getModelRoots() {
- if(modelRoots == null) {
- modelRoots = new EObject[2];
- }
-
- MatchModel matchModel = getMatchModel();
-
- if(matchModel != null) {
- if(modelRoots[0] == null || modelRoots[0].eIsProxy() || modelRoots[0].eResource() == null || !modelRoots[0].eResource().isLoaded()) {
- EList<EObject> leftRoots = matchModel.getLeftRoots();
- modelRoots[0] = leftRoots.get(0);
- }
- if(modelRoots[1] == null || modelRoots[1].eIsProxy() || modelRoots[1].eResource() == null || !modelRoots[1].eResource().isLoaded()) {
- EList<EObject> rightRoots = matchModel.getRightRoots();
- modelRoots[1] = rightRoots.get(0);
- }
- } else {
- IStatus warning = new Status(IStatus.WARNING, Activator.getPlugin().getSymbolicName(), Messages.warning_inputMatchModelNull, new NullPointerException());
- PlatformLogUtil.logAsWarning(Activator.getPlugin(), warning);
- }
- return modelRoots;
- }
-
- @Override
- protected ModelContentMergeViewer createMergeViewer(CompareViewerPane pane, CompareConfiguration compareConfig) {
-// return super.createMergeViewer(pane, compareConfig);
-//we provide a Papyrus ContentMergeViewer
- IViewerCreator creator = new PapyrusContentMergeViewerCreator();
- return (ModelContentMergeViewer)creator.createViewer(pane, compareConfig);
-// return new ModelElementContentMergeViewer(pane, compareConfig);
- }
-
- @Override
- protected ModelCompareInput createModelCompareInput(ComparisonSnapshot snap) {
- if(snap instanceof ComparisonResourceSetSnapshot) {
- return new ModelElementCompareInput(((ComparisonResourceSetSnapshot)snap).getMatchResourceSet(), ((ComparisonResourceSetSnapshot)snap).getDiffResourceSet());
- }
- return new ModelElementCompareInput(((ComparisonResourceSnapshot)snap).getMatch(), ((ComparisonResourceSnapshot)snap).getDiff());
- }
-
- protected SaveablesProvider createModelSaveablesProvider() {
- return new BasicModelSaveablesProvider();
- }
-
- /**
- * @see Bug 892 - Indicate files being compared in compare editor tab title
- * @see #setTitle(String)
- */
- @Override
- protected Object prepareInput(IProgressMonitor monitor) {
- init();
- String title;
- Object input = super.prepareInput(monitor);
- String leftLabel = getLeftLabel();
- String rightLabel = getRightLabel();
- String ancestorLabel = getAncestorLabel();
- if(ancestorLabel == null) {
- title = NLS.bind(Messages.twoWay_title, leftLabel, rightLabel);
- } else {
- title = NLS.bind(Messages.threeWay_title, new String[]{ ancestorLabel, leftLabel, rightLabel });
- }
- setTitle(title);
- return input;
- }
-
- /**
- * Returns the label of the left compared object to use it in the title and the tool tip of the compare editor.
- *
- * @return As specified above.
- */
- protected String getRightLabel() {
- String rightLabel;
- EObject rightRoot = getModelRoots()[1];
- Resource rightResource = preparedInput.getRightResource();
- EObject rightModelRoot = EcoreResourceUtil.getModelRoot(rightResource);
- rightLabel = rightResource.getURI().toPlatformString(true);
- if(rightRoot != rightModelRoot) {
- String fragment = rightResource.getURIFragment(rightRoot);
- fragment = fragment.lastIndexOf(ExtendedResource.URI_QUERY_SEPARATOR) == -1 ? "" : fragment.substring(0, fragment.lastIndexOf(ExtendedResource.URI_QUERY_SEPARATOR)); //$NON-NLS-1$
- rightLabel = rightLabel.concat(ExtendedResource.URI_FRAGMENT_SEPARATOR + fragment);
- }
- return rightLabel;
- }
-
- /**
- * Returns the label of the right compared object to use it in the title and the tool tip of the compare editor.
- *
- * @return As specified above.
- */
- protected String getLeftLabel() {
- String leftLabel;
- EObject leftRoot = getModelRoots()[0];
- Resource leftResource = preparedInput.getLeftResource();
- EObject leftModelRoot = EcoreResourceUtil.getModelRoot(leftResource);
- leftLabel = leftResource.getURI().toPlatformString(true);
- if(leftRoot != leftModelRoot) {
- String fragment = leftResource.getURIFragment(leftRoot);
- fragment = fragment.lastIndexOf(ExtendedResource.URI_QUERY_SEPARATOR) == -1 ? "" : fragment.substring(0, fragment.lastIndexOf(ExtendedResource.URI_QUERY_SEPARATOR)); //$NON-NLS-1$
- leftLabel = leftLabel.concat(ExtendedResource.URI_FRAGMENT_SEPARATOR + fragment);
- }
- return leftLabel;
- }
-
- /**
- * Returns the label of the ancestor object in case of three way comparison.
- *
- * @return As specified above.
- */
- // TODO aakar We should handle three way comparison
- protected String getAncestorLabel() {
- Resource ancestorResource = preparedInput.getAncestorResource();
- if(ancestorResource != null) {
- return ancestorResource.getURI().toString();
- }
- return null;
- }
-
- @Override
- public String getToolTipText() {
- if(preparedInput != null) {
- String leftLabel = getLeftLabel();
- String rightLabel = getRightLabel();
- String ancestorLabel = getAncestorLabel();
- if(ancestorLabel == null) {
- return NLS.bind(Messages.twoWay_tooltip, leftLabel, rightLabel);
- } else {
- return NLS.bind(Messages.threeWay_tooltip, new Object[]{ ancestorLabel, leftLabel, rightLabel });
- }
- }
- // Fall back
- return super.getToolTipText();
- }
-
- @Override
- public void saveChanges(IProgressMonitor monitor) {
- for(Object modelRoot : getModelRoots()) {
- if(modelRoot instanceof EObject) {
- // Save the all dirty resources of underlying model
- ModelSaveManager.INSTANCE.saveModel(((EObject)modelRoot).eResource(), getSaveOptions(), false, monitor);
- }
- }
- }
-
- public Saveable[] getActiveSaveables() {
- return getSaveables();
- }
-
- public Saveable[] getSaveables() {
- Set<Saveable> saveables = new HashSet<Saveable>();
- if(modelSaveablesProvider != null) {
- Saveable leftSaveable = modelSaveablesProvider.getSaveable(getModelRoots()[0].eResource());
- if(leftSaveable != null) {
- saveables.add(leftSaveable);
- }
- Saveable rightSaveable = modelSaveablesProvider.getSaveable(getModelRoots()[1].eResource());
- if(rightSaveable != null) {
- saveables.add(rightSaveable);
- }
- }
- return saveables.toArray(new Saveable[saveables.size()]);
-
- }
-
- public TransactionalEditingDomain getEditingDomain() {
- return editingDomain;
- }
-
- public TransactionalEditingDomain setEditingDomain(TransactionalEditingDomain editingDomain) {
- return this.editingDomain = editingDomain;
- }
-
- @Override
- protected void finalize() throws Throwable {
- if(modelSaveablesProvider != null) {
- modelSaveablesProvider.dispose();
- modelSaveablesProvider = null;
- }
- if(editingDomain != null) {
- editingDomain.dispose();
- }
- super.finalize();
- }
-
- //TODO
- @Override
- public void setDirty(boolean dirty) {
- // TODO Auto-generated method stub
- super.setDirty(dirty);
- }
-
-
- //we override this method to provide the Papyrus Structural Viewer
- /**
- * {@inheritDoc}
- *
- * @see CompareEditorInput#createOutlineContents(Composite, int)
- */
- @Override
- public Control createOutlineContents(Composite parent, int direction) {
-
-
- final Splitter splitter = new Splitter(parent, direction);
-
- final CompareViewerPane pane = new CompareViewerPane(splitter, SWT.NONE);
- IViewerCreator creator = new UMLStructureMergeViewerCreator();
- //structureMergeViewer = new ModelStructureMergeViewer(pane, getCompareConfiguration());
- structureMergeViewer = (ModelStructureMergeViewer)creator.createViewer(pane, getCompareConfiguration());
- pane.setContent(structureMergeViewer.getTree());
-
- structureMergeViewer.setInput(preparedInput);
-
- return splitter;
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/EcorePlatformUtil.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/EcorePlatformUtil.java
deleted file mode 100644
index 67c1d923fb3..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/EcorePlatformUtil.java
+++ /dev/null
@@ -1,1982 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2008-2011 See4sys, itemis and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * See4sys - Initial API and implementation
- * itemis - [346715] IMetaModelDescriptor methods of MetaModelDescriptorRegistry taking EObject or Resource arguments should not start new EMF transactions
- *
- * </copyright>
- */
-package org.eclipse.papyrus.emf.compare.transactional.editor.sphinx;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.MultiRule;
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.provider.IWrapperItemProvider;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.emf.workspace.AbstractEMFOperation;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.sphinx.emf.Activator;
-import org.eclipse.sphinx.emf.edit.TransientItemProvider;
-import org.eclipse.sphinx.emf.internal.messages.Messages;
-import org.eclipse.sphinx.emf.metamodel.IMetaModelDescriptor;
-import org.eclipse.sphinx.emf.model.IModelDescriptor;
-import org.eclipse.sphinx.emf.model.ModelDescriptorRegistry;
-import org.eclipse.sphinx.emf.resource.ModelResourceDescriptor;
-import org.eclipse.sphinx.emf.saving.SaveIndicatorUtil;
-import org.eclipse.sphinx.emf.scoping.IResourceScope;
-import org.eclipse.sphinx.platform.util.ExtendedPlatform;
-import org.eclipse.sphinx.platform.util.PlatformLogUtil;
-import org.eclipse.sphinx.platform.util.ReflectUtil;
-import org.eclipse.sphinx.platform.util.StatusUtil;
-import org.xml.sax.SAXException;
-
-/**
- * Eclipse platform utility class.
- * <p>
- * Provides a set of methods allowing to handle resources, to load or save models, to retrieve a file from a resource
- * (and vice-versa), etc.
- */
-public final class EcorePlatformUtil {
-
- // Prevent from instantiation
- private EcorePlatformUtil() {
- }
-
- /**
- * Converts given {@link IPath path} into a workspace-relative platform resource {@link URI} if possible or an
- * absolute file {@link URI} otherwise. Returns given {@link IPath} as indeterminate (scheme-less) {@link URI} if
- * none of both is possible.
- *
- * @param path
- * The {@link IPath path} for which to create the {@link URI}; must not be <code>null</code>.
- * @return Workspace-relative platform resource {@link URI} or absolute file {@link URI} for given {@link IPath
- * path} or given {@link IPath} as indeterminate (scheme-less) {@link URI} otherwise.
- */
- public static URI createURI(IPath path) {
- Assert.isNotNull(path);
-
- URI uri = URI.createURI(path.toString(), true);
- URI convertedURI = EcoreResourceUtil.convertToPlatformResourceURI(uri);
- if (!convertedURI.isPlatformResource()) {
- convertedURI = EcoreResourceUtil.convertToAbsoluteFileURI(convertedURI);
- }
- return convertedURI;
- }
-
- public static IPath createPath(URI uri) {
- Assert.isNotNull(uri);
-
- if (uri.isPlatform()) {
- return new Path(uri.toPlatformString(true)).removeTrailingSeparator();
- } else if (uri.isFile()) {
- return new Path(uri.toFileString()).removeTrailingSeparator();
- } else {
- return new Path(uri.toString()).removeTrailingSeparator();
- }
- }
-
- /**
- * Converts the given {@link IPath path} into an absolute file {@linkplain URI}.
- *
- * @param path
- * The {@link Path path} for which an {@linkplain URI} is to be created.
- * @return The absolute file {@linkplain URI} for the given {@link IPath path} or an {@link URI} corresponding to
- * given {@link IPath path} as is if no conversion is possible.
- */
- public static URI createAbsoluteFileURI(IPath path) {
- URI uri = createURI(path);
- return EcoreResourceUtil.convertToAbsoluteFileURI(uri);
- }
-
- /**
- * Converts the given {@link URI uri} into an absolute file location, <em>i.e.</em> into a {@linkplain IPath path}.
- *
- * @param uri
- * The file {@linkplain URI} for which an absolute file {@linkplain IPath location} must be created.
- * @return The absolute file {@linkplain IPath location} for the given file {@link URI uri}.
- */
- public static IPath createAbsoluteFileLocation(URI uri) {
- uri = EcoreResourceUtil.convertToAbsoluteFileURI(uri);
- String uriString;
- if (uri.isFile()) {
- uriString = uri.toFileString();
- } else {
- uriString = uri.toString();
- }
- return new Path(uriString).removeTrailingSeparator();
- }
-
- /**
- * Converts the given {@link IPath path} into an absolute file {@linkplain IPath location}.
- *
- * @param path
- * The file path for which an absolute file {@linkplain IPath location} must be created.
- * @return The absolute file {@linkplain IPath location} for the given file {@link IPath path}.
- */
- public static IPath convertToAbsoluteFileLocation(IPath path) {
- URI uri = createAbsoluteFileURI(path);
- String uriString;
- if (uri.isFile()) {
- uriString = uri.toFileString();
- } else {
- uriString = uri.toString();
- }
- return new Path(uriString).removeTrailingSeparator();
- }
-
- /**
- * Reads the model namespace (i.e. XML namespace) of given {@link IFile file}. Returns a meaningful result only if
- * the {@link IFile file} is an XML document.
- *
- * @param file
- * The {@link IFile file} to investigate.
- * @return The model namespace denoted in the specified {@link IFile file} or <code>null</code> if the file is
- * either a non-XML file or an XML file which is not well-formed or has no model namespace.
- */
- public static String readModelNamespace(IFile file) {
- if (file != null && file.isAccessible()) {
- URI uri = createURI(file.getFullPath());
- return EcoreResourceUtil.readModelNamespace(null, uri);
- }
- return null;
- }
-
- /**
- * Reads the target namespace of given {@link IFile file}. Returns a meaningful result only if given {@link IFile
- * file} is an XML document.
- *
- * @param file
- * The {@link IFile file} to investigate.
- * @return The target namespace denoted in given {@link IFile file} or <code>null</code> if the {@link IFile file}
- * is either a not an XML file or an XML file which is not well-formed or has no target namespace.
- */
- public static String readTargetNamespace(IFile file) {
- return readTargetNamespace(file, (String[]) null);
- }
-
- /**
- * @param file
- * @param targetNamespaceExcludePatterns
- * @return
- */
- public static String readTargetNamespace(IFile file, String... targetNamespaceExcludePatterns) {
- if (file != null && file.isAccessible()) {
- URI uri = createURI(file.getFullPath());
- return EcoreResourceUtil.readTargetNamespace(null, uri, targetNamespaceExcludePatterns);
- }
- return null;
- }
-
- /**
- * Retrieves the XML comments located above the root element in given {@link IFile file}. Returns a meaningful
- * result only if given {@link IFile file} is an XML document.
- *
- * @param file
- * The {@link IFile file} to investigate.
- * @return Collection of strings representing the retrieved XML comments or empty collection if no such could be
- * found.
- */
- public static Collection<String> readRootElementComments(IFile file) {
- if (file != null && file.isAccessible()) {
- URI uri = createURI(file.getFullPath());
- return EcoreResourceUtil.readRootElementComments(null, uri);
- }
- return Collections.emptyList();
- }
-
- /**
- * Retrieves the {@link EObject root object} of the model contained in given {@link IFile file}. Returns
- * <code>null</code> if the {@link IFile file} has not been loaded yet.
- *
- * @param file
- * The {@link IFile file} containing the model.
- * @return The {@link EObject root object} of the model in given {@link IFile file} or <tt>null</tt> if the
- * {@link IFile file} has not been loaded yet or is empty.
- * @see #getModelRoot(TransactionalEditingDomain, IFile)
- */
- public static EObject getModelRoot(IFile file) {
- TransactionalEditingDomain editingDomain = WorkspaceEditingDomainUtil.getEditingDomain(file);
- if (editingDomain != null) {
- return getModelRoot(editingDomain, file);
- }
- return null;
- }
-
- /**
- * Retrieves the {@link EObject root object} of the model contained in given {@link IFile file} using given
- * {@link TransactionalEditingDomain editing domain}. Returns <tt>null</tt> if the {@link IFile file} has not been
- * loaded into the {@link TransactionalEditingDomain editing domain}'s {@link ResourceSet resource set} yet or is
- * empty.
- *
- * @param editingDomain
- * The {@linkplain TransactionalEditingDomain editing domain} the specified {@link IFile file} belongs
- * to; must not be <code>null</code>.
- * @param file
- * The {@linkplain IFile file} containing the model; must not be <code>null</code>.
- * @return The {@linkplain EObject root object} of the model in given {@link IFile file} or <tt>null</tt> if that
- * {@linkplain IFile file} has not been loaded into the specified {@linkplain TransactionalEditingDomain
- * editing domain}'s {@linkplain ResourceSet resource set} yet.
- */
- public static EObject getModelRoot(final TransactionalEditingDomain editingDomain, final IFile file) {
- if (editingDomain != null && file != null) {
- try {
- return TransactionUtil.runExclusive(editingDomain, new RunnableWithResult.Impl<EObject>() {
- public void run() {
- URI uri = createURI(file.getFullPath());
- setResult(EcoreResourceUtil.getModelRoot(editingDomain.getResourceSet(), uri));
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- return null;
- }
-
- /**
- * Loads the model contained in given {@link IFile file} using {@link EcoreResourceUtil#getDefaultLoadOptions()
- * default load options} and returns its {@link EObject root object}. Returns <tt>null</tt> if the {@link IFile
- * file} is empty.
- * <p>
- * Note: Calling this method involves retrieving the {@link TransactionalEditingDomain editing domain} behind the
- * given file. In case that the {@link IFile file} has not been loaded yet this is done by analyzing the its content
- * type. However, if it happens that the {@link IFile file}'s content type is retrieved for the very first time this
- * operation is somewhat costly in terms of runtime performance. Therefore, when the
- * {@link TransactionalEditingDomain editing domain} is already available prior to calling this method it is
- * recommended to use {@link #loadModelRoot(TransactionalEditingDomain, IFile)} instead.
- *
- * @param file
- * The {@link IFile file} containing the model.
- * @return The {@link EObject root object} of the model in given {@link IFile file} or <tt>null</tt> if the
- * {@link IFile file} is empty.
- * @see EcoreResourceUtil#getDefaultLoadOptions()
- * @see #loadModelRoot(TransactionalEditingDomain, IFile)
- */
- public static EObject loadModelRoot(IFile file) {
- return loadModelRoot(file, EcoreResourceUtil.getDefaultLoadOptions());
- }
-
- /**
- * Loads the model contained in given {@link IFile file} using given load options and returns its {@link EObject
- * root object}. Returns <tt>null</tt> if the {@link IFile file} is empty.
- * <p>
- * Note: Calling this method involves retrieving the {@link TransactionalEditingDomain editing domain} behind the
- * given file. In case that the {@link IFile file} has not been loaded yet this is done by analyzing the its content
- * type. However, if it happens that the {@link IFile file}'s content type is retrieved for the very first time this
- * operation is somewhat costly in terms of runtime performance. Therefore, when the
- * {@link TransactionalEditingDomain editing domain} is already available prior to calling this method it is
- * recommended to use {@link #loadModelRoot(TransactionalEditingDomain, IFile, Map)} instead.
- *
- * @param file
- * The {@link IFile file} containing the model.
- * @param options
- * The options to be used for loading the model.
- * @return The {@link EObject root object} of the model in given {@link IFile file} or <tt>null</tt> if the
- * {@link IFile file} is empty.
- * @see #loadModelRoot(TransactionalEditingDomain, IFile, Map)
- */
- public static EObject loadModelRoot(IFile file, Map<?, ?> options) {
- TransactionalEditingDomain editingDomain = WorkspaceEditingDomainUtil.getEditingDomain(file);
- if (editingDomain != null) {
- return loadModelRoot(editingDomain, file, options);
- }
- return null;
- }
-
- /**
- * Loads the model contained in given {@link IFile file} into given {@link TransactionalEditingDomain editing
- * domain} using {@link EcoreResourceUtil#getDefaultLoadOptions() default load options} and returns its
- * {@link EObject root object}. Returns <tt>null</tt> if the {@link IFile file} is empty.
- *
- * @param file
- * The {@link IFile file} containing the model.
- * @param editingDomain
- * The {@link TransactionalEditingDomain editing domain} the {@link IFile file} belongs to.
- * @param options
- * The options to be used for loading the model.
- * @return The {@link EObject root object} of the model in given {@link IFile file} or <tt>null</tt> if the
- * {@link IFile file} is empty.
- * @see EcoreResourceUtil#getDefaultLoadOptions()
- */
- public static EObject loadModelRoot(TransactionalEditingDomain editingDomain, IFile file) {
- return loadModelRoot(editingDomain, file, EcoreResourceUtil.getDefaultLoadOptions());
- }
-
- /**
- * Loads the model contained in given {@link IFile file} into given {@link TransactionalEditingDomain editing
- * domain} using given load options and returns its {@link EObject root object}. Returns <tt>null</tt> if the
- * {@link IFile file} is empty.
- *
- * @param file
- * The {@link IFile file} containing the model; must not be <code>null</code>.
- * @param editingDomain
- * The {@link TransactionalEditingDomain editing domain} the {@link IFile file} belongs to; must not be
- * <code>null</code>.
- * @param options
- * The options to be used for loading the model.
- * @return The {@link EObject root object} of the model in given {@link IFile file} or <tt>null</tt> if the
- * {@link IFile file} is empty.
- */
- public static EObject loadModelRoot(final TransactionalEditingDomain editingDomain, final IFile file, final Map<?, ?> options) {
- if (editingDomain != null && file != null) {
- try {
- return TransactionUtil.runExclusive(editingDomain, new RunnableWithResult.Impl<EObject>() {
- public void run() {
- URI uri = createURI(file.getFullPath());
- setResult(EcoreResourceUtil.loadModelRoot(editingDomain.getResourceSet(), uri, options));
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- return null;
- }
-
- /**
- * Tests if the given {@link Resource resource} is loaded in the {@link ResourceSet resource set} of given
- * {@link TransactionalEditingDomain editingDomain}.
- *
- * @param editingDomain
- * The {@link TransactionalEditingDomain editing domain} with the {@link ResourceSet resource set} to be
- * investigated.
- * @param resource
- * The {@link Resource resource} that may or not be loaded.
- * @return <code>true</code> if specified {@link Resource resource} is loaded in {@link ResourceSet resource set} of
- * given {@link TransactionalEditingDomain editingDomain}; <code>false</code> otherwise.
- */
- public static boolean isResourceLoaded(final TransactionalEditingDomain editingDomain, final Resource resource) {
- if (editingDomain != null && resource != null) {
- try {
- return TransactionUtil.runExclusive(editingDomain, new RunnableWithResult.Impl<Boolean>() {
- public void run() {
- setResult(EcoreResourceUtil.isResourceLoaded(editingDomain.getResourceSet(), resource.getURI()));
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- return false;
- }
-
- /**
- * Tests if the given {@link IFile file} is loaded in the {@link ResourceSet resource set} of some
- * {@link TransactionalEditingDomain editingDomain}.
- *
- * @param file
- * The {@link IFile file} that may or not be loaded.
- * @return <code>true</code> if specified {@link IFile file} is loaded in {@link ResourceSet resource set} of some
- * {@link TransactionalEditingDomain editingDomain}; <code>false</code> otherwise.
- */
- public static boolean isFileLoaded(IFile file) {
- return WorkspaceEditingDomainUtil.getCurrentEditingDomain(file) != null;
- }
-
- /**
- * Tests if the given {@link IFile file} is loaded in the {@link ResourceSet resource set} of the given
- * {@link TransactionalEditingDomain editingDomain}.
- *
- * @param editingDomain
- * The {@link TransactionalEditingDomain editing domain} with the {@link ResourceSet resource set} to be
- * investigated.
- * @param file
- * The {@link IFile file} that may or not be loaded.
- * @return <code>true</code> if specified {@link IFile file} is loaded in {@link ResourceSet resource set} of given
- * {@link TransactionalEditingDomain editingDomain}; <code>false</code> otherwise.
- */
- public static boolean isFileLoaded(final TransactionalEditingDomain editingDomain, final IFile file) {
- if (editingDomain != null && file != null) {
- try {
- return TransactionUtil.runExclusive(editingDomain, new RunnableWithResult.Impl<Boolean>() {
- public void run() {
- URI uri = createURI(file.getFullPath());
- setResult(EcoreResourceUtil.isResourceLoaded(editingDomain.getResourceSet(), uri));
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- return false;
- }
-
- /**
- * Returns the {@linkplain IFile file} corresponding to the specified {@linkplain Object object}.
- * <p>
- * The supported object types are:
- * <ul>
- * <li>{@linkplain org.eclipse.core.resources.IFile}</li>
- * <li>{@linkplain org.eclipse.emf.common.util.URI}</li>
- * <li>{@linkplain org.eclipse.emf.ecore.resource.Resource}</li>
- * <li>{@linkplain org.eclipse.emf.ecore.EObject}</li>
- * <li>{@linkplain org.eclipse.emf.edit.provider.IWrapperItemProvider}</li>
- * <li>{@linkplain org.eclipse.emf.ecore.util.FeatureMap.Entry}</li>
- * </ul>
- *
- * @param object
- * The object from which a file must be returned.
- * @return The underlying file from the given object.
- */
- public static IFile getFile(Object object) {
- if (object instanceof IFile) {
- return (IFile) object;
- } else if (object instanceof URI) {
- return getFile((URI) object);
- } else if (object instanceof Resource) {
- return getFile((Resource) object);
- } else if (object instanceof EObject) {
- return getFile((EObject) object);
- } else if (object instanceof IWrapperItemProvider) {
- return getFile((IWrapperItemProvider) object);
- } else if (object instanceof FeatureMap.Entry) {
- return getFile((FeatureMap.Entry) object);
- } else if (object instanceof TransientItemProvider) {
- return getFile((TransientItemProvider) object);
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain IFile file} corresponding to the given {@linkplain org.eclipse.emf.common.util.URI}.
- *
- * @param uri
- * The {@linkplain URI} of the file to return.
- * @return The file corresponding to the specified {@link URI uri}.
- */
- public static IFile getFile(URI uri) {
- if (uri != null && Platform.isRunning()) {
- try {
- return (IFile) ReflectUtil.invokeInvisibleMethod(WorkspaceSynchronizer.class, "getFile", new Object[] { uri, //$NON-NLS-1$
- EcoreResourceUtil.getURIConverter(), false });
- } catch (Exception ex) {
- // Ignore exception
- }
- }
- return null;
- }
-
- /**
- * Retrieves the {@link IFile file} corresponding to the given <code>resource</code>.
- *
- * @param resource
- * The {@link Resource resource} for which the file is to be returned.
- * @return The file corresponding to the specified <code>resource</code>.
- */
- public static IFile getFile(final Resource resource) {
- if (resource != null && Platform.isRunning()) {
- return WorkspaceSynchronizer.getFile(resource);
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain IFile file} owning to the given {@linkplain org.eclipse.emf.ecore.EObject}.
- *
- * @param eObject
- * The {@linkplain EObject} whose file must be returned.
- * @return The file containing the specified {@link EObject eObject}.
- */
- public static IFile getFile(final EObject eObject) {
- if (eObject != null) {
- return getFile(eObject.eResource());
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain IFile file} owning the given
- * {@linkplain org.eclipse.emf.edit.provider.IWrapperItemProvider}.
- * <p>
- * First retrieves the owner of the {@link IWrapperItemProvider provider}; then, if owner is an {@linkplain EObject}
- * delegates to {@linkplain #getFile(EObject)} else delegates to {@linkplain #getFile(Object)}.
- *
- * @param provider
- * The {@linkplain IWrapperItemProvider} whose file must be returned.
- * @return The file containing the specified {@link IWrapperItemProvider provider}; <code>null</code> if that
- * provider is <code>null</code>.
- */
- public static IFile getFile(final IWrapperItemProvider provider) {
- if (provider != null) {
- Object owner = provider.getOwner();
- if (owner instanceof EObject) {
- return getFile((EObject) owner);
- } else {
- Object unwrapped = AdapterFactoryEditingDomain.unwrap(provider);
- return getFile(unwrapped);
- }
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain IFile file} matching the given {@link FeatureMap.Entry entry}.
- * <p>
- * First unwraps the {@link FeatureMap.Entry entry}; then, delegates to {@linkplain #getFile(Object)}.
- *
- * @param entry
- * The {@linkplain FeatureMap.Entry} whose underlying file must be returned.
- * @return The file under the specified {@link FeatureMap.Entry entry}.
- */
- public static IFile getFile(FeatureMap.Entry entry) {
- Object unwrapped = AdapterFactoryEditingDomain.unwrap(entry);
- return getFile(unwrapped);
- }
-
- /**
- * Retrieves the {@linkplain IFile file} owning the given {@linkplain TransientItemProvider}.
- * <p>
- * First retrieves the owner of the {@link TransientItemProvider provider}; then, if owner is an
- * {@linkplain EObject} delegates to {@linkplain #getFile(EObject)} else delegates to {@linkplain #getFile(Object)}.
- *
- * @param provider
- * The {@linkplain TransientItemProvider} whose file must be returned.
- * @return The file containing the specified {@link TransientItemProvider provider}; <code>null</code> if that
- * provider is <code>null</code>.
- */
- public static IFile getFile(final TransientItemProvider provider) {
- if (provider != null) {
- Object target = provider.getTarget();
- if (target instanceof EObject) {
- return getFile((EObject) target);
- }
- }
- return null;
- }
-
- /**
- * Returns the {@linkplain Resource resource} corresponding to the specified {@linkplain Object object}.
- * <p>
- * The supported object types are:
- * <ul>
- * <li>{@linkplain org.eclipse.core.resources.IFile}</li>
- * <li>{@linkplain org.eclipse.emf.common.util.URI}</li>
- * <li>{@linkplain org.eclipse.emf.ecore.resource.Resource}</li>
- * <li>{@linkplain org.eclipse.emf.ecore.EObject}</li>
- * <li>{@linkplain org.eclipse.emf.ecore.util.FeatureMap.Entry}</li>
- * <li>{@linkplain org.eclipse.emf.edit.provider.IWrapperItemProvider}</li>
- * </ul>
- * <p>
- * If the type of the specified object does not belongs to that list of supported types, <code>null</code> is
- * returned.
- *
- * @param object
- * The object from which a resource must be returned.
- * @return The underlying resource from the given object.
- */
- public static Resource getResource(Object object) {
- if (object instanceof IFile) {
- return getResource((IFile) object);
- } else if (object instanceof URI) {
- return getResource((URI) object);
- } else if (object instanceof Resource) {
- return (Resource) object;
- } else if (object instanceof EObject) {
- return getResource((EObject) object);
- } else if (object instanceof IWrapperItemProvider) {
- return getResource((IWrapperItemProvider) object);
- } else if (object instanceof FeatureMap.Entry) {
- return getResource((FeatureMap.Entry) object);
- } else if (object instanceof TransientItemProvider) {
- return getResource((TransientItemProvider) object);
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} corresponding to the given {@link IFile file}.
- *
- * @param file
- * The {@linkplain IFile file} whose {@link Resource resource} is to be returned.
- * @return The resource corresponding to the specified {@link IFile file}.
- */
- public static Resource getResource(final IFile file) {
- final TransactionalEditingDomain editingDomain = WorkspaceEditingDomainUtil.getCurrentEditingDomain(file);
- if (editingDomain != null) {
- try {
- return TransactionUtil.runExclusive(editingDomain, new RunnableWithResult.Impl<Resource>() {
- public void run() {
- URI uri = createURI(file.getFullPath());
- setResult(editingDomain.getResourceSet().getResource(uri, false));
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- return null;
- }
-
- /**
- * Returns the {@linkplain Resource resource} corresponding to the specified {@link URI uri}.
- *
- * @param uri
- * The {@linkplain URI} of the resource to return.
- * @return The resource corresponding to the specified {@link URI uri}.
- */
- public static Resource getResource(final URI uri) {
- IFile file = getFile(uri);
- final TransactionalEditingDomain editingDomain = WorkspaceEditingDomainUtil.getCurrentEditingDomain(file);
- if (editingDomain != null) {
- try {
- return TransactionUtil.runExclusive(editingDomain, new RunnableWithResult.Impl<Resource>() {
- public void run() {
- setResult(editingDomain.getResourceSet().getResource(uri.trimFragment(), false));
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} corresponding to the given {@link EObject object}.
- *
- * @param eObject
- * The {@linkplain EObject object} whose {@link Resource resource} is to be returned.
- * @return The resource corresponding to the specified {@link EObject object}.
- */
- public static Resource getResource(final EObject eObject) {
- return EcoreResourceUtil.getResource(eObject);
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} owning the given {@link IWrapperItemProvider provider}.
- * <p>
- * First retrieves the owner of the {@link IWrapperItemProvider provider}; then, if owner is an {@linkplain EObject}
- * returns its resource, else delegates to {@linkplain #getResource(Object)}.
- *
- * @param provider
- * The {@linkplain IWrapperItemProvider} whose resource must be returned.
- * @return The resource containing the specified {@link IWrapperItemProvider provider}; <code>null</code> if that
- * provider is <code>null</code>.
- */
- public static Resource getResource(final IWrapperItemProvider provider) {
- return EcoreResourceUtil.getResource(provider);
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} matching the given {@link FeatureMap.Entry entry}.
- * <p>
- * First unwraps the {@link FeatureMap.Entry entry}; then, delegates to {@linkplain #getResource(Object)}.
- *
- * @param entry
- * The {@linkplain FeatureMap.Entry} whose underlying resource must be returned.
- * @return The resource under the specified {@link FeatureMap.Entry entry}.
- */
- public static Resource getResource(FeatureMap.Entry entry) {
- return EcoreResourceUtil.getResource(entry);
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} owning the given {@link TransientItemProvider provider}.
- * <p>
- * First retrieves the owner of the {@link TransientItemProvider provider}; then, if owner is an
- * {@linkplain EObject} returns its resource.
- *
- * @param provider
- * The {@linkplain TransientItemProvider} whose resource must be returned.
- * @return The resource containing the specified {@link TransientItemProvider provider}; <code>null</code> if that
- * provider is <code>null</code>.
- */
- public static Resource getResource(final TransientItemProvider provider) {
- return EcoreResourceUtil.getResource(provider);
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} of the contextObject.
- *
- * @param contextObject
- * The Object used to research resources in the model.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context object's
- * {@link IModelDescriptor model descriptor} must be considered for the research.
- * @return The resources in the context object's model.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModel(Object contextObject, boolean includeReferencedModels) {
- if (contextObject instanceof IModelDescriptor) {
- return getResourcesInModel((IModelDescriptor) contextObject, includeReferencedModels);
- } else if (contextObject instanceof IFile) {
- return getResourcesInModel((IFile) contextObject, includeReferencedModels);
- } else if (contextObject instanceof URI) {
- return getResourcesInModel((URI) contextObject, includeReferencedModels);
- } else if (contextObject instanceof Resource) {
- return getResourcesInModel((Resource) contextObject, includeReferencedModels);
- } else if (contextObject instanceof EObject) {
- return getResourcesInModel((EObject) contextObject, includeReferencedModels);
- } else if (contextObject instanceof IWrapperItemProvider) {
- return getResourcesInModel((IWrapperItemProvider) contextObject, includeReferencedModels);
- } else if (contextObject instanceof FeatureMap.Entry) {
- return getResourcesInModel((FeatureMap.Entry) contextObject, includeReferencedModels);
- } else if (contextObject instanceof TransientItemProvider) {
- return getResourcesInModel((TransientItemProvider) contextObject, includeReferencedModels);
- }
- return Collections.emptyList();
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} provided in argument .
- *
- * @param modelDescriptor
- * The {@link IModelDescriptor model descriptor} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context
- * {@link IModelDescriptor model descriptor} must be considered for the research.
- * @return The {@link Resource resource}s owned by the {@link IModelDescriptor model descriptor}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModel(IModelDescriptor modelDescriptor, boolean includeReferencedModels) {
- if (modelDescriptor != null) {
- return modelDescriptor.getLoadedResources(includeReferencedModels);
- }
- return Collections.emptySet();
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} of the context {@link IFile file}.
- * If the given {@link IFile file} doesn't belong to any {@link IModelDescriptor model descriptor}, resources in
- * context{@link ResourceSet} will be returned
- *
- * @param contextFile
- * The {@link IFile file} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context {@link IFile
- * file}'s {@link IModelDescriptor model descriptor} must be considered for the research.
- * @return The resources in the context {@link IFile file}'s model.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModel(IFile contextFile, boolean includeReferencedModels) {
- IModelDescriptor modelDescriptor = ModelDescriptorRegistry.INSTANCE.getModel(contextFile);
- if (modelDescriptor != null) {
- return modelDescriptor.getLoadedResources(includeReferencedModels);
- }
- return getResourcesInContext(contextFile);
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} of the context {@link URI uri}.
- *
- * @param contextURI
- * The {@link URI uri} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context {@link URI uri}
- * 's {@link IModelDescriptor model descriptor} must be considered for the research.
- * @return The resources in the context {@link URI uri}'s model.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModel(URI contextURI, boolean includeReferencedModels) {
- Resource contextResource = getResource(contextURI);
- return getResourcesInModel(contextResource, includeReferencedModels);
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} of the context {@link Resource
- * resource}.If the given {@link Resource contextResource} doesn't belong to any {@link IModelDescriptor model
- * descriptor}, resources in context{@link ResourceSet} will be returned
- *
- * @param contextResource
- * The {@link Resource resource} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context
- * {@link Resource resource} 's {@link IModelDescriptor model descriptor} must be considered for the
- * research.
- * @return The resources in the context {@link Resource resource}'s model.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModel(Resource contextResource, boolean includeReferencedModels) {
- IModelDescriptor modelDescriptor = ModelDescriptorRegistry.INSTANCE.getModel(contextResource);
- if (modelDescriptor != null) {
- return modelDescriptor.getLoadedResources(includeReferencedModels);
- }
- return getResourcesInContext(contextResource);
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} of the context {@link EObject
- * eobject}.
- *
- * @param contextEObject
- * The {@link EObject eobject} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context {@link EObject
- * eobject}'s {@link IModelDescriptor model descriptor} must be considered for the research.
- * @return The resources in the context {@link EObject eobject}'s model.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModel(EObject contextEObject, boolean includeReferencedModels) {
- Resource contextResource = contextEObject.eResource();
- return getResourcesInModel(contextResource, includeReferencedModels);
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} of the context
- * {@link IWrapperItemProvider provider}.
- *
- * @param contextProvider
- * The {@link IWrapperItemProvider provider} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context
- * {@link IWrapperItemProvider provider}'s {@link IModelDescriptor model descriptor} must be considered
- * for the research.
- * @return The resources in the context {@link IWrapperItemProvider provider}'s model.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModel(IWrapperItemProvider contextProvider, boolean includeReferencedModels) {
- Resource contextResource = getResource(contextProvider);
- return getResourcesInModel(contextResource, includeReferencedModels);
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} of the context
- * {@link FeatureMap.Entry feature map entry}.
- *
- * @param contextEntry
- * The {@link FeatureMap.Entry feature map entry} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context
- * {@link FeatureMap.Entry feature map entry}'s {@link IModelDescriptor model descriptor} must be
- * considered for the research.
- * @return The resources in the context {@link FeatureMap.Entry feature map entry}'s model.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModel(FeatureMap.Entry contextEntry, boolean includeReferencedModels) {
- Resource contextResource = getResource(contextEntry);
- return getResourcesInModel(contextResource, includeReferencedModels);
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model descriptor} of the context
- * {@link TransientItemProvider provider}.
- *
- * @param contextProvider
- * The {@link TransientItemProvider provider} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context
- * {@link TransientItemProvider provider}'s {@link IModelDescriptor model descriptor} must be considered
- * for the research.
- * @return The resources in the context {@link TransientItemProvider provider}'s model.
- * @since 2.1
- */
- public static Collection<Resource> getResourcesInModel(TransientItemProvider contextProvider, boolean includeReferencedModels) {
- Resource contextResource = getResource(contextProvider);
- return getResourcesInModel(contextResource, includeReferencedModels);
- }
-
- /**
- * Returns all resources owned by the {@link IModelDescriptor model}s of given {@link IMetaModelDescriptor
- * metamodel} in the context {@link IContainer container}.
- *
- * @param contextContainer
- * The {@link IContainer container} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IModelDescriptor model descriptors} referenced by the context
- * {@link IContainer container}'s {@link IModelDescriptor model descriptor} must be considered for the
- * research.
- * @return The resources in the context {@link IContainer container}'s models.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInModels(IContainer contextContainer, IMetaModelDescriptor mmDescriptor,
- boolean includeReferencedModels) {
- Collection<Resource> resourcesInModels = new HashSet<Resource>();
- Collection<IModelDescriptor> modelDescriptors = ModelDescriptorRegistry.INSTANCE.getModels(contextContainer, mmDescriptor);
- for (IModelDescriptor modelDescriptor : modelDescriptors) {
- resourcesInModels.addAll(modelDescriptor.getLoadedResources(includeReferencedModels));
- }
- return resourcesInModels;
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the contextObject.
- *
- * @param contextObject
- * The Object used to research resources in the model.
- * @param includeReferencedScopes
- * Determines if the {@link IResourceScope model resource scope} referenced by the context object's
- * {@link IResourceScope model resource scope} must be considered for the research.
- * @return The resources in the context object's {@link IResourceScope model resource scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScope(Object contextObject, boolean includeReferencedScopes) {
- if (contextObject instanceof IModelDescriptor) {
- return getResourcesInScope((IModelDescriptor) contextObject, includeReferencedScopes);
- } else if (contextObject instanceof IFile) {
- return getResourcesInScope((IFile) contextObject, includeReferencedScopes);
- } else if (contextObject instanceof URI) {
- return getResourcesInScope((URI) contextObject, includeReferencedScopes);
- } else if (contextObject instanceof Resource) {
- return getResourcesInScope((Resource) contextObject, includeReferencedScopes);
- } else if (contextObject instanceof EObject) {
- return getResourcesInScope((EObject) contextObject, includeReferencedScopes);
- } else if (contextObject instanceof IWrapperItemProvider) {
- return getResourcesInScope((IWrapperItemProvider) contextObject, includeReferencedScopes);
- } else if (contextObject instanceof FeatureMap.Entry) {
- return getResourcesInScope((FeatureMap.Entry) contextObject, includeReferencedScopes);
- } else if (contextObject instanceof TransientItemProvider) {
- return getResourcesInScope((TransientItemProvider) contextObject, includeReferencedScopes);
- }
- return Collections.emptyList();
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the {@link IModelDescriptor
- * model descriptor} provided in argument .
- *
- * @param modelDescriptor
- * The {@link IModelDescriptor model descriptor} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context
- * {@link IResourceScope model resource scope} must be considered for the research.
- * @return The {@link Resource resource}s owned by the {@link IResourceScope model resource scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScope(IModelDescriptor modelDescriptor, boolean includeReferencedScopes) {
- if (modelDescriptor != null) {
- TransactionalEditingDomain editingDomain = modelDescriptor.getEditingDomain();
- return modelDescriptor.getScope().getLoadedResources(editingDomain, includeReferencedScopes);
- }
- return Collections.emptySet();
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the {@link IModelDescriptor
- * model descriptor} of the context {@link IFile file}. If the given {@link IFile file} does not belong to any
- * {@link IModelDescriptor model descriptor}, resources in context {@link ResourceSet} will be returned.
- *
- * @param contextFile
- * The {@link IFile file} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context {@link IFile
- * file}'s {@link IResourceScope model resource scope} must be considered for the research.
- * @return The resources in the context {@link IFile file}'s {@link IResourceScope model resource scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScope(IFile contextFile, boolean includeReferencedScopes) {
- IModelDescriptor modelDescriptor = ModelDescriptorRegistry.INSTANCE.getModel(contextFile);
- if (modelDescriptor != null) {
- return getResourcesInScope(modelDescriptor, includeReferencedScopes);
- }
- return getResourcesInContext(contextFile);
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the {@link IModelDescriptor
- * model descriptor} of the context {@link URI uri}.
- *
- * @param contextURI
- * The {@link URI uri} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context {@link URI
- * uri}'s {@link IResourceScope model resource scope} must be considered for the research.
- * @return The resources in the context {@link URI uri}'s {@link IResourceScope model resource scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScope(URI contextURI, boolean includeReferencedScopes) {
- Resource contextResource = getResource(contextURI);
- return getResourcesInScope(contextResource, includeReferencedScopes);
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the {@link IModelDescriptor
- * model descriptor} of the context {@link Resource resource}.If the given {@link Resource contextResource} does not
- * belong to any {@link IModelDescriptor model descriptor}, resources in context {@link ResourceSet} will be
- * returned.
- *
- * @param contextResource
- * The {@link Resource resource} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context
- * {@link Resource resource}'s {@link IResourceScope model resource scope} must be considered for the
- * research.
- * @return The resources in the context {@link Resource resource}'s {@link IResourceScope model resource scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScope(Resource contextResource, boolean includeReferencedScopes) {
- IModelDescriptor modelDescriptor = ModelDescriptorRegistry.INSTANCE.getModel(contextResource);
- if (modelDescriptor != null) {
- return getResourcesInScope(modelDescriptor, includeReferencedScopes);
- }
- return getResourcesInContext(contextResource);
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the {@link IModelDescriptor
- * model descriptor} of the context {@link EObject eObject}.
- *
- * @param contextEObject
- * The {@link EObject eObject} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context
- * {@link EObject eObject}'s {@link IResourceScope model resource scope} must be considered for the
- * research.
- * @return The resources in the context {@link EObject eObject}'s {@link IResourceScope model resource scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScope(EObject contextEObject, boolean includeReferencedScopes) {
- Resource contextResource = contextEObject.eResource();
- return getResourcesInScope(contextResource, includeReferencedScopes);
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the {@link IModelDescriptor
- * model descriptor} of the context {@link IWrapperItemProvider provider}.
- *
- * @param contextProvider
- * The {@link IWrapperItemProvider provider} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context
- * {@link IWrapperItemProvider provider}'s {@link IResourceScope model resource scope} must be considered
- * for the research.
- * @return The resources in the context {@link IWrapperItemProvider provider}'s {@link IResourceScope model resource
- * scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScope(IWrapperItemProvider contextProvider, boolean includeReferencedScopes) {
- Resource contextResource = getResource(contextProvider);
- return getResourcesInScope(contextResource, includeReferencedScopes);
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the {@link IModelDescriptor
- * model descriptor} of the context {@link FeatureMap.Entry feature map entry}.
- *
- * @param contextEntry
- * The {@link FeatureMap.Entry feature map entry} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context
- * {@link FeatureMap.Entry feature map entry}'s {@link IResourceScope model resource scope} must be
- * considered for the research.
- * @return The resources in the context {@link FeatureMap.Entry feature map entry}'s {@link IResourceScope model
- * resource scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScope(FeatureMap.Entry contextEntry, boolean includeReferencedScopes) {
- Resource contextResource = getResource(contextEntry);
- return getResourcesInScope(contextResource, includeReferencedScopes);
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope} of the {@link IModelDescriptor
- * model descriptor} of the context {@link TransientItemProvider provider}.
- *
- * @param contextProvider
- * The {@link TransientItemProvider provider} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context
- * {@link TransientItemProvider provider}'s {@link IResourceScope model resource scope} must be
- * considered for the research.
- * @return The resources in the context {@link TransientItemProvider provider}'s {@link IResourceScope model
- * resource scope}.
- * @since 2.1
- */
- public static Collection<Resource> getResourcesInScope(TransientItemProvider contextProvider, boolean includeReferencedScopes) {
- Resource contextResource = getResource(contextProvider);
- return getResourcesInScope(contextResource, includeReferencedScopes);
- }
-
- /**
- * Returns all resources owned by the {@link IResourceScope model resource scope}s of the {@link IModelDescriptor
- * model descriptor}s of the context {@link IContainer container}.
- *
- * @param contextContainer
- * The {@link IContainer container} used as context object for investigation.
- * @param includeReferencedModels
- * Determines if the {@link IResourceScope model resource scopes} referenced by the context
- * {@link IContainer container}'s {@link IResourceScope model resource scope} must be considered for the
- * research.
- * @return The resources in the context {@link IContainer container}'s {@link IResourceScope model resource scope}.
- * @since 0.7.0
- */
- public static Collection<Resource> getResourcesInScopes(IContainer contextContainer, boolean includeReferencedScopes) {
- Collection<Resource> resourcesInScopes = new HashSet<Resource>();
- Collection<IModelDescriptor> modelDescriptors = ModelDescriptorRegistry.INSTANCE.getModels(contextContainer);
- for (IModelDescriptor modelDescriptor : modelDescriptors) {
- resourcesInScopes.addAll(getResourcesInScope(modelDescriptor, includeReferencedScopes));
- }
- return resourcesInScopes;
- }
-
- private static Collection<Resource> getResourcesInContext(Object contextObject) {
- Resource resource = EcoreResourceUtil.getResource(contextObject);
- if (resource != null) {
- ResourceSet resourceSet = resource.getResourceSet();
- if (resourceSet != null) {
- return resourceSet.getResources();
- }
- return Collections.singletonList(resource);
- }
- return Collections.emptySet();
- }
-
- public static ISchedulingRule createSaveNewSchedulingRule(Collection<ModelResourceDescriptor> modelResourceDescriptors) {
- if (modelResourceDescriptors != null) {
- Set<IPath> paths = new HashSet<IPath>();
- for (ModelResourceDescriptor descriptor : modelResourceDescriptors) {
- paths.add(descriptor.getPath());
- }
- return ExtendedPlatform.createSaveNewSchedulingRule(paths);
- }
- return null;
- }
-
- /**
- * Creates the {@linkplain ISchedulingRule scheduling rule} that is required for saving the specified
- * {@link Resource resource}.
- *
- * @param resource
- * The {@linkplain Resource resource} to be saved.
- * @return The {@linkplain ISchedulingRule scheduling rule} required for saving the given {@link Resource resource}.
- */
- public static ISchedulingRule createSaveSchedulingRule(Resource resource) {
- if (resource != null) {
- IFile modelFile = getFile(resource);
- return ExtendedPlatform.createSaveSchedulingRule(modelFile);
- }
- return null;
- }
-
- /**
- * Creates the {@linkplain ISchedulingRule scheduling rule} that are required for saving the specified
- * {@link Resource resource}s.
- *
- * @param resources
- * The {@linkplain Resource resource}s to be saved (for which scheduling rules must be created.
- * @return The scheduling {@linkplain MultiRule rule}s required for saving the given {@link Resource resources}.
- */
- public static ISchedulingRule createSaveSchedulingRule(Collection<Resource> resources) {
- if (resources != null) {
- /*
- * Performance optimization: Create a scheduling rule on a per resource basis only if number of resources is
- * reasonably low.
- */
- if (resources.size() < ExtendedPlatform.LIMIT_INDIVIDUAL_RESOURCES_SCHEDULING_RULE) {
- Set<ISchedulingRule> rules = new HashSet<ISchedulingRule>();
- for (Resource resource : resources) {
- ISchedulingRule schedulingRule = createSaveSchedulingRule(resource);
- if (schedulingRule != null) {
- rules.add(schedulingRule);
- }
- }
- return MultiRule.combine(rules.toArray(new ISchedulingRule[rules.size()]));
- } else {
- // Return workspace root as scheduling rule otherwise
- return ResourcesPlugin.getWorkspace().getRoot();
- }
- }
- return null;
- }
-
- private static ISchedulingRule createSaveSchedulingRule(Map<TransactionalEditingDomain, Collection<Resource>> resources) {
- if (resources != null) {
- Collection<Resource> allResources = new HashSet<Resource>();
- for (Collection<Resource> resourcesInEditingDomain : resources.values()) {
- allResources.addAll(resourcesInEditingDomain);
- }
- return createSaveSchedulingRule(allResources);
- }
- return null;
- }
-
- /**
- * Add a new model {@link Resource} to the provided {@link TransactionalEditingDomain} , created by using
- * {@link EObject} modelRoot as based for the containing model.
- *
- * @param editingDomain
- * The {@link TransactionalEditingDomain} where to add new resource.
- * @param path
- * The relative {@link IPath} of the new {@link Resource}.
- * @param contentTypeId
- * The contenType ID of the contained model.
- * @param modelRoot
- * The root element of the model to include in the new {@link Resource}.
- * @param async
- * Boolean parameter to determine if the execution must be synchronous or asynchronous.
- * @param monitor
- * The {@link IProgressMonitor}.
- */
- public static void addNewModelResource(TransactionalEditingDomain editingDomain, IPath path, final String contentTypeId, EObject modelRoot,
- boolean async, IProgressMonitor monitor) {
- addNewModelResources(editingDomain, Collections.singletonList(new ModelResourceDescriptor(modelRoot, path, contentTypeId)), async, monitor);
- }
-
- /**
- * * Add a new {@link Resource resource}s described by modelResourceDescriptors to the provided
- * {@link TransactionalEditingDomain editingDomain} .
- *
- * @param editingDomain
- * The {@link TransactionalEditingDomain} where to add new resource.
- * @param modelResourceDescriptors
- * The list of {@link ModelResourceDescriptor} describing new resources to add.
- * @param async
- * Boolean parameter to determine if the execution must be synchronous or asynchronous.
- * @param monitor
- * The {@link IProgressMonitor}.
- */
- public static void addNewModelResources(final TransactionalEditingDomain editingDomain,
- final Collection<ModelResourceDescriptor> modelResourceDescriptors, boolean async, final IProgressMonitor monitor) {
- if (modelResourceDescriptors != null && editingDomain != null && modelResourceDescriptors.size() > 0) {
- ISchedulingRule rule = createSaveNewSchedulingRule(modelResourceDescriptors);
- if (async) {
- Job job = new Job(modelResourceDescriptors.size() == 1 ? Messages.job_addingNewModelResource : Messages.job_addingNewModelResources) {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- runAddNewModelResources(editingDomain, modelResourceDescriptors, monitor);
- return Status.OK_STATUS;
- } catch (CoreException ex) {
- return ex.getStatus();
- }
- }
- };
- job.setRule(rule);
- job.setPriority(Job.BUILD);
- job.schedule();
- } else {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- runAddNewModelResources(editingDomain, modelResourceDescriptors, monitor);
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(runnable, rule, 0, monitor);
- } catch (CoreException ex) {
- PlatformLogUtil.logAsError(Activator.getDefault(), ex);
- }
- }
- }
-
- }
-
- private static void runAddNewModelResources(final TransactionalEditingDomain editingDomain,
- final Collection<ModelResourceDescriptor> modelResourceDescriptors, IProgressMonitor monitor) throws CoreException {
- Assert.isNotNull(editingDomain);
- Assert.isNotNull(modelResourceDescriptors);
- SubMonitor progress = SubMonitor.convert(monitor, modelResourceDescriptors.size() == 1 ? Messages.task_addingNewModelResource
- : Messages.task_addingNewModelResources, 1);
-
- Map<String, Object> transactionOptions = WorkspaceTransactionUtil.getDefaultSaveNewTransactionOptions();
- String label = modelResourceDescriptors.size() == 1 ? Messages.operation_addingNewModelResource : Messages.operation_addingNewModelResources;
- final IUndoableOperation operation = new AbstractEMFOperation(editingDomain, label, transactionOptions) {
- @Override
- protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- SubMonitor progress = SubMonitor.convert(monitor, modelResourceDescriptors.size());
- for (ModelResourceDescriptor descriptor : modelResourceDescriptors) {
- progress.subTask(NLS.bind(Messages.subtask_addingResource, descriptor.getPath().toString()));
-
- // Convert path to URI
- URI uri = URI.createPlatformResourceURI(descriptor.getPath().toString(), true);
-
- // add new resource
- EcoreResourceUtil.addNewModelResource(editingDomain.getResourceSet(), uri, descriptor.getContentTypeId(),
- descriptor.getModelRoot());
-
- progress.worked(1);
- }
- }
- };
-
- try {
- // Execute save operation as IWorkspaceRunnable on workspace in order to avoid resource change
- // notifications during transaction execution
- /*
- * !! Important Note !! Only set IWorkspace.AVOID_UPDATE flag but don't define any scheduling
- * restrictions for the save operation right here (this must only be done on outer workspace jobs or
- * workspace runnables from which this method is called). Otherwise it would be likely to end up in
- * deadlocks with operations which already have acquired exclusive access to the workspace but are
- * waiting for exclusive access to the model (i.e. for the transaction).
- */
- ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, monitor);
- return Status.OK_STATUS;
- } catch (CoreException ex) {
- return ex.getStatus();
- }
-
- }
-
- @Override
- public boolean canUndo() {
- // Avoid the save operation to appear in the undo menu
- return false;
- }
- };
- IOperationHistory history = WorkspaceTransactionUtil.getOperationHistory(editingDomain);
- try {
- history.execute(operation, progress.newChild(1), null);
- } catch (ExecutionException ex) {
- IStatus status = StatusUtil.createErrorStatus(Activator.getPlugin(), ex);
- throw new CoreException(status);
- }
- }
-
- public static void saveNewModelResource(TransactionalEditingDomain editingDomain, IPath path, final String contentTypeId, EObject modelRoot,
- boolean async, IProgressMonitor monitor) {
- saveNewModelResources(editingDomain, Collections.singletonList(new ModelResourceDescriptor(modelRoot, path, contentTypeId)),
- EcoreResourceUtil.getDefaultSaveOptions(), async, monitor);
- }
-
- public static void saveNewModelResources(TransactionalEditingDomain editingDomain, Collection<ModelResourceDescriptor> modelResourceDescriptors,
- boolean async, IProgressMonitor monitor) {
- saveNewModelResources(editingDomain, modelResourceDescriptors, EcoreResourceUtil.getDefaultSaveOptions(), async, monitor);
- }
-
- public static void saveNewModelResource(TransactionalEditingDomain editingDomain, IPath path, final String contentTypeId, EObject modelRoot,
- Map<?, ?> options, boolean async, IProgressMonitor monitor) {
- saveNewModelResources(editingDomain, Collections.singletonList(new ModelResourceDescriptor(modelRoot, path, contentTypeId)), options, async,
- monitor);
- }
-
- public static void saveNewModelResources(final TransactionalEditingDomain editingDomain,
- final Collection<ModelResourceDescriptor> modelResourceDescriptors, final Map<?, ?> options, boolean async, IProgressMonitor monitor) {
-
- if (modelResourceDescriptors != null && editingDomain != null && modelResourceDescriptors.size() > 0) {
- ISchedulingRule rule = createSaveNewSchedulingRule(modelResourceDescriptors);
- if (async) {
- Job job = new Job(modelResourceDescriptors.size() == 1 ? Messages.job_savingNewModelResource : Messages.job_savingNewModelResources) {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- runSaveNewModelResources(editingDomain, modelResourceDescriptors, options, monitor);
- return Status.OK_STATUS;
- } catch (CoreException ex) {
- return ex.getStatus();
- }
- }
- };
- job.setRule(rule);
- job.setPriority(Job.BUILD);
- job.schedule();
- } else {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- runSaveNewModelResources(editingDomain, modelResourceDescriptors, options, monitor);
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(runnable, rule, 0, monitor);
- } catch (CoreException ex) {
- PlatformLogUtil.logAsError(Activator.getDefault(), ex);
- }
- }
- }
- }
-
- /**
- * @param editingDomain
- * The {@link TransactionalEditingDomain editing domain} onto which a write-transaction must be created
- * in order to safely perform the saving; must not be <code>null</code>.
- * @param path
- * The {@link IPath path} of the new file to save; must not be <code>null</code>.
- * @param contentType
- * @param modelRoot
- * @param options
- * @param monitor
- */
- private static void runSaveNewModelResources(final TransactionalEditingDomain editingDomain,
- final Collection<ModelResourceDescriptor> modelResourceDescriptors, final Map<?, ?> options, IProgressMonitor monitor)
- throws CoreException {
- Assert.isNotNull(editingDomain);
- Assert.isNotNull(modelResourceDescriptors);
- SubMonitor progress = SubMonitor.convert(monitor, modelResourceDescriptors.size() == 1 ? Messages.task_savingNewModelResource
- : Messages.task_savingNewModelResources, 1);
-
- Map<String, Object> transactionOptions = WorkspaceTransactionUtil.getDefaultSaveNewTransactionOptions();
- String label = modelResourceDescriptors.size() == 1 ? Messages.operation_savingNewModelResource : Messages.operation_savingNewModelResources;
- final IUndoableOperation operation = new AbstractEMFOperation(editingDomain, label, transactionOptions) {
- @Override
- protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- SubMonitor progress = SubMonitor.convert(monitor, modelResourceDescriptors.size());
- for (ModelResourceDescriptor descriptor : modelResourceDescriptors) {
- progress.subTask(NLS.bind(Messages.subtask_savingResource, descriptor.getPath().toString()));
-
- // Convert path to URI
- URI uri = URI.createPlatformResourceURI(descriptor.getPath().toString(), true);
-
- try {
- // Save new resource
- /*
- * !! Important Note !! Resource must be saved before marking it as freshly saved
- * because otherwise the resource would loose its dirty state and consequently not be
- * saved at all.
- */
- EcoreResourceUtil.saveNewModelResource(editingDomain.getResourceSet(), uri, descriptor.getContentTypeId(),
- descriptor.getModelRoot(), options);
-
- // Mark resource as freshly saved in order to avoid that it gets automatically reloaded
- SaveIndicatorUtil.setSaved(editingDomain, descriptor.getModelRoot().eResource());
- } catch (Exception ex) {
- // Log exception in Error Log
- /*
- * !! Important Note !! The exception has already been recorded as error on the resource
- * and is principally subject to being converted to a problem marker later on (see
- * org.eclipse.sphinx.emf.util.EcoreResourceUtil.saveModelResource(Resource, Map<?,?>)
- * and org.eclipse.sphinx.emf.internal.resource.ResourceProblemHandler for details).
- * However, this is a new resource which had never saved before and does not yet exist
- * in the file system. As a consequence, there is no target to which the problem marker
- * could be attached and the problem behind this exception would remain unperceiveable
- * if we wouldn't log anything at this point.
- */
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
-
- progress.worked(1);
- }
- }
- };
-
- try {
- // Execute save operation as IWorkspaceRunnable on workspace in order to avoid resource change
- // notifications during transaction execution
- /*
- * !! Important Note !! Only set IWorkspace.AVOID_UPDATE flag but don't define any scheduling
- * restrictions for the save operation right here (this must only be done on outer workspace jobs or
- * workspace runnables from which this method is called). Otherwise it would be likely to end up in
- * deadlocks with operations which already have acquired exclusive access to the workspace but are
- * waiting for exclusive access to the model (i.e. for the transaction).
- */
- ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, monitor);
- return Status.OK_STATUS;
- } catch (CoreException ex) {
- return ex.getStatus();
- }
- }
-
- @Override
- public boolean canUndo() {
- // Avoid the save operation to appear in the undo menu
- return false;
- }
- };
- IOperationHistory history = WorkspaceTransactionUtil.getOperationHistory(editingDomain);
- try {
- history.execute(operation, progress.newChild(1), null);
- } catch (ExecutionException ex) {
- IStatus status = StatusUtil.createErrorStatus(Activator.getPlugin(), ex);
- throw new CoreException(status);
- }
- }
-
- /**
- * Saves all modified resources of the model behind the specified object (<em>i.e.</em> all resources in the context
- * of the given object).
- *
- * @param contextResource
- * The object resource identifying the model to save.
- * @param async
- * If <code>true</code>, model will be saved within a workspace job.
- * @param monitor
- * The progress monitor to use for showing save process progress.
- */
- public static void saveModel(Object contextObject, boolean async, IProgressMonitor monitor) {
- saveModel(contextObject, EcoreResourceUtil.getDefaultSaveOptions(), async, monitor);
- }
-
- /**
- * Saves all modified, writable models from a given context object.
- *
- * @param contextObject
- * The object context identifying the models to save.
- * @param options
- * The save options.
- * @param async
- * When passing <code>true</code> the model will be saved within a workspace job.
- * @param monitor
- * The progress monitor to use for showing save process progress.
- */
- // TODO Make sure that this method can also be used for contextObjects in resources which are located outside the
- // Eclipse workspace (only ISchedulingRule creation and IWorkspaceRunnable usages need to be adapted)
- public static void saveModel(Object contextObject, final Map<?, ?> options, boolean async, IProgressMonitor monitor) {
- if (contextObject instanceof IProject) {
- saveProject((IProject) contextObject, options, async, monitor);
- return;
- }
-
- SubMonitor progress = SubMonitor.convert(monitor, 100);
- Collection<Resource> resourcesInModel = new ArrayList<Resource>(getResourcesInModel(contextObject, true));
- final Map<TransactionalEditingDomain, Collection<Resource>> resourcesToSave = detectResourcesToSave(resourcesInModel,
- progress.newChild(async ? 100 : 5));
- if (resourcesToSave.size() > 0) {
- ISchedulingRule rule = createSaveSchedulingRule(resourcesToSave);
- if (async) {
- Job job = new Job(Messages.job_savingModel) {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- runSaveModelResources(resourcesToSave, options, monitor);
- return Status.OK_STATUS;
- } catch (CoreException ex) {
- return ex.getStatus();
- }
- }
- };
-
- job.setRule(rule);
- job.setPriority(Job.BUILD);
- job.schedule();
- } else {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- runSaveModelResources(resourcesToSave, options, monitor);
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(runnable, rule, 0, progress.newChild(95));
- } catch (CoreException ex) {
- PlatformLogUtil.logAsError(Activator.getDefault(), ex);
- }
- }
- }
- }
-
- /**
- * Saves all modified {@link Resource resource}s of all models behind the specified {@link IProject project}
- * including all referenced projects ( <em>i.e.</em> all resources in the context of the given project).
- *
- * @param project
- * The {@link IProject project} identifying the models to save.
- * @param async
- * If <code>true</code>, models will be saved within a workspace job.
- * @param monitor
- * The progress monitor to use for showing save process progress.
- */
- public static void saveProject(IProject project, boolean async, IProgressMonitor monitor) {
- saveProject(project, EcoreResourceUtil.getDefaultSaveOptions(), async, monitor);
- }
-
- /**
- * Saves all modified {@link Resource}s of all models behind the specified project including all referenced
- * {@link IProject}s ( <em>i.e.</em> all resources in the context of the given project).
- *
- * @param project
- * The {@link IProject project} identifying the models to save.
- * @param options
- * The save options.
- * @param async
- * If <code>true</code>, models will be saved within a workspace job.
- * @param monitor
- * The progress monitor to use for showing save process progress.
- */
- public static void saveProject(IProject project, final Map<?, ?> options, boolean async, IProgressMonitor monitor) {
- SubMonitor progress = SubMonitor.convert(monitor, 100);
- Collection<Resource> resourcesInProject = new ArrayList<Resource>(getResourcesInScopes(project, true));
- final Map<TransactionalEditingDomain, Collection<Resource>> resourcesToSave = detectResourcesToSave(resourcesInProject,
- progress.newChild(async ? 100 : 5));
- if (resourcesToSave.size() > 0) {
- ISchedulingRule rule = createSaveSchedulingRule(resourcesToSave);
- if (async) {
- Job job = new Job(resourcesToSave.size() == 1 ? Messages.job_savingModel : Messages.job_savingModels) {
- @Override
- public IStatus run(IProgressMonitor monitor) {
- try {
- runSaveModelResources(resourcesToSave, options, monitor);
- return Status.OK_STATUS;
- } catch (CoreException ex) {
- return ex.getStatus();
- }
- }
- };
- job.setRule(rule);
- job.setPriority(Job.BUILD);
- job.schedule();
- } else {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- runSaveModelResources(resourcesToSave, options, monitor);
- }
- };
- try {
- ResourcesPlugin.getWorkspace().run(runnable, rule, 0, progress.newChild(95));
- } catch (CoreException ex) {
- PlatformLogUtil.logAsError(Activator.getDefault(), ex);
- }
- }
- }
- }
-
- private static Map<TransactionalEditingDomain, Collection<Resource>> detectResourcesToSave(Collection<Resource> resources,
- IProgressMonitor monitor) {
- SubMonitor progress = SubMonitor.convert(monitor, resources.size());
-
- Map<TransactionalEditingDomain, Collection<Resource>> resourcesToSave = new HashMap<TransactionalEditingDomain, Collection<Resource>>();
- for (Resource resource : resources) {
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resource);
- if (editingDomain != null) {
- if (isResourceToSave(editingDomain, resource)) {
- Collection<Resource> resourcesToSaveInEditingDomain = resourcesToSave.get(editingDomain);
- if (resourcesToSaveInEditingDomain == null) {
- resourcesToSaveInEditingDomain = new HashSet<Resource>();
- resourcesToSave.put(editingDomain, resourcesToSaveInEditingDomain);
- }
- resourcesToSaveInEditingDomain.add(resource);
- }
- }
- progress.worked(1);
- }
- return resourcesToSave;
- }
-
- private static boolean isResourceToSave(TransactionalEditingDomain editingDomain, Resource contextResource) {
- Assert.isNotNull(editingDomain);
- return !editingDomain.isReadOnly(contextResource) && SaveIndicatorUtil.isDirty(editingDomain, contextResource);
- }
-
- /**
- * Saves model {@link Resource resource}s.
- *
- * @param resourcesToSave
- * The {@link TransactionalEditingDomain editing domain}s with the corresponding resources to save; must
- * not be <code>null</code>.
- * @param options
- * The save options.
- * @param monitor
- * The progress monitor to use (can be <code>null</code>).
- */
- private static void runSaveModelResources(final Map<TransactionalEditingDomain, Collection<Resource>> resourcesToSave, final Map<?, ?> options,
- IProgressMonitor monitor) throws CoreException {
- Assert.isNotNull(resourcesToSave);
- final SubMonitor progress = SubMonitor.convert(monitor, resourcesToSave.size());
-
- for (final TransactionalEditingDomain editingDomain : resourcesToSave.keySet()) {
- progress.setTaskName(resourcesToSave.get(editingDomain).size() == 1 ? Messages.task_savingModelResource
- : Messages.task_savingModelResources);
-
- /*
- * !! Important Note !! The saving of model resources as such does not imply any modifications of the
- * resource set and therefore could be done in a read transaction. However, it is possible that the
- * resources to be saved have a org.eclipse.emf.ecore.xmi.ResoureHandler registered upon them and that the
- * ResourceHandler#preSave() method performs some resource set modifying operations. In order to avoid
- * IllegalStateExceptions telling that the resource set cannot be modified without a write transaction in
- * such cases the whole save operation must be executed in a write transaction.
- */
- Map<String, Object> transactionOptions = WorkspaceTransactionUtil.getDefaultSaveTransactionOptions();
- String label = resourcesToSave.get(editingDomain).size() == 1 ? Messages.operation_savingModelResource
- : Messages.operation_savingModelResources;
- final IUndoableOperation operation = new AbstractEMFOperation(editingDomain, label, transactionOptions) {
- @Override
- protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- SubMonitor progress = SubMonitor.convert(monitor, resourcesToSave.get(editingDomain).size());
- for (Resource resource : resourcesToSave.get(editingDomain)) {
- progress.subTask(NLS.bind(Messages.subtask_savingResource, resource.getURI().toString()));
-
- try {
- // Save resource
- /*
- * !! Important Note !! Resource must be saved before marking it as freshly saved
- * because otherwise the resource would loose its dirty state and consequently not
- * be saved at all.
- */
- EcoreResourceUtil.saveModelResource(resource, options);
-
- // Mark resource as freshly saved in order to avoid that it gets automatically
- // reloaded
- SaveIndicatorUtil.setSaved(editingDomain, resource);
- } catch (Exception ex) {
- // Ignore exception, it has already been recorded as error on resource and will be
- // converted to a problem marker later on (see
- // org.eclipse.sphinx.emf.util.EcoreResourceUtil.saveModelResource(Resource,
- // Map<?,?>) and org.eclipse.sphinx.emf.internal.resource.ResourceProblemHandler for
- // details)
- }
-
- progress.worked(1);
- }
-
- // Refresh command stack state of associated editing domain
- ((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
- }
- };
-
- try {
- // Execute save operation as IWorkspaceRunnable on workspace in order to avoid resource
- // change notifications during transaction execution
- /*
- * !! Important Note !! Only set IWorkspace.AVOID_UPDATE flag but don't define any scheduling
- * restrictions for the save operation right here (this must only be done on outer workspace
- * jobs or workspace runnables from which this method is called). Otherwise it would be likely
- * to end up in deadlocks with operations which already have acquired exclusive access to the
- * workspace but are waiting for exclusive access to the model (i.e. for the transaction).
- */
- ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, progress.newChild(1));
- return Status.OK_STATUS;
- } catch (CoreException ex) {
- return ex.getStatus();
- }
- }
-
- @Override
- public boolean canUndo() {
- // Avoid that save operation appears in the undo menu
- return false;
- }
- };
-
- IOperationHistory history = WorkspaceTransactionUtil.getOperationHistory(editingDomain);
- try {
- history.execute(operation, progress.newChild(1), null);
- } catch (ExecutionException ex) {
- IStatus status = StatusUtil.createErrorStatus(Activator.getPlugin(), ex);
- throw new CoreException(status);
- }
- }
- }
-
- /**
- * Unloads the model contained in given {@link IFile file}.
- *
- * @param file
- * The {@link IFile file} containing the model.
- * @see #unloadFile(TransactionalEditingDomain, IFile)
- */
- public static void unloadFile(IFile file) {
- /*
- * !! Important Note !! For the sake of robustness, it is necessary to consider all editing domains but not only
- * the one which would be returned by WorkspaceEditingDomainUtil#getCurrentEditingDomain(IFile). Although not
- * really intended by Sphinx workspace management it might anyway happen that the same file gets loaded into
- * multiple editing domains. Typical reasons for this are e.g. lazy loading of one file from multiple other
- * files which are in different editing domains or programatic action by some application. We then have to make
- * sure that the given file gets unloaded from all editing domains it is in.
- */
- Collection<TransactionalEditingDomain> editingDomains = WorkspaceEditingDomainUtil.getAllEditingDomains();
- for (TransactionalEditingDomain editingDomain : editingDomains) {
- if (EcorePlatformUtil.isFileLoaded(editingDomain, file)) {
- unloadFile(editingDomain, file);
- }
- }
- }
-
- /**
- * Unloads the model contained in given {@linkplain IFile file} from given {@linkplain TransactionalEditingDomain
- * editing domain}.
- *
- * @param file
- * The {@linkplain IFile file} containing the model.
- * @param editingDomain
- * The {@linkplain TransactionalEditingDomain editing domain} the <code>file</code> belongs to.
- */
- public static void unloadFile(final TransactionalEditingDomain editingDomain, final IFile file) {
- if (editingDomain != null && file != null) {
- try {
- editingDomain.runExclusive(new Runnable() {
- public void run() {
- try {
- URI uri = createURI(file.getFullPath());
- EcoreResourceUtil.unloadResource(editingDomain.getResourceSet(), uri);
- } catch (RuntimeException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- }
-
- /**
- * Unloads the models contained in given {@linkplain IFile file}s from given {@linkplain TransactionalEditingDomain
- * editing domain} inside a read-only transaction.
- *
- * @param files
- * The {@link IFile file}s containing the models.
- * @param editingDomain
- * The {@link TransactionalEditingDomain editing domain} the {@link IFile file}s belong to.
- * @since 0.7.0
- */
- public static void unloadFiles(final TransactionalEditingDomain editingDomain, final Collection<IFile> files, final boolean memoryOptimized,
- IProgressMonitor monitor) throws OperationCanceledException {
- if (editingDomain != null && files != null && files.size() > 0) {
- final SubMonitor progress = SubMonitor.convert(monitor, Messages.task_unloadingModelFiles, files.size());
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
-
- try {
- editingDomain.runExclusive(new Runnable() {
- public void run() {
- for (IFile file : files) {
- progress.subTask(NLS.bind(Messages.subtask_unloadingModelFile, file.getFullPath().toString()));
-
- try {
- URI uri = createURI(file.getFullPath());
- EcoreResourceUtil.unloadResource(editingDomain.getResourceSet(), uri, memoryOptimized);
- } catch (RuntimeException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
-
- progress.worked(1);
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
- editingDomain.yield();
- }
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- }
-
- /**
- * Unloads the specified {@linkplain Resource resource}s from given {@linkplain TransactionalEditingDomain editing
- * domain} inside a read-only transaction.
- *
- * @param memoryOptimized
- * @param resources
- * The resources to unload.
- * @param editingDomain
- * The editing domain owning {@link Resource resource}s.
- * @since 0.7.0
- */
- public static void unloadResources(final TransactionalEditingDomain editingDomain, final Collection<Resource> resources,
- final boolean memoryOptimized, IProgressMonitor monitor) throws OperationCanceledException {
- if (editingDomain != null && resources != null && resources.size() > 0) {
- final SubMonitor progress = SubMonitor.convert(monitor, Messages.task_unloadingModelResources, resources.size());
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
-
- try {
- editingDomain.runExclusive(new Runnable() {
- public void run() {
- List<Resource> safeResources = new ArrayList<Resource>(resources);
- for (Resource resource : safeResources) {
- progress.subTask(NLS.bind(Messages.subtask_unloadingModelResource, resource.getURI().toString()));
-
- try {
- if (editingDomain.getResourceSet().getResources().contains(resource)) {
- EcoreResourceUtil.unloadResource(resource, memoryOptimized);
- }
- } catch (RuntimeException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
-
- progress.worked(1);
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
- editingDomain.yield();
- }
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- }
-
- /**
- * Unloads all {@linkplain Resource resource}s from given {@linkplain TransactionalEditingDomain editing domain}
- * inside a read-only transaction.
- *
- * @param editingDomain
- * The editing domain owning {@link Resource resource}s.
- */
- public static void unloadAllResources(final TransactionalEditingDomain editingDomain, IProgressMonitor monitor) throws OperationCanceledException {
- if (editingDomain != null) {
- final SubMonitor progress = SubMonitor.convert(monitor, Messages.task_unloadingModelResources, editingDomain.getResourceSet()
- .getResources().size());
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
-
- try {
- editingDomain.runExclusive(new Runnable() {
- public void run() {
- List<Resource> safeResources = new ArrayList<Resource>(editingDomain.getResourceSet().getResources());
- for (Resource resource : safeResources) {
- progress.subTask(NLS.bind(Messages.subtask_unloadingModelResource, resource.getURI().toString()));
-
- try {
- EcoreResourceUtil.unloadResource(resource, true);
- } catch (RuntimeException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
-
- progress.worked(1);
- if (progress.isCanceled()) {
- throw new OperationCanceledException();
- }
- editingDomain.yield();
- }
- }
- });
- } catch (InterruptedException ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- }
-
- /**
- * Parses given {@link IFile file} and validates it against XSD schema with specified {@link URL url}. Raises an
- * exception if the {@link IFile file}'s content is not compliant with respect to XSD schema.
- *
- * @param file
- * The {@link IFile file} to be validated.
- * @param schemaURL
- * The {@link URL url} of the XSD schema to be used for validation.
- * @throws SAXException
- * @throws IOException
- */
- public static void validate(IFile file, URL schemaURL) throws SAXException, IOException {
- Assert.isNotNull(file);
-
- URI uri = createURI(file.getFullPath());
- EcoreResourceUtil.validate(uri, schemaURL);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/EcoreResourceUtil.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/EcoreResourceUtil.java
deleted file mode 100644
index fb8358afe32..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/EcoreResourceUtil.java
+++ /dev/null
@@ -1,1148 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2008-2011 See4sys, BMW Car IT, itemis and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * See4sys - Initial API and implementation
- * BMW Car IT - Added/Updated javadoc
- * itemis - [346715] IMetaModelDescriptor methods of MetaModelDescriptorRegistry taking EObject or Resource arguments should not start new EMF transactions
- * itemis - [357962] Make sure that problems occurring when saving model elements in a new resource are not recorded as errors/warnings on resource
- * </copyright>
- */
-package org.eclipse.papyrus.emf.compare.transactional.editor.sphinx;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.XMLConstants;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.common.CommonPlugin;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.util.BasicEList;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.ContentHandler;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.Resource.Diagnostic;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.ecore.xmi.XMIException;
-import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.provider.IWrapperItemProvider;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.sphinx.emf.Activator;
-import org.eclipse.sphinx.emf.edit.TransientItemProvider;
-import org.eclipse.sphinx.emf.internal.messages.Messages;
-import org.eclipse.sphinx.emf.resource.ExtendedResource;
-import org.eclipse.sphinx.emf.resource.ExtendedResourceAdapterFactory;
-import org.eclipse.sphinx.emf.resource.ScopingResourceSetImpl;
-import org.eclipse.sphinx.platform.util.ExtendedPlatform;
-import org.eclipse.sphinx.platform.util.PlatformLogUtil;
-import org.eclipse.sphinx.platform.util.XMLRootElementHandler;
-import org.xml.sax.SAXException;
-
-/**
- * Utility class for resource management.
- */
-public final class EcoreResourceUtil {
-
- // Prevent from instantiation
- private EcoreResourceUtil() {
- }
-
- /**
- * Returns an instance of {@link ExtensibleURIConverterImpl} where the URI mappings are initialized in such a way
- * that normalization of non-platform:/resource {@link URI}s which reference resources inside the workspace yields
- * the corresponding platform:/resource {@link URI}s.
- *
- * @return An instance of {@link ExtensibleURIConverterImpl} containing URI mappings for normalizing
- * non-platform:/resource {@link URI}s referencing workspace resources to corresponding platform:/resource
- * {@link URI}s.
- */
- public static URIConverter getURIConverter() {
- return getURIConverter(null);
- }
-
- /**
- * Returns the {@link URIConverter URI converter} of given {@link ResourceSet resource set}. If no
- * {@link ResourceSet resource set} is provided an instance of {@link ExtensibleURIConverterImpl} is returned
- * instead. In both cases, the {@link URIConverter URI converter}'s URI mappings are initialized in such a way that
- * normalization of non-platform:/resource {@link URI}s which reference resources inside the workspace yields the
- * corresponding platform:/resource {@link URI}s.
- *
- * @param resourceSet
- * The {@link ResourceSet resource set} whose {@link URIConverter URI converter} is to be retrieved.
- * @return The {@link URIConverter URI converter} of given {@link ResourceSet resource set}, or an instance of
- * {@link ExtensibleURIConverterImpl} if no such is provided, containing URI mappings for normalizing
- * non-platform:/resource {@link URI}s referencing workspace resources to corresponding platform:/resource
- * {@link URI}s.
- */
- public static URIConverter getURIConverter(ResourceSet resourceSet) {
- // Retrieve or create URI converter
- URIConverter uriConverter;
- if (resourceSet != null) {
- uriConverter = resourceSet.getURIConverter();
- } else {
- uriConverter = new ExtensibleURIConverterImpl();
- }
- if (Platform.isRunning()) {
- // Initialize URI mappings
- IPath workspaceRootPath = ResourcesPlugin.getWorkspace().getRoot().getFullPath().addTrailingSeparator();
- URI workspaceRootURI = URI.createPlatformResourceURI(workspaceRootPath.toString(), true);
-
- IPath workspaceRootLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().addTrailingSeparator();
- URI workspaceRootLocationURI = URI.createURI(workspaceRootLocation.toString(), true);
- URI workspaceRootLocationFileURI = URI.createFileURI(workspaceRootLocation.toString());
-
- uriConverter.getURIMap().put(workspaceRootLocationURI, workspaceRootURI);
- uriConverter.getURIMap().put(workspaceRootLocationFileURI, workspaceRootURI);
- }
- return uriConverter;
- }
-
- /**
- * Converts given {@link URI} into an absolute file {@link URI}.
- *
- * @param uri
- * The {@link URI} to be converted.
- * @return Absolute file {@link URI} for the given {@link URI} or given {@link URI} if no conversion is possible.
- */
- public static URI convertToAbsoluteFileURI(URI uri) {
- Assert.isNotNull(uri);
-
- // FIXME File bug to EMF: CommonPlugin.asLocalURI() is unable to convert URIs that start with a driver letter
- // (IOException raised and caught internally)
- if (!uri.isRelative() && uri.scheme().matches("[A-Z]")) { //$NON-NLS-1$
- uri = URI.createFileURI(uri.toString());
- }
-
- // Try to convert given URI to absolute file URI right away
- URI convertedURI = CommonPlugin.asLocalURI(uri);
-
- // Resulting URI still relative?
- if (convertedURI.isRelative()) {
- // Normalize given URI and try to convert it again
- uri = getURIConverter().normalize(uri);
- convertedURI = CommonPlugin.asLocalURI(uri);
- }
-
- return convertedURI;
- }
-
- /**
- * Converts given URI into a platform resource URI.
- *
- * @param uri
- * The {@link URI} to be converted.
- * @return platform resource URI for the given URI or given URI if it references a location outside the workspace or
- * platform is not available.
- */
- public static URI convertToPlatformResourceURI(URI uri) {
- Assert.isNotNull(uri);
-
- // Already a platform resource URI?
- if (uri.isPlatformResource()) {
- return uri;
- } else {
- // Try to convert given URI to platform resource URI
- return getURIConverter().normalize(uri);
- }
- }
-
- /**
- * Proves if resource specified by an URI exists.
- *
- * @param uri
- * The URI to prove Returns <b>true</b> only if the URI represents a file and if this file exists.
- */
- public static boolean exists(URI uri) {
- if (uri != null) {
- return getURIConverter().exists(uri, null);
- }
- return false;
- }
-
- /**
- * Returns the id of the content type of the file behind given {@link URI}.
- *
- * @param uri
- * The {@link URI} whose content type id is to be established.
- * @return The id of the content type of the file behind given {@link URI}, or <code>null</code> if given
- * {@link URI} references a resource which is no file (e.g., a folder or project), or a file that does not
- * exist or has no content type.
- */
- public static String getContentTypeId(URI uri) {
- if (uri != null) {
- try {
- Map<String, ?> contentDescription = getURIConverter().contentDescription(uri, null);
- return (String) contentDescription.get(ContentHandler.CONTENT_TYPE_PROPERTY);
- } catch (Exception ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
- return null;
- }
-
- /**
- * Determines if {@link Resource resource} behind specified {@link URI} is read-only. Returns <code>false</code> if
- * this resource does not exist.
- *
- * @param uri
- * The {@link URI} identifying the {@link Resource resource} to be investigated.
- * @return <code>true</code> if {@link Resource resource} behind specified {@link URI} is read-only, and
- * <code>false</code> otherwise.
- */
- public static boolean isReadOnly(URI uri) {
- if (uri != null) {
- Map<String, ?> attributes = getURIConverter().getAttributes(uri, null);
- Object readOnly = attributes.get(URIConverter.ATTRIBUTE_READ_ONLY);
- return readOnly instanceof Boolean && (Boolean) readOnly;
- }
- return false;
- }
-
- /**
- * Reads the model namespace (i.e. XML namespace) of given {@link Resource resource}. Returns a meaningful result
- * only if given {@link Resource resource} is an XML document.
- *
- * @param resource
- * The {@link Resource resource} to investigate.
- * @return The model namespace denoted in given {@link Resource resource} or <code>null</code> if the
- * {@link Resource resource} is either a non-XML file or an XML file which is not well-formed or has no
- * model namespace.
- */
- public static String readModelNamespace(Resource resource) {
- if (resource != null) {
- return readModelNamespace(EcoreResourceUtil.getURIConverter(resource.getResourceSet()), resource.getURI());
- }
- return null;
- }
-
- /**
- * Reads the model namespace (i.e. XML namespace) of resource behind given {@link URI}. Returns a meaningful result
- * only if the resource in question is an XML document.
- *
- * @param uriConverter
- * The {@link URIConverter uriConverter} used to create {@link InputStream inputstream} . May be
- * <code>null</code>.
- * @param uri
- * The {@link URI uri} of the resource to investigate.
- * @return The model namespace denoted in resource behind given {@link URI} or <code>null</code> if the resource in
- * question is either a non-XML file or an XML file which is not well-formed or has no model namespace.
- */
- public static String readModelNamespace(URIConverter uriConverter, URI uri) {
- String namespace = null;
- if (exists(uri)) {
- InputStream inputStream = null;
- try {
- uriConverter = uriConverter != null ? uriConverter : new ExtensibleURIConverterImpl();
- inputStream = uriConverter.createInputStream(uri);
- XMLRootElementHandler handler = new XMLRootElementHandler();
- handler.parseContents(inputStream);
- namespace = handler.getRootElementNamespace();
- } catch (SAXException ex) {
- // Ignore parse exceptions because we might be face to non-XML files or XML files
- // which are not well-formed - that's o.k. simply return null
- } catch (IOException ex) {
- // Ignore I/O exceptions because we might be face to non-XML files or XML files
- // which are not well-formed - that's o.k. simply return null
- } catch (Exception ex) {
- PlatformLogUtil.logAsWarning(Activator.getPlugin(), ex);
- } finally {
- ExtendedPlatform.safeClose(inputStream);
- }
- }
- return namespace;
- }
-
- /**
- * Reads the target namespace of given {@link Resource resource}. Returns a meaningful result only if given
- * {@link Resource resource} is an XML document.
- *
- * @param resource
- * The {@link Resource resource} to investigate.
- * @return The target namespace denoted in given {@link Resource resource} or <code>null</code> if the
- * {@link Resource resource} is either a not an XML file or an XML file which is not well-formed or has no
- * target namespace.
- */
- public static String readTargetNamespace(Resource resource) {
- return readTargetNamespace(resource, (String[]) null);
- }
-
- public static String readTargetNamespace(Resource resource, String... targetNamespaceExcludePatterns) {
- if (resource != null) {
- return readTargetNamespace(getURIConverter(resource.getResourceSet()), resource.getURI(), targetNamespaceExcludePatterns);
- }
- return null;
- }
-
- /**
- * Reads the target namespace of the resource behind given {@link URI}. Returns a meaningful result only if the
- * resource in question is an XML document.
- *
- * @param uriConverter
- * The {@link URIConverter uriConverter} used to create {@link InputStream input stream} . May be
- * <code>null</code>.
- * @param uri
- * The {@link URI uri} of the resource to investigate.
- * @return The target namespace denoted in resource behind given {@link URI} or <code>null</code> if the resource in
- * question is either a not an XML file or an XML file which is not well-formed or has no target namespace.
- */
- public static String readTargetNamespace(URIConverter uriConverter, URI uri) {
- return readTargetNamespace(uriConverter, uri, (String[]) null);
- }
-
- public static String readTargetNamespace(URIConverter uriConverter, URI uri, String... targetNamespaceExcludePatterns) {
- String targetNamespace = null;
- if (exists(uri)) {
- InputStream inputStream = null;
- try {
- uriConverter = uriConverter != null ? uriConverter : new ExtensibleURIConverterImpl();
- inputStream = uriConverter.createInputStream(uri);
- XMLRootElementHandler handler = new XMLRootElementHandler();
- if (targetNamespaceExcludePatterns != null) {
- handler.seTargetNamespaceExcludePatterns(targetNamespaceExcludePatterns);
- }
- handler.parseContents(inputStream);
- targetNamespace = handler.getTargetNamespace();
- } catch (SAXException ex) {
- // Ignore parse exceptions because we might be face to non-XML files or XML files
- // which are not well-formed - that's o.k. simply return null
- } catch (IOException ex) {
- // Ignore I/O exceptions because we might be face to non-XML files or XML files
- // which are not well-formed - that's o.k. simply return null
- } catch (Exception ex) {
- PlatformLogUtil.logAsWarning(Activator.getPlugin(), ex);
- } finally {
- ExtendedPlatform.safeClose(inputStream);
- }
- }
- return targetNamespace;
- }
-
- /**
- * Retrieves the XML comments located above the root element in given {@link Resource resource}. Returns a
- * meaningful result only if given {@link Resource resource} is an XML document.
- *
- * @param resource
- * The {@link Resource resource} to investigate.
- * @return Collection of strings representing the retrieved XML comments or empty collection if no such could be
- * found.
- */
- public static Collection<String> readRootElementComments(Resource resource) {
- if (resource != null) {
- return readRootElementComments(getURIConverter(resource.getResourceSet()), resource.getURI());
- }
- return Collections.emptyList();
- }
-
- /**
- * Retrieves the XML comments located above the root element in resource behind given {@link URI}. Returns a
- * meaningful result only if the resource in question is an XML document.
- *
- * @param uriConverter
- * The {@link URIConverter uriConverter} used to create {@link InputStream input stream} . May be
- * <code>null</code>.
- * @param uri
- * The {@link URI uri} of the resource to investigate.
- * @return Collection of strings representing the retrieved XML comments or empty collection if no such could be
- * found.
- */
- public static Collection<String> readRootElementComments(URIConverter uriConverter, URI uri) {
- Collection<String> comments = new ArrayList<String>();
-
- if (exists(uri)) {
- InputStream inputStream = null;
- try {
- uriConverter = uriConverter != null ? uriConverter : new ExtensibleURIConverterImpl();
- inputStream = uriConverter.createInputStream(uri);
- XMLRootElementHandler handler = new XMLRootElementHandler();
- // Parse and retrieve comments above root element
- handler.parseContents(inputStream, true);
- comments = handler.getRootElementComments();
- } catch (SAXException ex) {
- // Ignore parse exceptions because we might be face to non-XML files or XML files
- // which are not well-formed - that's o.k. simply return null
- } catch (IOException ex) {
- // Ignore I/O exceptions because we might be face to non-XML files or XML files
- // which are not well-formed - that's o.k. simply return null
- } catch (Exception ex) {
- PlatformLogUtil.logAsWarning(Activator.getPlugin(), ex);
- } finally {
- ExtendedPlatform.safeClose(inputStream);
- }
- }
- return comments;
- }
-
- /**
- * Reads the XSI schema location of given {@link Resource resource} and extracts pairs of namespace and schema URIs
- * from it (see http://www.w3.org/TR/xmlschema-0/#schemaLocation for details). Returns a meaningful result only if
- * given {@link Resource resource} is an XML document.
- *
- * @param resource
- * The {@link Resource resource} to investigate.
- * @return Pairs of namespace and schema URIs in given {@link Resource resource} or an empty map if the
- * {@link Resource resource} is either a non-XML file or an XML file which is not well-formed or has no XSI
- * schema location.
- */
- public static Map<String, String> readSchemaLocationEntries(Resource resource) {
- if (resource != null) {
- return readSchemaLocationEntries(getURIConverter(resource.getResourceSet()), resource.getURI());
- }
- return Collections.emptyMap();
- }
-
- /**
- * Reads the XSI schema location of the resource behind given {@link URI} and extracts pairs of namespace and schema
- * URIs from it (see http://www.w3.org/TR/xmlschema-0/#schemaLocation for details). Returns a meaningful result only
- * if the resource in question is an XML document.
- *
- * @param uriConverter
- * The {@link URIConverter uriConverter} used to create {@link InputStream input stream} . May be
- * <code>null</code>.
- * @param uri
- * The {@link URI uri} of the {@link Resource resource} to investigate.
- * @return Pairs of namespace and schema URIs in resource behind given {@link URI} or an empty map if the resource
- * in question is either a non-XML file or an XML file which is not well-formed or has no XSI schema
- * location.
- */
- public static Map<String, String> readSchemaLocationEntries(URIConverter uriConverter, URI uri) {
- String schemaLocation = null;
- if (exists(uri)) {
- InputStream inputStream = null;
- try {
- uriConverter = uriConverter != null ? uriConverter : new ExtensibleURIConverterImpl();
- inputStream = uriConverter.createInputStream(uri);
- XMLRootElementHandler handler = new XMLRootElementHandler();
- handler.parseContents(inputStream);
- schemaLocation = handler.getSchemaLocation();
- } catch (SAXException ex) {
- // Ignore parse exceptions because we might be face to non-XML files or XML files
- // which are not well-formed - that's o.k. simply return null
- } catch (IOException ex) {
- // Ignore I/O exceptions because we might be face to non-XML files or XML files
- // which are not well-formed - that's o.k. simply return null
- } catch (Exception ex) {
- PlatformLogUtil.logAsWarning(Activator.getPlugin(), ex);
- } finally {
- ExtendedPlatform.safeClose(inputStream);
- }
- }
- Map<String, String> schemaLocationEntries = new HashMap<String, String>();
- if (schemaLocation != null) {
- String[] schemaLocationTokens = schemaLocation.split(" "); //$NON-NLS-1$
- for (int i = 0; i + 1 < schemaLocationTokens.length; i = i + 2) {
- schemaLocationEntries.put(schemaLocationTokens[i], schemaLocationTokens[i + 1]);
- }
- }
- return schemaLocationEntries;
- }
-
- /**
- * Returns a set of default options which can be used for loading a Resource.
- *
- * @return A set of default options for loading a Resource.
- */
- public static Map<?, ?> getDefaultLoadOptions() {
- HashMap<Object, Object> options = new HashMap<Object, Object>(1);
-
- // Be fault-tolerant and enable files which are partially broken to be loaded
- options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
-
- return options;
- }
-
- /**
- * Returns a map with the default options for resource saving.
- *
- * @return This method will return an empty map.
- */
- public static Map<?, ?> getDefaultSaveOptions() {
- return Collections.emptyMap();
- }
-
- /**
- * Retrieves the top level EObject contained within a resource.
- *
- * @param resource
- * Some model resource
- * @return The first EObject from the resource's content. Returns <code>null</code> if:
- * <ul>
- * <li><code>resource</code> is <code>null</code>;</li>
- * <li><code>resource</code> has no content;</li>
- * <li>content does not contain an EObject as its first element.</li>
- * </ul>
- */
- public static EObject getModelRoot(Resource resource) {
- if (resource != null) {
- EList<EObject> contents = resource.getContents();
- if (contents.size() > 0) {
- return resource.getContents().get(0);
- }
- }
- return null;
- }
-
- /**
- * Returns the root element of the model owned by the resource specified by the given URI. Does not explicitly ask
- * the loading of the resource if it has not already been loaded in resource set.
- *
- * @param resourceSet
- * The resource set into which model resource must be loaded.
- * @param uri
- * The URI to resolve; i.e. the URI of the model resource to load.
- * @return The root of the loaded model or <code>null</code> if underlying resource has not been loaded.
- */
- public static EObject getModelRoot(ResourceSet resourceSet, URI uri) {
- return loadModelRoot(resourceSet, uri, null, false);
- }
-
- /**
- * Returns the element of the model owned by the resource specified by the given URI and pointed by the given
- * fragment. Does not explicitly ask the loading of the resource if it has not already been loaded in resource set.
- *
- * @param resourceSet
- * The resource set into which model resource must be loaded.
- * @param uri
- * The URI to resolve; i.e. the URI of the model resource to load.
- * @return The element of the loaded model pointed by the fragment of the uri or <code>null</code> if underlying
- * resource has not been loaded.
- */
- public static EObject getModelFragment(ResourceSet resourceSet, URI uri) {
- return loadModelFragment(resourceSet, uri, false);
- }
-
- /**
- * Returns the element of the model pointed by the fragment owned by the resource specified by the given {@link URI
- * uri}. Asks the loading of the resource if it has not already been loaded in resource set.
- *
- * @param resourceSet
- * The resource set into which model resource must be loaded.
- * @param uri
- * The {@link URI uri} containing a fragment to resolve; i.e. the URI of the model resource to load
- * append with the reference to the model object.
- * @return The object of the loaded model referenced by the fragment, or <code>null</code> if the URI cannot be
- * resolved to an existing file.
- */
- public static EObject loadModelFragment(ResourceSet resourceSet, URI uri) {
- return loadModelFragment(resourceSet, uri, true);
- }
-
- private static EObject loadModelFragment(ResourceSet resourceSet, URI uri, boolean loadOnDemand) {
- Assert.isNotNull(resourceSet);
- Assert.isNotNull(uri);
-
- if (uri.hasFragment()) {
- // Try to convert given URI to platform:/resource URI if not yet so
- /*
- * !! Important Note !! This is necessary in order to avoid that resources which are located inside the
- * workspace get loaded multiple times just because they are referenced by URIs with different schemes. If
- * given resource set were an instance of ResourceSetImpl this extra conversion wouldn't be necessary.
- * org.eclipse.emf.ecore.resource.ResourceSet.getResource(URI, boolean) normalizes and compares given URI
- * and to normalized copies of URIs of already present resources and thereby avoids multiple loading of same
- * resources on its own. This is however not true when ExtendedResourceSetImpl or a subclass of it is used.
- * Herein, URI normalization and comparison has been removed from
- * org.eclipse.sphinx.emf.resource.ExtendedResourceSetImpl.getResource(URI, boolean) in order to increase
- * runtime performance.
- */
- if (!uri.isPlatform()) {
- uri = convertToPlatformResourceURI(uri);
- }
-
- return resourceSet.getEObject(uri, loadOnDemand);
- }
- return null;
- }
-
- /**
- * Returns the root element of the model owned by the resource specified by the given URI. Asks the loading of the
- * resource if it has not already been loaded in resource set.
- *
- * @param resourceSet
- * The resource set into which model resource must be loaded.
- * @param uri
- * The URI to resolve; i.e. the URI of the model resource to load.
- * @param options
- * The load options. If <code>null</code>, default loading options are used.
- * @return The root of the loaded model.
- */
- public static EObject loadModelRoot(ResourceSet resourceSet, URI uri, Map<?, ?> options) {
- return loadModelRoot(resourceSet, uri, options, true);
- }
-
- /**
- * Loads a model from a {@link java.io.File File} in a given {@link ResourceSet}.
- * <p>
- * This will return the first root of the loaded model, other roots can be accessed via the resource's content.
- * </p>
- *
- * @param resourceSet
- * The {@link ResourceSet} to load the model in.
- * @param file
- * {@link java.io.File File} containing the model to be loaded.
- * @param options
- * The load options. If <code>null</code>, default loading options are used.
- * @return The model loaded from the file.
- * @throws IOException
- * If the given file does not exist.
- */
- public static EObject loadModelRoot(ResourceSet resourceSet, File file, Map<?, ?> options) throws IOException {
- Assert.isNotNull(file);
- return loadModelRoot(resourceSet, URI.createFileURI(file.getPath()), options);
- }
-
- /**
- * Returns the {@linkplain Resource resource} corresponding to the specified {@linkplain Object object}.
- * <p>
- * The supported object types are:
- * <ul>
- * <li>{@linkplain org.eclipse.emf.ecore.resource.Resource}</li>
- * <li>{@linkplain org.eclipse.emf.ecore.EObject}</li>
- * <li>{@linkplain org.eclipse.emf.ecore.util.FeatureMap.Entry}</li>
- * <li>{@linkplain org.eclipse.emf.edit.provider.IWrapperItemProvider}</li>
- * </ul>
- * <p>
- * If the type of the specified object does not belongs to that list of supported types, <code>null</code> is
- * returned.
- *
- * @param object
- * The object from which a resource must be returned.
- * @return The underlying resource from the given object.
- */
- public static Resource getResource(Object object) {
- if (object instanceof Resource) {
- return (Resource) object;
- } else if (object instanceof EObject) {
- return getResource((EObject) object);
- } else if (object instanceof IWrapperItemProvider) {
- return getResource((IWrapperItemProvider) object);
- } else if (object instanceof FeatureMap.Entry) {
- return getResource((FeatureMap.Entry) object);
- } else if (object instanceof TransientItemProvider) {
- return getResource((TransientItemProvider) object);
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} corresponding to the given {@link EObject object}.
- *
- * @param eObject
- * The {@linkplain EObject object} whose {@link Resource resource} is to be returned.
- * @return The resource corresponding to the specified {@link EObject object}.
- */
- public static Resource getResource(final EObject eObject) {
- if (eObject != null) {
- return eObject.eResource();
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} owning the given {@link IWrapperItemProvider provider}.
- * <p>
- * First retrieves the owner of the {@link IWrapperItemProvider provider}; then, if owner is an {@linkplain EObject}
- * returns its resource, else delegates to {@linkplain #getResource(Object)}.
- *
- * @param provider
- * The {@linkplain IWrapperItemProvider} whose resource must be returned.
- * @return The resource containing the specified {@link IWrapperItemProvider provider}; <code>null</code> if that
- * provider is <code>null</code>.
- */
- public static Resource getResource(final IWrapperItemProvider provider) {
- if (provider != null) {
- Object owner = provider.getOwner();
- if (owner instanceof EObject) {
- return ((EObject) owner).eResource();
- } else {
- Object unwrapped = AdapterFactoryEditingDomain.unwrap(provider);
- return getResource(unwrapped);
- }
- }
- return null;
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} matching the given {@link FeatureMap.Entry entry}.
- * <p>
- * First unwraps the {@link FeatureMap.Entry entry}; then, delegates to {@linkplain #getResource(Object)}.
- *
- * @param entry
- * The {@linkplain FeatureMap.Entry} whose underlying resource must be returned.
- * @return The resource under the specified {@link FeatureMap.Entry entry}.
- */
- public static Resource getResource(FeatureMap.Entry entry) {
- Object unwrapped = AdapterFactoryEditingDomain.unwrap(entry);
- return getResource(unwrapped);
- }
-
- /**
- * Retrieves the {@linkplain Resource resource} owning the given {@link TransientItemProvider provider}.
- * <p>
- * First retrieves the owner of the {@link TransientItemProvider provider}; then, if owner is an
- * {@linkplain EObject} returns its resource, else delegates to {@linkplain #getResource(Object)}.
- *
- * @param provider
- * The {@linkplain TransientItemProvider} whose resource must be returned.
- * @return The resource containing the specified {@link IWrapperItemProvider provider}; <code>null</code> if that
- * provider is <code>null</code>.
- */
- public static Resource getResource(TransientItemProvider provider) {
- if (provider != null) {
- Notifier target = provider.getTarget();
- if (target instanceof EObject) {
- return ((EObject) target).eResource();
- }
- }
- return null;
- }
-
- /**
- * Returns the contents of given Resource. If the provided Resource is
- * <tt>null<tt> the method will return an empty list.
- *
- * @param resource
- * @return The content of the given <code>resource</code> or an empty list if no Resource is provided.
- */
- public static EList<EObject> getResourceContents(Resource resource) {
- if (resource != null) {
- return resource.getContents();
- }
- return new BasicEList<EObject>(0);
- }
-
- /**
- * Returns the name of the model for the provided model root.
- *
- * @param modelRoot
- * Can either be an EObject or a Resource.
- * @return The name of the model specified by the given <code>modelRoot</code>.
- */
- public static String getModelName(Notifier modelRoot) {
- EObject modelContent = null;
- if (modelRoot instanceof EObject) {
- modelContent = (EObject) modelRoot;
- }
- if (modelRoot instanceof Resource) {
- modelContent = EcoreResourceUtil.getModelRoot((Resource) modelRoot);
- }
- if (modelContent != null) {
- String modelPackageName = modelContent.eClass().getEPackage().getName();
- return modelPackageName.substring(0, 1).toUpperCase() + modelPackageName.substring(1);
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Proves if the model with the specified {@link URI uri} is already loaded into the given {@link ResourceSet
- * resourceSet}.
- *
- * @param resourceSet
- * The resource set to search resource in.
- * @param uri
- * The URI of the concerned resource.
- * @return <ul>
- * <li><tt><b>true</b>&nbsp;&nbsp;</tt> if resource set contains the model with specified the URI;</li>
- * <li><tt><b>false</b>&nbsp;</tt> otherwise.</li>
- * </ul>
- */
- public static boolean isResourceLoaded(ResourceSet resourceSet, URI uri) {
- if (resourceSet != null && uri != null) {
- Resource resource = resourceSet.getResource(uri, false);
- return resource != null && resource.isLoaded();
- }
- return false;
- }
-
- /**
- * Create the new model given by the {@link EObject modelRoot} parameter. The method will create a new Resource
- * specified by a given URI and content type id. The new created resource will be added to a given ResourceSet.
- *
- * @param resourceSet
- * The ResourceSet to which the new Resource is added.
- * @param uri
- * The URI specifying the location to which the Resource is to be saved to.
- * @param contentTypeId
- * The id of the content type of which new created Resource shall be of.
- * @param modelRoot
- * Can either be an EObject or a Resource.
- * @since 0.7.0
- */
- public static Resource addNewModelResource(ResourceSet resourceSet, URI uri, String contentTypeId, EObject modelRoot) {
- if (uri != null && modelRoot != null) {
- try {
- // Create new ResourceSet if none has been provided
- if (resourceSet == null) {
- resourceSet = new ScopingResourceSetImpl();
- }
-
- // Unload and remove model resource if it is already loaded
- Resource resource = resourceSet.getResource(uri, false);
- if (resource != null) {
- try {
- unloadResource(resource);
- } catch (Exception ex) {
- PlatformLogUtil.logAsError(Activator.getPlugin(), ex);
- }
- }
-
- // Create and add new model resource to the resourceSet
- resource = resourceSet.createResource(uri, contentTypeId);
- if (resource != null) {
- resource.getContents().add(modelRoot);
- }
- return resource;
- } catch (Exception ex) {
- throw new WrappedException(ex);
- }
- }
- return null;
- }
-
- /**
- * The {@link Resource} provided as argument will be added to the given ResourceSet if it is not already inside.
- *
- * @param resourceSet
- * The resourceSet where to add resources
- * @param resource
- * The resource to add
- * @since 0.7.0
- */
- public static void addModelResource(ResourceSet resourceSet, Resource resource) {
- if (resource != null) {
- // Create new ResourceSet if none has been provided
- if (resourceSet == null) {
- resourceSet = new ScopingResourceSetImpl();
- }
-
- // Add resource to resourceSet if not already present
- if (resourceSet.getResource(resource.getURI(), false) == null) {
- resourceSet.getResources().add(resource);
- }
- }
- }
-
- /**
- * Saves the new model given by the {@link EObject modelRoot} parameter. The method will create a new Resource
- * specified by a given URI and content type id. The new created resource will be added to a given ResourceSet and
- * saved.
- *
- * @param resourceSet
- * The ResourceSet to which the new Resource is added.
- * @param uri
- * The URI specifying the location to which the Resource is to be saved to.
- * @param contentTypeId
- * The id of the content type of which new created Resource shall be of.
- * @param modelRoot
- * Can either be an EObject or a Resource.
- * @param options
- * The save options.
- * @see #getDefaultSaveOptions()
- */
- public static void saveNewModelResource(ResourceSet resourceSet, URI uri, String contentTypeId, EObject modelRoot, Map<?, ?> options) {
- // Create new model resource and add it to the provided ResourceSet
- Resource resource = addNewModelResource(resourceSet, uri, contentTypeId, modelRoot);
-
- // Save the newly created resource
- saveModelResource(resource, options);
- }
-
- /**
- * Saves the specified <code>resource</code>.
- *
- * @param resource
- * The {@link Resource resource} to be saved.
- * @param options
- * The save options.
- * @see #getDefaultSaveOptions()
- */
- public static void saveModelResource(Resource resource, Map<?, ?> options) {
- if (resource != null) {
- try {
- resource.save(options);
- } catch (IOException ex) {
- // Record exception as error on resource
- Throwable cause = ex.getCause();
- Exception exception = cause instanceof Exception ? (Exception) cause : ex;
- URI uri = resource.getURI();
- resource.getErrors()
- .add(new XMIException(NLS.bind(Messages.error_problemOccurredWhenSavingResource, uri.toString()), exception, uri.toString(),
- 1, 1));
-
- // Re-throw exception
- throw new WrappedException(ex);
- }
- }
- }
-
- /**
- * Unloads given {@link Resource resource} and removes it from underlying {@link ResourceSet resourceSet}.
- *
- * @param resource
- * The resource to be unloaded.
- */
- public static void unloadResource(Resource resource) {
- unloadResource(resource, false);
- }
-
- /**
- * Unloads given {@link Resource resource} and removes it from underlying {@link ResourceSet resourceSet}.
- *
- * @param resource
- * The resource to be unloaded.
- * @param memoryOptimized
- * Will activate the memory optimization option for unloading the resource. This is only available if the
- * resource is an XMLResource.
- */
- public static void unloadResource(Resource resource, boolean memoryOptimized) {
- if (resource != null) {
- try {
- // Perform resource unload, either memory optimized or normally
- if (memoryOptimized) {
- ExtendedResource extendedResource = ExtendedResourceAdapterFactory.INSTANCE.adapt(resource);
- if (extendedResource != null) {
- Map<Object, Object> defaultLoadOptions = extendedResource.getDefaultLoadOptions();
- defaultLoadOptions.put(ExtendedResource.OPTION_UNLOAD_MEMORY_OPTIMIZED, Boolean.TRUE);
- }
- }
- resource.unload();
- } catch (Exception ex) {
- throw new WrappedException(ex);
- } finally {
- // Remove resource from ResourceSet
- ResourceSet resourceSet = resource.getResourceSet();
- if (resourceSet != null) {
- resourceSet.getResources().remove(resource);
- }
- }
- }
- }
-
- /**
- * Unloads the resource with the specified URI from the given resource set.
- *
- * @param resourceSet
- * A resource set from which the model's resource should be unloaded.
- * @param uri
- * The URI of the resource to unload.
- */
- public static void unloadResource(ResourceSet resourceSet, URI uri) {
- unloadResource(resourceSet, uri, false);
- }
-
- /**
- * Unloads the resource with the specified URI from the given resource set.
- * <p>
- * It is recommended to call this method inside a write-transaction (see
- * {@link EcorePlatformUtil#unloadFile(ResourceSet, IPath)}).
- *
- * @param resourceSet
- * A resource set from which the model's resource should be unloaded.
- * @param uri
- * The URI of the resource to unload.
- * @param memoryOptimized
- * Will activate the memory optimization option for unloading the resource. This is only available if the
- * resource is an XMLResource.
- */
- public static void unloadResource(ResourceSet resourceSet, URI uri, boolean memoryOptimized) {
- if (resourceSet != null && uri != null) {
- // Get resource and unload it
- Resource resource = resourceSet.getResource(uri, false);
- unloadResource(resource, memoryOptimized);
- }
- }
-
- /**
- * Parses {@link Resource resource} with given {@link URI uri} and validates it against XSD schema with specified
- * {@link URL url}. Raises an exception if the {@link Resource resource}'s content is not compliant with respect to
- * XSD schema.
- *
- * @param uri
- * The {@link URI uri} of the {@link Resource resource} to be validated.
- * @param schemaURL
- * The {@link URL url} of the XSD schema to be used for validation.
- * @throws SAXException
- * @throws IOException
- */
- public static void validate(URI uri, URL schemaURL) throws SAXException, IOException {
- Assert.isNotNull(uri);
-
- // 1. Lookup a factory for the W3C XML Schema language
- SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
-
- // 2. Compile the schema
- Schema schema = factory.newSchema(schemaURL);
-
- // 3. Get a validator from the schema
- Validator validator = schema.newValidator();
-
- // 4. Load the resource and validate it
- InputStream stream = null;
- try {
- stream = URIConverter.INSTANCE.createInputStream(uri);
- Source source = new StreamSource(stream);
- validator.validate(source);
- } finally {
- ExtendedPlatform.safeClose(stream);
- }
- }
-
- /**
- * Loads from resource set the resource specified by the given URI, or try to load the URI if not in resource set.
- *
- * @param resourceSet
- * The resource set into which model resource must be loaded.
- * @param uri
- * The URI to resolve; <em>i.e.</em> the URI of the model resource to load.
- * @param options
- * The loading options.
- * @param loadOnDemand
- * If <code>true</code>, creates and loads the resource if it does not already exist.
- * @return The resource resolved by the specified URI, or <code>null</code> if there is not one and it is not being
- * demand loaded.
- */
- private static Resource loadModelResource(ResourceSet resourceSet, URI uri, Map<?, ?> options, boolean loadOnDemand) {
- Assert.isNotNull(uri);
-
- // Create new ResourceSet if none has been provided
- if (resourceSet == null) {
- resourceSet = new ScopingResourceSetImpl();
- }
-
- // Try to convert given URI to platform:/resource URI if not yet so
- /*
- * !! Important Note !! This is necessary in order to avoid that resources which are located inside the
- * workspace get loaded multiple times just because they are referenced by URIs with different schemes. If given
- * resource set were an instance of ResourceSetImpl this extra conversion wouldn't be necessary.
- * org.eclipse.emf.ecore.resource.ResourceSet.getResource(URI, boolean) normalizes and compares given URI and to
- * normalized copies of URIs of already present resources and thereby avoids multiple loading of same resources
- * on its own. This is however not true when ExtendedResourceSetImpl or a subclass of it is used. Herein, URI
- * normalization and comparison has been removed from
- * org.eclipse.sphinx.emf.resource.ExtendedResourceSetImpl.getResource(URI, boolean) in order to increase
- * runtime performance.
- */
- if (!uri.isPlatform()) {
- uri = convertToPlatformResourceURI(uri);
- }
-
- // Just get model resource if it is already loaded
- Resource resource = resourceSet.getResource(uri, false);
-
- // Load it using specified options if not done so yet and a demand load has been requested
- if ((resource == null || !resource.isLoaded()) && loadOnDemand) {
- if (exists(uri)) {
- if (resource == null) {
- String contentType = getContentTypeId(uri);
- resource = resourceSet.createResource(uri, contentType);
- }
- if (resource != null) {
- try {
- // Capture errors and warnings encountered during resource creation
- /*
- * !! Important note !! This is necessary because the resource's errors and warnings are
- * automatically cleared when the loading begins. Therefore, if we don't retrieve them at this
- * point all previously encountered errors and warnings would be lost (see
- * org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(InputStream, Map<?, ?>) for details)
- */
- List<Diagnostic> creationErrors = new ArrayList<Diagnostic>(resource.getErrors());
- List<Diagnostic> creationWarnings = new ArrayList<Diagnostic>(resource.getWarnings());
-
- // Load resource
- resource.load(options);
-
- // Make sure that no empty resources are kept in resource set
- if (resource.getContents().isEmpty()) {
- unloadResource(resource, true);
- }
-
- // Restore creation time errors and warnings
- resource.getErrors().addAll(creationErrors);
- resource.getWarnings().addAll(creationWarnings);
- } catch (IOException ex) {
- // Capture errors and warnings encountered during resource load attempt
- /*
- * !! Important note !! This is necessary because the resource's errors and warnings are
- * automatically cleared when it gets unloaded. Therefore, if we don't retrieve them at this
- * point all encountered errors and warnings encountered during loading would be lost (see
- * org.eclipse.emf.ecore.resource.impl.ResourceImpl.doUnload() for details)
- */
- List<Diagnostic> loadErrors = new ArrayList<Diagnostic>(resource.getErrors());
- List<Diagnostic> loadWarnings = new ArrayList<Diagnostic>(resource.getWarnings());
-
- // Make sure that resource gets unloaded and removed from resource set again
- try {
- unloadResource(resource, true);
- } catch (Exception e) {
- // Log unload problem in Error Log but don't let it go along as runtime exception. It is
- // most likely just a consequence of the load problems encountered before and therefore
- // should not prevent those from being restored as errors and warnings on resource.
- PlatformLogUtil.logAsError(Activator.getPlugin(), e);
- }
-
- // Restore load time errors and warnings on resource
- resource.getErrors().addAll(loadErrors);
- resource.getWarnings().addAll(loadWarnings);
-
- // Re-throw exception
- throw new WrappedException(ex);
- }
- }
- }
- }
- return resource;
- }
-
- /**
- * Loads the model from the resource specified by the given URI and returns its root element.
- *
- * @param resourceSet
- * The resource set into which model resource must be loaded.
- * @param uri
- * The URI to resolve; <em>i.e.</em> the URI of the model resource to load.
- * @param options
- * The load options. If <code>null</code>, default loading options are used.
- * @param loadOnDemand
- * If <code>true</code>, creates and loads the resource if it does not already exist.
- * @return The root of the loaded model; can be <code>null</code> if resource is not loaded resource set.
- */
- private static EObject loadModelRoot(ResourceSet resourceSet, URI uri, Map<?, ?> options, boolean loadOnDemand) {
- // Use default loading options when no specified
- if (options == null) {
- options = getDefaultLoadOptions();
- }
-
- // Load resource from resource set
- Resource resource = loadModelResource(resourceSet, uri, options, loadOnDemand);
-
- // Obtain and return resource content
- return getModelRoot(resource);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/WorkspaceEditingDomainUtil.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/WorkspaceEditingDomainUtil.java
deleted file mode 100644
index 0cdfaa2404d..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/WorkspaceEditingDomainUtil.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2008-2010 See4sys, BMW Car IT and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * See4sys - Initial API and implementation
- * BMW Car IT - Added/Updated javadoc
- *
- * </copyright>
- */
-package org.eclipse.papyrus.emf.compare.transactional.editor.sphinx;
-
-import java.util.Collection;
-import java.util.Collections;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.edit.provider.IWrapperItemProvider;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.sphinx.emf.domain.IContainerEditingDomainProvider;
-import org.eclipse.sphinx.emf.edit.TransientItemProvider;
-import org.eclipse.sphinx.emf.metamodel.IMetaModelDescriptor;
-import org.eclipse.sphinx.emf.model.IModelDescriptor;
-
-/**
- * This utility class is intended to retrieve an {@linkplain EditingDomain} in various ways.
- */
-public final class WorkspaceEditingDomainUtil {
-
- // Prevent from instantiation
- private WorkspaceEditingDomainUtil() {
- }
-
- /**
- * Returns the {@link TransactionalEditingDomain editing domain} which currently contains the given {@link IFile
- * file} in its {@link ResourceSet resource set}.
- *
- * @param file
- * The {@link IFile file} whose current {@link TransactionalEditingDomain editing domain} is to be
- * retrieved.
- * @return The {@link TransactionalEditingDomain editing domain} which contains the given {@link IFile file}, or
- * <code>null</code> if given {@link IFile file} isn't contained in any {@link TransactionalEditingDomain
- * editing domain}.
- */
- public static TransactionalEditingDomain getCurrentEditingDomain(IFile file) {
- for (TransactionalEditingDomain editingDomain : getEditingDomains(ResourcesPlugin.getWorkspace().getRoot())) {
- if (EcorePlatformUtil.isFileLoaded(editingDomain, file)) {
- return editingDomain;
- }
- }
- return null;
- }
-
- /**
- * Returns the {@link TransactionalEditingDomain editing domain} to which the given {@link IFile file} is mapped.
- * The mapped {@link TransactionalEditingDomain editing domain} is the {@link TransactionalEditingDomain editing
- * domain} which is used as target when loading the {@link IFile file} from the workspace.
- * <p>
- * Even though the mapped {@link TransactionalEditingDomain editing domain} represents the primary
- * {@link TransactionalEditingDomain editing domain} for the given {@link IFile file} it still may happen that the
- * {@link IFile file} gets loaded in another or "foreign" {@link TransactionalEditingDomain editing domain}. Typical
- * reasons for this are e.g. lazy loading of one file from multiple other files which are in different
- * {@link TransactionalEditingDomain editing domain}s or programatic action by some application.
- * <p>
- *
- * @param file
- * The {@link IFile file} whose mapped {@link TransactionalEditingDomain editing domain} is to be
- * retrieved.
- * @return The {@link TransactionalEditingDomain editing domain} to which the given {@link IFile file} is mapped, or
- * <code>null</code> if given {@link IFile file} isn't mapped to any {@link TransactionalEditingDomain
- * editing domain}.
- */
- public static TransactionalEditingDomain getMappedEditingDomain(IFile file) {
- if (file != null) {
- IEditingDomainProvider provider = (IEditingDomainProvider) Platform.getAdapterManager().loadAdapter(file,
- IEditingDomainProvider.class.getName());
- if (provider != null) {
- EditingDomain editingDomain = provider.getEditingDomain();
- if (editingDomain instanceof TransactionalEditingDomain) {
- return (TransactionalEditingDomain) editingDomain;
- }
- }
- }
- return null;
- }
-
- /**
- * Retrieves the {@link TransactionalEditingDomain editing domain} which the given {@link Object object} belongs to.
- * The following types of {@link Object object}s are supported:
- * <p>
- * <ul>
- * <li>{@linkplain EObject}</li>
- * <li>{@linkplain FeatureMap.Entry}</li>
- * <li>{@linkplain IEditingDomainProvider}</li>
- * <li>{@linkplain IFile}</li>
- * <li>{@linkplain IModelDescriptor}</li>
- * <li>{@linkplain IWrapperProviderItem}</li>
- * <li>{@linkplain Resource}</li>
- * <li>{@linkplain ResourceSet}</li>
- * <li>{@linkplain Transaction}</li>
- * <li>{@linkplain TransactionalEditingDomain}</li>
- * <li>{@linkplain URI}</li>
- * </ul>
- * <p>
- * Note that it is not possible to obtain a single {@link TransactionalEditingDomain editing domain} from a
- * {@linkplain IContainer}. You can however retrieve the collection of {@link TransactionalEditingDomain editing
- * domain}s available on a {@linkplain IContainer} by calling {@linkplain #getEditingDomains(IContainer)}.
- *
- * @param object
- * The object whose corresponding {@link TransactionalEditingDomain editing domain} must be returned.
- * @return The EditingDomain the <code>object</code> corresponds with or <code>null</code> if the
- * <code>object</code> cannot be mapped to an {@link TransactionalEditingDomain editing domain}.
- * @see org.eclipse.sphinx.emf.workspace.domain.WorkspaceEditingDomainManager#getEditingDomainMapping()
- * @see #getEditingDomains(IContainer)
- */
- public static TransactionalEditingDomain getEditingDomain(Object object) {
- if (object instanceof IModelDescriptor) {
- return getEditingDomain((IModelDescriptor) object);
- } else if (object instanceof IFile) {
- return getEditingDomain((IFile) object);
- } else if (object instanceof URI) {
- return getEditingDomain((URI) object);
- } else if (object instanceof Resource) {
- // If resource is not yet or not anymore in a resource set, then try to figure out which editing domain it
- // would belong to if it were in a resource set
- Resource resource = (Resource) object;
- if (resource.getResourceSet() == null) {
- return getEditingDomain(EcorePlatformUtil.getFile(resource));
- }
- } else if (object instanceof IWrapperItemProvider) {
- return getEditingDomain((IWrapperItemProvider) object);
- } else if (object instanceof FeatureMap.Entry) {
- return getEditingDomain((FeatureMap.Entry) object);
- } else if (object instanceof TransientItemProvider) {
- return getEditingDomain((TransientItemProvider) object);
- }
-
- return object != null ? TransactionUtil.getEditingDomain(object) : null;
- }
-
- /**
- * Retrieves the {@link TransactionalEditingDomain editing domain} behind given {@link IModelDescriptor model
- * descriptor}.
- *
- * @param modelDescriptor
- * The {@link IModelDescriptor model descriptor} whose {@link TransactionalEditingDomain editing domain}
- * is to be retrieved.
- * @return The {@link TransactionalEditingDomain editing domain} behind given {@link IModelDescriptor model
- * descriptor} or <code>null</code> if no such could be retrieved.
- */
- public static TransactionalEditingDomain getEditingDomain(IModelDescriptor modelDescriptor) {
- if (modelDescriptor != null) {
- return modelDescriptor.getEditingDomain();
- }
- return null;
- }
-
- /**
- * Retrieves the {@link TransactionalEditingDomain editing domain} corresponding to the given {@link IFile file}.
- * Tries at first to determine the {@link TransactionalEditingDomain editing domain} which currently contains the
- * given {@link IFile file} in its {@link ResourceSet resource set} and returns it if successful. Otherwise, the
- * {@link TransactionalEditingDomain editing domain} to which the given {@link IFile file} is mapped is returned.
- *
- * @param file
- * The {@link IFile file} whose {@link TransactionalEditingDomain is to be retrieved}.
- * @return The {@link TransactionalEditingDomain editing domain} the given file belongs to, or <code>null</code> if
- * given {@link IFile file} doesn't belong to any {@link TransactionalEditingDomain editing domain}.
- * @see #getCurrentEditingDomain(IFile)
- * @see #getMappedEditingDomain(IFile)
- */
- public static TransactionalEditingDomain getEditingDomain(IFile file) {
- TransactionalEditingDomain editingDomain = getCurrentEditingDomain(file);
- if (editingDomain != null) {
- return editingDomain;
- }
- return getMappedEditingDomain(file);
- }
-
- /**
- * Retrieves the EditingDomain by a URI. Consults the active mapping to map a resource to its
- * {@link TransactionalEditingDomain editing domain}.
- *
- * @param uri
- * An URI (file, EMF Object's URI)
- * @return The {@link TransactionalEditingDomain editing domain} associated with the given URI. Returns
- * <code>null</code> if the URI cannot be resolved to workspace file or no
- * {@link TransactionalEditingDomain editing domain} can be mapped through the active mapping.
- */
- public static TransactionalEditingDomain getEditingDomain(URI uri) {
- IFile file = EcorePlatformUtil.getFile(uri);
- return getEditingDomain(file);
- }
-
- /**
- * Retrieves the {@link TransactionalEditingDomain editing domain} corresponding to the object wrapped in the given
- * IWrapperItemProvider.
- *
- * @param wrapperItemProvider
- * The IWrapperItemProvider wrapping the Object for which the {@link TransactionalEditingDomain editing
- * domain} is to be retrieved.
- * @return The {@link TransactionalEditingDomain editing domain} the wrapped Object is associated with or
- * <code>null</code> if the Object cannot be mapped to an {@link TransactionalEditingDomain editing domain}.
- */
- public static TransactionalEditingDomain getEditingDomain(IWrapperItemProvider wrapperItemProvider) {
- if (wrapperItemProvider != null) {
- Object unwrapped = AdapterFactoryEditingDomain.unwrap(wrapperItemProvider);
- TransactionalEditingDomain editingDomain = getEditingDomain(unwrapped);
- if (editingDomain != null) {
- return editingDomain;
- }
- return getEditingDomain(wrapperItemProvider.getOwner());
- }
- return null;
- }
-
- /**
- * Returns the {@link TransactionalEditingDomain editing domain} for the value Object of the given FeatureMap.Entry.
- *
- * @param entry
- * A FeatureMap.Entry holding the Object for which the {@link TransactionalEditingDomain editing domain}
- * is to be retrieved.
- * @return The EditingDomain the Object held by the given <code>entry</entry> corresponds with or <code>null</code>
- * if the Object cannot be mapped to an {@link TransactionalEditingDomain editing domain}.
- */
- public static TransactionalEditingDomain getEditingDomain(FeatureMap.Entry entry) {
- Object unwrapped = AdapterFactoryEditingDomain.unwrap(entry);
- return getEditingDomain(unwrapped);
- }
-
- /**
- * Returns the {@link TransactionalEditingDomain editing domain} for the value Object of the given
- * ItemProviderAdapter.
- *
- * @param provider
- * An ItemProviderAdapter holding the Object for which the {@link TransactionalEditingDomain editing
- * domain} is to be retrieved.
- * @return The EditingDomain the Target held by the given
- * <code>provider</entry> corresponds with or <code>null</code> if the Object cannot be mapped to an
- * {@link TransactionalEditingDomain editing domain}.
- */
- public static TransactionalEditingDomain getEditingDomain(TransientItemProvider provider) {
- Object target = provider.getTarget();
- return getEditingDomain(target);
- }
-
- /**
- * Retrieves the {@link TransactionalEditingDomain editing domain} corresponding to the specified meta-model
- * descriptor for the given context container.
- *
- * @param container
- * The container to consider as context object in order to retrieve the right
- * {@link TransactionalEditingDomain editing domain}.
- * @param mmDescriptor
- * A meta-model descriptor.
- * @return The {@link TransactionalEditingDomain editing domain} for the specified meta-model descriptor and the
- * specified context container or <code>null</code> if it cannot be mapped to any
- * {@link TransactionalEditingDomain editing domain}.
- */
- public static TransactionalEditingDomain getEditingDomain(IContainer container, IMetaModelDescriptor mmDescriptor) {
- if (container != null) {
- IContainerEditingDomainProvider provider = (IContainerEditingDomainProvider) Platform.getAdapterManager().loadAdapter(container,
- IContainerEditingDomainProvider.class.getName());
- if (provider != null) {
- return provider.getEditingDomain(mmDescriptor);
- }
- }
- return null;
- }
-
- /**
- * Returns all {@link TransactionalEditingDomain editing domain}s in the given {@link IContainer container} (i.e.
- * {@link IWorkspaceRoot workspace root}, {@link IProject project} or {@link IFolder folder}).
- *
- * @return The collection of {@link TransactionalEditingDomain editing domain}s in given {@link IContainer
- * container}.
- */
- public static Collection<TransactionalEditingDomain> getEditingDomains(IContainer container) {
- IContainerEditingDomainProvider provider = (IContainerEditingDomainProvider) Platform.getAdapterManager().loadAdapter(container,
- IContainerEditingDomainProvider.class.getName());
- if (provider != null) {
- return provider.getEditingDomains();
- }
- return Collections.emptyList();
- }
-
- /**
- * Returns all {@link TransactionalEditingDomain editing domain}s that exist in the workspace.
- * <p>
- * This is a convenience method, fully equivalent to:
- *
- * <pre>
- * WorkspaceEditingDomainUtil.getEditingDomains(ResourcesPlugin.getWorkspace().getRoot());
- * </pre>
- *
- * </p>
- * * @return The collection of {@link TransactionalEditingDomain editing domain}s in the workspace.
- */
- public static Collection<TransactionalEditingDomain> getAllEditingDomains() {
- return getEditingDomains(ResourcesPlugin.getWorkspace().getRoot());
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/WorkspaceTransactionUtil.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/WorkspaceTransactionUtil.java
deleted file mode 100644
index df0d6dba57e..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/sphinx/WorkspaceTransactionUtil.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2008-2010 See4sys, BMW Car IT and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * See4sys - Initial API and implementation
- * BMW Car IT - Added/Updated javadoc
- *
- * </copyright>
- */
-package org.eclipse.papyrus.emf.compare.transactional.editor.sphinx;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.OperationHistoryFactory;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.transaction.Transaction;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.TransactionImpl;
-import org.eclipse.emf.workspace.AbstractEMFOperation;
-import org.eclipse.emf.workspace.IWorkspaceCommandStack;
-import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl;
-import org.eclipse.osgi.util.NLS;
-
-/**
- * An utility class providing helper methods for handling and executing transactions on an EMF model.
- */
-public final class WorkspaceTransactionUtil {
-
- // Prevent from instantiation
- private WorkspaceTransactionUtil() {
- }
-
- /**
- * Returns the IOperationHistory for the given EditingDomain.
- *
- * @param editingDomain
- * The EditingDomain for which the IOperationHistory is to be retrieved.
- * @return The IOperationHistory of the given <code>edingDomain</code>.
- */
- public static IOperationHistory getOperationHistory(TransactionalEditingDomain editingDomain) {
- if (editingDomain != null) {
- CommandStack commandStack = editingDomain.getCommandStack();
- if (commandStack instanceof IWorkspaceCommandStack) {
- return ((IWorkspaceCommandStack) commandStack).getOperationHistory();
- }
- }
- return OperationHistoryFactory.getOperationHistory();
- }
-
- /**
- * Returns the IUndoContext for the given EditingDomain.
- *
- * @param editingDomain
- * The EditingDomain for which the IUndoContext is to be retrieved.
- * @return The IUndoContext of the given <code>edingDomain</code>.
- */
- public static IUndoContext getUndoContext(TransactionalEditingDomain editingDomain) {
- if (editingDomain != null) {
- CommandStack commandStack = editingDomain.getCommandStack();
- if (commandStack instanceof WorkspaceCommandStackImpl) {
- return IOperationHistory.GLOBAL_UNDO_CONTEXT;
- }
- }
- return (IUndoContext) ResourcesPlugin.getWorkspace().getAdapter(IUndoContext.class);
- }
-
- /**
- * Returns a default set of options which can be used for executing an operation within a transaction.
- *
- * @return The default options for executing an operation in a transaction.
- */
- public static Map<String, Object> getDefaultTransactionOptions() {
- Map<String, Object> options = new HashMap<String, Object>();
- options.put(TransactionImpl.BLOCK_CHANGE_PROPAGATION, Boolean.TRUE);
- options.put(Transaction.OPTION_NO_VALIDATION, Boolean.TRUE);
- return options;
- }
-
- /**
- * Returns a default set of options which can be used for executing an operation saving a new model within a write
- * transaction.
- *
- * @return The default options for executing a save new operation in a transaction.
- */
- public static Map<String, Object> getDefaultSaveNewTransactionOptions() {
- Map<String, Object> options = WorkspaceTransactionUtil.getDefaultTransactionOptions();
- options.put(Transaction.OPTION_NO_UNDO, Boolean.TRUE);
- return options;
- }
-
- /**
- * Returns a default set of options which can be used for executing an operation saving an existing model within a
- * write transaction.
- *
- * @return The default options for executing a save operation in a transaction.
- */
- public static Map<String, Object> getDefaultSaveTransactionOptions() {
- Map<String, Object> options = WorkspaceTransactionUtil.getDefaultTransactionOptions();
- options.put(Transaction.OPTION_NO_UNDO, Boolean.TRUE);
- options.put(Transaction.OPTION_NO_NOTIFICATIONS, Boolean.TRUE);
- options.put(Transaction.OPTION_NO_TRIGGERS, Boolean.TRUE);
- return options;
- }
-
- /**
- * Executes a write operation in a write transaction .
- *
- * @param editingDomain
- * The Transactional Editing domain receiving the transaction .
- * @param runnable
- * The runnable defining the run method .
- * @param operationLabel
- * The label of the operation to execute .
- * @throws OperationCanceledException
- * Thrown when the transaction is cancelled by the user.
- * @throws ExecutionException
- * Thrown when the transaction could not be completed to an Exception.
- **/
- public static void executeInWriteTransaction(TransactionalEditingDomain editingDomain, Runnable runnable, String operationLabel)
- throws OperationCanceledException, ExecutionException {
- executeInWriteTransaction(editingDomain, runnable, operationLabel, getOperationHistory(editingDomain), getDefaultTransactionOptions(), null);
- }
-
- /**
- * Execute a write operation in a write transaction.
- *
- * @param editingDomain
- * The {@linkplain TransactionalEditingDomain editing domain} receiving the transaction.
- * @param runnable
- * The {@linkplain Runnable runnable} defining the run method.
- * @param operationLabel
- * The label of the operation to execute.
- * @param operationHistory
- * The {@linkplain IOperationHistory operation history} to store the executed operation.
- * @param transactionOptions
- * The options to set the transaction.
- * @param monitor
- * The {@linkplain IProgressMonitor progress monitor} to use during operation execution.
- * @throws OperationCanceledException
- * Thrown when the transaction is canceled by the user.
- * @throws ExecutionException
- * Thrown when the transaction could not be completed to an Exception.
- * @since 0.7.0
- **/
- public static void executeInWriteTransaction(TransactionalEditingDomain editingDomain, final Runnable runnable, final String operationLabel,
- IOperationHistory operationHistory, final Map<String, Object> transactionOptions, IProgressMonitor monitor)
- throws OperationCanceledException, ExecutionException {
- Assert.isNotNull(editingDomain);
- Assert.isNotNull(runnable);
-
- String safeLabel = operationLabel == null ? "Unnamed operation" : operationLabel; //$NON-NLS-1$
- IUndoableOperation operation = new AbstractEMFOperation(editingDomain, safeLabel, transactionOptions) {
- @Override
- protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- try {
- runnable.run();
- return Status.OK_STATUS;
- } catch (RuntimeException ex) {
- if (ex instanceof OperationCanceledException) {
- throw (OperationCanceledException) ex;
- } else {
- throw new ExecutionException(NLS.bind(" {0} transaction failed", operationLabel), ex);
- //throw new ExecutionException(NLS.bind(Messages.problem_transactionFailed, operationLabel), ex);
- }
- }
- }
-
- @Override
- public boolean canUndo() {
- return transactionOptions.get(Transaction.OPTION_NO_UNDO) != Boolean.TRUE;
- }
- };
- // Perform the execution of the transaction.
- IStatus status = operationHistory.execute(operation, monitor, null);
-
- if (status.getSeverity() == IStatus.CANCEL) {
- throw new OperationCanceledException();
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/PapyrusCompareAction.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/PapyrusCompareAction.java
deleted file mode 100644
index a5513ef71fb..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/PapyrusCompareAction.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.emf.compare.transactional.editor.v2;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.compare.*;
-import org.eclipse.compare.internal.CompareUIPlugin;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.papyrus.emf.compare.transactional.editor.Activator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.team.internal.ui.TeamUIMessages;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-import org.eclipse.team.internal.ui.history.CompareFileRevisionEditorInput;
-import org.eclipse.team.internal.ui.synchronize.SaveablesCompareEditorInput;
-import org.eclipse.ui.*;
-
-/**
- *
- * Duplicate code from TeamAction
- *
- */
-public class PapyrusCompareAction extends TeamAction {
-
-
-
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
-
- IResource[] selectedResources = getSelectedResources();
-
- ITypedElement ancestor = null;
- ITypedElement left = null;
- ITypedElement right = null;
-
- if(selectedResources.length == 2) {
- if(selectedResources[0] != null)
- left = getElementFor(selectedResources[0]);
-
- if(selectedResources[1] != null)
- right = getElementFor(selectedResources[1]);
-
- } else if(selectedResources.length == 3) {
- // prompt for ancestor
- SelectAncestorDialog dialog = new SelectAncestorDialog(getShell(), selectedResources);
- int code = dialog.open();
- if(code != Window.OK)
- return;
-
- ancestor = getElementFor(dialog.ancestorResource);
- left = getElementFor(dialog.leftResource);
- right = getElementFor(dialog.rightResource);
- } else {
- return;
- }
- openInCompare(ancestor, left, right);
- }
-
- private void openInCompare(ITypedElement ancestor, ITypedElement left, ITypedElement right) {
-
- IWorkbenchPage workBenchPage = getTargetPage();
- CompareEditorInput input = new PapyrusSaveablesCompareEditorInput(ancestor, left, right, workBenchPage) ;
-
- try {
- workBenchPage.openEditor(input, "org.eclipse.papyrus.emf.compare.transactional.editor", true);
- } catch (PartInitException e) {
- Activator.log.error(e);
- }
- }
-
- public boolean isEnabled() {
- int l = getSelectedResources().length;
- return l == 2 || l == 3;
- }
-
- private ITypedElement getElementFor(IResource resource) {
- return SaveablesCompareEditorInput.createFileElement((IFile)resource);
- }
-
- // see
- // org.eclipse.compare.internal.ResourceCompareInput.SelectAncestorDialog
- private class SelectAncestorDialog extends MessageDialog {
-
- private IResource[] theResources;
-
- IResource ancestorResource;
-
- IResource leftResource;
-
- IResource rightResource;
-
- private Button[] buttons;
-
- public SelectAncestorDialog(Shell parentShell, IResource[] theResources) {
- super(parentShell, TeamUIMessages.SelectAncestorDialog_title, null, TeamUIMessages.SelectAncestorDialog_message, MessageDialog.QUESTION, new String[]{ IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
- this.theResources = theResources;
- }
-
- protected Control createCustomArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- buttons = new Button[3];
- for(int i = 0; i < 3; i++) {
- buttons[i] = new Button(composite, SWT.RADIO);
- buttons[i].addSelectionListener(selectionListener);
- buttons[i].setText(NLS.bind(TeamUIMessages.SelectAncestorDialog_option, theResources[i].getFullPath().toPortableString()));
- buttons[i].setFont(parent.getFont());
- // set initial state
- buttons[i].setSelection(i == 0);
- }
- pickAncestor(0);
- return composite;
- }
-
- private void pickAncestor(int i) {
- ancestorResource = theResources[i];
- leftResource = theResources[i == 0 ? 1 : 0];
- rightResource = theResources[i == 2 ? 1 : 2];
- }
-
- private SelectionListener selectionListener = new SelectionAdapter() {
-
- public void widgetSelected(SelectionEvent e) {
- Button selectedButton = (Button)e.widget;
- if(!selectedButton.getSelection())
- return;
- for(int i = 0; i < 3; i++)
- if(selectedButton == buttons[i])
- pickAncestor(i);
- }
- };
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/PapyrusSaveablesCompareEditorInput.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/PapyrusSaveablesCompareEditorInput.java
deleted file mode 100644
index a698971b702..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/PapyrusSaveablesCompareEditorInput.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.papyrus.emf.compare.transactional.editor.v2;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.CompareViewerPane;
-import org.eclipse.compare.CompareViewerSwitchingPane;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.internal.CompareStructureViewerSwitchingPane;
-import org.eclipse.compare.structuremergeviewer.IDiffContainer;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.emf.compare.transactional.editor.Activator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.internal.ui.synchronize.SaveablesCompareEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.Saveable;
-
-
-public class PapyrusSaveablesCompareEditorInput extends SaveablesCompareEditorInput {
-
- private String TRANSACTIONAL_COMPARE_EDITOR_IMAGE_PATH = "icons/papyrus_compare_editor.gif";
-private ITypedElement left;
-
-//TODO create an interface?
-public ITypedElement getLeft() {
- return left;
-}
-
-
-//TODO create an interface?
-public ITypedElement getRight() {
- return right;
-}
-
-
-
-private ITypedElement right;
- public PapyrusSaveablesCompareEditorInput(ITypedElement ancestor, ITypedElement left, ITypedElement right, IWorkbenchPage page) {
- super(ancestor, left, right, page);
- this.left = left;
- this.right = right;
- }
-
-
-
- protected Image fgTitleImage;
-
-
- public Image getTitleImage() {
- if(fgTitleImage == null) {
- fgTitleImage = Activator.getImage(TRANSACTIONAL_COMPARE_EDITOR_IMAGE_PATH);
- }
- return fgTitleImage;
- }
-
-
- public ImageDescriptor getImageDescriptor() {
- return ImageDescriptor.createFromImage(getTitleImage());
- }
-
- public String getToolTipText() {
- return getTitle();
- }
-
- public String getTitle() {
- String title = super.getTitle();
- return title.replaceFirst("Compare", "PapyrusCompare");
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/TransactionalActionBarContributor.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/TransactionalActionBarContributor.java
deleted file mode 100644
index bbc3cd56bac..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/TransactionalActionBarContributor.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.papyrus.emf.compare.transactional.editor.v2;
-
-import java.awt.color.ProfileDataException;
-import java.util.EventObject;
-import java.util.Set;
-import java.util.jar.Manifest;
-
-import org.eclipse.core.commands.operations.IOperationHistoryListener;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.OperationHistoryEvent;
-import org.eclipse.emf.common.command.CommandStackListener;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.ResourceUndoContext;
-import org.eclipse.sphinx.emf.compare.ui.editor.ModelCompareEditor;
-import org.eclipse.sphinx.emf.compare.ui.internal.Activator;
-import org.eclipse.sphinx.emf.util.WorkspaceEditingDomainUtil;
-import org.eclipse.sphinx.platform.util.PlatformLogUtil;
-import org.eclipse.ui.IEditorPart;
-
-
-public class TransactionalActionBarContributor extends EditingDomainActionBarContributor {
-
- //TODO useful?
-//not used!
- protected IOperationHistoryListener historyListener;
-
- public void init(org.eclipse.ui.IActionBars actionBars) {
- super.init(actionBars);
- historyListener = createOperationHistoryListener();
-
- }
-
- /**
- * Creates the {@linkplain IOperationHistoryListener operation history listener} that is responsible for setting
- * editing domain on <em>undo</em>/<em>redo</em> actions as soon as an operation (on the command stack of that
- * precise editing domain) has been finished.
- *
- * @return The {@linkplain IOperationHistoryListener operation history listener} to add on the concerned editing
- * domain's command stack.
- */
- protected IOperationHistoryListener createOperationHistoryListener() {
- return new IOperationHistoryListener() {
-
- public void historyNotification(OperationHistoryEvent event) {
- if(event.getEventType() == OperationHistoryEvent.DONE || event.getEventType() == OperationHistoryEvent.UNDONE || event.getEventType() == OperationHistoryEvent.REDONE) {
- undoAction.update();
- redoAction.update();
- // IUndoContext[] contexts = event.getOperation().getContexts();
- // for (IUndoContext context : contexts) {
- // if (ModelCompareEditor.ID.equals(context.getLabel())) {
- // Set<Resource> affectedResources = ResourceUndoContext.getAffectedResources(event.getOperation());
- // TransactionalEditingDomain editingDomain = null;
- // for (Resource resource : affectedResources) {
- // TransactionalEditingDomain domain = WorkspaceEditingDomainUtil.getEditingDomain(resource);
- // if (editingDomain != null && editingDomain != domain) {
- // //
- // // !! Important Note !!
- // // For the moment, the case where two elements from different editing domain are
- // // compared is not really supported because we do not know very well the expected
- // // behavior of such a kind of comparison.
- // //
- // UnsupportedOperationException ex = new UnsupportedOperationException("Several editing domains"); //$NON-NLS-1$
- // PlatformLogUtil.logAsWarning(Activator.getPlugin(), ex);
- // editingDomain = null;
- // break;
- // } else {
- // editingDomain = domain;
- // }
- // }
- // if (editingDomain != null) {
- // // Set editing domain on Undo/Redo actions
- // if (undoAction != null) {
- // undoAction.setEditingDomain(editingDomain);
- // }
- // if (redoAction != null) {
- // redoAction.setEditingDomain(editingDomain);
- // }
- // }
- // break;
- // }
- // }
- }
- }
- };
- }
-
- private TransactionalEditingDomain domain;
-
- @Override
- public void activate() {
- IEditorPart part = getActiveEditor();
- if(part instanceof IEditingDomainProvider) {
- domain = (TransactionalEditingDomain)((IEditingDomainProvider)part).getEditingDomain();
- domain.getCommandStack().addCommandStackListener(new CommandStackListener() {
-
- public void commandStackChanged(EventObject event) {
- // TODO Auto-generated method stub
- undoAction.update();
- redoAction.update();
- //TODO : try to refresh the editor!
- //getActiveEditor().getEditorInput().
- }
- });
- }
- // TODO Auto-generated method stub
- super.activate();
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/TransactionalCompareEditor.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/TransactionalCompareEditor.java
deleted file mode 100644
index 7d7bac69752..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.emf.compare.transactional.editor/src/org/eclipse/papyrus/emf/compare/transactional/editor/v2/TransactionalCompareEditor.java
+++ /dev/null
@@ -1,428 +0,0 @@
-package org.eclipse.papyrus.emf.compare.transactional.editor.v2;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.internal.CompareEditor;
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.core.commands.operations.IOperationHistoryListener;
-import org.eclipse.core.commands.operations.IUndoContext;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.commands.operations.ObjectUndoContext;
-import org.eclipse.core.commands.operations.OperationHistoryEvent;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.edit.provider.AdapterFactoryItemDelegator;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.emf.workspace.IWorkspaceCommandStack;
-import org.eclipse.emf.workspace.ResourceUndoContext;
-import org.eclipse.papyrus.emf.compare.transactional.editor.Activator;
-import org.eclipse.sphinx.emf.workspace.ui.saving.BasicModelSaveablesProvider.SiteNotifyingSaveablesLifecycleListener;
-import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.ISaveablesLifecycleListener;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.SaveablesLifecycleEvent;
-
-
-@SuppressWarnings("restriction")
-//remove the warning for CompareEditor which is internal
-public class TransactionalCompareEditor extends CompareEditor implements IEditingDomainProvider/*,ICustomEditingDomainProvider/*implements IEditingDomainItemProvider*/{
-
- /**
- * The identifier of this editor (as contributed).
- */
- public static String ID = "org.eclipse.papyrus.emf.compare.transactional.editor";
-
- /**
- * The undo context for this compare editor.
- */
- protected IUndoContext undoContext;
-
- //TODO not used for the moment
- private IOperationHistoryListener affectedObjectsListener;
-
- /**
- * Default constructor.
- */
- public TransactionalCompareEditor() {
- // Create undo context
- undoContext = new ObjectUndoContext(this, ID);
- }
-
- @Override
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
-// super.init(site, input);
-
- // First do not keep duplicated editing domain entries
-// Set<TransactionalEditingDomain> editingDomains = new HashSet<TransactionalEditingDomain>();
-// for (TransactionalEditingDomain editingDomain : getEditingDomains()) {
-// if (editingDomain != null) {
-// editingDomains.add(editingDomain);
-// }
-// }
-// if (editingDomains.isEmpty()) {
-// Activator.log.error(new RuntimeException("Editing domain not found"));
-// }
-
- // Then creates and registers listeners on resulting editing domains
-// for (TransactionalEditingDomain editingDomain : editingDomains) {
-// //TODO
-// //addTransactionalEditingDomainListeners(editingDomain);
-// }
- }
-
- /**
- * @return An array of {@linkplain TransactionalEditingDomain editing domain}s which size is 2 and where at index 0
- * is editing domain from left, at index 1 is editing domain from right.
- */
- private TransactionalEditingDomain[] editingDomains ;
- public TransactionalEditingDomain[] getEditingDomains() {
- if(editingDomains==null){
- //TransactionalEditingDomain[] editingDomains = new TransactionalEditingDomain[2];
- editingDomains = new TransactionalEditingDomain[2];
- EObject[] modelRoots = getModelRoots();
-// IFile[] modelRoots = getModelRoots();
- if (modelRoots[0] != null) {
-// editingDomains[0] = WorkspaceEditingDomainUtil.getEditingDomain(modelRoots[0]);
-// System.out.println("editingDomain file 1 = " + editingDomains[0]);
- }
- if (modelRoots[1] != null) {
-// editingDomains[1] = WorkspaceEditingDomainUtil.getEditingDomain(modelRoots[1]);
-// System.out.println("editingDomain file 2 = " + editingDomains[1]);
- }
-// if (editingDomains[0] == null && editingDomains[1] == null) {
-// Activator.log.error(new RuntimeException("No editing domain found")); //$NON-NLS-1$
-// PlatformLogUtil.logAsError(Activator.getPlugin(), new RuntimeException("No editing domain found")); //$NON-NLS-1$
-// }
-
- //TODO
-// editingDomains[0] = new TransactionalE
- TransactionalEditingDomain editingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain();
- editingDomains[0] = editingDomain;
- editingDomains[1] = editingDomain;
- }
- return editingDomains;
- }
-
- /**
- * @return The root objects of the model part that are currently being compared in this editor or an empty array if
- * no such objects are available. Anyway, always returns an array of {@linkplain EObject}s which size is 2
- * and where at index 0 is the left root and at index 1 is the right root.
- */
- public EObject[] getModelRoots() {
-// public IFile[] getModelRoots() {
-// List<IFile>
- IFile[] files = new IFile[2];
- EObject[] modelRoots = new EObject[2];
- IEditorInput editorInput = getEditorInput();
- ITypedElement left = null;
- ITypedElement right = null;
-
- if(editorInput instanceof PapyrusSaveablesCompareEditorInput){
- left = ((PapyrusSaveablesCompareEditorInput)editorInput).getLeft();
- right = ((PapyrusSaveablesCompareEditorInput)editorInput).getRight();
- }else if(editorInput instanceof CompareEditorInput){
- //TODO manage other case?
- }
-
- if(left instanceof LocalResourceTypedElement){
- IResource res = ((LocalResourceTypedElement)left).getResource();
- if(res instanceof IFile){
- files[0] = (IFile)res;
- }
- }
-
- if(right instanceof LocalResourceTypedElement){
- IResource res = ((LocalResourceTypedElement)right).getResource();
- if(res instanceof IFile){
- files[1] = (IFile)res;
- }
- }
-
- return modelRoots;
-// return files;
- }
-
- //IEditingDomainProvider
-// public Collection<?> getChildren(Object object) {
-// // TODO Auto-generated method stub
-// return null;
-// }
-//
-// public Object getParent(Object object) {
-// // TODO Auto-generated method stub
-// return null;
-// }
-//
-// public Collection<?> getNewChildDescriptors(Object object, EditingDomain editingDomain, Object sibling) {
-// // TODO Auto-generated method stub
-// return null;
-// }
-//
-// public Command createCommand(Object object, EditingDomain editingDomain, Class<? extends Command> commandClass, CommandParameter commandParameter) {
-// // TODO Auto-generated method stub
-// return null;
-// }
-
-
- @Override
- public void dispose() {
- for (TransactionalEditingDomain editingDomain : getEditingDomains()) {
- if (editingDomain != null) {
- removeTransactionalEditingDomainListeners(editingDomain);
- }
- }
-
- for (IOperationHistory operationHistory : getOperationHistories()) {
- if (operationHistory != null) {
- operationHistory.dispose(getUndoContext(), true, true, true);
- }
- }
- super.dispose();
- }
-
- protected void addTransactionalEditingDomainListeners(TransactionalEditingDomain editingDomain) {
- if (editingDomain != null) {
- // Create and register IOperationHistoryListener that detects changed objects
- affectedObjectsListener = createAffectedObjectsListener();
- Assert.isNotNull(affectedObjectsListener);
- ((IWorkspaceCommandStack) editingDomain.getCommandStack()).getOperationHistory().addOperationHistoryListener(affectedObjectsListener);
- }
- }
-
- protected void removeTransactionalEditingDomainListeners(TransactionalEditingDomain editingDomain) {
- if (editingDomain != null) {
- if (affectedObjectsListener != null) {
- IOperationHistory operationHistory = ((IWorkspaceCommandStack) editingDomain.getCommandStack()).getOperationHistory();
- operationHistory.removeOperationHistoryListener(affectedObjectsListener);
- }
- }
- }
-
- /**
- * Creates and returns the {@linkplain IOperationHistoryListener listener} to add on the
- * {@linkplain IOperationHistory operation history} of {@linkplain TransactionalEditingDomain editing domain}'s
- * {@linkplain IWorkspaceCommandStack command stack}.
- * <p>
- * The listener's implementation that is provided here aims at updating {@linkplain IUndoableOperation operation}'s
- * context by first removing default {@linkplain IUndoContext undo context} and second by adding
- * {@linkplain IUndoContext undo context} encapsulated by this editor.
- * <p>
- * Clients may override this default implementation.
- *
- * @return The {@linkplain IOperationHistoryListener operation history listener} to register on the command stack of
- * the concerned editing domain.
- */
- protected IOperationHistoryListener createAffectedObjectsListener() {
- return new IOperationHistoryListener() {
-
- public void historyNotification(final OperationHistoryEvent event) {
- IUndoableOperation operation = event.getOperation();
- if (event.getEventType() == OperationHistoryEvent.ABOUT_TO_EXECUTE) {
- handleOperationAboutToExecute(operation);
- } else if (event.getEventType() == OperationHistoryEvent.DONE || event.getEventType() == OperationHistoryEvent.UNDONE
- || event.getEventType() == OperationHistoryEvent.REDONE) {
- Set<?> affectedResources = ResourceUndoContext.getAffectedResources(operation);
- Resource[] resources = getModelRootsResources();
- boolean isLeftResourceAffected = resources[0] != null ? affectedResources.contains(resources[0]) : false;
- boolean isRightResourceAffected = resources[1] != null ? affectedResources.contains(resources[1]) : false;
- if (isLeftResourceAffected || isRightResourceAffected) {
- handleOperationFinished(operation);
- }
- }
- }
-
- private void handleOperationAboutToExecute(final IUndoableOperation operation) {
- if (operation.canUndo()) {
- IWorkbenchPartSite site = getSite();
- if (site != null) {
- site.getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- if (isActivePart()) {
- Resource[] resources = getModelRootsResources();
- for (Resource resource : resources) {
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resource);
- if (editingDomain != null && editingDomain.getCommandStack() instanceof IWorkspaceCommandStack) {
- IWorkspaceCommandStack cmdStack = (IWorkspaceCommandStack) editingDomain.getCommandStack();
- IUndoContext defaultUndoContext = cmdStack.getDefaultUndoContext();
- if (defaultUndoContext != null) {
- // Remove default undo context and this editor's undo context
- operation.removeContext(defaultUndoContext);
- }
- }
- }
- operation.addContext(getUndoContext());
- }
- }
- });
- }
- }
- }
-
- private void handleOperationFinished(final IUndoableOperation operation) {
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- // Update editor part name
- // FIXME Not needed for the moment.
- // setPartName(getModelRootsNames());
- }
- });
- }
- };
- }
-
- /**
- * @return
- */
- public ISaveablesLifecycleListener createModelSaveablesLifecycleListener() {
- return new SiteNotifyingSaveablesLifecycleListener(this) {
- @Override
- public void handleLifecycleEvent(SaveablesLifecycleEvent event) {
- super.handleLifecycleEvent(event);
-
- if (event.getEventType() == SaveablesLifecycleEvent.DIRTY_CHANGED) {
- firePropertyChange(PROP_DIRTY);
- }
- }
- };
- }
-
- @Override
- public boolean isSaveOnCloseNeeded() {
- // Model-based editors don't need to be saved when being closed even if the model is dirty, because they don't
- // own the model. The model is loaded, managed, and saved globally, i.e. it is not destroyed but stays there
- // when editors are being closed.
- return false;
- }
-
- @Override
- public boolean isSaveAsAllowed() {
- // TODO Modify implementation as soon as saving as diff model would be available.
- return false;
- }
-
- @Override
- public Object getAdapter(@SuppressWarnings("rawtypes") Class key) {
- if (key.equals(IUndoContext.class)) {
- // Used by undo/redo actions to get their undo context
- return getUndoContext();
- } else {
- return super.getAdapter(key);
- }
- }
-
- /**
- * @return The {@linkplain IUndoContext undo context} associated to this compare editor.
- */
- public IUndoContext getUndoContext() {
- return undoContext;
- }
-
-
- protected IOperationHistory[] getOperationHistories() {
- IOperationHistory[] operationHistories = new IOperationHistory[2];
- TransactionalEditingDomain[] editingDomains = getEditingDomains();
- for (int i = 0; i < 2; i++) {
- if (editingDomains[i] != null) {
- operationHistories[i] = ((IWorkspaceCommandStack) editingDomains[i].getCommandStack()).getOperationHistory();
- }
- }
- return operationHistories;
- }
-
- /**
- * <p>
- * <table>
- * <tr valign=top>
- * <td><b>Note</b>&nbsp;&nbsp;</td>
- * <td>Whatever the model roots are (i.e. if <code>null</code> or not), this method returns an array of
- * {@linkplain Resource}s whose size is 2.</td>
- * </tr>
- * </table>
- *
- * @return
- */
- protected Resource[] getModelRootsResources() {
- Resource[] resources = new Resource[2];
- EObject[] modelRoots = getModelRoots();
- for (int i = 0; i < 2; i++) {
- EObject modelRoot = modelRoots[i];
- if (modelRoot != null) {
- resources[i] = modelRoot.eResource();
- }
- }
- return resources;
- }
-
- protected String getModelRootsNames() {
- String[] labels = new String[2];
- EObject[] modelRoots = getModelRoots();
- AdapterFactoryItemDelegator[] itemDelegators = getItemDelegators();
- for (int i = 0; i < 2; i++) {
- if (modelRoots[i] != null && itemDelegators[i] != null) {
- // Label of model root
- labels[i] = itemDelegators[i].getText(modelRoots[i]);
- }
- }
- if (labels[0] != null && labels[1] != null) {
- return labels[0] + " <---> " + labels[1]; //$NON-NLS-1$
- } else {
- return ((CompareEditorInput) getEditorInput()).getTitle();
- }
- }
-
- protected AdapterFactory[] getAdapterFactories() {
- AdapterFactory[] adapterFactories = new AdapterFactory[2];
- TransactionalEditingDomain[] editingDomains = getEditingDomains();
- for (int i = 0; i < 2; i++) {
- TransactionalEditingDomain editingDomain = editingDomains[i];
- if (editingDomain != null) {
- adapterFactories[i] = ((AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
- }
- }
- return adapterFactories;
- }
-
- protected AdapterFactoryItemDelegator[] getItemDelegators() {
- AdapterFactoryItemDelegator[] itemDelegators = new AdapterFactoryItemDelegator[2];
- AdapterFactory[] adapterFactories = getAdapterFactories();
- for (int i = 0; i < 2; i++) {
- AdapterFactory adapterFactory = adapterFactories[i];
- if (adapterFactory != null) {
- itemDelegators[i] = new AdapterFactoryItemDelegator(adapterFactory);
- }
- }
- return itemDelegators;
- }
-
- protected boolean isActivePart() {
- return this == getSite().getWorkbenchWindow().getPartService().getActivePart();
- }
-
- public TransactionalEditingDomain getEditingDomain() {
- return getEditingDomains()[0];
- }
-
-
-
-// @Override
-// public void setInput(IEditorInput input) {
-// if (input instanceof ModelElementCompareEditorInput) {
-// super.setInput(input);
-// } else {
-// PlatformLogUtil.logAsError(Activator.getPlugin(), new RuntimeException(Messages.error_invalidEditorInput));
-// }
-// }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.classpath b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.classpath
deleted file mode 100644
index f6e5811e42c..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?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="output" path="bin"/>
-</classpath>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.project b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.project
deleted file mode 100644
index 73a08911e95..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.sysml.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/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 363780c849d..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Fri Oct 28 10:54:13 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/META-INF/MANIFEST.MF b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index f9eeef542ca..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,10 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.sysml.emf.compare.ui;singleton:=true
-Bundle-Version: 0.9.0.qualifier
-Bundle-Vendor: %providerName
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.papyrus.infra.emf.compare.ui;bundle-version="0.9.0"
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/about.html b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/about.html
deleted file mode 100644
index 82d49bf5f81..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/build.properties b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/build.properties
deleted file mode 100644
index 454578ed04e..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-bin.includes = .,\
- plugin.xml,\
- plugin.properties,\
- todo/,\
- plugin-doc.pdoc,\
- icons/,\
- about.html,\
- META-INF/
-src.includes = todo/,\
- plugin.xml,\
- plugin.properties,\
- plugin-doc.pdoc,\
- icons/,\
- about.html,\
- META-INF/
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/icons/sysml.gif b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/icons/sysml.gif
deleted file mode 100644
index dc2c17a9ac0..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/icons/sysml.gif
+++ /dev/null
Binary files differ
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin-doc.pdoc b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin-doc.pdoc
deleted file mode 100644
index 728c936d200..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin-doc.pdoc
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="This plugin provides elements to customize EMF-Compare for SysML">
- <implicitDependencies plugin="org.eclipse.papyrus.infra.emf.compare.ui" comment="This plugin uses the extension point org.eclipse.papyrus.infra.emf.compare.ui.customization and the action &quot;Find unused dependencies&quot; removes it!"/>
- <referent firstName="Vincent" lastName="Lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
-</doc:Documentation>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin.properties b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin.properties
deleted file mode 100644
index 8a7df32130c..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-#Properties file for org.eclipse.papyrus.sysml.emf.compare
-providerName = Eclipse Modeling Project
-pluginName = Papyrus SysML Compare
-compareCustomization.tooltip = Apply the SysML customization on the viewers \ No newline at end of file
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin.xml b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin.xml
deleted file mode 100644
index 0449a432ebe..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/plugin.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?eclipse version="3.4"?>
-
-<plugin>
-
- <extension point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
- <browserCustomization
- file="todo/dummySysML.uiCustom"
- loadByDefault="true"/>
- </extension>
- <extension
- point="org.eclipse.papyrus.infra.emf.compare.ui.customization">
- <compareCustomization
- file="todo/dummySysML.uiCustom"
- icon="icons/sysml.gif"
- name="org.eclipse.papyrus.sysml.emf.compare.ui.sysml.customization"
- tooltip="%compareCustomization.tooltip">
- </compareCustomization>
- </extension>
-</plugin>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/todo/dummySysML.uiCustom b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/todo/dummySysML.uiCustom
deleted file mode 100644
index 28f50552307..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.sysml.emf.compare.ui/todo/dummySysML.uiCustom
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?>
-<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/uml2/3.0.0/UML"/>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.classpath b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/deprecated/org.eclipse.papyrus.uml.compare.ui/.project b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.project
deleted file mode 100644
index 465c4541780..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.uml.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>
- <buildCommand>
- <name>org.eclipse.emf.facet.common.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.emf.facet.common.ProjectNature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.settings/org.eclipse.jdt.core.prefs b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 0cc8f3fb6fc..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Wed Oct 12 17:16:52 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/META-INF/MANIFEST.MF b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index e01ad53e420..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,25 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Papyrus UML Compare
-Bundle-SymbolicName: org.eclipse.papyrus.uml.compare.ui;singleton:=true
-Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.compare.ui.Activator
-Bundle-Vendor: Eclipse Modeling Project
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.compare,
- org.eclipse.emf.compare.ui,
- org.eclipse.emf.facet.infra.browser.custom,
- org.eclipse.emf.facet.infra.browser.custom.core,
- org.eclipse.emf.facet.infra.browser.uicore,
- org.eclipse.emf.compare.diff,
- org.eclipse.emf.edit.ui,
- org.eclipse.emf.compare,
- org.eclipse.emf.transaction,
- org.eclipse.emf.workspace;bundle-version="1.5.1"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.uml.compare.ui,
- org.eclipse.papyrus.uml.compare.ui.merge.viewer,
- org.eclipse.papyrus.uml.compare.ui.provider,
- org.eclipse.papyrus.uml.compare.ui.structure.viewer
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/build.properties b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/build.properties
deleted file mode 100644
index 09eda12bd38..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/build.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- resources/emfcompare.uiCustom
-source.. = src/
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/icons/PapyrusLogo16x16.gif b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/icons/PapyrusLogo16x16.gif
deleted file mode 100644
index 8a31f458379..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/icons/PapyrusLogo16x16.gif
+++ /dev/null
Binary files differ
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/icons/papyrus_compare_editor.gif b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/icons/papyrus_compare_editor.gif
deleted file mode 100644
index e817df6ff0c..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/icons/papyrus_compare_editor.gif
+++ /dev/null
Binary files differ
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.xml b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.xml
deleted file mode 100644
index 8610ce8257c..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<?eclipse version="3.4"?>
-
-<plugin>
- <extension point="org.eclipse.compare.structureMergeViewers">
- <viewer class="org.eclipse.papyrus.uml.compare.ui.structure.viewer.UMLStructureMergeViewerCreator" extensions="uml" id="org.eclipse.papyrus.uml.compare.ui.structureviewer" label="My Structure Merge Viewer">
- </viewer>
- <contentTypeBinding contentTypeId="org.eclipse.papyrus.uml.compare.papyrus" structureMergeViewerId="org.eclipse.papyrus.uml.compare.ui.structureviewer">
- </contentTypeBinding>
- </extension>
-
- <extension point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
- <browserCustomization file="resources/emfcompare.uiCustom"/>
- </extension>
- <extension
- point="org.eclipse.core.contenttype.contentTypes">
- <content-type
- id="org.eclipse.papyrus.uml.compare.papyrus"
- name="Papyrus type"
- priority="normal">
- </content-type>
- </extension>
- <extension
- point="org.eclipse.compare.contentMergeViewers">
- <viewer
- class="org.eclipse.papyrus.uml.compare.ui.merge.viewer.PapyrusContentMergeViewerCreator"
- extensions="uml"
- id="org.eclipse.papyrus.uml.compare.ui.content.merge.viewer"
- label="My Papyrus Content Merge Viewer">
- </viewer>
- <contentTypeBinding
- contentMergeViewerId="org.eclipse.papyrus.uml.compare.ui.content.merge.viewer"
- contentTypeId="org.eclipse.papyrus.uml.compare.papyrus"
- structureMergeViewerId="org.eclipse.papyrus.uml.compare.ui.structureviewer">
- </contentTypeBinding>
- </extension>
- <extension
- point="org.eclipse.compare.contentMergeViewers">
- <viewer
- class="org.eclipse.papyrus.uml.compare.ui.transactional.merge.viewer.TransactionalContentMergeViewerCreator"
- extensions="uml"
- id="org.eclipse.papyrus.uml.compare.ui.content.transactional.merge.viewer"
- label="Transactional Papyrus Content Merge Viewer">
- </viewer>
- <contentTypeBinding
- contentMergeViewerId="org.eclipse.papyrus.uml.compare.ui.content.merge.viewer"
- contentTypeId="org.eclipse.papyrus.uml.compare.papyrus"
- structureMergeViewerId="org.eclipse.papyrus.uml.compare.ui.structureviewer">
- </contentTypeBinding>
- </extension>
-</plugin>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/resources/emfcompare.uiCustom b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/resources/emfcompare.uiCustom
deleted file mode 100644
index ba6d75bfd7b..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/resources/emfcompare.uiCustom
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?>
-<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/emf/compare/diff/1.1" allQuerySetsAvailable="false"/>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Activator.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Activator.java
deleted file mode 100644
index 85069d90aa7..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Activator.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.papyrus.uml.compare.ui;
-
-import java.util.List;
-
-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.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-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.uml.compare.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * Returns the image from the given path.
- *
- * @param path the path the image to be displayed
- * @return the image found
- * FIXME
- */
- public static Image getImage(String path) {
- final ImageRegistry registry = getDefault().getImageRegistry();
- Image image = registry.get(path);
- if(image == null) {
- registry.put(path, Activator.imageDescriptorFromPlugin(PLUGIN_ID, path));
- image = registry.get(path);
- }
- return image;
-
- }
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- private CustomizationManager fCustomizationManager;
- /**
- * duplicate code from the ModelExplorer
- * @return the customization manager in charge to adapt element in modisco
- */
- public CustomizationManager getCustomizationManager() {
- if(this.fCustomizationManager == null) {
- this.fCustomizationManager = new CustomizationManager();
- init(this.fCustomizationManager);
- }
- return this.fCustomizationManager;
- }
-
- 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
- List<MetamodelView> registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
- for(MetamodelView metamodelView : registryDefaultCustomizations) {
- customizationManager.registerCustomization(metamodelView);
- }
- customizationManager.loadCustomizations();
- //TODO not useful for the moment
-// loadFacetsForCustomizations(registryDefaultCustomizations,customizationManager);
-
- } catch (Throwable e) {
- Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/PapyrusContentMergeViewerCreator.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/PapyrusContentMergeViewerCreator.java
deleted file mode 100644
index 226a4207d6e..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/PapyrusContentMergeViewerCreator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.papyrus.uml.compare.ui.merge.viewer;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IViewerCreator;
-import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Composite;
-
-
-public class PapyrusContentMergeViewerCreator implements IViewerCreator {
-
- public PapyrusContentMergeViewerCreator() {
- // TODO Auto-generated constructor stub
- }
-
- public Viewer createViewer(Composite parent, CompareConfiguration config) {
- //return new ModelContentMergeViewer(parent,config);
- return new UMLModelContentMergeViewer(parent, config);
- }
-
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeDiffTab.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeDiffTab.java
deleted file mode 100644
index 0e86910da87..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeDiffTab.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************
- * 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.uml.compare.ui.merge.viewer;
-
-import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder;
-import org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab;
-import org.eclipse.swt.widgets.Composite;
-
-
-/**
- * The Structure Tab in the Merge Viewer.
- */
-//duplicate code from tatiana
-//TODO : verify the super class
-public class UMLModelContentMergeDiffTab extends ModelContentMergeDiffTab {
-
-
- /**
- * Instantiates a new uML model content merge diff tab.
- *
- * @param parentComposite
- * the parent composite
- * @param side
- * the side
- * @param parentFolder
- * the parent folder
- */
- public UMLModelContentMergeDiffTab(Composite parentComposite, int side, ModelContentMergeTabFolder parentFolder) {
- super(parentComposite, side, parentFolder);
- }
-
-// /*
-// * (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);
-// }
-
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeTabFolder.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeTabFolder.java
deleted file mode 100644
index 81248c673a5..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeTabFolder.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*****************************************************************************
- * 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.uml.compare.ui.merge.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.jface.viewers.IContentProvider;
-import org.eclipse.papyrus.uml.compare.ui.provider.PapyrusLabelProvider;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The Class UMLModelContentMergeTabFolder.
- */
-//duplicate code from tatiana
-//TODO verify the super class
-public class UMLModelContentMergeTabFolder extends ModelContentMergeTabFolder {
-
- /** The my uml viewer. */
- protected final UMLModelContentMergeViewer myUMLViewer;
-
- /**
- * Instantiates a new uML model content merge tab folder.
- *
- * @param viewer the viewer
- * @param composite the composite
- * @param side the side
- */
- public UMLModelContentMergeTabFolder(ModelContentMergeViewer viewer, Composite composite, int side) {
- super(viewer, composite, side);
- myUMLViewer = (UMLModelContentMergeViewer)viewer;
- }
-
-
- @Override
- protected IModelContentMergeViewerTab createModelContentMergeDiffTab(Composite parent) {
-// IModelContentMergeViewerTab tab = super.createModelContentMergeDiffTab(parent);
- UMLModelContentMergeDiffTab diffTab = new UMLModelContentMergeDiffTab(parent, partSide, this);
- diffTab.setContentProvider(createDiffTabContentProvider());
- diffTab.setLabelProvider(new PapyrusLabelProvider());
- return diffTab;
-
- }
-//
-// /* (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);
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeViewer.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeViewer.java
deleted file mode 100644
index 3d60da9361c..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/merge/viewer/UMLModelContentMergeViewer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.papyrus.uml.compare.ui.merge.viewer;
-
-import java.util.List;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
-import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
-import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-//TODO set the correct super class
-//duplicate code from tatiana
-public class UMLModelContentMergeViewer extends ModelContentMergeViewer {
-
- //duplicate code from tatiana
- public UMLModelContentMergeViewer(Composite parent, CompareConfiguration config) {
- super(parent, config);
- }
-
- @Override
- protected ModelContentMergeTabFolder createModelContentMergeTabFolder(Composite composite, int side) {
- // TODO Auto-generated method stub
-// return super.createModelContentMergeTabFolder(composite, side);
- return new UMLModelContentMergeTabFolder(this, composite, side);
- }
-
- @Override
- protected void copy(List<DiffElement> diffs, boolean leftToRight) {
- DiffElement diff = diffs.get(0);
- if(diff instanceof ModelElementChangeLeftTarget){
- EObject element = ((ModelElementChangeLeftTarget)diff).getLeftElement();
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
- int d=0;
- d++;
-
- }else if(diff instanceof UpdateReference){
- EObject element = ((UpdateReference)diff).getLeftElement();
- TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
- int d=0;
- d++;
- }
- super.copy(diffs, leftToRight);
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/provider/PapyrusLabelProvider.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/provider/PapyrusLabelProvider.java
deleted file mode 100644
index 93c68776aad..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/provider/PapyrusLabelProvider.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*****************************************************************************
- * 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.uml.compare.ui.provider;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.ecore.EObject;
-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.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.papyrus.uml.compare.ui.Activator;
-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 AppearanceConfiguration configuration;
-
- /**
- * Constructor.
- *
- * @param customizationManager the customization manager
- */
- public PapyrusLabelProvider(CustomizationManager customizationManager) {
- super(customizationManager);
- 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) {
- 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(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 (SecurityException e) {
- //TODO
-// Activator.logError(e);
- } catch (NoSuchMethodException e) {
-// Activator.logError(e);
- } catch (IllegalArgumentException e) {
-// Activator.logError(e);
- } catch (IllegalAccessException e) {
-// Activator.logError(e);
- } catch (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(Object element) {
- if(element == null) {
- return ""; //$NON-NLS-1$
- }
- if(element instanceof EObject) {
- 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(Object element) {
- if(element == null) {
- return null;
- }
- if(element instanceof EObject) {
- 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(EObject eObject) {
- if(eObject == null) {
- return null;
- }
- return new ModelElementItem(eObject, getTreeElement(eObject.eContainer()), configuration);
- }
-
- //TODO for test only!
- @Override
- public Color getBackground(Object element) {
- RGB rgb = new RGB(255, 0, 0);
- Device device = Display.getDefault();
- Color color = new Color(device , rgb);
- // TODO Auto-generated method stub
- return color;
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/structure/viewer/UMLStructureMergeViewerCreator.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/structure/viewer/UMLStructureMergeViewerCreator.java
deleted file mode 100644
index 5034a838024..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/structure/viewer/UMLStructureMergeViewerCreator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.papyrus.uml.compare.ui.structure.viewer;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IViewerCreator;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.core.runtime.content.IContentDescriber;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer;
-import org.eclipse.emf.compare.ui.viewer.structure.ParameterizedStructureMergeViewer;
-import org.eclipse.emf.facet.infra.browser.uicore.CustomizableModelLabelProvider;
-import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
-import org.eclipse.jface.viewers.IColorProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Device;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-/**
- *
- * This class creates the Structure Merge Viewer for Papyrus
- *
- */
-public class UMLStructureMergeViewerCreator implements IViewerCreator{
-
- public UMLStructureMergeViewerCreator() {
- //nothing to do
- }
-
- public Viewer createViewer(Composite parent, CompareConfiguration config) {
- return new ParameterizedStructureMergeViewer(parent,config);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalContentMergeViewerCreator.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalContentMergeViewerCreator.java
deleted file mode 100644
index c3254147292..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalContentMergeViewerCreator.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.papyrus.uml.compare.ui.transactional.merge.viewer;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.IViewerCreator;
-import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
-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);
- }
-
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeDiffTab.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeDiffTab.java
deleted file mode 100644
index 62a5aaa8e0e..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeDiffTab.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*****************************************************************************
- * 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.uml.compare.ui.transactional.merge.viewer;
-
-import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder;
-import org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab;
-import org.eclipse.swt.widgets.Composite;
-
-
-/**
- * The Structure Tab in the Merge Viewer.
- */
-//duplicate code from tatiana
-//TODO : verify the super class
-public class TransactionalModelContentMergeDiffTab extends ModelContentMergeDiffTab {
-
-
- /**
- * 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);
- }
-
-// /*
-// * (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);
-// }
-
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeTabFolder.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeTabFolder.java
deleted file mode 100644
index e3bb0fc97e2..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeTabFolder.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*****************************************************************************
- * 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.uml.compare.ui.transactional.merge.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.jface.viewers.IContentProvider;
-import org.eclipse.papyrus.uml.compare.ui.provider.PapyrusLabelProvider;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * 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());
- diffTab.setLabelProvider(new PapyrusLabelProvider());
- return diffTab;
-
- }
-//
-// /* (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);
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeViewer.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeViewer.java
deleted file mode 100644
index d67857f41cc..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/transactional/merge/viewer/TransactionalModelContentMergeViewer.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.eclipse.papyrus.uml.compare.ui.transactional.merge.viewer;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-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.edit.domain.IEditingDomainProvider;
-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.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.papyrus.uml.compare.ui.Activator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-
-public class TransactionalModelContentMergeViewer extends ModelContentMergeViewer {
-
- private TransactionalEditingDomain domain;
-
-
- private boolean isSynchronizedWithDiagram;
-
- //duplicate code from tatiana
- public TransactionalModelContentMergeViewer(Composite parent, CompareConfiguration config) {
- super(parent, config);
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- if(editor instanceof IEditingDomainProvider) {
- domain = (TransactionalEditingDomain)((IEditingDomainProvider)editor).getEditingDomain();
- }
- }
-
- @Override
- protected ModelContentMergeTabFolder createModelContentMergeTabFolder(Composite composite, int side) {
- // TODO Auto-generated method stub
- // return super.createModelContentMergeTabFolder(composite, side);
- return new TransactionalModelContentMergeTabFolder(this, composite, side);
- }
-
- /**
- * Undoes the changes implied by the currently selected {@link DiffElement diff}.
- */
- protected void copyDiffLeftToRight() {
- if(currentSelection != null) {
- doCopy(currentSelection, true);
- }
- currentSelection.clear();
- switchCopyState(false);
- }
-
- /**
- * Applies the changes implied by the currently selected {@link DiffElement diff}.
- */
- protected void copyDiffRightToLeft() {
- if(currentSelection != null) {
- doCopy(currentSelection, false);
- }
- currentSelection.clear();
- switchCopyState(false);
- }
-
-
- protected void doCopy(final List<DiffElement> diffs, final boolean leftToRight) {
- Map<?, ?> transactionOptions = Collections.EMPTY_MAP;
- final Runnable runnable = new Runnable() {
-
- public void run() {
- // TODO Auto-generated method stub
- TransactionalModelContentMergeViewer.this.copy(diffs, leftToRight);
- }
- };
-
- // AbstractCommand cmd = new ChangeC(){
- //
- // public void execute() {
- // // TODO Auto-generated method stub
- //
- // }
- //
- // public void redo() {
- // // TODO Auto-generated method stub
- //
- // }
- //
- // }
- IUndoableOperation operation = new AbstractEMFOperation(domain, "copy action", transactionOptions) {
-
- @Override
- protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- // try {
- runnable.run();
- return Status.OK_STATUS;
- // } catch (RuntimeException ex) {
- // if (ex instanceof OperationCanceledException) {
- // throw (OperationCanceledException) ex;
- // } else {
- //// throw new ExecutionException(NLS.bind(Messages.problem_transactionFailed, operationLabel), ex);
- // }
- // }
- //
- }
-
- // @Override
- // public boolean canUndo() {
- //// return transactionOptions.get(Transaction.OPTION_NO_UNDO) != Boolean.TRUE;
- // }
-
-
- };
-
- Command command = new EMFOperationCommand(domain, operation);
- // domain.getCommandStack().
- domain.getCommandStack().execute(command);
-
- }
-
-
- @Override
- protected void createToolItems(ToolBarManager tbm) {
-
- final IAction diagramSynchronization = new Action("Diagram Synchronisation", IAction.AS_CHECK_BOX) {
-
- @Override
- public ImageDescriptor getImageDescriptor() {
- //TODO improve?
- return Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/PapyrusLogo16x16.gif");
- }
- };
-
-
- ActionContributionItem actionContributionItem = new ActionContributionItem(diagramSynchronization) {
- @Override
- public void fill(ToolBar parent, int index) {
- // TODO Auto-generated method stub
- super.fill(parent, index);
- }
- };
- //actionContributionItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);
- diagramSynchronization.addPropertyChangeListener(new IPropertyChangeListener() {
-
- public void propertyChange(PropertyChangeEvent event) {
- //we are here each time the user click on the action!
- diagramSynchronization.setChecked(diagramSynchronization.isChecked());
- isSynchronizedWithDiagram = diagramSynchronization.isChecked();
- }
- });
- tbm.insert(0, actionContributionItem);
- super.createToolItems(tbm);
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/testSWT/MyViewer.java b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/testSWT/MyViewer.java
deleted file mode 100644
index 85aefa657a9..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.compare.ui/src/testSWT/MyViewer.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package testSWT;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.CoolBar;
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.CoolItem;
-import org.eclipse.swt.widgets.Text;
-
-
-public class MyViewer extends Composite {
- private Text text;
-
- /**
- * Create the composite.
- * @param parent
- * @param style
- */
- public MyViewer(Composite parent, int style) {
- super(parent, style);
- setLayout(new FormLayout());
-
- CoolBar coolBar = new CoolBar(this, SWT.FLAT);
- FormData fd_coolBar = new FormData();
- fd_coolBar.bottom = new FormAttachment(0, 173);
- fd_coolBar.right = new FormAttachment(0, 120);
- fd_coolBar.top = new FormAttachment(0, 143);
- fd_coolBar.left = new FormAttachment(0, 10);
- coolBar.setLayoutData(fd_coolBar);
-
- CoolItem coolItem = new CoolItem(coolBar, SWT.NONE);
-
- Button button = new Button(this, SWT.CHECK);
- FormData fd_button = new FormData();
- fd_button.top = new FormAttachment(0, 154);
- fd_button.left = new FormAttachment(0, 22);
- button.setLayoutData(fd_button);
- button.setText("Check Button");
-
- Button btnCheckButton_1 = new Button(this, SWT.CHECK);
- FormData fd_btnCheckButton_1 = new FormData();
- fd_btnCheckButton_1.top = new FormAttachment(0, 10);
- fd_btnCheckButton_1.left = new FormAttachment(button, 0, SWT.LEFT);
- btnCheckButton_1.setLayoutData(fd_btnCheckButton_1);
- btnCheckButton_1.setText("Check Button");
-
- Button btnNewButton = new Button(this, SWT.CHECK);
- FormData fd_btnNewButton = new FormData();
- fd_btnNewButton.top = new FormAttachment(btnCheckButton_1, 27);
- fd_btnNewButton.left = new FormAttachment(button, 0, SWT.LEFT);
- btnNewButton.setLayoutData(fd_btnNewButton);
- btnNewButton.setText("New Button");
-
- ToolBar toolBar = new ToolBar(this, SWT.FLAT | SWT.RIGHT);
- FormData fd_toolBar = new FormData();
- fd_toolBar.bottom = new FormAttachment(coolBar, -6);
- fd_toolBar.right = new FormAttachment(button, 0, SWT.RIGHT);
- toolBar.setLayoutData(fd_toolBar);
-
- ToolItem tltmNewItem = new ToolItem(toolBar, SWT.NONE);
- tltmNewItem.setText("New Item");
-
- Button btnNewButton_1 = new Button(this, SWT.NONE);
- btnNewButton_1.setLayoutData(new FormData());
- btnNewButton_1.setText("New Button");
-
- Button btnNewButton_2 = new Button(this, SWT.NONE);
- btnNewButton_2.setLayoutData(new FormData());
- btnNewButton_2.setText("New Button");
-
- text = new Text(this, SWT.BORDER);
- text.setLayoutData(new FormData());
-
- }
-
- @Override
- protected void checkSubclass() {
- // Disable the check that prevents subclassing of SWT components
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.classpath b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.classpath
deleted file mode 100644
index f6e5811e42c..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.classpath
+++ /dev/null
@@ -1,6 +0,0 @@
-<?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="output" path="bin"/>
-</classpath>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.project b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.project
deleted file mode 100644
index c171225e032..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.uml.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/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index a1ee3be7ece..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Wed Nov 02 15:02:47 CET 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/META-INF/MANIFEST.MF b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index 5b41eaee981..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,10 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.papyrus.uml.emf.compare.ui;singleton:=true
-Bundle-Version: 0.9.0.qualifier
-Bundle-Vendor: %providerName
-Require-Bundle: org.eclipse.papyrus.infra.emf.compare.ui
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Bundle-Localization: plugin
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/about.html b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/about.html
deleted file mode 100644
index 82d49bf5f81..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/build.properties b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/build.properties
deleted file mode 100644
index 8882b335fdb..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/build.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- plugin.properties,\
- todo/,\
- plugin-doc.pdoc,\
- icons/
-src.includes = icons/,\
- plugin-doc.pdoc,\
- plugin.properties,\
- plugin.xml,\
- todo/,\
- META-INF/
-
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/icons/uml_notation.gif b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/icons/uml_notation.gif
deleted file mode 100644
index dbe9a75c66f..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/icons/uml_notation.gif
+++ /dev/null
Binary files differ
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin-doc.pdoc b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin-doc.pdoc
deleted file mode 100644
index 3a9e449ffe7..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin-doc.pdoc
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<doc:Documentation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:doc="http://www.eclipse.org/papyrus/documentation/plugin/documentation" description="This plugin provides elements to customize EMF-Compare for UML">
- <implicitDependencies plugin="org.eclipse.papyrus.infra.emf.compare.ui" comment="This plugin uses the extension point org.eclipse.papyrus.infra.emf.compare.ui.customization and the action &quot;Find unused dependencies&quot; removes it!"/>
- <referent firstName="Vincent" lastName="Lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
-</doc:Documentation>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin.properties b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin.properties
deleted file mode 100644
index 020a12343ea..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-#Properties file for org.eclipse.papyrus.uml.emf.compare
-providerName = Eclipse Modeling Project
-pluginName = Papyrus UML Compare
-compareCustomization.tooltip = Apply the UML customization on the viewers \ No newline at end of file
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin.xml b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin.xml
deleted file mode 100644
index d8e8241ef24..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/plugin.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
- <browserCustomization
- file="todo/dummyUML.uiCustom"
- loadByDefault="true"/>
- </extension>
- <extension
- point="org.eclipse.papyrus.infra.emf.compare.ui.customization">
- <compareCustomization
- file="todo/dummyUML.uiCustom"
- icon="icons/uml_notation.gif"
- name="org.eclipse.papyrus.uml.emf.compare.ui.uml.customization"
- tooltip="%compareCustomization.tooltip">
- </compareCustomization>
- </extension>
-</plugin>
diff --git a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/todo/dummyUML.uiCustom b/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/todo/dummyUML.uiCustom
deleted file mode 100644
index 28f50552307..00000000000
--- a/sandbox/PapyrusEMFCompareV1/deprecated/org.eclipse.papyrus.uml.emf.compare.ui/todo/dummyUML.uiCustom
+++ /dev/null
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="ASCII"?>
-<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/uml2/3.0.0/UML"/>
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.classpath b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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
deleted file mode 100644
index 01a33a9ae6f..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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
deleted file mode 100644
index 5152edbd2ac..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,22 +0,0 @@
-#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
deleted file mode 100644
index 4772e74af97..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,59 +0,0 @@
-#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
deleted file mode 100644
index 1a1059cff80..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,38 +0,0 @@
-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
deleted file mode 100644
index 82d49bf5f81..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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
deleted file mode 100644
index f2fe747dc83..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-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
deleted file mode 100644
index 8a31f458379..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/PapyrusLogo16x16.gif
+++ /dev/null
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
deleted file mode 100644
index bc86fbc897e..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gif
+++ /dev/null
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
deleted file mode 100644
index 9d812915bb2..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/plugin.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?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
deleted file mode 100644
index c37dc4fe2d3..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/Activator.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 8883cb205d3..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CustomizationAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index ce8fa891310..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/AbstractEMFCompareHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 0019b45fcc8..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/RedoHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index f45b7c20ef4..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handlers/UndoHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index e2e4edc8be8..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/listeners/CloseEditorListener.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index e08b9b9e13d..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/AbstractActionStateSourceProvider.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index d8e12489ce2..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ActionSourceProvider.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index dc8420ff77a..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ModelStructureLabelProvider.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 726f2b5421a..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/PapyrusLabelProvider.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index e7d71e1f28e..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/TransactionalActionSourceProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index ad1ce5b13f2..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusParameterizedStructureMergeViewer.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index a986d59cefa..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusStructureMergeViewerCreator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 4e371690bfb..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalContentMergeViewerCreator.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 909fd56bb5d..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeDiffTab.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index 1b22913ebb5..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeTabFolder.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*****************************************************************************
- * 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
deleted file mode 100644
index bd25116ba51..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/viewer/TransactionalModelContentMergeViewer.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*****************************************************************************
- * 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);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.classpath b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.classpath
deleted file mode 100644
index 2d1a4302f04..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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/.project b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.project
deleted file mode 100644
index 498925e84ad..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.infra.emf.compare</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/.settings/org.eclipse.jdt.core.prefs b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 84e4cf4b517..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Mon Nov 28 11:49:55 CET 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.problem.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/.settings/org.eclipse.jdt.ui.prefs b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 3a12994bde4..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,108 +0,0 @@
-#Thu Dec 01 17:08:16 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
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=false
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=true
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=true
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=true
-sp_cleanup.make_parameters_final=true
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=true
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=true
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=true
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=true
-sp_cleanup.use_this_for_non_static_field_access=true
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/META-INF/MANIFEST.MF b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/META-INF/MANIFEST.MF
deleted file mode 100644
index 280fb4fab18..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,26 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Papyrus CompEMF are
-Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.compare;singleton:=true
-Bundle-Version: 0.9.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.infra.emf.compare.Activator
-Bundle-Vendor: Eclipse Modeling Project
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.team.ui,
- org.eclipse.emf.ecore,
- org.eclipse.emf.compare.match,
- org.eclipse.emf.compare,
- org.eclipse.emf.compare.diff,
- org.eclipse.emf.compare.ui,
- org.eclipse.compare,
- com.google.collect,
- org.eclipse.papyrus.infra.services.edit,
- org.eclipse.gmf.runtime.emf.type.core
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.papyrus.infra.emf.compare,
- org.eclipse.papyrus.infra.emf.compare.actions,
- org.eclipse.papyrus.infra.emf.compare.merger,
- org.eclipse.papyrus.infra.emf.compare.merger.provider,
- org.eclipse.papyrus.infra.emf.compare.utils
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/build.properties b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/build.properties
deleted file mode 100644
index 6f20375d6c7..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/plugin.xml b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/plugin.xml
deleted file mode 100644
index c68b79c5e35..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/plugin.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.ui.commands">
- <command
- description="Compare UML Elements"
- id="org.eclipse.papyrus.infra.emf.compare.uml.element.papyrus"
- name="Compare UML Elements">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- commandId="org.eclipse.papyrus.infra.emf.compare.uml.element.papyrus">
- </handler>
- </extension>
- <extension
- point="org.eclipse.emf.compare.diff.mergerprovider">
- <mergerprovider
- fileExtension="uml"
- mergerProviderClass="org.eclipse.papyrus.infra.emf.compare.merger.provider.PapyrusMergerProvider"
- priority="low">
- </mergerprovider>
- </extension>
-
-</plugin>
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/Activator.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/Activator.java
deleted file mode 100644
index d0d62c15e14..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/Activator.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
- * 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;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.commands.IExecutionListener;
-import org.eclipse.papyrus.infra.core.log.LogHelper;
-import org.eclipse.papyrus.infra.emf.compare.service.SaveEMFCompareListener;
-import org.eclipse.papyrus.infra.emf.compare.utils.CompareEditorConfiguration;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-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"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /** listener on the command service to catch the save and saveAll action */
- private IExecutionListener commandServiceListener;
-
- /** this map contains the compare editor configuration */
- private static final Map<IEditorPart, CompareEditorConfiguration> configuration = new HashMap<IEditorPart, CompareEditorConfiguration>();
-
- public static LogHelper log;
-
- /**
- * 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;
- Activator.log = new LogHelper(this);
- //we add a listener on the command service
- this.commandServiceListener = new SaveEMFCompareListener();
- final ICommandService service = (ICommandService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class);
- service.addExecutionListener(this.commandServiceListener);
- }
-
- /*
- * (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;
- //we remove the listener on the command service
- final ICommandService service = (ICommandService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(ICommandService.class);
- service.removeExecutionListener(this.commandServiceListener);
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return Activator.plugin;
- }
-
- /**
- *
- * @param editor
- * an editor
- * @return
- * the configuration mapped with this editor (can be <code>null</code>)
- */
- public CompareEditorConfiguration getConfigurationFor(final IEditorPart editor) {
- return Activator.configuration.get(editor);
- }
-
- /**
- * map an editor and a configuration
- *
- * @param editor
- * an editor
- * @param configuration
- * a configuration
- */
- public void addConfiguration(final IEditorPart editor, final CompareEditorConfiguration configuration) {
- Activator.configuration.put(editor, configuration);
- }
-
- /**
- * Remove the configuration
- *
- * @param editor
- * a editor
- */
- public void removeConfiguration(final IEditorPart editor) {
- Activator.configuration.remove(editor);
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/actions/CompareTwoElementsAction.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/actions/CompareTwoElementsAction.java
deleted file mode 100644
index 01b8af392b8..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/actions/CompareTwoElementsAction.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*****************************************************************************
- * 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.actions;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.team.internal.ui.actions.TeamAction;
-
-/**
- * Action to compare two arbitrary elements.
- * Availbale in the context menu of the model explorer.
- */
-public class CompareTwoElementsAction extends TeamAction {
-
- @Override
- protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
- // TODO Auto-generated method stub
-
- }
-
-// /* (non-Javadoc)
-// * @see org.eclipse.team.internal.ui.actions.TeamAction#execute(org.eclipse.jface.action.IAction)
-// */
-// protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
-//
-// Object[] selectedElements = getSelection().toArray();
-// if(selectedElements.length != 2) {
-//// Activator.logInfo(Messages.bind(Messages.CompareTwoElementsAction_only_only_element_is_selected, selectedElements.length));
-// return;
-// }
-//
-// EObject left = getElementFor(selectedElements[0]);
-// EObject right = getElementFor(selectedElements[1]);
-// if(left == null) {
-//// Activator.logInfo(Messages.CompareTwoElementsAction_left_element_is_null);
-// return;
-// }
-//
-// if(right == null) {
-//// Activator.logInfo(Messages.CompareTwoElementsAction_right_element_is_null);
-// return;
-// }
-//
-// ComparisonResourceSnapshot snapshot = doContentCompare(left, right);
-// openInCompare(snapshot);
-// }
-//
-// /* (non-Javadoc)
-// * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
-// */
-// public boolean isEnabled() {
-// Object[] selectedElements = getSelection().toArray();
-// if(selectedElements.length != 2) {
-// return false;
-// }
-// EObject left = getElementFor(selectedElements[0]);
-// EObject right = getElementFor(selectedElements[1]);
-// return left != null && right != null;
-// }
-//
-// /**
-// * Open in compare.
-// *
-// * @param snapshot the snapshot
-// */
-// private void openInCompare(ComparisonSnapshot snapshot) {
-// CompareUI.openCompareEditor(new ModelCompareEditorInput(snapshot) {
-//
-// @Override
-// protected ModelContentMergeViewer createMergeViewer(CompareViewerPane pane, CompareConfiguration config) {
-// return new UMLModelContentMergeViewer(pane, config) {
-// @Override
-// protected IMergeViewerContentProvider createMergeViewerContentProvider() {
-// return new ElementContentMergeContentProvider(configuration);
-// }
-// };
-// }
-//
-// @Override
-// public Control createOutlineContents(Composite parent, int direction) {
-// Control result = super.createOutlineContents(parent, direction);
-// structureMergeViewer.setLabelProvider(new UMLStyledStructureLabelProvider(new PapyrusLabelProvider()));
-// return result;
-// }
-//
-// });
-// }
-//
-// /**
-// * Do content compare.
-// *
-// * @param left the left
-// * @param right the right
-// * @return the comparison resource snapshot
-// */
-// protected ComparisonResourceSnapshot doContentCompare(final EObject left, final EObject right) {
-// final ComparisonResourceSnapshot snapshot = DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
-//
-// try {
-// PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
-//
-// public void run(IProgressMonitor monitor) throws InterruptedException {
-// final MatchModel match = contentMatch(left, right, monitor);
-// final DiffModel diff = contentDiff(left, right, match);
-//
-// snapshot.setDiff(diff);
-// snapshot.setMatch(match);
-// }
-//
-// });
-// } catch (final InterruptedException e) {
-// Activator.logError(e);
-// } catch (final EMFCompareException e) {
-// Activator.logError(e);
-// } catch (final InvocationTargetException e) {
-// Activator.logError(e);
-// }
-// return snapshot;
-// }
-//
-// /**
-// * Content diff.
-// *
-// * @param left the left
-// * @param right the right
-// * @param match the match
-// * @return the diff model
-// */
-// protected DiffModel contentDiff(final EObject left, final EObject right, final MatchModel match) {
-// ElementContentDiffEngine engine = new ElementContentDiffEngine(left, right);
-// final DiffModel diff = engine.doDiff(match);
-// final Collection<AbstractDiffExtension> extensions = DiffService.getCorrespondingDiffExtensions(match);
-// for(final AbstractDiffExtension ext : extensions) {
-// if(ext != null) {
-// ext.visit(diff);
-// }
-// }
-//
-// engine.reset();
-// return diff;
-// }
-//
-// /**
-// * Content match.
-// *
-// * @param left the left
-// * @param right the right
-// * @param monitor the monitor
-// * @return the match model
-// * @throws InterruptedException the interrupted exception
-// */
-// protected MatchModel contentMatch(final EObject left, final EObject right, IProgressMonitor monitor) throws InterruptedException {
-// final Map<String, Object> options = new EMFCompareMap<String, Object>();
-// options.put(MatchOptions.OPTION_PROGRESS_MONITOR, monitor);
-// options.put(MatchOptions.OPTION_MATCH_SCOPE_PROVIDER, new GenericMatchScopeProvider(left.eResource(), right.eResource()));
-// options.put(MatchOptions.OPTION_IGNORE_ID, Boolean.TRUE);
-// options.put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.TRUE);
-//
-// final IMatchEngine matchEngine = new ElementContentMatchEngine(left, right);
-// final MatchModel match = matchEngine.contentMatch(left, right, options);
-// return match;
-// }
-//
-// /**
-// * Gets the element for.
-// *
-// * @param object the object
-// * @return the element for
-// */
-// protected EObject getElementFor(Object object) {
-// if(object instanceof IAdaptable) {
-// return (EObject)((IAdaptable)object).getAdapter(EObject.class);
-// }
-//
-// if(object instanceof EObject) {
-// return (EObject)object;
-// }
-// return null;
-// }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AbstractPapyrusDefaultMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AbstractPapyrusDefaultMerger.java
deleted file mode 100644
index b8d51df7396..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AbstractPapyrusDefaultMerger.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*****************************************************************************
- * 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.merger;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-
-public abstract class AbstractPapyrusDefaultMerger extends DefaultMerger {
-
- protected Command getCommand(final Object objectToEdit, final IEditCommandRequest request) {
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(objectToEdit);
- if(provider != null) {
- return new GMFtoEMFCommandWrapper(provider.getEditCommand(request));
- }
- return null;
- }
-
- protected TransactionalEditingDomain getEditingDomain() {
- //FIXME
- return TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain();
- }
-
- protected Command getDestroyElementCommand(final EObject element) {
- final TransactionalEditingDomain domain = getEditingDomain();
- Command command = null;
- if(domain != null) {
- final IEditCommandRequest request = new DestroyElementRequest(domain, element, false);
- command = getCommand(element, request);
- }
- return command;
- }
-
- protected boolean usePapyrusEditService() {
- return false;
- }
-
-
-
- public abstract Command doApplyInOriginCommand();
-
- public abstract Command doUndoInTargetCommand();
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeChangeLeftTargetMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeChangeLeftTargetMerger.java
deleted file mode 100644
index 12389a92dc6..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeChangeLeftTargetMerger.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.List;
-
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChangeLeftTarget;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * Merger for an {@link AttributeChangeLeftTarget} operation.<br/>
- * <p>
- * Are considered for this merger :
- * <ul>
- * <li>{@link RemoveAttribute}</li>
- * <li>{@link RemoteAddAttribute}</li>
- * </ul>
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class AttributeChangeLeftTargetMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final AttributeChangeLeftTarget theDiff = (AttributeChangeLeftTarget)this.diff;
- final EObject origin = theDiff.getLeftElement();
- final Object value = theDiff.getLeftTarget();
- final EAttribute attr = theDiff.getAttribute();
- try {
- EFactory.eRemove(origin, attr.getName(), value);
- } catch (FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final AttributeChangeLeftTarget theDiff = (AttributeChangeLeftTarget)this.diff;
- final EObject target = theDiff.getRightElement();
- final Object value = theDiff.getLeftTarget();
- final EAttribute attr = theDiff.getAttribute();
- try {
- int valueIndex = -1;
- if (attr.isMany()) {
- final EObject leftElement = theDiff.getLeftElement();
- final Object leftValues = leftElement.eGet(attr);
- if (leftValues instanceof List) {
- final List leftValuesList = (List)leftValues;
- valueIndex = leftValuesList.indexOf(value);
- }
- }
- EFactory.eAdd(target, attr.getName(), value, valueIndex);
- } catch (FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeChangeRightTargetMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeChangeRightTargetMerger.java
deleted file mode 100644
index 2017294052f..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeChangeRightTargetMerger.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.List;
-
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChangeRightTarget;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * Merger for an {@link AttributeChangeRightTarget} operation.<br/>
- * <p>
- * Are considered for this merger :
- * <ul>
- * <li>{@link AddAttribute}</li>
- * <li>{@link RemoteRemoveAttribute}</li>
- * </ul>
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class AttributeChangeRightTargetMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final AttributeChangeRightTarget theDiff = (AttributeChangeRightTarget)this.diff;
- final EObject origin = theDiff.getLeftElement();
- final Object value = theDiff.getRightTarget();
- final EAttribute attr = theDiff.getAttribute();
- try {
- int valueIndex = -1;
- if (attr.isMany()) {
- final EObject rightElement = theDiff.getRightElement();
- final Object rightValues = rightElement.eGet(attr);
- if (rightValues instanceof List) {
- final List rightValuesList = (List)rightValues;
- valueIndex = rightValuesList.indexOf(value);
- }
- }
- EFactory.eAdd(origin, attr.getName(), value, valueIndex);
- } catch (FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final AttributeChangeRightTarget theDiff = (AttributeChangeRightTarget)this.diff;
- final EObject target = theDiff.getRightElement();
- final Object value = theDiff.getRightTarget();
- final EAttribute attr = theDiff.getAttribute();
- try {
- EFactory.eRemove(target, attr.getName(), value);
- } catch (FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeOrderChangeMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeOrderChangeMerger.java
deleted file mode 100644
index 6117d20fda7..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/AttributeOrderChangeMerger.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.metamodel.AttributeOrderChange;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-/**
- * Merger for an {@link AttributeOrderChange} operation.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-@SuppressWarnings("unchecked")
-public class AttributeOrderChangeMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final AttributeOrderChange theDiff = (AttributeOrderChange)this.diff;
- final EAttribute attribute = theDiff.getAttribute();
- final EObject leftElement = theDiff.getLeftElement();
- final EObject rightElement = theDiff.getRightElement();
-
- final List<Object> leftList = (List<Object>)leftElement.eGet(attribute);
- final List<Object> rightList = (List<Object>)rightElement.eGet(attribute);
-
- /*
- * We need to transform the "left" list into the "right" list, modulo missing values. In practical
- * terms, this means that we'll simply leave untouched any element that has no match in the "right"
- * list (elements that were deleted) while reordering the others in the order they have in the "right"
- * list.
- */
- final List<Object> leftCopy = new ArrayList<Object>(leftList);
- final List<Object> result = new ArrayList<Object>(leftList.size());
- // Add all unmatched values in the result list
- for (int i = 0; i < leftList.size(); i++) {
- final Object left = leftList.get(i);
-
- boolean hasMatch = false;
- for (int j = 0; !hasMatch && j < rightList.size(); j++) {
- hasMatch = !areDistinctValues(left, rightList.get(j));
- }
-
- if (!hasMatch) {
- leftCopy.remove(left);
- result.add(left);
- }
- }
- // Then reorder according to the right list's order
- for (int i = 0; i < rightList.size(); i++) {
- final Object right = rightList.get(i);
-
- Object leftMatch = null;
- for (int j = 0; leftMatch == null && j < leftCopy.size(); j++) {
- if (!areDistinctValues(right, leftCopy.get(j))) {
- leftMatch = leftCopy.get(j);
- }
- }
-
- if (leftMatch != null) {
- leftCopy.remove(leftMatch);
- result.add(leftMatch);
- }
- }
- // Finally, set the value of our attribute to this new list
- leftElement.eSet(attribute, result);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final AttributeOrderChange theDiff = (AttributeOrderChange)this.diff;
- final EAttribute attribute = theDiff.getAttribute();
- final EObject leftElement = theDiff.getLeftElement();
- final EObject rightElement = theDiff.getRightElement();
-
- final List<Object> leftList = (List<Object>)leftElement.eGet(attribute);
- final List<Object> rightList = (List<Object>)rightElement.eGet(attribute);
-
- /*
- * We need to transform the "right" list into the "left" list, modulo missing values. In practical
- * terms, this means that we'll simply leave untouched any element that has no match in the "left"
- * list (elements that were added) while reordering the others in the order they have in the "left"
- * list.
- */
- final List<Object> rightCopy = new ArrayList<Object>(rightList);
- final List<Object> result = new ArrayList<Object>(rightList.size());
- // Add all unmatched values in the result list
- for (int i = 0; i < rightList.size(); i++) {
- final Object right = rightList.get(i);
-
- boolean hasMatch = false;
- for (int j = 0; !hasMatch && j < leftList.size(); j++) {
- hasMatch = !areDistinctValues(right, leftList.get(j));
- }
-
- if (!hasMatch) {
- rightCopy.remove(right);
- result.add(right);
- }
- }
- // Then reorder according to the left list's order
- for (int i = 0; i < leftList.size(); i++) {
- final Object left = leftList.get(i);
-
- Object rightMatch = null;
- for (int j = 0; rightMatch == null && j < rightCopy.size(); j++) {
- if (!areDistinctValues(left, rightCopy.get(j))) {
- rightMatch = rightCopy.get(j);
- }
- }
-
- if (rightMatch != null) {
- rightCopy.remove(rightMatch);
- result.add(rightMatch);
- }
- }
- // Finally, set the value of our attribute to this new list
- rightElement.eSet(attribute, result);
- }
-
- /**
- * Compare values by equality handling specifics of EMF.
- *
- * @param left
- * object 1.
- * @param right
- * object 2
- * @return true if both objects are not equals.
- */
- private static boolean areDistinctValues(Object left, Object right) {
- final boolean distinct;
- if (left instanceof EEnumLiteral && right instanceof EEnumLiteral) {
- final StringBuilder value1 = new StringBuilder();
- value1.append(((EEnumLiteral)left).getLiteral()).append(((EEnumLiteral)left).getValue());
- final StringBuilder value2 = new StringBuilder();
- value2.append(((EEnumLiteral)right).getLiteral()).append(((EEnumLiteral)right).getValue());
- distinct = !value1.toString().equals(value2.toString());
- } else if (left != null && left.getClass().isArray()) {
- // [299641] compare arrays by their content instead of instance equality
- distinct = areDistinctArrays(left, right);
- } else if (left instanceof FeatureMap.Entry || right instanceof FeatureMap.Entry) {
- distinct = areDistinctEntries(left, right);
- } else {
- distinct = left != null && !left.equals(right) || left == null && left != right;
- }
- return distinct;
- }
-
- /**
- * Compares the two given value while assuming one or both is a {@link FeatureMap.Entry}.
- *
- * @param left
- * Left of the two values to compare.
- * @param right
- * Right of the two values to compare.
- * @return <code>true</code> if the two values are distinct, <code>false</code> otherwise.
- */
- private static boolean areDistinctEntries(Object left, Object right) {
- final boolean distinct;
- if (left instanceof FeatureMap.Entry && right instanceof FeatureMap.Entry) {
- distinct = areDistinctValues(((FeatureMap.Entry)left).getValue(),
- ((FeatureMap.Entry)right).getValue());
- } else if (left instanceof FeatureMap.Entry) {
- distinct = areDistinctValues(((FeatureMap.Entry)left).getValue(), right);
- } else {
- distinct = areDistinctValues(left, ((FeatureMap.Entry)right).getValue());
- }
- return distinct;
- }
-
- /**
- * Compares two values as arrays, checking that the length and content of both matches each other.
- *
- * @param left
- * The value of the attribute from the left compare resource.
- * @param right
- * The value of the attribute from the right compare resource.
- * @return <code>true</code> if the <code>left</code> value is distinct from the <code>right</code> value.
- */
- private static boolean areDistinctArrays(Object left, Object right) {
- boolean distinct = false;
- // we know left is a non-null array.
- if (right == null || !right.getClass().isArray()) {
- distinct = true;
- } else {
- final int leftLength = Array.getLength(left);
- final int rightLength = Array.getLength(right);
- if (leftLength != rightLength) {
- distinct = true;
- } else {
- for (int i = 0; i < leftLength; i++) {
- final Object leftElement = Array.get(left, i);
- final Object rightElement = Array.get(right, i);
- if (areDistinctValues(leftElement, rightElement)) {
- distinct = true;
- break;
- }
- }
- }
- }
- return distinct;
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/DiffExtensionMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/DiffExtensionMerger.java
deleted file mode 100644
index f6342acc602..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/DiffExtensionMerger.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-
-/**
- * Merger for an {@link DiffExtension} operation.<br/>
- *
- * @author <a href="mailto:cedric.brun@obeo.fr">Cedric Brun</a>
- */
-public class DiffExtensionMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
-
- @Override
- public void doApplyInOrigin() {
- // TODO code diff extension merger
- // final AbstractDiffExtension extension = (AbstractDiffExtension)this.diff;
- // if (!extension.providesMerger()) {
- // /*
- // * No merger is provided so we'll browse the hidden elements and merge them..
- // */
- // for (final Iterator<DiffElement> iterator = extension.getHideElements().iterator();
- // iterator.hasNext(); ) {
- // final DiffElement hidden = iterator.next();
- // final AbstractMerger merger = MergeFactory.createMerger(hidden);
- // merger.applyInOrigin();
- // }
- // } else {
- // extension.getMerger().applyInOrigin();
- // }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- // TODO code diff extension merger
- // final AbstractDiffExtension extension = (AbstractDiffExtension)this.diff;
- // if (!extension.providesMerger()) {
- // /*
- // * No merger is provided so we'll browse the hidden elements and merge them..
- // */
- // for (final Iterator<DiffElement> iterator = extension.getHideElements().iterator();
- // iterator.hasNext(); ) {
- // final DiffElement hidden = iterator.next();
- // final AbstractMerger merger = MergeFactory.createMerger(hidden);
- // merger.undoInTarget();
- // }
- // } else {
- // extension.getMerger().undoInTarget();
- // }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/DiffGroupMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/DiffGroupMerger.java
deleted file mode 100644
index b04da1a0f90..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/DiffGroupMerger.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.merge.service.MergeService;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-
-/**
- * This merger will handle DiffGroup merging by recursively create mergers on each of its contents.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class DiffGroupMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#applyInOrigin()
- */
- @Override
- public void applyInOrigin() {
- // Creates a temporary list to avoid ConcurentModificationExceptions
- final List<DiffElement> subDiffs = new ArrayList<DiffElement>(diff.getSubDiffElements());
- MergeService.merge(subDiffs, false);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#undoInTarget()
- */
- @Override
- public void undoInTarget() {
- // Creates a temporary list to avoid ConcurentModificationExceptions
- final List<DiffElement> subDiffs = new ArrayList<DiffElement>(diff.getSubDiffElements());
- MergeService.merge(subDiffs, true);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ModelElementChangeRightTargetMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ModelElementChangeRightTargetMerger.java
deleted file mode 100644
index ae884c33194..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ModelElementChangeRightTargetMerger.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceOrderChange;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-/**
- * Merger for an {@link ModelElementChangeRightTarget} operation.<br/>
- * <p>
- * Are considered for this merger :
- * <ul>
- * <li>RemoveModelElement</li>
- * <li>RemoteAddModelElement</li>
- * </ul>
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class ModelElementChangeRightTargetMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final ModelElementChangeRightTarget theDiff = (ModelElementChangeRightTarget)this.diff;
- final EObject origin = theDiff.getLeftParent();
- final EObject element = theDiff.getRightElement();
- final EObject newOne = copy(element);
- final EReference ref = element.eContainmentFeature();
- if (ref != null) {
- try {
- int expectedIndex = -1;
- if (ref.isMany()) {
- final Object containmentRefVal = element.eContainer().eGet(ref);
- if (containmentRefVal instanceof List<?>) {
- @SuppressWarnings("unchecked")
- final List<EObject> listVal = (List<EObject>)containmentRefVal;
- expectedIndex = listVal.indexOf(element);
- }
- }
- EFactory.eAdd(origin, ref.getName(), newOne, expectedIndex, true);
- setXMIID(newOne, getXMIID(element));
- } catch (final FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- } else if (origin == null && getDiffModel().getLeftRoots().size() > 0) {
- getDiffModel().getLeftRoots().get(0).eResource().getContents().add(newOne);
- } else if (origin != null) {
- origin.eResource().getContents().add(newOne);
- } else {
- // FIXME Throw exception : couldn't merge this
- }
- // we should now have a look for AddReferencesLinks needing this object
- final Iterator<EObject> siblings = getDiffModel().eAllContents();
- while (siblings.hasNext()) {
- final DiffElement op = (DiffElement)siblings.next();
- if (op instanceof ReferenceChangeRightTarget) {
- final ReferenceChangeRightTarget link = (ReferenceChangeRightTarget)op;
- // now if I'm in the target References I should put my copy in the origin
- if (link.getLeftTarget() != null && link.getLeftTarget() == element) {
- link.setRightTarget(newOne);
- }
- } else if (op instanceof ReferenceOrderChange) {
- final ReferenceOrderChange link = (ReferenceOrderChange)op;
- if (link.getLeftElement() == origin && link.getReference() == ref) {
- final ListIterator<EObject> targetIterator = link.getLeftTarget().listIterator();
- boolean replaced = false;
- while (!replaced && targetIterator.hasNext()) {
- final EObject target = targetIterator.next();
- if (target.eIsProxy()
- && equalProxyURIs(((InternalEObject)target).eProxyURI(),
- EcoreUtil.getURI(element))) {
- targetIterator.set(newOne);
- replaced = true;
- }
- }
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final ModelElementChangeRightTarget theDiff = (ModelElementChangeRightTarget)this.diff;
- final EObject element = theDiff.getRightElement();
- final EObject parent = theDiff.getRightElement().eContainer();
- EcoreUtil.remove(element);
- // now removes all the dangling references
- removeDanglingReferences(parent);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#canUndoInTarget()
- */
- @Override
- public boolean canUndoInTarget() {
- final ModelElementChangeRightTarget theDiff = (ModelElementChangeRightTarget)this.diff;
- final boolean isRightElementNotNull = theDiff.getRightElement() != null;
- return isRightElementNotNull;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#getDependencies(boolean)
- */
- @Override
- protected List<DiffElement> getDependencies(boolean applyInOrigin) {
- if (applyInOrigin) {
- return diff.getRequires();
- }
- return super.getDependencies(applyInOrigin);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/MoveModelElementMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/MoveModelElementMerger.java
deleted file mode 100644
index e48facd10b0..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/MoveModelElementMerger.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.List;
-
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-/**
- * Merger for a {@link MoveModelElement} operation.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class MoveModelElementMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
- @SuppressWarnings("unchecked")
- @Override
- public void doApplyInOrigin() {
- final MoveModelElement theDiff = (MoveModelElement)this.diff;
- final EObject leftTarget = theDiff.getLeftTarget();
- final EObject leftElement = theDiff.getLeftElement();
- final EReference ref = theDiff.getRightElement().eContainmentFeature();
- if (ref != null) {
- // ordering handling:
- int index = -1;
- final EObject rightElementParent = theDiff.getRightElement().eContainer();
- final Object rightRefValue = rightElementParent.eGet(ref);
- if (rightRefValue instanceof List) {
- final List<Object> refRightValueList = (List<Object>)rightRefValue;
- index = refRightValueList.indexOf(theDiff.getRightElement());
- }
-
- try {
- // We'll store the element's ID because moving an element deletes its XMI ID
- final String elementID = getXMIID(leftElement);
- EcoreUtil.remove(leftElement);
- EFactory.eAdd(leftTarget, ref.getName(), leftElement, index, true);
- // Sets anew the element's ID
- setXMIID(leftElement, elementID);
- } catch (FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- } else {
- // shouldn't be here
- assert false;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @SuppressWarnings("unchecked")
- @Override
- public void doUndoInTarget() {
- final MoveModelElement theDiff = (MoveModelElement)this.diff;
- final EObject rightTarget = theDiff.getRightTarget();
- final EObject rightElement = theDiff.getRightElement();
- final EReference ref = theDiff.getLeftElement().eContainmentFeature();
- if (ref != null) {
- // ordering handling:
- int index = -1;
- final EObject leftElementParent = theDiff.getLeftElement().eContainer();
- final Object leftRefValue = leftElementParent.eGet(ref);
- if (leftRefValue instanceof List) {
- final List<Object> refLeftValueList = (List<Object>)leftRefValue;
- index = refLeftValueList.indexOf(theDiff.getLeftElement());
- }
-
- try {
- final String elementID = getXMIID(rightElement);
- EcoreUtil.remove(rightElement);
- EFactory.eAdd(rightTarget, ref.getName(), rightElement, index, true);
- setXMIID(rightElement, elementID);
- } catch (FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- } else {
- // shouldn't be here
- assert false;
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/PapyrusModelElementChangeLeftTargetMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/PapyrusModelElementChangeLeftTargetMerger.java
deleted file mode 100644
index b92e8cbcec3..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/PapyrusModelElementChangeLeftTargetMerger.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.internal.merge.impl.ModelElementChangeLeftTargetMerger;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceOrderChange;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.emf.compare.Activator;
-import org.eclipse.papyrus.infra.emf.compare.merger.provider.PapyrusMergeCommandProvider;
-import org.eclipse.papyrus.infra.emf.compare.utils.CompareEditorConfiguration;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Merger for an {@link ModelElementChangeLeftTarget} operation.<br/>
- * <p>
- * Are considered for this merger :
- * <ul>
- * <li>AddModelElement</li>
- * <li>RemoteRemoveModelElement</li>
- * </ul>
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class PapyrusModelElementChangeLeftTargetMerger extends ModelElementChangeLeftTargetMerger {
-
-private boolean useEditService(){
- CompareEditorConfiguration config = getConfiguration();
- return config != null && config.isEditServiceUsing();
-}
-
-private CompareEditorConfiguration getConfiguration(){
- IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- return Activator.getDefault().getConfigurationFor(editor);
-}
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
- @Override
- protected void doApplyInOrigin() {
-
- if(useEditService()) {
- System.out.println("Synchronization avec le diagramme : " + useEditService());
- final ModelElementChangeLeftTarget theDiff = (ModelElementChangeLeftTarget)this.diff;
- final EObject element = theDiff.getLeftElement();
- TransactionalEditingDomain domain = getConfiguration().getEditingDomain();
- Command cmd = PapyrusMergeCommandProvider.INSTANCE.getDestroyCommand(domain, element);
- domain.getCommandStack().execute(cmd);
- } else {
- System.out.println("Synchronization avec le diagramme : " + useEditService());
- super.doApplyInOrigin();
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @Override
- protected void doUndoInTarget() {
- final ModelElementChangeLeftTarget theDiff = (ModelElementChangeLeftTarget)this.diff;
- // we should copy the element to the Origin one.
- final EObject origin = theDiff.getRightParent();
- final EObject element = theDiff.getLeftElement();
- final EObject newOne = copy(element);
- final EReference ref = element.eContainmentFeature();
- if(ref != null) {
- try {
- int elementIndex = -1;
- if(ref.isMany()) {
- final Object containmentRefVal = element.eContainer().eGet(ref);
- if(containmentRefVal instanceof List<?>) {
- @SuppressWarnings("unchecked")
- final List<EObject> listVal = (List<EObject>)containmentRefVal;
- elementIndex = listVal.indexOf(element);
- }
- }
- EFactory.eAdd(origin, ref.getName(), newOne, elementIndex, true);
- setXMIID(newOne, getXMIID(element));
- } catch (final FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- } else if(origin == null && getDiffModel().getRightRoots().size() > 0) {
- getDiffModel().getRightRoots().get(0).eResource().getContents().add(newOne);
- } else if(origin != null) {
- origin.eResource().getContents().add(newOne);
- } else {
- // FIXME throw exception : couldn't merge this
- }
- // we should now have a look for RemovedReferencesLinks needing elements to apply
- final Iterator<EObject> siblings = getDiffModel().eAllContents();
- while(siblings.hasNext()) {
- final Object op = siblings.next();
- if(op instanceof ReferenceChangeLeftTarget) {
- final ReferenceChangeLeftTarget link = (ReferenceChangeLeftTarget)op;
- // now if I'm in the target References I should put my copy in the origin
- if(link.getRightTarget() != null && link.getRightTarget() == element) {
- link.setLeftTarget(newOne);
- }
- } else if(op instanceof ReferenceOrderChange) {
- final ReferenceOrderChange link = (ReferenceOrderChange)op;
- if(link.getRightElement() == origin && link.getReference() == ref) {
- final ListIterator<EObject> targetIterator = link.getRightTarget().listIterator();
- boolean replaced = false;
- while(!replaced && targetIterator.hasNext()) {
- final EObject target = targetIterator.next();
- if(target.eIsProxy() && equalProxyURIs(((InternalEObject)target).eProxyURI(), EcoreUtil.getURI(element))) {
- targetIterator.set(newOne);
- replaced = true;
- }
- }
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#getDependencies(boolean)
- */
- @Override
- protected List<DiffElement> getDependencies(boolean applyInOrigin) {
- if(!applyInOrigin) {
- return diff.getRequires();
- }
- return super.getDependencies(applyInOrigin);
- }
-
- public Command doApplyInOriginCommand() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Command doUndoInTargetCommand() {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/PapyrusUpdateAttributeMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/PapyrusUpdateAttributeMerger.java
deleted file mode 100644
index ce96c500e57..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/PapyrusUpdateAttributeMerger.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.internal.merge.impl.UpdateAttributeMerger;
-import org.eclipse.emf.compare.diff.metamodel.UpdateAttribute;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.emf.compare.merger.provider.PapyrusMergeCommandProvider;
-import org.eclipse.papyrus.infra.emf.compare.utils.Utils;
-
-
-public class PapyrusUpdateAttributeMerger extends UpdateAttributeMerger {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final UpdateAttribute theDiff = (UpdateAttribute)this.diff;
- final EObject element = theDiff.getRightElement();
- final EObject origin = theDiff.getLeftElement();
- final EAttribute attr = theDiff.getAttribute();
- if(Utils.useEditService()) {
- final TransactionalEditingDomain domain = Utils.getConfiguration().getEditingDomain();
- Command cmd = null;
- try {
- cmd = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, origin, origin.eClass().getEStructuralFeature(attr.getName()), EFactory.eGet(element, attr.getName()));
- } catch (final FactoryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- domain.getCommandStack().execute(cmd);
- } else {
- try {
- EFactory.eSet(origin, attr.getName(), EFactory.eGet(element, attr.getName()));
- } catch (final FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final UpdateAttribute theDiff = (UpdateAttribute)this.diff;
- final EObject element = theDiff.getRightElement();
- final EObject origin = theDiff.getLeftElement();
- final EAttribute attr = theDiff.getAttribute();
- if(Utils.useEditService()) {
- final TransactionalEditingDomain domain = Utils.getConfiguration().getEditingDomain();
- Command cmd = null;
- try {
- cmd = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, element, element.eClass().getEStructuralFeature(attr.getName()), EFactory.eGet(origin, attr.getName()));
- } catch (final FactoryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- domain.getCommandStack().execute(cmd);
- } else {
- try {
- EFactory.eSet(element, attr.getName(), EFactory.eGet(origin, attr.getName()));
- } catch (final FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceChangeLeftTargetMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceChangeLeftTargetMerger.java
deleted file mode 100644
index 108a07395d6..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceChangeLeftTargetMerger.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.merge.service.MergeService;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceOrderChange;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDependencyChange;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-/**
- * Merger for an {@link ReferenceChangeLeftTarget} operation.<br/>
- * <p>
- * Are considered for this merger :
- * <ul>
- * <li>AddReferenceValue</li>
- * <li>RemoteRemoveReferenceValue</li>
- * </ul>
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class ReferenceChangeLeftTargetMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final ReferenceChangeLeftTarget theDiff = (ReferenceChangeLeftTarget)this.diff;
- final EObject element = theDiff.getLeftElement();
- final EObject leftTarget = theDiff.getLeftTarget();
- try {
- EFactory.eRemove(element, theDiff.getReference().getName(), leftTarget);
- } catch (final FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- // we should now have a look for AddReferencesLinks needing this object
- final Iterator<EObject> siblings = getDiffModel().eAllContents();
- while (siblings.hasNext()) {
- final DiffElement op = (DiffElement)siblings.next();
- if (op instanceof ReferenceChangeLeftTarget) {
- final ReferenceChangeLeftTarget link = (ReferenceChangeLeftTarget)op;
- // now if I'm in the target References I should put my copy in the origin
- if (link.getReference().equals(theDiff.getReference().getEOpposite())
- && link.getLeftTarget().equals(element)) {
- removeFromContainer(link);
- }
- } else if (op instanceof ResourceDependencyChange) {
- final ResourceDependencyChange link = (ResourceDependencyChange)op;
- final Resource res = link.getRoots().get(0).eResource();
- if (res == leftTarget.eResource()) {
- EcoreUtil.remove(link);
- res.unload();
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final ReferenceChangeLeftTarget theDiff = (ReferenceChangeLeftTarget)this.diff;
- final EReference reference = theDiff.getReference();
- final EObject element = theDiff.getRightElement();
- final EObject leftTarget = theDiff.getLeftTarget();
- final EObject rightTarget = theDiff.getRightTarget();
-
- int index = -1;
- if (reference.isMany()) {
- final EObject leftElement = theDiff.getLeftElement();
- final Object leftRefValue = leftElement.eGet(reference);
- if (leftRefValue instanceof List) {
- final List refLeftValueList = (List)leftRefValue;
- index = refLeftValueList.indexOf(leftTarget);
- }
- }
- final EObject copiedValue = MergeService.getCopier(diff).copyReferenceValue(reference, element,
- leftTarget, rightTarget, index);
-
- // we should now have a look for AddReferencesLinks needing this object
- final Iterator<EObject> siblings = getDiffModel().eAllContents();
- while (siblings.hasNext()) {
- final DiffElement op = (DiffElement)siblings.next();
- if (op instanceof ReferenceChangeLeftTarget) {
- final ReferenceChangeLeftTarget link = (ReferenceChangeLeftTarget)op;
- // now if I'm in the target References I should put my copy in the origin
- if (link.getReference().equals(reference.getEOpposite())
- && link.getLeftTarget().equals(element)) {
- removeFromContainer(link);
- }
- } else if (op instanceof ReferenceOrderChange) {
- final ReferenceOrderChange link = (ReferenceOrderChange)op;
- if (link.getLeftElement() == element && link.getReference() == reference) {
- final ListIterator<EObject> targetIterator = link.getLeftTarget().listIterator();
- boolean replaced = false;
- while (!replaced && targetIterator.hasNext()) {
- final EObject target = targetIterator.next();
- if (target.eIsProxy()
- && equalProxyURIs(((InternalEObject)target).eProxyURI(),
- EcoreUtil.getURI(leftTarget))) {
- targetIterator.set(copiedValue);
- replaced = true;
- }
- }
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#getDependencies(boolean)
- */
- @Override
- protected List<DiffElement> getDependencies(boolean applyInOrigin) {
- if (!applyInOrigin) {
- return diff.getRequires();
- }
- return super.getDependencies(applyInOrigin);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceChangeRightTargetMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceChangeRightTargetMerger.java
deleted file mode 100644
index e88a5c4928d..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceChangeRightTargetMerger.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.merge.service.MergeService;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceOrderChange;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDependencyChange;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-
-/**
- * Merger for an {@link ReferenceChangeRightTarget} operation.<br/>
- * <p>
- * Are considered for this merger :
- * <ul>
- * <li>RemoveReferenceValue</li>
- * <li>RemoteAddReferenceValue</li>
- * </ul>
- * </p>
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class ReferenceChangeRightTargetMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final ReferenceChangeRightTarget theDiff = (ReferenceChangeRightTarget)this.diff;
- final EReference reference = theDiff.getReference();
- final EObject element = theDiff.getLeftElement();
- final EObject rightTarget = theDiff.getRightTarget();
- final EObject leftTarget = theDiff.getLeftTarget();
-
- // ordering handling:
- int index = -1;
- if (reference.isMany()) {
- final EObject rightElement = theDiff.getRightElement();
- final Object rightRefValue = rightElement.eGet(reference);
- if (rightRefValue instanceof List) {
- final List refRightValueList = (List)rightRefValue;
- index = refRightValueList.indexOf(rightTarget);
- }
- }
- final EObject copiedValue = MergeService.getCopier(diff).copyReferenceValue(reference, element,
- rightTarget, leftTarget, index);
-
- // We'll now look through this reference's eOpposite as they are already taken care of
- final Iterator<EObject> related = getDiffModel().eAllContents();
- while (related.hasNext()) {
- final DiffElement op = (DiffElement)related.next();
- if (op instanceof ReferenceChangeRightTarget) {
- final ReferenceChangeRightTarget link = (ReferenceChangeRightTarget)op;
- // If this is my eOpposite, delete it from the DiffModel (merged along with this one)
- if (link.getReference().equals(theDiff.getReference().getEOpposite())
- && link.getRightTarget().equals(element)) {
- removeFromContainer(link);
- }
- } else if (op instanceof ReferenceOrderChange) {
- final ReferenceOrderChange link = (ReferenceOrderChange)op;
- if (link.getLeftElement() == element && link.getReference() == reference) {
- final ListIterator<EObject> targetIterator = link.getLeftTarget().listIterator();
- boolean replaced = false;
- while (!replaced && targetIterator.hasNext()) {
- final EObject target = targetIterator.next();
- if (target.eIsProxy()
- && equalProxyURIs(((InternalEObject)target).eProxyURI(),
- EcoreUtil.getURI(rightTarget))) {
- targetIterator.set(copiedValue);
- replaced = true;
- }
- }
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final ReferenceChangeRightTarget theDiff = (ReferenceChangeRightTarget)this.diff;
- final EObject element = theDiff.getRightElement();
- final EObject rightTarget = theDiff.getRightTarget();
- try {
- EFactory.eRemove(element, theDiff.getReference().getName(), rightTarget);
- } catch (final FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- // we should now have a look for AddReferencesLinks needing this object
- final Iterator<EObject> related = getDiffModel().eAllContents();
- while (related.hasNext()) {
- final DiffElement op = (DiffElement)related.next();
- if (op instanceof ReferenceChangeRightTarget) {
- final ReferenceChangeRightTarget link = (ReferenceChangeRightTarget)op;
- // now if I'm in the target References I should put my copy in the origin
- if (link.getReference().equals(theDiff.getReference().getEOpposite())
- && link.getRightTarget().equals(element)) {
- removeFromContainer(link);
- }
- } else if (op instanceof ResourceDependencyChange) {
- final ResourceDependencyChange link = (ResourceDependencyChange)op;
- final Resource res = link.getRoots().get(0).eResource();
- if (res == rightTarget.eResource()) {
- EcoreUtil.remove(link);
- res.unload();
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#getDependencies(boolean)
- */
- @Override
- protected List<DiffElement> getDependencies(boolean applyInOrigin) {
- if (applyInOrigin) {
- return diff.getRequires();
- }
- return super.getDependencies(applyInOrigin);
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceOrderChangeMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceOrderChangeMerger.java
deleted file mode 100644
index 8e614ab6410..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/ReferenceOrderChangeMerger.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-
-import java.util.Collection;
-
-import org.eclipse.emf.compare.EMFComparePlugin;
-import org.eclipse.emf.compare.FactoryException;
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceOrderChange;
-import org.eclipse.emf.compare.util.EFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.InternalEObject;
-
-/**
- * Merger for a {@link ReferenceOrderChange} operation.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- *
- * FIXME : remove google dependencies!
- */
-public class ReferenceOrderChangeMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final ReferenceOrderChange theDiff = (ReferenceOrderChange)this.diff;
- final EObject leftElement = theDiff.getLeftElement();
-
- final Collection<EObject> target = Collections2.filter(theDiff.getLeftTarget(),
- new Predicate<EObject>() {
- public boolean apply(EObject input) {
- return !input.eIsProxy()
- || !DefaultMerger.isEMFCompareProxy(((InternalEObject)input).eProxyURI());
- }
- });
-
- try {
- EFactory.eSet(leftElement, theDiff.getReference().getName(), target);
- } catch (final FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final ReferenceOrderChange theDiff = (ReferenceOrderChange)this.diff;
- final EObject rightElement = theDiff.getRightElement();
-
- final Collection<EObject> target = Collections2.filter(theDiff.getRightTarget(),
- new Predicate<EObject>() {
- public boolean apply(EObject input) {
- return !input.eIsProxy()
- || !DefaultMerger.isEMFCompareProxy(((InternalEObject)input).eProxyURI());
- }
- });
-
- try {
- EFactory.eSet(rightElement, theDiff.getReference().getName(), target);
- } catch (final FactoryException e) {
- EMFComparePlugin.log(e, true);
- }
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/UpdateReferenceMerger.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/UpdateReferenceMerger.java
deleted file mode 100644
index 1ef32c9823d..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/UpdateReferenceMerger.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2011 Obeo.
- * 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:
- * Obeo - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.infra.emf.compare.merger;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.compare.diff.merge.DefaultMerger;
-import org.eclipse.emf.compare.diff.merge.service.MergeService;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-
-/**
- * Merger for an {@link UpdateUniqueReferenceValue} operation.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
-public class UpdateReferenceMerger extends DefaultMerger {
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
- */
- @Override
- public void doApplyInOrigin() {
- final UpdateReference theDiff = (UpdateReference)this.diff;
- final EReference reference = theDiff.getReference();
- final EObject element = theDiff.getLeftElement();
- final EObject leftTarget = (EObject)theDiff.getRightElement().eGet(reference);
- final EObject matchedLeftTarget = theDiff.getLeftTarget();
-
- if (leftTarget == null) {
- // We're unsetting the value, no need to copy
- element.eUnset(reference);
- } else {
- MergeService.getCopier(diff).copyReferenceValue(reference, element, leftTarget,
- matchedLeftTarget, -1);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doUndoInTarget()
- */
- @Override
- public void doUndoInTarget() {
- final UpdateReference theDiff = (UpdateReference)this.diff;
- final EReference reference = theDiff.getReference();
- final EObject element = theDiff.getRightElement();
- final EObject rightTarget = (EObject)theDiff.getLeftElement().eGet(reference);
- final EObject matchedRightTarget = theDiff.getRightTarget();
-
- if (rightTarget == null) {
- // We're unsetting the value, no need to copy
- element.eUnset(reference);
- } else {
- MergeService.getCopier(diff).copyReferenceValue(reference, element, rightTarget,
- matchedRightTarget, -1);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#getDependencies(boolean)
- */
- @Override
- protected List<DiffElement> getDependencies(boolean applyInOrigin) {
- final List<DiffElement> diffs = diff.getRequires();
- final List<DiffElement> result = new ArrayList<DiffElement>();
- for (DiffElement diffElement : diffs) {
- if (applyInOrigin && diffElement instanceof ModelElementChangeRightTarget) {
- result.add(diffElement);
- } else if (!applyInOrigin && diffElement instanceof ModelElementChangeLeftTarget) {
- result.add(diffElement);
- }
- }
- return result;
- }
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/MergeCommandProvider.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/MergeCommandProvider.java
deleted file mode 100644
index c33fe4b1923..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/MergeCommandProvider.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*****************************************************************************
- * 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.merger.provider;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChange;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.AttributeOrderChange;
-import org.eclipse.emf.compare.diff.metamodel.ConflictingDiffElement;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChange;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChange;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceOrderChange;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDependencyChange;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDependencyChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDependencyChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.ResourceDiff;
-import org.eclipse.emf.compare.diff.metamodel.UpdateAttribute;
-import org.eclipse.emf.compare.diff.metamodel.UpdateContainmentFeature;
-import org.eclipse.emf.compare.diff.metamodel.UpdateModelElement;
-import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
-import org.eclipse.emf.compare.diff.metamodel.impl.AttributeChangeImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-
-
-public class MergeCommandProvider {//TODO create an interface?
-
- public Command getMergeCommand(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain, final EObject elementToDestroy) {
- Command cmd = null;
- if(diffElement instanceof AttributeChangeImpl) {
- cmd = getMergeCommandForAttributeChange(container, confirmationRequired, (AttributeChange)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ConflictingDiffElement) {
- cmd = getMergeCommandForConflictingDiffElement(container, confirmationRequired, (ConflictingDiffElement)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof DiffGroup) {
- cmd = getMergeCommandForDiffGroup(container, confirmationRequired, (DiffGroup)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ModelElementChange) {
- cmd = getMergeCommandForModelElementChange(container, confirmationRequired, (ModelElementChange)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ReferenceChange) {
- cmd = getMergeCommandForReferenceChange(container, confirmationRequired, (ReferenceChange)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ResourceDiff) {
- cmd = getMergeCommandForResourceDiff(container, confirmationRequired, (ResourceDiff)diffElement, leftToRight, editingDomain);
- } else {
- //TODO log an error;
- }
- return cmd;
- }
-
- protected Command getMergeCommandForAttributeChange(final Object container, final boolean confirmationRequired, final AttributeChange diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof AttributeChangeLeftTarget) {
- cmd = getMergeCommandForAttributeChangeLeftTarget(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof AttributeChangeRightTarget) {
- cmd = getMergeCommandForAttributeChangeRightTarget(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof AttributeOrderChange) {
- cmd = getMergeCommandForAttributeOrderChange(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof UpdateAttribute) {
- cmd = getMergeCommandForUpdateAttribute(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForAttributeChangeLeftTarget(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {//TODO
- return null;
- }
-
- protected Command getMergeCommandForAttributeChangeRightTarget(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForAttributeOrderChange(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {//TODO
- return null;
- }
-
- protected Command getMergeCommandForUpdateAttribute(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForConflictingDiffElement(final Object container, final boolean confirmationRequired, final ConflictingDiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForDiffGroup(final Object container, final boolean confirmationRequired, final DiffGroup diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForModelElementChange(final Object container, final boolean confirmationRequired, final ModelElementChange diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof ModelElementChangeLeftTarget) {
- cmd = getMergeCommandForModelElementChangeLeftTarget(container, confirmationRequired, (ModelElementChangeLeftTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ModelElementChangeRightTarget) {
- cmd = getMergeCommandForModelElementChangeRightTarget(container, confirmationRequired, (ModelElementChangeRightTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof UpdateModelElement) {
- cmd = getMergeCommandForUpdateModelElement(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForModelElementChangeLeftTarget(final Object container, final boolean confirmationRequired, final ModelElementChangeLeftTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
-
- return null;
- }
-
- protected Command getMergeCommandForModelElementChangeRightTarget(final Object container, final boolean confirmationRequired, final ModelElementChangeRightTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForUpdateModelElement(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof MoveModelElement) {
- cmd = getMergeCommandForMoveModelElement(container, confirmationRequired, (MoveModelElement)diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForMoveModelElement(final Object container, final boolean confirmationRequired, final MoveModelElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof UpdateContainmentFeature) {
- cmd = getMergeCommandForUpdateContainmentFeature(container, confirmationRequired, (UpdateContainmentFeature)diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
-
- }
-
- protected Command getMergeCommandForUpdateContainmentFeature(final Object container, final boolean confirmationRequired, final UpdateContainmentFeature diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForReferenceChange(final Object container, final boolean confirmationRequired, final ReferenceChange diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {//TODO
- Command cmd = null;
- if(diffElement instanceof ReferenceChangeLeftTarget) {
- cmd = getMergeCommandForReferenceChangeLeftTarget(container, confirmationRequired, (ReferenceChangeLeftTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ReferenceChangeRightTarget) {
- cmd = getMergeCommandForReferenceChangeRightTarget(container, confirmationRequired, (ReferenceChangeRightTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ReferenceOrderChange) {
- cmd = getMergeCommandForReferenceOrderChange(container, confirmationRequired, (ReferenceOrderChange)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof UpdateReference) {
- cmd = getMergeCommandForUpdateReference(container, confirmationRequired, (UpdateReference)diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForReferenceChangeLeftTarget(final Object container, final boolean confirmationRequired, final ReferenceChangeLeftTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForReferenceChangeRightTarget(final Object container, final boolean confirmationRequired, final ReferenceChangeRightTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForReferenceOrderChange(final Object container, final boolean confirmationRequired, final ReferenceOrderChange diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForUpdateReference(final Object container, final boolean confirmationRequired, final UpdateReference diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForResourceDiff(final Object container, final boolean confirmationRequired, final ResourceDiff diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- Command cmd = null;
- if(diffElement instanceof ResourceDependencyChange) {
- cmd = getMergeCommandForResourceDependencyChange(container, confirmationRequired, diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForResourceDependencyChange(final Object container, final boolean confirmationRequired, final DiffElement diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {//TODO
- Command cmd = null;
- if(diffElement instanceof ResourceDependencyChangeLeftTarget) {
- cmd = getMergeCommandForResourceDependencyChangeLeftTarget(container, confirmationRequired, (ResourceDependencyChangeLeftTarget)diffElement, leftToRight, editingDomain);
- } else if(diffElement instanceof ResourceDependencyChangeRightTarget) {
- cmd = getMergeCommandForResourceDependencyChangeRightTarget(container, confirmationRequired, (ResourceDependencyChangeRightTarget)diffElement, leftToRight, editingDomain);
- } else {
- //TODO
- }
- return cmd;
- }
-
- protected Command getMergeCommandForResourceDependencyChangeLeftTarget(final Object container, final boolean confirmationRequired, final ResourceDependencyChangeLeftTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
- protected Command getMergeCommandForResourceDependencyChangeRightTarget(final Object container, final boolean confirmationRequired, final ResourceDependencyChangeRightTarget diffElement, final boolean leftToRight, final TransactionalEditingDomain editingDomain) {
- //TODO
- return null;
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/PapyrusMergeCommandProvider.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/PapyrusMergeCommandProvider.java
deleted file mode 100644
index 2b7248bcb67..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/PapyrusMergeCommandProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*****************************************************************************
- * 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.merger.provider;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-
-
-public class PapyrusMergeCommandProvider {
-
- public static PapyrusMergeCommandProvider INSTANCE = new PapyrusMergeCommandProvider();
-
- private PapyrusMergeCommandProvider() {
-
- }
-
- public Command getDestroyCommand(final TransactionalEditingDomain domain, final EObject element) {
- final IEditCommandRequest request = new DestroyElementRequest(domain, element, false);
- return getCommand(element, request);
- }
-
- private Command getCommand(final EObject elementToEdit, final IEditCommandRequest request) {
- final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToEdit);
- if(provider != null) {
- return new GMFtoEMFCommandWrapper(provider.getEditCommand(request));
- }
- return null;
- }
-
- public Command getSetCommand(final TransactionalEditingDomain domain, final EObject element, final EStructuralFeature feature, final Object value) {
- final IEditCommandRequest request = new SetRequest(domain, element, feature, value);
- return getCommand(element, request);
- }
-
-
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/PapyrusMergerProvider.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/PapyrusMergerProvider.java
deleted file mode 100644
index e8cf53aa0fb..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/merger/provider/PapyrusMergerProvider.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*****************************************************************************
- * 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.merger.provider;
-
-import java.util.Map;
-
-import org.eclipse.emf.compare.diff.internal.merge.DefaultMergerProvider;
-import org.eclipse.emf.compare.diff.merge.IMerger;
-import org.eclipse.emf.compare.diff.merge.IMergerProvider;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.AttributeChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.AttributeOrderChange;
-import org.eclipse.emf.compare.diff.metamodel.DiffElement;
-import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeLeftTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceChangeRightTarget;
-import org.eclipse.emf.compare.diff.metamodel.ReferenceOrderChange;
-import org.eclipse.emf.compare.diff.metamodel.UpdateAttribute;
-import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
-import org.eclipse.emf.compare.util.EMFCompareMap;
-import org.eclipse.papyrus.infra.emf.compare.merger.AttributeChangeLeftTargetMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.AttributeChangeRightTargetMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.AttributeOrderChangeMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.DiffGroupMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.ModelElementChangeRightTargetMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.MoveModelElementMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.PapyrusModelElementChangeLeftTargetMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.PapyrusUpdateAttributeMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.ReferenceChangeLeftTargetMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.ReferenceChangeRightTargetMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.ReferenceOrderChangeMerger;
-import org.eclipse.papyrus.infra.emf.compare.merger.UpdateReferenceMerger;
-
-
-public class PapyrusMergerProvider implements IMergerProvider {
-
- /**
- * This map keeps a bridge between a given {@link DiffElement}'s class and the most accurate merger's
- * class for that particular {@link DiffElement}.
- */
- private Map<Class<? extends DiffElement>, Class<? extends IMerger>> mergerTypes;
-
- /**
- * The default merge provide
- */
- private final IMergerProvider defaultMergeProvider = new DefaultMergerProvider();
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.emf.compare.diff.merge.IMergerProvider#getMergers()
- */
- public Map<Class<? extends DiffElement>, Class<? extends IMerger>> getMergers() {
- if(this.mergerTypes == null) {
- this.mergerTypes = new EMFCompareMap<Class<? extends DiffElement>, Class<? extends IMerger>>();
- this.mergerTypes.put(DiffGroup.class, DiffGroupMerger.class);
- this.mergerTypes.put(ModelElementChangeRightTarget.class, ModelElementChangeRightTargetMerger.class);
- this.mergerTypes.put(ModelElementChangeLeftTarget.class, PapyrusModelElementChangeLeftTargetMerger.class);
- this.mergerTypes.put(MoveModelElement.class, MoveModelElementMerger.class);
- this.mergerTypes.put(ReferenceChangeRightTarget.class, ReferenceChangeRightTargetMerger.class);
- this.mergerTypes.put(ReferenceChangeLeftTarget.class, ReferenceChangeLeftTargetMerger.class);
- this.mergerTypes.put(UpdateReference.class, UpdateReferenceMerger.class);
- this.mergerTypes.put(AttributeChangeRightTarget.class, AttributeChangeRightTargetMerger.class);
- this.mergerTypes.put(AttributeChangeLeftTarget.class, AttributeChangeLeftTargetMerger.class);
- this.mergerTypes.put(UpdateAttribute.class, PapyrusUpdateAttributeMerger.class);
- this.mergerTypes.put(ReferenceOrderChange.class, ReferenceOrderChangeMerger.class);
- this.mergerTypes.put(AttributeOrderChange.class, AttributeOrderChangeMerger.class);
- }
- return this.mergerTypes;
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/service/SaveEMFCompareListener.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/service/SaveEMFCompareListener.java
deleted file mode 100644
index acded6e0fa9..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/service/SaveEMFCompareListener.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*****************************************************************************
- * 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.service;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IExecutionListener;
-import org.eclipse.core.commands.NotHandledException;
-import org.eclipse.papyrus.infra.emf.compare.Activator;
-import org.eclipse.papyrus.infra.emf.compare.utils.CompareEditorConfiguration;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-
-/**
- *
- * This listener is used to catch the Save and the SaveAll actions to save the diResource linked to the modified uml Resource
- *
- */
-public class SaveEMFCompareListener implements IExecutionListener {
-
- /** the id of the save action */
- public static final String SAVE = "org.eclipse.ui.file.save";
-
- /** the id of the saveAll action */
- public static final String SAVE_ALL = "org.eclipse.ui.file.saveAll";
-
- /**
- *
- * {@inheritDoc}
- *
- * @param commandId
- * @param exception
- */
- public void notHandled(final String commandId, final NotHandledException exception) {
- //nothing to do
- }
-
- /**
- *
- * {@inheritDoc}
- *
- * @param commandId
- * @param exception
- */
- public void postExecuteFailure(final String commandId, final ExecutionException exception) {
- //nothing to do
- }
-
- /**
- *
- * {@inheritDoc}
- *
- * @param commandId
- * @param returnValue
- */
- public void postExecuteSuccess(final String commandId, final Object returnValue) {
- if(commandId.equals(SaveEMFCompareListener.SAVE)) {
- final IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- save(Collections.singletonList(editor));
- } else if(commandId.equals(SaveEMFCompareListener.SAVE_ALL)) {
- final IEditorPart editors[] = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getDirtyEditors();
- save(Arrays.asList(editors));
- }
- }
-
- /**
- *
- * {@inheritDoc}
- *
- * @param commandId
- * @param event
- */
- public void preExecute(final String commandId, final ExecutionEvent event) {
- //nothing to do!
- }
-
- /**
- * Save resources
- *
- * @param dirtyEditor
- * the list of the Resource to Save
- */
- private void save(final List<IEditorPart> dirtyEditor) {
- for(final IEditorPart current : dirtyEditor) {
- final CompareEditorConfiguration config = Activator.getDefault().getConfigurationFor(current);
- if(config != null) {
- config.save();
- }
- }
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/utils/CompareEditorConfiguration.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/utils/CompareEditorConfiguration.java
deleted file mode 100644
index 931b586caad..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/utils/CompareEditorConfiguration.java
+++ /dev/null
@@ -1,261 +0,0 @@
-/*****************************************************************************
- * 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.utils;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-import org.eclipse.ui.IEditorPart;
-
-/**
- *
- * This class contains all the information and the methods to do UML file comparison with the Eclipse Viewer
- *
- */
-public class CompareEditorConfiguration {
-
- /**
- * the left diResource
- */
- private Resource leftDiResource;
-
- /**
- * the right diResource
- */
- private Resource rightDiResource;
-
- /**
- * the editing domain for the merge
- */
- private TransactionalEditingDomain domain;
-
- /**
- * the right uml resource
- */
- private Resource rightUMLResource;
-
- /**
- * the left uml resource
- */
- private Resource leftUMLResource;
-
- /**
- * a boolean to know if we should use the edit service
- */
- private boolean isEditServiceUsing = false;
-
- /** this boolean is used to know if the editing domain is provided by the editor or has been created by this class */
- private boolean provideTransactionalEditingDomain = false;//TODO pourrait être supprimer en regardant lors du dispose si l'éditeur est un domain provider!
-
- /**
- * the list of the metamodels for the customization manager
- */
- private Set<EPackage> metamodels;
-
- /**
- *
- * Constructor.
- *
- * @param editor
- * the compare editor
- * @param leftUMLResource
- * the left UML Resource
- * @param rightUMLResource
- * the right UMLResource
- */
- public CompareEditorConfiguration(final IEditorPart editor, final Resource leftUMLResource, final Resource rightUMLResource) {
- this.leftUMLResource = leftUMLResource;
- this.rightUMLResource = rightUMLResource;
- if(editor instanceof IEditingDomainProvider) {
- //we assume it will be always the case...
- this.domain = (TransactionalEditingDomain)((IEditingDomainProvider)editor).getEditingDomain();
- }
- if(this.leftUMLResource == null) {
- return;
- }
- Assert.isNotNull(rightUMLResource);
- Assert.isNotNull(rightUMLResource);
- initialize();
- }
-
- /**
- * initialize the field
- */
- private void initialize() {
- initializeEditingDomain();
- initializeDiResource();
- }
-
- /**
- * Returns <code>true</code> if we should use the edit service
- *
- * @return
- * Getter for {@link #isEditServiceUsing}
- */
- public boolean isEditServiceUsing() {
- return this.isEditServiceUsing;
- }
-
- /**
- * Setter for {@link #isEditServiceUsing()}
- *
- * @param use
- * <code>true</code> if we should use the edit service
- */
- public void setUseEditService(final boolean use) {
- this.isEditServiceUsing = use;
- }
-
- /**
- * Initialize the editing domain used for the action
- */
- private void initializeEditingDomain() {
- if(this.domain == null) {
- this.domain = TransactionUtil.getEditingDomain(this.leftUMLResource);
- if(this.domain == null) {
- this.domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(this.leftUMLResource.getResourceSet());
- this.provideTransactionalEditingDomain = true;
- }
- }
-
- }
-
- /**
- * initialize the di resource
- */
- private void initializeDiResource() {
- URI uri;
- URI diURI;
- ResourceSet set;
- //the left :
- uri = this.leftUMLResource.getURI();
- diURI = URI.createPlatformResourceURI(uri.toPlatformString(false).replace("uml", "di"), false);//TODO FIXME avoid to duplicate these string?
- set = this.leftUMLResource.getResourceSet();
- if(set.getURIConverter().exists(diURI, null)) {
- this.leftDiResource = set.getResource(diURI, true);
- try {
- this.leftDiResource.load(null);
- } catch (final IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- //the right
- uri = this.rightUMLResource.getURI();
- diURI = URI.createPlatformResourceURI(uri.toPlatformString(false).replace("uml", "di"), false);//TODO FIXME avoid to duplicate these string?
- set = this.rightUMLResource.getResourceSet();
- if(set.getURIConverter().exists(diURI, null)) {
- this.rightDiResource = set.getResource(diURI, true);
- try {
- this.rightDiResource.load(null);
- } catch (final IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- /**
- * save the di resource
- */
- public void save() {
- final Map<?, ?> options = null;
- if(this.leftDiResource != null) {
- try {
- this.leftDiResource.save(options);
- } catch (final IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- if(this.rightDiResource != null) {
- try {
- this.rightDiResource.save(options);
- } catch (final IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Getter for {@link #domain}
- *
- * @return
- * {@link #domain}
- */
- public TransactionalEditingDomain getEditingDomain() {
- return this.domain;
- }
-
- /**
- *
- * @return
- * <code>true</code> if there is diResource associated to the UML Resource
- */
- public boolean manageDiResource() {
- return this.leftDiResource != null || this.rightDiResource != null;
- }
-
- /**
- *
- * @return
- * the list of the metamodel managed for the CustomizationManager
- */
- public Set<EPackage> getMetamodels() {
- if(this.metamodels == null) {
- this.metamodels = new HashSet<EPackage>();
- if(this.leftUMLResource != null && this.rightUMLResource != null) {
- final List<EObject> contents = new ArrayList<EObject>(this.leftUMLResource.getContents());
- contents.addAll(this.rightUMLResource.getContents());
- for(final EObject current : contents) {
- this.metamodels.add(current.eClass().getEPackage());
- }
- }
- }
- return this.metamodels;
- }
-
- public void dispose() {
- //we detach the editingdomain of the resourceset
- if(this.provideTransactionalEditingDomain) {
- this.domain.dispose();
- //if not the editing domain comes from the editor, we doesn't manage it!
- }
- final Map<?, ?> options = null;
- if(this.leftDiResource != null) {
- this.leftDiResource.unload();
- }
- if(this.rightDiResource != null) {
- this.rightDiResource.unload();
- }
- this.metamodels.clear();
- }
-
-}
diff --git a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/utils/Utils.java b/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/utils/Utils.java
deleted file mode 100644
index 3bf9b3c0e98..00000000000
--- a/sandbox/PapyrusEMFCompareV1/org.eclipse.papyrus.infra.emf.compare/src/org/eclipse/papyrus/infra/emf/compare/utils/Utils.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*****************************************************************************
- * 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.utils;
-
-import org.eclipse.papyrus.infra.emf.compare.Activator;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-
-public class Utils {
-
- private Utils() {
- //nothing to do
- }
-
- //FIXME refactore this class in an upper plugin->yes!
- public static final IEditorPart getCurrentEditor() {
- final IWorkbench workbench = PlatformUI.getWorkbench();
- if(workbench != null) {
- final IWorkbenchWindow activeWorkbench = workbench.getActiveWorkbenchWindow();
- if(activeWorkbench != null) {
- final IWorkbenchPage activePage = activeWorkbench.getActivePage();
- if(activePage != null) {
- activePage.getActiveEditor();
- }
- }
- }
- return null;
- }
-
-
- public static boolean useEditService() {
- final CompareEditorConfiguration config = Utils.getConfiguration();
- return config != null && config.isEditServiceUsing();
- }
-
- public static CompareEditorConfiguration getConfiguration() {
- final IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- return Activator.getDefault().getConfigurationFor(editor);
- }
-}

Back to the top