diff options
author | cletavernie | 2013-06-18 08:16:24 +0000 |
---|---|---|
committer | cletavernie | 2013-06-18 08:16:24 +0000 |
commit | 098d8c358b9b62de9cb43e6424bca6ecec506087 (patch) | |
tree | a79ae6004374ba16ae62adbda5a88db75dbe0284 /deprecated | |
parent | e30c5c80eb0d2ee70abf965916c04145d78edfbd (diff) | |
download | org.eclipse.papyrus-098d8c358b9b62de9cb43e6424bca6ecec506087.tar.gz org.eclipse.papyrus-098d8c358b9b62de9cb43e6424bca6ecec506087.tar.xz org.eclipse.papyrus-098d8c358b9b62de9cb43e6424bca6ecec506087.zip |
Deprecate 1.X integration of EMF Compare for Papyrus 0.10.X
Diffstat (limited to 'deprecated')
287 files changed, 27479 insertions, 0 deletions
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.project new file mode 100644 index 00000000000..4646b498da8 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.compare.report.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/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.settings/org.eclipse.jdt.core.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0b515fef1d4 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1
+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/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..f12b0ae7e9d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/META-INF/MANIFEST.MF @@ -0,0 +1,26 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.ui.ide,
+ org.eclipse.papyrus.compare.report;bundle-version="0.10.0",
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.compare.diff,
+ org.eclipse.emf.compare.ui,
+ org.eclipse.ocl,
+ org.eclipse.ocl.ecore,
+ org.eclipse.acceleo.model,
+ org.eclipse.acceleo.engine
+Export-Package: org.eclipse.papyrus.compare.report.ui.common
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Eclipse-LazyStart: true
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.compare.report.ui.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.compare.report.ui;singleton:=
+ true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/OSGI-INF/l10n/bundle.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 00000000000..aafbd3c60ac --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,5 @@ +#Properties file for org.eclipse.papyrus.compare.report.ui
+menu.label = Acceleo Model to Text
+action.label = Generate DiffReport
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Acceleo GenerateReport Module IDE Plug-in (Incubation)
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/about.html new file mode 100644 index 00000000000..209103075a7 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/build.properties new file mode 100644 index 00000000000..d9ef6898f30 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/build.properties @@ -0,0 +1,10 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ about.html,\
+ OSGI-INF/
+src.includes = about.html
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/icons/export_as_html.gif b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/icons/export_as_html.gif Binary files differnew file mode 100644 index 00000000000..8a31f458379 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/icons/export_as_html.gif diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/plugin.xml b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/plugin.xml new file mode 100644 index 00000000000..b1b7e793e1e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/plugin.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.emfdiff"
+ id="org.eclipse.papyrus.compare.report.ui.popupMenus.contribution.IFile">
+ <menu id="org.eclipse.acceleo.module.menu" label="%menu.label" path="additionsAcceleo">
+ <groupMarker name="acceleo"/>
+ </menu>
+ <action
+ class="org.eclipse.papyrus.compare.report.ui.popupMenus.AcceleoGenerateGenerateReportAction"
+ enablesFor="+"
+ id="org.eclipse.papyrus.compare.report.ui.popupMenus.acceleoGenerateGenerateReportAction"
+ icon="icons/export_as_html.gif"
+ label="%action.label"
+ menubarPath="org.eclipse.acceleo.module.menu/acceleo"/>
+ </objectContribution>
+ </extension>
+
+ <extension
+ point="org.eclipse.emf.compare.ui.export">
+ <action
+ class="org.eclipse.papyrus.compare.report.ui.action.ExportAsGenReportAction"
+ fileExtension="uml"
+ id="org.eclipse.papyrus.compare.exportAsHTMLAction">
+ </action>
+ </extension>
+
+</plugin>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/Activator.java new file mode 100644 index 00000000000..9c9b26f604d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/Activator.java @@ -0,0 +1,66 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.ui;
+
+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.compare.report.ui";
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The constructor.
+ */
+ public Activator() {
+ }
+
+ /**{@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
+ * @generated
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /**{@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ * @generated
+ */
+ 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;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/action/ExportAsGenReportAction.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/action/ExportAsGenReportAction.java new file mode 100644 index 00000000000..806c0f5fef3 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/action/ExportAsGenReportAction.java @@ -0,0 +1,53 @@ +package org.eclipse.papyrus.compare.report.ui.action;
+
+import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot;
+import org.eclipse.emf.compare.ui.export.IExportAction;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.papyrus.compare.report.ui.Activator;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+public class ExportAsGenReportAction implements IExportAction {
+
+ private final String myText = "As HTML Report";
+
+ private final String myToolTipText = "Export Diff Report in HTML format";
+
+ private final String myImagePath = "icons/export_as_html.gif";
+
+ private final Image myImage;
+
+ public ExportAsGenReportAction() {
+ myImage = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, myImagePath).createImage();
+ }
+
+ public String getText() {
+ return myText;
+ }
+
+ public String getToolTipText() {
+ return myToolTipText;
+ }
+
+ public void exportSnapshot(ComparisonSnapshot snapshot) {
+ final ExportAsHTMLWizard wizard = new ExportAsHTMLWizard();
+ final IWorkbench workbench = PlatformUI.getWorkbench();
+
+ wizard.init(workbench, snapshot);
+ final WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.open();
+
+ }
+
+ public Image getDisabledImage() {
+ return myImage;
+ }
+
+ public Image getEnabledImage() {
+ return myImage;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/action/ExportAsHTMLWizard.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/action/ExportAsHTMLWizard.java new file mode 100644 index 00000000000..a223b3c2075 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/action/ExportAsHTMLWizard.java @@ -0,0 +1,178 @@ +package org.eclipse.papyrus.compare.report.ui.action;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+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.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.ui.internal.wizard.SaveDeltaWizard;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.papyrus.compare.report.services.UmlElementService;
+import org.eclipse.papyrus.compare.report.ui.common.GenerateAll;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+
+public class ExportAsHTMLWizard extends SaveDeltaWizard {
+
+ private static final String HTML_EXTENSION = "html";
+
+ private static final String EMFDIFF_EXTENSION = "emfdiff";
+
+ private WizardNewFileCreationPage myNewReportFileCreationPage;
+
+ private IResource myFirstSelectedFile;
+
+ private String myDefaultFileName;
+
+ public ExportAsHTMLWizard() {
+ super(null); // use default extension
+ }
+
+
+ public void init(IWorkbench workbench, ComparisonSnapshot inputSnapshot) {
+ super.init(workbench, inputSnapshot);
+ DiffModel model = getDiffModel(inputSnapshot);
+ Resource firstSelectedResource = getFirstSelectedResource(model);
+ myFirstSelectedFile = ResourcesPlugin.getWorkspace().getRoot().findMember(firstSelectedResource.getURI().toPlatformString(true));
+ myDefaultFileName = new UmlElementService().getFileName(model);
+ }
+
+ private DiffModel getDiffModel(ComparisonSnapshot inputSnapshot) {
+ if(inputSnapshot instanceof ComparisonResourceSnapshot) {
+ return ((ComparisonResourceSnapshot)inputSnapshot).getDiff();
+ } else {
+ EList<DiffModel> diffModels = ((ComparisonResourceSetSnapshot)inputSnapshot).getDiffResourceSet().getDiffModels();
+ if(!diffModels.isEmpty()) {
+ return diffModels.get(0);
+ } else {
+ // log;
+ return null;
+ }
+ }
+ }
+
+ private Resource getFirstSelectedResource(DiffModel diffModel) {
+ EList<EObject> leftRoots = diffModel.getLeftRoots();
+ if(leftRoots.isEmpty()) {
+ // log
+ return null;
+ }
+ return leftRoots.get(0).eResource();
+ }
+
+ @Override
+ public IStructuredSelection getSelection() {
+ IStructuredSelection result = super.getSelection();
+ if(result == null || result.isEmpty() && myFirstSelectedFile != null) {
+ return new StructuredSelection(myFirstSelectedFile);
+ }
+ return result;
+ }
+
+ public void addPages() {
+ super.addPages();
+ findNewDiffFilePage().setAllowExistingResources(true);
+ findNewDiffFilePage().setFileExtension(EMFDIFF_EXTENSION);
+ findNewDiffFilePage().setFileName(getDefaultFileName() + "." + EMFDIFF_EXTENSION);
+
+ myNewReportFileCreationPage = new WizardNewFileCreationPage("newFilePage1", getSelection());//$NON-NLS-1$
+ myNewReportFileCreationPage.setFileName(getDefaultFileName() + "." + HTML_EXTENSION);
+ myNewReportFileCreationPage.setAllowExistingResources(true);
+ myNewReportFileCreationPage.setTitle("New HTML File");
+ myNewReportFileCreationPage.setDescription("Create a new HTML file");
+ myNewReportFileCreationPage.setFileExtension(HTML_EXTENSION);
+ addPage(myNewReportFileCreationPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ boolean result = super.performFinish();
+ if(!result) {
+ return false;
+ }
+
+ myNewReportFileCreationPage.createNewFile();
+
+ IProgressMonitor monitor = new NullProgressMonitor();
+ IResource targetFolder = getTargetFolder(); // The logical folder were the IFile is to appear.
+ File rawTargetFolder = getRawTargetFolder(); // The file-system folder were the File is to be created.
+ GenerateAll generator = new GenerateAll(getNewDiffModelURI(), rawTargetFolder, getTemplateArguments());
+
+ try {
+ generator.doGenerate(monitor);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return false;
+ } finally {
+ try {
+ targetFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+ return true;
+ }
+
+ private String getDefaultFileName() {
+ return myDefaultFileName;
+ }
+
+ private List<? extends Object> getTemplateArguments() {
+ return Collections.singletonList(myNewReportFileCreationPage.getFileName());
+ }
+
+ private File getRawTargetFolder() {
+ File targetFolder = null;
+ IResource targetFolderResource = ResourcesPlugin.getWorkspace().getRoot().findMember(myNewReportFileCreationPage.getContainerFullPath());
+ if (targetFolderResource.isLinked()) {
+ targetFolder = targetFolderResource.getRawLocation().toFile();
+ } else {
+ IPath targetFolderPath = targetFolderResource.getLocation();
+ if (targetFolderPath != null) {
+ targetFolder = targetFolderPath.toFile();
+ } else {
+ // Virtual folder or non-local project.
+ // In that case, use the diff-model's folder as file-system folder.
+ WizardNewFileCreationPage saveDiffPage = findNewDiffFilePage();
+ IPath filePath = saveDiffPage.getContainerFullPath().append(saveDiffPage.getFileName());
+ IFile fileHandle = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath);
+ targetFolder = fileHandle.getRawLocation().toFile().getParentFile();
+ }
+ }
+ return targetFolder;
+ }
+
+ private IResource getTargetFolder() {
+ return ResourcesPlugin.getWorkspace().getRoot().findMember(myNewReportFileCreationPage.getContainerFullPath());
+ }
+
+ private WizardNewFileCreationPage findNewDiffFilePage() {
+ final String page = "newFilePage1"; //$NON-NLS-1$
+ return (WizardNewFileCreationPage)getPage(page);
+ }
+
+ private URI getNewDiffModelURI() {
+ WizardNewFileCreationPage saveDiffPage = findNewDiffFilePage();
+ IPath filePath = saveDiffPage.getContainerFullPath().append(saveDiffPage.getFileName());
+ IFile fileHandle = ResourcesPlugin.getWorkspace().getRoot().getFile(filePath);
+ return URI.createFileURI(fileHandle.getLocation().toOSString());
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/common/GenerateAll.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/common/GenerateAll.java new file mode 100644 index 00000000000..b72d221e949 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/common/GenerateAll.java @@ -0,0 +1,93 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.ui.common;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+
+
+/**
+ * Main entry point of the 'GenerateReport' generation module.
+ */
+public class GenerateAll {
+
+ /**
+ * The model URI.
+ */
+ private URI modelURI;
+
+ private EObject model;
+
+ /**
+ * The output folder.
+ */
+ private File targetFolder;
+
+ /**
+ * The other arguments.
+ */
+ List<? extends Object> arguments;
+
+ /**
+ * Constructor.
+ *
+ * @param modelURI
+ * is the URI of the model.
+ * @param targetFolder
+ * is the output folder
+ * @param arguments
+ * are the other arguments
+ * @throws IOException
+ * Thrown when the output cannot be saved.
+ * @generated
+ */
+ public GenerateAll(URI modelURI, File targetFolder, List<? extends Object> arguments) {
+ this.modelURI = modelURI;
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+
+ public GenerateAll(EObject model, File targetFolder, List<? extends Object> arguments) {
+ this.model = model;
+ this.targetFolder = targetFolder;
+ this.arguments = arguments;
+ }
+ /**
+ * Launches the generation.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * Thrown when the output cannot be saved.
+ * @generated
+ */
+ public void doGenerate(IProgressMonitor monitor) throws IOException {
+ if (!targetFolder.exists()) {
+ targetFolder.mkdirs();
+ }
+
+ org.eclipse.papyrus.compare.report.files.GenerateReport gen0;
+ if (modelURI != null) {
+ gen0 = new org.eclipse.papyrus.compare.report.files.GenerateReport(modelURI, targetFolder, arguments);
+ } else {
+ gen0 = new org.eclipse.papyrus.compare.report.files.GenerateReport(model, targetFolder, arguments);
+ }
+ gen0.doGenerate(BasicMonitor.toMonitor(monitor));
+
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/popupMenus/AcceleoGenerateGenerateReportAction.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/popupMenus/AcceleoGenerateGenerateReportAction.java new file mode 100644 index 00000000000..04555f6a2a2 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report.ui/src/org/eclipse/papyrus/compare/report/ui/popupMenus/AcceleoGenerateGenerateReportAction.java @@ -0,0 +1,112 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.ui.popupMenus;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.compare.report.ui.Activator;
+import org.eclipse.papyrus.compare.report.ui.common.GenerateAll;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionDelegate;
+
+/**
+ * GenerateReport code generation.
+ */
+public class AcceleoGenerateGenerateReportAction extends ActionDelegate implements IActionDelegate {
+
+ /**
+ * Selected model files.
+ */
+ protected List<IFile> files;
+
+ /**{@inheritDoc}
+ *
+ * @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ public void selectionChanged(IAction action, ISelection selection) {
+ if (selection instanceof IStructuredSelection) {
+ files = ((IStructuredSelection) selection).toList();
+ }
+ }
+
+ /**{@inheritDoc}
+ *
+ * @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction)
+ * @generated
+ */
+ public void run(IAction action) {
+ if (files != null) {
+ IRunnableWithProgress operation = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ try {
+ Iterator<IFile> filesIt = files.iterator();
+ while (filesIt.hasNext()) {
+ IFile model = (IFile)filesIt.next();
+ URI modelURI = URI.createPlatformResourceURI(model.getFullPath().toString(), true);
+ try {
+ IContainer target = model.getProject().getFolder("reports");
+ GenerateAll generator = new GenerateAll(modelURI, target.getLocation().toFile(), getArguments());
+ generator.doGenerate(monitor);
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+ Activator.getDefault().getLog().log(status);
+ } finally {
+ model.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ }
+ }
+ } catch (CoreException e) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+ Activator.getDefault().getLog().log(status);
+ }
+ }
+ };
+ try {
+ PlatformUI.getWorkbench().getProgressService().run(true, true, operation);
+ } catch (InvocationTargetException e) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+ Activator.getDefault().getLog().log(status);
+ } catch (InterruptedException e) {
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
+ Activator.getDefault().getLog().log(status);
+ }
+ }
+ }
+
+ /**
+ * Computes the arguments of the generator.
+ *
+ * @return the arguments
+ * @generated
+ */
+ protected List<? extends Object> getArguments() {
+ return new ArrayList<String>();
+ }
+
+}
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.project new file mode 100644 index 00000000000..187fa7d6f05 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.compare.report</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.acceleo.ide.ui.acceleoBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.acceleo.ide.ui.acceleoNature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.settings/org.eclipse.jdt.core.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0b515fef1d4 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1
+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/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..d38d1ac5c3b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.compare.diff,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.ocl,
+ org.eclipse.ocl.ecore,
+ org.eclipse.acceleo.model,
+ org.eclipse.acceleo.engine;bundle-version="3.0.0",
+ org.eclipse.uml2.uml;bundle-version="3.1.0",
+ org.eclipse.uml2.uml.edit;bundle-version="3.1.0",
+ org.eclipse.emf.edit.ui;bundle-version="2.6.0"
+Export-Package: org.eclipse.papyrus.compare.report.files,
+ org.eclipse.papyrus.compare.report.services
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Eclipse-LazyStart: true
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.compare.report.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.compare.report
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/OSGI-INF/l10n/bundle.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/OSGI-INF/l10n/bundle.properties new file mode 100644 index 00000000000..7d49f053684 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.papyrus.compare.report
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Acceleo Report Module Runtime Plug-in (Incubation)
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/about.html new file mode 100644 index 00000000000..209103075a7 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>November 14, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/build.acceleo b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/build.acceleo new file mode 100644 index 00000000000..da659727a93 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/build.acceleo @@ -0,0 +1,28 @@ +<!-- ===================================================================== -->
+<!-- Custom targets. -->
+<!-- Set customBuildCallbacks = build.acceleo in your build.properties. -->
+<!-- ===================================================================== -->
+<project name="Build Acceleo Module" default="noDefault">
+
+ <!-- ================================================================= -->
+ <!-- Default target -->
+ <!-- ================================================================= -->
+ <target name="noDefault">
+ <echo message="This file must be called with explicit targets" />
+ </target>
+
+ <!-- ================================================================= -->
+ <!-- Steps to do after the target gather.bin.parts -->
+ <!-- Available parameters : -->
+ <!-- build.result.folder - folder containing the build results -->
+ <!-- target.folder - destination folder -->
+ <!-- ================================================================= -->
+
+ <target name="post.gather.bin.parts">
+ <acceleoCompiler
+ sourceFolders="${target.folder}"
+ dependencies="">
+ </acceleoCompiler>
+ </target>
+
+</project>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/build.properties new file mode 100644 index 00000000000..ed077d52ad5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/build.properties @@ -0,0 +1,8 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ OSGI-INF/
+customBuildCallbacks = build.acceleo
+src.includes = about.html
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/Activator.java new file mode 100644 index 00000000000..df49594465e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/Activator.java @@ -0,0 +1,64 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle.
+ */
+public class Activator extends Plugin {
+
+ /**
+ * The plug-in ID.
+ */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.compare.report";
+
+ /**
+ * The shared instance.
+ */
+ private static Activator plugin;
+
+ /**
+ * The constructor.
+ */
+ public Activator() {
+ }
+
+ /**{@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /**{@inheritDoc}
+ *
+ * @see org.eclipse.core.runtime.Plugin#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;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/AttributeChange.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/AttributeChange.java new file mode 100644 index 00000000000..b0196cb4bbd --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/AttributeChange.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'AttributeChange' generation module.
+ *
+ * @generated
+ */
+public class AttributeChange extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "attributeChange";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "attributeChange", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public AttributeChange() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public AttributeChange(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public AttributeChange(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ AttributeChange generator = new AttributeChange(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/Common.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/Common.java new file mode 100644 index 00000000000..d19eb5d035b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/Common.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'Common' generation module.
+ *
+ * @generated
+ */
+public class Common extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "common";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "common", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public Common() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public Common(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public Common(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ Common generator = new Common(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ConflictingDiffElement.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ConflictingDiffElement.java new file mode 100644 index 00000000000..03b988617cd --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ConflictingDiffElement.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'ConflictingDiffElement' generation module.
+ *
+ * @generated
+ */
+public class ConflictingDiffElement extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "conflictingDiffElement";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "conflictingDiffElement", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public ConflictingDiffElement() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public ConflictingDiffElement(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public ConflictingDiffElement(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ ConflictingDiffElement generator = new ConflictingDiffElement(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/Css.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/Css.java new file mode 100644 index 00000000000..dbd232c9847 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/Css.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'Css' generation module.
+ *
+ * @generated
+ */
+public class Css extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "css";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "css", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public Css() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public Css(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public Css(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ Css generator = new Css(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/DiffElement.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/DiffElement.java new file mode 100644 index 00000000000..fadf884c9b6 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/DiffElement.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'DiffElement' generation module.
+ *
+ * @generated
+ */
+public class DiffElement extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "diffElement";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "diffElement", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public DiffElement() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public DiffElement(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public DiffElement(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ DiffElement generator = new DiffElement(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/DiffGroup.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/DiffGroup.java new file mode 100644 index 00000000000..33b506d07bb --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/DiffGroup.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'DiffGroup' generation module.
+ *
+ * @generated
+ */
+public class DiffGroup extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "diffGroup";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "diffGroup", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public DiffGroup() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public DiffGroup(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public DiffGroup(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ DiffGroup generator = new DiffGroup(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/GenerateReport.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/GenerateReport.java new file mode 100644 index 00000000000..cc6ddc9db51 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/GenerateReport.java @@ -0,0 +1,273 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'GenerateReport' generation module.
+ *
+ * @generated
+ */
+public class GenerateReport extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "generateReport";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "generateReport", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public GenerateReport() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public GenerateReport(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public GenerateReport(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ GenerateReport generator = new GenerateReport(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/HtmlUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/HtmlUtils.java new file mode 100644 index 00000000000..ffcdbeab1cd --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/HtmlUtils.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'HtmlUtils' generation module.
+ *
+ * @generated
+ */
+public class HtmlUtils extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "htmlUtils";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "htmlUtils", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public HtmlUtils() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public HtmlUtils(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public HtmlUtils(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ HtmlUtils generator = new HtmlUtils(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ModelElementChange.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ModelElementChange.java new file mode 100644 index 00000000000..4d198dc0dfc --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ModelElementChange.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'ModelElementChange' generation module.
+ *
+ * @generated
+ */
+public class ModelElementChange extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "modelElementChange";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "modelElementChange", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public ModelElementChange() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public ModelElementChange(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public ModelElementChange(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ ModelElementChange generator = new ModelElementChange(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ModelUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ModelUtils.java new file mode 100644 index 00000000000..e655b03a9f3 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ModelUtils.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'ModelUtils' generation module.
+ *
+ * @generated
+ */
+public class ModelUtils extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "modelUtils";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "modelUtils", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public ModelUtils() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public ModelUtils(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public ModelUtils(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ ModelUtils generator = new ModelUtils(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ReferenceChange.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ReferenceChange.java new file mode 100644 index 00000000000..ea93d0d4176 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ReferenceChange.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'ReferenceChange' generation module.
+ *
+ * @generated
+ */
+public class ReferenceChange extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "referenceChange";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "referenceChange", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public ReferenceChange() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public ReferenceChange(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public ReferenceChange(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ ReferenceChange generator = new ReferenceChange(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ResourceDiff.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ResourceDiff.java new file mode 100644 index 00000000000..52090d61301 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/ResourceDiff.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'ResourceDiff' generation module.
+ *
+ * @generated
+ */
+public class ResourceDiff extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "resourceDiff";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "resourceDiff", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public ResourceDiff() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public ResourceDiff(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public ResourceDiff(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ ResourceDiff generator = new ResourceDiff(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE.getNsURI(), org.eclipse.emf.compare.diff.metamodel.DiffPackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/TableUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/TableUtils.java new file mode 100644 index 00000000000..7224bf92709 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/TableUtils.java @@ -0,0 +1,271 @@ +/*******************************************************************************
+ * Copyright (c) 2008, 2010 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.compare.report.files;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.acceleo.engine.event.IAcceleoTextGenerationListener;
+import org.eclipse.acceleo.engine.generation.strategy.IAcceleoGenerationStrategy;
+import org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator;
+import org.eclipse.emf.common.util.BasicMonitor;
+import org.eclipse.emf.common.util.Monitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+/**
+ * Entry point of the 'TableUtils' generation module.
+ *
+ * @generated
+ */
+public class TableUtils extends AbstractAcceleoGenerator {
+ /**
+ * The name of the module.
+ *
+ * @generated
+ */
+ public static final String MODULE_FILE_NAME = "tableUtils";
+
+ /**
+ * The name of the templates that are to be generated.
+ *
+ * @generated
+ */
+ public static final String[] TEMPLATE_NAMES = { "tableUtils", };
+
+ /**
+ * Allows the public constructor to be used. Note that a generator created
+ * this way cannot be used to launch generations before one of
+ * {@link #initialize(EObject, File, List)} or
+ * {@link #initialize(URI, File, List)} is called.
+ * <p>
+ * The main reason for this constructor is to allow clients of this
+ * generation to call it from another Java file, as it allows for the
+ * retrieval of {@link #getProperties()} and
+ * {@link #getGenerationListeners()}.
+ * </p>
+ *
+ * @generated
+ */
+ public TableUtils() {
+ // Empty implementation
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param modelURI
+ * URI where the model on which this generator will be used is located.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in three scenarios : the module cannot be found, it cannot be loaded, or
+ * the model cannot be loaded.
+ * @generated
+ */
+ public TableUtils(URI modelURI, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(modelURI, targetFolder, arguments);
+ }
+
+ /**
+ * This allows clients to instantiates a generator with all required information.
+ *
+ * @param model
+ * We'll iterate over the content of this element to find Objects matching the first parameter
+ * of the template we need to call.
+ * @param targetFolder
+ * This will be used as the output folder for this generation : it will be the base path
+ * against which all file block URLs will be resolved.
+ * @param arguments
+ * If the template which will be called requires more than one argument taken from the model,
+ * pass them here.
+ * @throws IOException
+ * This can be thrown in two scenarios : the module cannot be found, or it cannot be loaded.
+ * @generated
+ */
+ public TableUtils(EObject model, File targetFolder,
+ List<? extends Object> arguments) throws IOException {
+ initialize(model, targetFolder, arguments);
+ }
+
+ /**
+ * This can be used to launch the generation from a standalone application.
+ *
+ * @param args
+ * Arguments of the generation.
+ * @generated
+ */
+ public static void main(String[] args) {
+ try {
+ if (args.length < 2) {
+ System.out.println("Arguments not valid : {model, folder}.");
+ } else {
+ URI modelURI = URI.createFileURI(args[0]);
+ File folder = new File(args[1]);
+ List<String> arguments = new ArrayList<String>();
+ for (int i = 2; i < args.length; i++) {
+ arguments.add(args[i]);
+ }
+ TableUtils generator = new TableUtils(modelURI, folder, arguments);
+ generator.doGenerate(new BasicMonitor());
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Launches the generation described by this instance.
+ *
+ * @param monitor
+ * This will be used to display progress information to the user.
+ * @throws IOException
+ * This will be thrown if any of the output files cannot be saved to disk.
+ * @generated
+ */
+ @Override
+ public void doGenerate(Monitor monitor) throws IOException {
+ /*
+ * TODO if you wish to change the generation as a whole, override this.
+ * The default behavior should be sufficient in most cases.
+ */
+ super.doGenerate(monitor);
+ }
+
+ /**
+ * If this generator needs to listen to text generation events, listeners can be returned from here.
+ *
+ * @return List of listeners that are to be notified when text is generated through this launch.
+ * @generated
+ */
+ @Override
+ public List<IAcceleoTextGenerationListener> getGenerationListeners() {
+ List<IAcceleoTextGenerationListener> listeners = super.getGenerationListeners();
+ // TODO if you need to listen to generation event, add listeners to the list here
+ return listeners;
+ }
+
+ /**
+ * If you need to change the way files are generated, this is your entry point.
+ * <p>
+ * The default is {@link org.eclipse.acceleo.engine.generation.strategy.DefaultStrategy}; it generates
+ * files on the fly. If you only need to preview the results, return a new
+ * {@link org.eclipse.acceleo.engine.generation.strategy.PreviewStrategy}. Both of these aren't aware of
+ * the running Eclipse and can be used standalone.
+ * </p>
+ * <p>
+ * If you need the file generation to be aware of the workspace (A typical example is when you wanna
+ * override files that are under clear case or any other VCS that could forbid the overriding), then
+ * return a new {@link org.eclipse.acceleo.engine.generation.strategy.WorkspaceAwareStrategy}.
+ * <b>Note</b>, however, that this <b>cannot</b> be used standalone.
+ * </p>
+ * <p>
+ * All three of these default strategies support merging through JMerge.
+ * </p>
+ *
+ * @return The generation strategy that is to be used for generations launched through this launcher.
+ * @generated
+ */
+ public IAcceleoGenerationStrategy getGenerationStrategy() {
+ return super.getGenerationStrategy();
+ }
+
+ /**
+ * This will be called in order to find and load the module that will be launched through this launcher.
+ * We expect this name not to contain file extension, and the module to be located beside the launcher.
+ *
+ * @return The name of the module that is to be launched.
+ * @generated
+ */
+ @Override
+ public String getModuleName() {
+ return MODULE_FILE_NAME;
+ }
+
+ /**
+ * If the module(s) called by this launcher require properties files, return their qualified path from
+ * here.Take note that the first added properties files will take precedence over subsequent ones if they
+ * contain conflicting keys.
+ * <p>
+ * Properties need to be in source folders, the path that we expect to get as a result of this call are of
+ * the form <package>.<properties file name without extension>. For example, if you have a file
+ * named "messages.properties" in package "org.eclipse.acceleo.sample", the path that needs be returned by
+ * a call to {@link #getProperties()} is "org.eclipse.acceleo.sample.messages".
+ * </p>
+ *
+ * @return The list of properties file we need to add to the generation context.
+ * @see java.util.ResourceBundle#getBundle(String)
+ * @generated
+ */
+ @Override
+ public List<String> getProperties() {
+ List<String> propertiesFiles = super.getProperties();
+ /*
+ * TODO if your generation module requires access to properties files,
+ * add their qualified path to the list here. Properties files are
+ * expected to be in source folders, and the path here to be the
+ * qualified path as if referring to a Java class. For example, if you
+ * have a file named "messages.properties" in package
+ * "org.eclipse.acceleo.sample", the path that needs be added to this
+ * list is "org.eclipse.acceleo.sample.messages".
+ */
+ return propertiesFiles;
+ }
+
+ /**
+ * This will be used to get the list of templates that are to be launched by this launcher.
+ *
+ * @return The list of templates to call on the module {@link #getModuleName()}.
+ * @generated
+ */
+ @Override
+ public String[] getTemplateNames() {
+ return TEMPLATE_NAMES;
+ }
+
+ /**
+ * This can be used to update the resource set's package registry with all needed EPackages.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerPackages(ResourceSet resourceSet) {
+ super.registerPackages(resourceSet);
+ resourceSet.getPackageRegistry().put(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getNsURI(), org.eclipse.emf.ecore.EcorePackage.eINSTANCE);
+ // TODO If you need additional package registrations, do them here. The following line is an example for UML.
+ // resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
+ }
+
+ /**
+ * This can be used to update the resource set's resource factory registry with all needed factories.
+ *
+ * @param resourceSet
+ * The resource set which registry has to be updated.
+ * @generated
+ */
+ @Override
+ public void registerResourceFactories(ResourceSet resourceSet) {
+ super.registerResourceFactories(resourceSet);
+ // TODO If you need additional resource factories registrations, do them here. The following line is an example for UML.
+ // resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/attributeChange.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/attributeChange.mtl new file mode 100644 index 00000000000..4184e9df08d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/attributeChange.mtl @@ -0,0 +1,60 @@ +[comment encoding = UTF-8 /] + +[comment] +A representation of the model object 'Attribute Change'. Superclass of elements describing difference between the values of a given attribute. +[/comment] + +[module attributeChange('http://www.eclipse.org/emf/compare/diff/1.1')/] + +[import tableUtils/] +[import modelUtils/] +[import common/] + +[template public genAttributeChanges(el : DiffElement, leftRoot: String, rightRoot: String) {attributeChanges: Sequence(AttributeChange) = attributeChanges(el); }] +[if not attributeChanges->isEmpty()] +[openTable()/] +[addHeader('Changed Attributes', leftRoot, rightRoot)/] +[for (attributeChanges)] +[genAttributeChange()/] +[/for] +[closeTable()/] +[/if] +[/template] + +[template public genAttributeChange(el : AttributeChange)] +[if not el.attribute.oclIsInvalid() and not el.attribute.oclIsUndefined()] +[addRow(el.attribute.name, el.leftElement.eGet(el.attribute).attributeToString(), el.rightElement.eGet(el.attribute).attributeToString())/] +[/if] +[/template] + +[comment] +A representation of the model object 'Attribute Change Left Target'. +A "LeftTarget" element change describes a difference involving the left element/resource. +In the case of AttributeChanges, these describe differences within multi-valued attributes. +Specifically, the addition of a value or the remote removal of a value (for three way comparisons). +[/comment] +[template public genAttributeChange(el : AttributeChangeLeftTarget)] +[addRow(el.attribute.name.concat(' value removed'), noElement().attributeToString(), el.leftTarget.attributeToString())/] +[/template] + +[comment] +A representation of the model object 'Attribute Change Right Target'. +A "RightTarget" element change describes a difference involving the right element/resource. +In the case of AttributeChanges, these describe differences within multi-valued attributes. +Specifically, the removal of a value or the remote addition of a value (for three way comparisons). +[/comment] +[template public genAttributeChange(el : AttributeChangeRightTarget)] +[addRow(el.attribute.name.concat(' value added'), noElement(), el.rightTarget.attributeToString())/] +[/template] + +[comment] +A representation of the model object 'Update Attribute'. +Differences of this kind represent modifications of the value of single-valued attributes. +[/comment] +[template public genAttributeChange(el :UpdateAttribute)] +[addRow(el.attribute.name, el.leftElement.eGet(el.attribute).attributeToString(), el.rightElement.eGet(el.attribute).attributeToString())/] +[/template] + +[query private attributeChanges(element : DiffElement) : Sequence(AttributeChange) = element.subDiffElements->select(attr: DiffElement| attr.oclIsKindOf(AttributeChange))/] + +[query private attributeToString(element : OclAny) : String = element.toString()/] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/common.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/common.mtl new file mode 100644 index 00000000000..977e407b352 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/common.mtl @@ -0,0 +1,11 @@ +[comment encoding = UTF-8 /] +[module common('http://www.eclipse.org/emf/compare/diff/1.1','http://www.eclipse.org/uml2/3.0.0/UML')/] + + +[query public appendLevelToIndex(index: Sequence(Integer)) : Sequence(Integer) = index->append(0)/] + +[query private nextIndex(index: Sequence(Integer)) : Sequence(Integer) = index->subSequence(1, (index->size()-1))->append(index->last() + 1)/] + +[query public composeIndex(prefix: String , i : Integer) : String = if (prefix <> '') then prefix.concat('.').concat(i.toString()) else prefix.concat(i.toString()) endif/] + +[query public hierarchyLevel(index: String) : Integer = index.tokenize('.')->size() + 1/] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/conflictingDiffElement.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/conflictingDiffElement.mtl new file mode 100644 index 00000000000..a7ebbef973a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/conflictingDiffElement.mtl @@ -0,0 +1,20 @@ +[comment encoding = UTF-8 /] +[module conflictingDiffElement('http://www.eclipse.org/emf/compare/diff/1.1')/] + +[import tableUtils/] +[import modelUtils/] +[import htmlUtils/] +[import common/] + +[comment] +A representation of the model object 'Conflicting Diff Element'. +This will act as a container for conflictual changes. +[/comment] +[template public genConflictingDiffElement(el : ConflictingDiffElement, prefix : String , leftRoot: String, rightRoot: String)] +[elementHeading(el.originElement, prefix)/] +Conflictual Change: +[openTable()/] +[addHeader('Origin Element', leftRoot, rightRoot)/] +[addRow(el.originElement.elementName(), el.leftParent.elementName(), el.rightParent.elementName())/] +[closeTable()/] +[/template] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/css.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/css.mtl new file mode 100644 index 00000000000..8336476b1fc --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/css.mtl @@ -0,0 +1,193 @@ +[comment encoding = UTF-8 /] +[module css('http://www.eclipse.org/emf/2002/Ecore')/] + +[template public genCSS()] +<STYLE type="text/css"> +.Normal { +font-family: Verdana; +font-size: 11pt;} +.BodyText { +font-family: Verdana; +font-size: 11pt;} +.Title { +text-align: center; +font-family: Verdana; +font-size: 20pt; +font-weight: bold; +padding-bottom: 16pt;} +.Subtitle { +text-align: center; +font-family: Verdana; +font-size: 16pt; +font-style: italic; +padding-bottom: 16pt;} +.DocumentInfo { +font-family: Verdana; +font-size: 11pt;} +.ListNumber2 { +font-family: Verdana; +font-size: 11pt;} +.Heading1 { +margin-top: 12pt; +border-top-style: dotted;page-break-before: always; +font-family: Verdana; +font-size: 16pt; +font-weight: bold; +padding-top: 12pt; +padding-bottom: 12pt;} +.Heading2 { +font-family: Verdana; +font-size: 14pt; +padding-top: 6pt; +padding-bottom: 6pt;} +.Heading3 { +font-family: Verdana; +font-size: 12pt; +padding-left: 0.7cm; +padding-top: 6pt; +padding-bottom: 6pt;} +.Heading4 { +font-family: Verdana; +font-size: 11pt; +padding-left: 1cm; +padding-bottom: 6pt;} +.Heading5 { +font-family: Verdana; +font-size: 10pt; +padding-left: 1.2cm; +padding-bottom: 6pt;} +.Heading6 { +font-family: Verdana; +font-size: 9pt; +padding-left: 1.4cm; +padding-bottom: 6pt;} +.TableCell { +text-align: left; +vertical-align:middle; +font-family: Verdana; +font-size: 9pt; +padding-left: 0.1cm; +padding-right: 0.1cm;} +.TableHeadingCell { +text-align: left; +vertical-align:middle; +color: rgb(255,255,255); +background-color: rgb(0,0,128); +font-family: Verdana; +font-size: 9pt; +font-weight: bold; +padding-left: 0.1cm;} +.TOC1 { +font-family: Verdana; +font-size: 12pt; +font-weight: bold; +padding-top: 12pt;} +.TOC2 { +font-family: Verdana; +font-size: 12pt; +padding-left: 0.35cm; +padding-top: 12pt;} +.TOC3 { +font-family: Verdana; +font-size: 11pt; +font-style: italic; +padding-left: 0.7cm; +padding-top: 6pt;} +.TOC4 { +font-family: Verdana; +font-size: 9pt; +padding-left: 1cm;} +.Header { +font-family: Tahoma; +font-size: 9pt; +font-weight: bold;} +.Footer { +font-family: Tahoma; +font-size: 9pt;} +.Caption { +text-align: center; +font-family: Verdana; +font-size: 8pt; +font-weight: bold; +padding-top: 6pt; +padding-bottom: 12pt;} +.TableCaption { +text-align: left; +font-family: Verdana; +font-size: 8pt; +font-weight: bold; +padding-bottom: 6pt;} +.ListOfFigures { +font-family: Verdana; +font-size: 11pt; +font-weight: bold;} +.Hyperlink { +color: rgb(0,0,255); +font-family: Verdana; +font-size: 11pt; +text-decoration: underline;} +.DocumentClass { +text-align: center; +font-family: Verdana; +font-size: 11pt;} +.TableCellAnnot { +text-align: left; +vertical-align:middle; +font-family: Verdana; +font-size: 9pt; +font-style: italic; +padding-left: 0.1cm; +padding-right: 0.1cm;} +.TableHeadingCellAnnot { +text-align: left; +vertical-align:middle; +background-color: rgb(255,255,0); +font-family: Verdana; +font-size: 9pt; +font-weight: bold; +padding-left: 0.1cm;} +.TextualCode { +font-family: Courier; +font-size: 9pt; +margin-bottom: 12pt; +border-style: solid; +border-width: 1pt; +padding-left: 3pt; +padding-top: 3pt; +padding-bottom: 3pt; +padding-right: 3pt; +min-width: 160mm; +width: 80%; +white-space: nowrap;} +.EndOfDocument { +text-align: center; +color: rgb(192,192,192); +font-family: Verdana; +font-size: 7pt;} +.ListTitle { +font-family: Verdana; +font-size: 8pt; +font-weight: bold;} +.ListOfTables { +font-family: Verdana; +font-size: 11pt; +font-weight: bold;} +table{ +border:1px solid rgb(0, 0, 0); +border-spacing: 0px; +border-collapse: collapse; +} +td{ +border:1px solid rgb(0, 0, 0); +border-collapse: collapse; + min-height: 0.5cm; +height: 0.5cm; +} +th{ +border:1px solid rgb(0, 0, 0); +border-collapse: collapse; + min-height: 0.5cm; +height: 0.5cm; +} +</STYLE> +[/template] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/diffElement.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/diffElement.mtl new file mode 100644 index 00000000000..7e6c327c3aa --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/diffElement.mtl @@ -0,0 +1,38 @@ +[comment encoding = UTF-8 /] +[module diffElement('http://www.eclipse.org/emf/compare/diff/1.1')/] + +[import attributeChange/] +[import referenceChange/] +[import diffGroup/] +[import modelElementChange/] +[import conflictingDiffElement/] +[import resourceDiff/] + +[template public processDiffElement(el : DiffGroup, leftRoot: String, rightRoot: String)] +[el.processDiffGroup('', leftRoot, rightRoot)/] +[/template] + +[template public processDiffElement(el : AttributeChange, leftRoot: String, rightRoot: String)] +[el.genAttributeChange()/] +[/template] + +[template public processDiffElement(el : ReferenceChange, leftRoot: String, rightRoot: String)] +[el.genReferenceChange()/] +[/template] + +[template public processDiffElement(el : ConflictingDiffElement, leftRoot: String, rightRoot: String)] +[el.genConflictingDiffElement('', leftRoot, rightRoot)/] +[/template] + +[template public processDiffElement(el : ModelElementChange, leftRoot: String, rightRoot: String)] +[el.genModelElementChange('', leftRoot, rightRoot)/] +[/template] + +[template public processDiffElement(el : ResourceDiff, leftRoot: String, rightRoot: String)] +[el.genResourceDiff('', leftRoot, rightRoot)/] +[/template] + +[template public processDiffElement(el : DiffElement, leftRoot: String, rightRoot: String)] +[el.kind/] Unknown diff +[/template] + diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/diffGroup.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/diffGroup.mtl new file mode 100644 index 00000000000..8d5d0f77b1c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/diffGroup.mtl @@ -0,0 +1,35 @@ +[comment encoding = UTF-8 /] +[module diffGroup('http://www.eclipse.org/emf/compare/diff/1.1')/] + +[import common/] +[import modelUtils/] +[import tableUtils/] +[import htmlUtils/] + +[import attributeChange/] +[import referenceChange/] +[import modelElementChange/] +[import conflictingDiffElement/] + +[template public processDiffGroup(el : DiffGroup, prefix : String, leftRoot: String, rightRoot: String) {subgroups: Sequence(DiffGroup) = el.subDiffGroups();}] +[if prefix <> ''] +[elementHeading(el.rightParent, prefix)/] +[/if] +[el.genAttributeChanges(leftRoot, rightRoot)/] +[el.genReferenceChanges(leftRoot, rightRoot)/] +[for (next : DiffGroup | subgroups)] +[next.processDiffGroup(composeIndex(prefix, i), leftRoot, rightRoot)/] +[/for] + +[for (next: ModelElementChange | el.modelElementChanges())] +[next.genModelElementChange(composeIndex(prefix, subgroups->size() + i), leftRoot, rightRoot)/] +[/for] +[for (next: ConflictingDiffElement | el.conflictingDiffElements())] +[next.genConflictingDiffElement(composeIndex(prefix, el.modelElementChanges()->size()+ i), leftRoot, rightRoot)/] +[/for] + +[/template] + +[query private subDiffGroups(element : DiffElement) : Sequence(DiffGroup) = element.subDiffElements->select(next: DiffElement| next.oclIsKindOf(DiffGroup))/] + +[query private conflictingDiffElements(element : DiffElement) : Sequence(DiffGroup) = element.subDiffElements->filter(ConflictingDiffElement)/] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/generateReport.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/generateReport.mtl new file mode 100644 index 00000000000..7dbd296ebd9 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/generateReport.mtl @@ -0,0 +1,29 @@ +[comment encoding = UTF-8 /] +[module generateReport('http://www.eclipse.org/emf/compare/diff/1.1','http://www.eclipse.org/emf/2002/Ecore','http://www.eclipse.org/uml2/3.0.0/UML')/] + +[import modelUtils/] +[import htmlUtils/] +[import diffElement/] + +[template public generateReport(model : DiffModel)] +[comment @main /] +[generateReport(model, model.fileName().concat('.html'))/] +[/template] + +[template public generateReport(model : DiffModel, fileName : String)] +[file (fileName, false, 'UTF-8')] +[docHeading()/] +[reportHeader(leftRootName(model), rightRootName(model))/] +[for (diffElement : DiffElement | model.ownedElements)] +[diffElement.processDiffElement(leftRootName(model), rightRootName(model))/] +[/for] +[printClosingText('End of Diff Report')/] +[docEnding()/] +[/file] +[/template] + +[template private reportHeader(leftRoot : String, rightRoot : String)] +[heading(1)/] Difference report between (1) [leftRoot/] and (2)[rightRoot/][closeHeading()/] +[/template] + +[query private fileName(model: DiffModel) : String = model.leftRootName().concat('_diff_').concat(model.rightRootName())/] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/htmlUtils.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/htmlUtils.mtl new file mode 100644 index 00000000000..dae7493ed80 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/htmlUtils.mtl @@ -0,0 +1,46 @@ +[comment encoding = UTF-8 /] +[module htmlUtils('http://www.eclipse.org/emf/2002/Ecore')/] + +[import common/] +[import css/] +[import modelUtils/] + +[template public elementHeading(el : EObject, index: String)] +[heading(hierarchyLevel(index))/][index/] +[decode(invoke('org.eclipse.papyrus.compare.report.services.UmlElementService', 'getText(org.eclipse.emf.ecore.EObject)', Sequence{el}))/] +[closeHeading()/] +[/template] + +[template public docHeading()] +<HTML> +<HEAD> +[genCSS()/] +</HEAD> +<BODY> +[/template] + +[template public printClosingText(text : String)] +<HR style="width: 14cm; text-align: center;"> +<BR> +<DIV class="BodyText">[text/]<BR> +</DIV> +[/template] + +[template public docEnding()] +</BODY> +</HTML> +[/template] + +[template public lineBreak()] +<br> +[/template] + +[template public heading(level : Integer)] +<DIV class="Heading[level/]"> +[/template] + +[template public closeHeading()] +</DIV> +[/template] + +[query public decode(name : OclAny) : String = name.oclAsType(String).replaceAll('<', '<').replaceAll('>', '>')/] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/modelElementChange.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/modelElementChange.mtl new file mode 100644 index 00000000000..5576cd7744f --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/modelElementChange.mtl @@ -0,0 +1,85 @@ +[comment encoding = UTF-8 /] +[module modelElementChange('http://www.eclipse.org/emf/compare/diff/1.1','http://www.eclipse.org/emf/2002/Ecore')/] + +[import modelUtils/] +[import tableUtils/] +[import htmlUtils/] + +[template public genModelElementChange(el : ModelElementChangeLeftTarget, prefix : String , leftRoot: String, rightRoot: String)] +[elementHeading(el.leftElement, prefix)/] +(1) [elementQualifiedName(el.leftElement)/][lineBreak()/] +Deleted in the second model + +[openTable()/] +[addHeader(leftRoot, rightRoot)/] +[addRow(elementContents(el.leftElement), noElement())/] +[closeTable()/] +[/template] + +[template public genModelElementChange(el : ModelElementChangeRightTarget, prefix : String , leftRoot: String, rightRoot: String)] +[elementHeading(el.rightElement, prefix)/] +(2) [elementQualifiedName(el.rightElement)/][lineBreak()/] +Added in the second model + +[openTable()/] +[addHeader(leftRoot, rightRoot)/] +[addRow(noElement(), elementContents(el.rightElement))/] +[closeTable()/] +[/template] + +[template public elementContents(obj: EObject)] +[invoke('org.eclipse.papyrus.compare.report.services.UmlElementService', 'getContents(org.eclipse.emf.ecore.EObject)', Sequence{obj})/] +[/template] + + +[comment] +A representation of the model object 'Update Containment Feature'. +This particular kind of move operation describe a change of containment reference +of a given element within the same container. +[/comment] +[template public genModelElementChange(el : UpdateContainmentFeature, prefix : String , leftRoot: String, rightRoot: String)] +[elementHeading(el.leftElement, prefix)/] +(1) [elementQualifiedName(el.leftElement)/][lineBreak()/] +(2) [elementQualifiedName(el.rightElement)/][lineBreak()/] +Containment Feature was changed: + +[openTable()/] +[addHeader('-', leftRoot, rightRoot)/] +[addRow('Containment Feature', elementName(el.leftElement.eContainmentFeature()), elementName(el.rightElement.eContainmentFeature()))/] +[closeTable()/] +[/template] + +[comment] +A representation of the model object 'Move Model Element'. +These describe a change of container for a given element. +[/comment] +[template public genModelElementChange(el : MoveModelElement, prefix : String , leftRoot: String, rightRoot: String)] +[elementHeading(el.leftElement, prefix)/] +(1) [elementQualifiedName(el.leftElement)/][lineBreak()/] +(2) [elementQualifiedName(el.rightElement)/][lineBreak()/] +The Element was moved: + +[openTable()/] +[addHeader('-', leftRoot, rightRoot)/] +[addRow('Parent', elementName(el.leftTarget), elementName(el.rightTarget))/] +[closeTable()/] +[/template] + +[comment] +A representation of the model object 'Update Model Element'. +Superclass of DiffElements used to describe "move" types of differences. +This includes both Moving from a container to another and changing the containment reference of an element. These changes imply both an addition and a removal. +[/comment] +[template public genModelElementChange(el : UpdateModelElement, prefix : String , leftRoot: String, rightRoot: String)] +Generic processModelElementChange for [el.kind/] kind +[/template] + +[comment] +A representation of the model object 'Model Element Change'. +Superclass of DiffElements used to describe element additions or removals. +[/comment] +[template public genModelElementChange(el : ModelElementChange, prefix : String , leftRoot: String, rightRoot: String)] +Generic processModelElementChange for [el.kind/] kind +[/template] + +[query public modelElementChanges(element : DiffElement) : Sequence(ModelElementChange) = element.subDiffElements->select(next: DiffElement| next.oclIsKindOf(ModelElementChange))/] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/modelUtils.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/modelUtils.mtl new file mode 100644 index 00000000000..8c84d46ff5e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/modelUtils.mtl @@ -0,0 +1,42 @@ +[comment encoding = UTF-8 /] +[module modelUtils('http://www.eclipse.org/emf/compare/diff/1.1','http://www.eclipse.org/uml2/3.0.0/UML')/] + +[comment] +This will return the name of the given element +[/comment] +[query public elementName(element : OclAny) : String = if (not element.oclIsUndefined() and element.oclIsKindOf(NamedElement)) then element.oclAsType(NamedElement).name else '<not a named element>' endif/] + +[query public elementQualifiedName(element : OclAny) : String = if (not element.oclIsUndefined() and element.oclIsKindOf(NamedElement)) + then element.oclAsType(NamedElement).getQualifiedName2() + else '<not a named element>' endif/] + +[query public getQualifiedName2(element : NamedElement) : String = if (element.getQualifiedName().isEmpty()) + then elementQualifiedName(element.namespace) + else element.getQualifiedName().replaceAll('::', '/') endif/] + +[query public elementMetaclass(element : OclAny) : String = if (not element.oclIsUndefined()) then element.eClass().name else '' endif/] + +[query public elementContent(element : OclAny) : String = if (element.oclIsKindOf(NamedElement)) then element.oclAsType(NamedElement).name else '<not a named element>' endif/] + +[query public leftRootName(model: DiffModel) : String = model.leftRoots->first().elementName()/] + +[query public rightRootName(model: DiffModel) : String = model.rightRoots->first().elementName()/] + +[query public label(element : OclAny) : String = if (not umlLabel().isEmpty()) then umlLabel() else + (if (not element.oclIsUndefined() and element.oclIsKindOf(ValueSpecification)) then element.oclAsType(ValueSpecification).stringValue() else '' endif) + endif/] + +[query public elementStereotypesAndKeywords(element : OclAny) : String = if (not element.oclIsUndefined() and element.oclIsKindOf(Element)) then elementStereotypes(element.oclAsType(Element)) else '' endif/] + +[query public elementStereotypes(element : Element) : String = if (not element.getAppliedStereotypes()->isEmpty()) then elementStereotypes2() else '' endif/] + +[query public elementStereotypes2(element : Element) : String = element.getAppliedStereotypes().elementName()->sep(', ')/] + +[query public elementKeywords(element : Element) : String = element.getKeywords()->sep(', ')/] + +[query private umlLabel(element : OclAny) : String = if (not element.oclIsUndefined() and element.oclIsKindOf(Element)) then element.oclAsType(NamedElement).getLabel() else '' endif/] + +[query private isEmpty(str : String) : Boolean = str.oclIsUndefined() or str.size() = 0/] + +[query public noElement() : String = '-'/] + diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/referenceChange.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/referenceChange.mtl new file mode 100644 index 00000000000..3b9e8b3c85c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/referenceChange.mtl @@ -0,0 +1,56 @@ +[comment encoding = UTF-8 /] +[module referenceChange('http://www.eclipse.org/emf/compare/diff/1.1', 'http://www.eclipse.org/emf/2002/Ecore')/] + +[import modelUtils/] +[import tableUtils/] + +[template public genReferenceChanges(el : DiffElement, leftRoot: String, rightRoot: String) {referenceChanges: Sequence(ReferenceChange) = referenceChanges(el); }] +[if not referenceChanges->isEmpty()] +[openTable()/] +[addHeader('Changed References', leftRoot, rightRoot)/] +[for (referenceChanges)] +[genReferenceChange()/] +[/for] +[closeTable()/] +[/if] +[/template] + +[comment] +A representation of the model object 'Reference Change Left Target'. +A "LeftTarget" element change describes a difference involving the left element/resource. +In the case of ReferenceChanges, these describe differences within multi-valued references. +Specifically, the addition of a value or the remote removal of a value (for three way comparisons). +[/comment] +[template public genReferenceChange(el : ReferenceChangeLeftTarget)] +[addRow(el.reference.name.concat(' value removed'), el.leftTarget.elementName(), noElement()) /] +[/template] + +[comment] +[/comment] +[template public genReferenceChange(el : ReferenceChangeRightTarget)] +[addRow(el.reference.name.concat(' value added'), noElement(), el.rightTarget.elementName())/] +[/template] + +[comment] +A representation of the model object 'Reference Order Change'. +[/comment] +[template public genReferenceChange(el : ReferenceOrderChange)] +[addRow(el.reference.name.concat(' reference order change'), elementNames(el.leftTarget), elementNames(el.rightTarget))/] +[/template] + +[comment] +Differences of this kind represent modifications of the value of single-valued references. +[/comment] +[template public genReferenceChange(el : UpdateReference)] +[addRow(el.reference.name, el.leftElement.eGet(el.reference).elementName(), el.rightElement.eGet(el.reference).elementName())/] +[/template] + +[template public genReferenceChange(el : ReferenceChange)] +[addRow(el.reference.name, el.leftElement.eGet(el.reference).elementName(), el.rightElement.eGet(el.reference).elementName())/] +[/template] + +[query private referenceChanges(element : DiffElement) : Sequence(ReferenceChange) = element.subDiffElements->select(next: DiffElement| next.oclIsKindOf(ReferenceChange))/] + +[query private elementNames(elements : Collection(EObject)) : String = elements.elementName()->sep(',')/] + + diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/resourceDiff.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/resourceDiff.mtl new file mode 100644 index 00000000000..a0bb9acbc0a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/resourceDiff.mtl @@ -0,0 +1,42 @@ +[comment encoding = UTF-8 /] +[module resourceDiff('http://www.eclipse.org/emf/compare/diff/1.1', 'http://www.eclipse.org/emf/2002/Ecore')/] + +[import tableUtils/] +[import modelUtils/] +[import common/] + +[comment] +Differences of this kind represent changes regarding a third-party resource. +[/comment] +[template public genResourceDiff(el : ResourceDiff, prefix : String , leftRoot: String, rightRoot: String)] +Changes regarding a third-party resource: +[for (next: ResourceDiff | el.subDiffElements->filter(ResourceDiff))] +[next.genResourceDiff(prefix, leftRoot, rightRoot)/] +[/for] +//call children changes +[/template] + +[comment] +Superclass of DiffElements representing additions or removals of references towards a third-party resource. +[/comment] +[template public genResourceDiff(el : ResourceDependencyChange)] +[elementNames(el.roots)/] +[/template] + +[comment] +"LeftTarget" element change describes a difference involving the left ResourceSet. These differences can be +used to describe additions or remote removals of third-party resources dependencies. +[/comment] +[template public genResourceDiff(el : ResourceDependencyChangeLeftTarget)] +[elementNames(el.roots)/] +[/template] + +[comment] +"RightTarget" element change describes a difference involving the right ResourceSet. These differences can +be used to describe deletions or remote additions of third-party resources dependencies. +[/comment] +[template public genResourceDiff(el : ResourceDependencyChangeRightTarget)] +[elementNames(el.roots)/] +[/template] + +[query private elementNames(elements : Collection(EObject)) : String = elements.elementName()->sep(',')/] diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/tableUtils.mtl b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/tableUtils.mtl new file mode 100644 index 00000000000..898070a5baa --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/files/tableUtils.mtl @@ -0,0 +1,37 @@ +[comment encoding = UTF-8 /] +[module tableUtils('http://www.eclipse.org/emf/2002/Ecore')/] + +[import modelUtils/] +[import common/] +[import htmlUtils/] + +[template public openTable()] +<TABLE ><TBODY> +[/template] + +[template public closeTable()] +</TBODY></TABLE>[lineBreak()/] +[/template] + +[template public addHeader(name: String, leftRoot: String, rightRoot: String)] +<tr><th class="TableHeadingCell" style="width: 50mm;">[name/]</th> +<th class="TableHeadingCell" style="width: 50mm;">(1) [leftRoot/]</th> +<th class="TableHeadingCell" style="width: 50mm;">(2) [rightRoot/]</th></tr> +[/template] + +[template public addHeader(leftRoot: String, rightRoot: String)] +<tr><th class="TableHeadingCell" style="width: 50mm;">(1) [leftRoot/]</th> +<th class="TableHeadingCell" style="width: 50mm;">(2) [rightRoot/]</th></tr> +[/template] + +[template public addRow(title: String, leftElement: String, rightElement: String)] +<tr><TD class="TableCell" style="width: 50mm;">[title/]</td> +<TD class="TableCell" style="width: 80mm;">[leftElement/]</td> +<TD class="TableCell" style="width: 80mm;">[rightElement/]</td></tr> +[/template] + +[template public addRow(leftElement: String, rightElement: String)] +<tr><TD class="TableCell" style="width: 100mm;">[leftElement/]</td> +<TD class="TableCell" style="width: 100mm;">[rightElement/]</td></tr> +[/template] + diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/services/UmlElementService.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/services/UmlElementService.java new file mode 100644 index 00000000000..9800f162cc5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.compare.report/src/org/eclipse/papyrus/compare/report/services/UmlElementService.java @@ -0,0 +1,115 @@ +package org.eclipse.papyrus.compare.report.services;
+
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.uml2.uml.Comment;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
+
+public class UmlElementService {
+
+ private static AdapterFactoryLabelProvider oursAdapterLabelProvider = new AdapterFactoryLabelProvider(
+ new UMLItemProviderAdapterFactory());
+
+ public String getFileName(DiffModel model) {
+ return getFirstElementName(model.getLeftRoots()) + "_diff_" + getFirstElementName(model.getRightRoots());
+ }
+
+ private String getFirstElementName(EList<EObject> children) {
+ if (children.isEmpty()) {
+ return "";
+ }
+ return getElementName(children.get(0));
+ }
+
+ public String getText(EObject eobject) {
+ return oursAdapterLabelProvider.getText(eobject);
+ }
+
+
+ public String getContents(EObject eObject) {
+ EClass eClass = eObject.eClass();
+ StringBuffer result = new StringBuffer();
+ for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i) {
+ EStructuralFeature eStructuralFeature = eClass
+ .getEStructuralFeature(i);
+ if (eStructuralFeature.isChangeable()
+ && !eStructuralFeature.isDerived()) {
+ if (eStructuralFeature instanceof EAttribute) {
+ result.append(getAttributeString(eObject,
+ (EAttribute) eStructuralFeature));
+ } else {
+ result.append(getReferenceString(eObject,
+ (EReference) eStructuralFeature));
+ }
+ }
+ }
+ return result.toString();
+ }
+
+ private StringBuffer getAttributeString(EObject eObject, EAttribute attr) {
+ StringBuffer result = new StringBuffer();
+ Object attrValue = eObject.eGet(attr);
+ if (attrValue != null && !attrValue.equals("")) {
+ result.append(attr.getName());
+ result.append(" : ");
+ result.append(attrValue);
+ result.append("</br>");
+ }
+ return result;
+ }
+
+ private StringBuffer getReferenceString(EObject eObject,
+ EReference eReference) {
+ StringBuffer result = new StringBuffer();
+ Object refValue = getElementName(eObject.eGet(eReference));
+ if (refValue != null && !refValue.equals("") && !refValue.equals("[]") && !refValue.equals(" ")) {
+ if (eReference.isContainment()) {
+ result.append(eReference.getName());
+ result.append(" ");
+ result.append(" : ");
+ result.append(refValue);
+ result.append("</br>");
+ } else {
+ result.append(eReference.getName());
+ result.append(" : ");
+ result.append("'" + refValue + "'");
+ result.append("</br>");
+ }
+ }
+ return result;
+ }
+
+ private String getElementName(Object obj) {
+ if (obj == null) {
+ return "";
+ }
+ if (obj instanceof NamedElement) {
+ return ((NamedElement) obj).getLabel();
+ }
+ if (obj instanceof Comment) {
+ return ((Comment) obj).getBody();
+ }
+ if (obj instanceof EObject) {
+ return obj.toString();
+ }
+ if (obj instanceof List) {
+ String result = "";
+ for (Object next : ((List) obj)) {
+ result += getElementName(next);
+ result += ", ";
+ }
+ return result;
+ }
+ return obj.toString();
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/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/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.project new file mode 100644 index 00000000000..d6c8da15259 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.emf.compare.common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.settings/org.eclipse.jdt.core.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.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/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..2a5688f01a0 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/META-INF/MANIFEST.MF @@ -0,0 +1,35 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.infra.emf.compare.instance;bundle-version="0.10.0",
+ org.eclipse.compare,
+ org.eclipse.emf.compare.ui;bundle-version="1.3.1",
+ org.eclipse.emf.compare;bundle-version="1.3.1",
+ org.eclipse.emf.compare.diff;bundle-version="1.3.1",
+ org.eclipse.emf.compare.match;bundle-version="1.3.1",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
+ org.eclipse.papyrus.infra.emf.compare.ui;bundle-version="0.10.0",
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
+ org.eclipse.ui,
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="0.10.0"
+Export-Package: org.eclipse.papyrus.infra.emf.compare.common,
+ org.eclipse.papyrus.infra.emf.compare.common.editor,
+ org.eclipse.papyrus.infra.emf.compare.common.factory,
+ org.eclipse.papyrus.infra.emf.compare.common.handler,
+ org.eclipse.papyrus.infra.emf.compare.common.modelresource,
+ org.eclipse.papyrus.infra.emf.compare.common.utils
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.emf.compare.common.Activat
+ or
+Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.compare.common;sing
+ leton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/build.properties new file mode 100644 index 00000000000..7299a10c1b3 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/build.properties @@ -0,0 +1,10 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ plugin.pdoc,\
+ build.properties,\
+ about.html
+src.includes = about.html
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.pdoc b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.pdoc new file mode 100644 index 00000000000..2bc2b2b7241 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.pdoc @@ -0,0 +1,4 @@ +<?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 common for the CompareEditor integration inside the PapyrusSashEditora CompareEditor for Papyrus. This CompareEditor is done
to be opened in the sasheditor as the others papyrus editors (diagram and table)
This editor is "partially volatile", that is to say, we lose all its information when we close it, 
but we don't lose it when we close Papyrus or Eclipse (see bug 371606)
">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.properties new file mode 100644 index 00000000000..d6b8baf2f09 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.papyrus.infra.emf.compare.common
+providerName = Eclipse Modeling Project
+pluginName = Common Plugin for Papyrus Compare Editor (Incubation)
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.xml b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.xml new file mode 100644 index 00000000000..c7d232618d8 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/plugin.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.core.model">
+ <model
+ classname="org.eclipse.papyrus.infra.emf.compare.common.modelresource.EMFCompareEditorModel"
+ description="The model for the PapyrusCompareEditor">
+ </model>
+ </extension>
+
+</plugin>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/Activator.java new file mode 100644 index 00000000000..779c3fbb3c9 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/Activator.java @@ -0,0 +1,70 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.emf.compare.common"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** the Papyrus log helper */
+ public static LogHelper log;
+
+ /**
+ * 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;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (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;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/AbstractPapyrusCompareEditor.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/AbstractPapyrusCompareEditor.java new file mode 100644 index 00000000000..c6a4b893771 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/AbstractPapyrusCompareEditor.java @@ -0,0 +1,290 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.editor;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Map;
+
+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.OperationHistoryEvent;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.compare.EMFCompareException;
+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.MatchOptions;
+import org.eclipse.emf.compare.match.engine.GenericMatchScopeProvider;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.compare.match.service.MatchService;
+import org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput;
+import org.eclipse.emf.compare.util.EMFCompareMap;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.emf.compare.common.Activator;
+import org.eclipse.papyrus.infra.emf.compare.common.utils.ICompareViewerProvider;
+import org.eclipse.papyrus.infra.emf.compare.common.utils.PapyrusModelCompareEditorInput;
+import org.eclipse.papyrus.infra.emf.compare.ui.provider.EMFCompareLabelProvider;
+import org.eclipse.papyrus.infra.emf.compare.ui.utils.ICustomizableEditor;
+import org.eclipse.papyrus.infra.emf.compare.ui.utils.LabelProviderUtil;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ * This abstract allows to regroup the configuration for the Papyrus nested compare editor
+ * and the standalone Papyrus Compare Editor
+ *
+ */
+@SuppressWarnings("restriction")
+//suppress restriction for CompareEditor
+public abstract class AbstractPapyrusCompareEditor extends CompareEditor implements ICustomizableEditor {
+
+
+ /**
+ * The listener on the operation history to catch the Undo/Redo and update the upper viewer
+ */
+ private IOperationHistoryListener historyListener;
+
+
+ /**
+ * The label provider for this editor
+ */
+ private EMFCompareLabelProvider labelProvider;
+
+ public AbstractPapyrusCompareEditor() {
+ super();
+ }
+
+ protected final void addUndoRedoListeners() {
+ final IOperationHistory operationHistory = getIOperationHistory();
+ operationHistory.addOperationHistoryListener(getUndoRedoListener());
+ }
+
+ /**
+ * Remove the listener on the Undo/Redo
+ */
+ protected void removeUndoRedoListener() {
+ final IOperationHistory operationHistory = getIOperationHistory();
+ operationHistory.removeOperationHistoryListener(getUndoRedoListener());
+ }
+
+ public EMFCompareLabelProvider getLabelProvider() {
+ if(labelProvider == null) {
+ labelProvider = LabelProviderUtil.createLabelProvider();
+ }
+ return labelProvider;
+ }
+
+ /**
+ *
+ * @param monitor
+ * the monitor
+ * @param left
+ * the left object
+ * @param right
+ * the right object
+ * @return
+ * the options for the comparison
+ */
+ //TODO : i'm not sure of these options for EMF, but this method is always overriden in Papyrus
+ protected Map<String, Object> getCompareOptions(final IProgressMonitor monitor, final EObject left, final EObject right) {
+ 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); //TODO verify this parameter
+ options.put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.TRUE); //TODO verify this parameter
+ return options;
+ }
+
+
+ @Override
+ public void setFocus() {
+ //I refresh the viewer here, because the EMF queries for name, ... are called during the creation of the editor, and
+ //it is not the correct Editor which is used by these queries to get the correct label provider
+ //
+ refreshViewers();
+ super.setFocus();
+ }
+
+ /**
+ *
+ * @param left
+ * the left eobject
+ * @param right
+ * the rihgt eobject
+ * @return
+ * the ComparisinSnapshot
+ */
+ protected ComparisonSnapshot doContentCompare(final EObject left, final EObject right) {
+ final ComparisonResourceSnapshot snapshot = DiffFactory.eINSTANCE.createComparisonResourceSnapshot();
+
+ try {
+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {
+
+ public void run(final IProgressMonitor monitor) throws InterruptedException {
+ final Map<String, Object> options = getCompareOptions(monitor, left, right);
+ final MatchModel match = doMatch(monitor, left, right, options);
+ DiffModel diff = doDiff(match, options);
+ snapshot.setDiff(diff);
+ snapshot.setMatch(match);
+ }
+
+ });
+
+ } catch (final InterruptedException e) {
+ Activator.log.error(e);
+ } catch (final EMFCompareException e) {
+ Activator.log.error(e);
+ } catch (final InvocationTargetException e) {
+ Activator.log.error(e);
+ }
+
+ return snapshot;
+ }
+
+ /**
+ *
+ * @param monitor TODO
+ * @param left
+ * @param right
+ * @param options
+ * @return
+ * the MatchModel for the comparison
+ * @throws InterruptedException
+ */
+ protected MatchModel doMatch(IProgressMonitor monitor, final EObject left, final EObject right, final Map<String, Object> options) throws InterruptedException {
+ return MatchService.doContentMatch(left, right, options);
+ }
+
+ /**
+ *
+ * @param match
+ * @param options
+ * @return
+ * the DiffModel for the comparison
+ */
+ protected DiffModel doDiff(final MatchModel match, Map<String, Object> options) {
+ return DiffService.doDiff(match);
+ }
+
+ /**
+ *
+ * @param left
+ * @param right
+ * @return
+ */
+ protected final ModelCompareEditorInput getCompareInput(final EObject left, final EObject right) {
+ final ComparisonSnapshot snapshot = doContentCompare(left, right);
+ return getConfiguredModelCompareEditorInput(snapshot);
+ }
+
+ /**
+ *
+ * @param snapshot
+ * the ComparisonSnapshot
+ * @return
+ * the ModelCompareEditorInput for this snapshot
+ */
+ //TODO try to set this method in private
+ private final ModelCompareEditorInput getConfiguredModelCompareEditorInput(final ComparisonSnapshot snapshot) {
+ final ModelCompareEditorInput input = createModelCompareEditorInput(snapshot);
+ configureInput((PapyrusModelCompareEditorInput)input);
+ return input;
+ }
+
+ protected ModelCompareEditorInput createModelCompareEditorInput(final ComparisonSnapshot snapshot) {
+ return new PapyrusModelCompareEditorInput(snapshot, this);
+ }
+
+ /**
+ * This method allows to set label and image to use for this input
+ *
+ * @param input
+ * the input
+ */
+ protected abstract void configureInput(final PapyrusModelCompareEditorInput input);
+
+ /**
+ *
+ */
+ protected void addListeners() {
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.ui.utils.ICustomizableEditor#refreshViewers()
+ *
+ */
+ public void refreshViewers() {
+ final IEditorInput input = this.getEditorInput();
+ if(input instanceof ICompareViewerProvider) {
+ final Viewer contentViewer = ((ICompareViewerProvider)input).getContentMergeViewer();
+ final Viewer structureViewer = ((ICompareViewerProvider)input).getStructureMergeViewer();
+ if(contentViewer != null) {
+ contentViewer.refresh();
+ }
+ if(structureViewer != null) {
+ structureViewer.refresh();
+ }
+ }
+ }
+
+ protected IOperationHistoryListener getUndoRedoListener() {
+ if(this.historyListener == null) {
+ this.historyListener = new IOperationHistoryListener() {
+
+ /** the last catched event */
+ private OperationHistoryEvent lastEvent = null;
+
+ /**
+ *
+ * @see org.eclipse.core.commands.operations.IOperationHistoryListener#historyNotification(org.eclipse.core.commands.operations.OperationHistoryEvent)
+ *
+ * @param event
+ */
+ public void historyNotification(final OperationHistoryEvent event) {
+ int eventType = event.getEventType();
+ if(eventType == OperationHistoryEvent.UNDONE || eventType == OperationHistoryEvent.REDONE) {
+ if(this.lastEvent != event) {
+ this.lastEvent = event;
+ if(!event.getOperation().getLabel().equals("Create CompareEditor")) {//TODO improve it!
+ resetInput();
+ }
+ }
+ }
+ //after each action, the status could have change
+ firePropertyChange(PROP_DIRTY);
+ }
+
+ private void resetInput() {
+ AbstractPapyrusCompareEditor.this.resetInput();
+ }
+ };
+ }
+ return this.historyListener;
+ }
+
+ protected abstract IOperationHistory getIOperationHistory();
+
+ /**
+ * reset the input in the viewer
+ */
+ protected abstract void resetInput();
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/EMFCompareEditor.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/EMFCompareEditor.java new file mode 100644 index 00000000000..8aef8ca034e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/EMFCompareEditor.java @@ -0,0 +1,309 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.editor;
+
+import org.eclipse.compare.CompareEditorInput;
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.compare.ui.ModelCompareInput;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.commands.NotifyingWorkspaceCommandStack;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.emf.compare.common.Activator;
+import org.eclipse.papyrus.infra.emf.compare.common.editor.listener.CloseEditorTriggerListener;
+import org.eclipse.papyrus.infra.emf.compare.common.messages.Messages;
+import org.eclipse.papyrus.infra.emf.compare.common.utils.EMFCompareUtils;
+import org.eclipse.papyrus.infra.emf.compare.common.utils.PapyrusModelCompareEditorInput;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IReusableEditor;
+import org.eclipse.ui.ISaveablesLifecycleListener;
+import org.eclipse.ui.ISaveablesSource;
+import org.eclipse.ui.PartInitException;
+
+/**
+ *
+ * This class provides an EMF-Compare Editor for Papyrus. This Editor has been created to be embedded in the Papyrus SashEditor
+ *
+ */
+public class EMFCompareEditor extends AbstractPapyrusCompareEditor implements IReusableEditor, ISaveablesSource, IPropertyChangeListener, ISaveablesLifecycleListener {
+
+ /** the service registry */
+ protected ServicesRegistry servicesRegistry;
+
+ private CloseEditorTriggerListener closeListener;
+
+ protected PapyrusEMFCompareInstance rawModel;
+
+
+ /**
+ * The compare editor input
+ */
+ private CompareEditorInput input;//TODO move it in the supper class?
+
+ private PartNameSynchronizer synchronizer;
+
+ /**
+ *
+ * @see org.eclipse.compare.internal.CompareEditor#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
+ *
+ * @param event
+ */
+ @Override
+ public void propertyChange(final PropertyChangeEvent event) {
+ if(event.getSource() == IAction.class && event.getProperty() == CompareEditorInput.PROP_TITLE) {
+ //the CustomizationAction of the viewer sent this refresh
+ setPartName(EMFCompareUtils.getCompareEditorTitle(EMFCompareEditor.this, rawModel));
+ } else {
+ super.propertyChange(event);
+ }
+ }
+
+
+ /**
+ * @param servicesRegistry
+ * the service registry
+ * @param rawModel
+ * the raw model
+ *
+ */
+ public EMFCompareEditor(final ServicesRegistry servicesRegistry, final PapyrusEMFCompareInstance rawModel) {
+ this.servicesRegistry = servicesRegistry;
+ this.rawModel = rawModel;
+ this.synchronizer = new PartNameSynchronizer(rawModel);
+ this.input = getCompareInput(rawModel.getLeft(), rawModel.getRight());
+ addListeners();
+ }
+
+
+ protected EMFCompareEditor() {
+ //FIXME, used by the compare UMl File Editor, try to merge code
+ super();
+ }
+
+
+
+ @Override
+ protected void addListeners() {
+ addUndoRedoListeners();
+ if(EMFCompareEditor.this.servicesRegistry != null) {//we are in papyrus
+ TransactionalEditingDomain domain = null;
+ try {
+ domain = EMFCompareEditor.this.servicesRegistry.getService(TransactionalEditingDomain.class);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ closeListener = new CloseEditorTriggerListener(this.rawModel, this.servicesRegistry);
+ domain.addResourceSetListener(closeListener);
+ }
+ }
+
+ /**
+ * Remove the listener
+ */
+ protected void removeListeners() {
+ removeUndoRedoListener();
+ //done by the CloseTriggerlistener. Here, it is too early to remove it
+ // if(EMFCompareEditor.this.servicesRegistry != null) {//we are in papyrus
+ // TransactionalEditingDomain domain = null;
+ // try {
+ // domain = EMFCompareEditor.this.servicesRegistry.getService(TransactionalEditingDomain.class);
+ // } catch (ServiceException e) {
+ // Activator.log.error(e);
+ // }
+ //
+ // domain.removeResourceSetListener(closeListener);
+ // }
+ }
+
+ protected ISashWindowsContainer getISashWindowsContainer() {
+ ISashWindowsContainer container = null;
+ if(EMFCompareEditor.this.servicesRegistry != null) {//we are in papyrus
+ try {
+ container = ServiceUtils.getInstance().getISashWindowsContainer(this.servicesRegistry);
+ } catch (ServiceException e) {
+ Activator.log.error("I can't get the ISashWindowsContainer to add a listener on it", e); //$NON-NLS-1$
+ }
+ }
+ return container;
+ }
+
+
+
+ /**
+ *
+ * @see org.eclipse.ui.IEditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
+ *
+ * @param site
+ * @param input
+ * @throws PartInitException
+ */
+ @Override
+ public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
+ if(input instanceof CompareEditorInput) {
+ super.init(site, input);
+ } else {
+ super.init(site, this.input);
+ }
+
+ }
+
+ @Override
+ public void dispose() {
+ removeListeners();
+ super.dispose();
+ }
+
+ /**
+ *
+ * A class taking in charge the synchronization of the partName and the right/left elements.
+ * When a name change, the other is automatically updated.
+ *
+ * @author vincent lorenzo
+ * adapted class from UmlGmfDiagramEditor
+ */
+ public class PartNameSynchronizer {
+
+ /** the papyrus table */
+ private PapyrusEMFCompareInstance compareInstance;
+
+ /**
+ * Listener on diagram name change.
+ */
+ private final Adapter tableNameListener = new Adapter() {
+
+ /**
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ *
+ * @param notification
+ */
+ public void notifyChanged(final Notification notification) {
+ setPartName(EMFCompareUtils.getCompareEditorTitle(EMFCompareEditor.this, rawModel));
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#getTarget()
+ *
+ * @return
+ */
+ public Notifier getTarget() {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
+ *
+ * @param newTarget
+ */
+ public void setTarget(final Notifier newTarget) {
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ *
+ * @param type
+ * @return
+ */
+ public boolean isAdapterForType(final Object type) {
+ return false;
+ }
+
+ };
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param diagram
+ */
+ public PartNameSynchronizer(final PapyrusEMFCompareInstance compareInstance) {
+ setCompare(compareInstance);
+ }
+
+ /**
+ * Change the associated diagram.
+ *
+ * @param papyrusTable
+ */
+ public void setCompare(final PapyrusEMFCompareInstance compareInstance) {
+ // Remove from old diagram, if any
+ if(this.compareInstance != null) {
+ compareInstance.getLeft().eAdapters().remove(this.tableNameListener);
+ compareInstance.getRight().eAdapters().remove(this.tableNameListener);
+ }
+ // Set new table
+ this.compareInstance = compareInstance;
+
+ // Listen to name change
+ compareInstance.getLeft().eAdapters().add(this.tableNameListener);
+ compareInstance.getRight().eAdapters().add(this.tableNameListener);
+
+ }
+ }
+
+ @Override
+ protected void configureInput(final PapyrusModelCompareEditorInput input) {
+ //not useful for the moment
+ }
+
+
+ @Override
+ protected IOperationHistory getIOperationHistory() {
+ return ((NotifyingWorkspaceCommandStack)getEditingDomain().getCommandStack()).getOperationHistory();
+ }
+
+
+ @Override
+ protected void resetInput() {
+ final TreeViewer viewer = ((PapyrusModelCompareEditorInput)this.input).getStructureMergeViewer();
+ final PapyrusModelCompareEditorInput input = (PapyrusModelCompareEditorInput)getCompareInput(rawModel.getLeft(), rawModel.getRight());
+ final ModelCompareInput input2 = input.getpreparedModelCompareInput();
+ viewer.setInput(input2);
+ }
+
+
+ public EditingDomain getEditingDomain() {
+ return (EditingDomain)getAdapter(TransactionalEditingDomain.class);
+ }
+
+ @Override
+ public Object getAdapter(Class adapter) {
+ if(adapter.equals(TransactionalEditingDomain.class)) {
+ TransactionalEditingDomain domain = null;
+ try {
+ domain = servicesRegistry.getService(adapter);
+ } catch (ServiceException e) {
+ Activator.log.error(Messages.EMFCompareEditor_EditingDomainNotFound, e);
+ }
+ return domain;
+ }
+ return super.getAdapter(adapter);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/listener/CloseEditorTriggerListener.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/listener/CloseEditorTriggerListener.java new file mode 100644 index 00000000000..2531ee4e670 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/editor/listener/CloseEditorTriggerListener.java @@ -0,0 +1,115 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.editor.listener;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.command.RemoveCommand;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.TriggerListener;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.emf.compare.common.Activator;
+import org.eclipse.papyrus.infra.emf.compare.common.messages.Messages;
+
+/**
+ *
+ * This class listen the close of the nested Compare Editor.
+ * When it is closed,
+ * - it removed it from the model (notation and di files are concerned)
+ * - it remove itself from the list of listener on the editing domain
+ *
+ */
+public class CloseEditorTriggerListener extends TriggerListener {
+
+ /**
+ * The listened model of the editor
+ */
+ private final EObject rawModel;
+
+ /** the service registry */
+ private final ServicesRegistry registry;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param rawModel
+ * the model for the editor to listen
+ * @param registry
+ * the service registry
+ */
+ public CloseEditorTriggerListener(final EObject rawModel, final ServicesRegistry registry) {
+ this.rawModel = rawModel;
+ this.registry = registry;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.transaction.TriggerListener#trigger(org.eclipse.emf.transaction.TransactionalEditingDomain,
+ * org.eclipse.emf.common.notify.Notification)
+ *
+ * @param domain
+ * @param notification
+ * @return
+ */
+ @Override
+ protected Command trigger(final TransactionalEditingDomain domain, final Notification notification) {
+ final Object notifier = notification.getNotifier();
+ IPageMngr mngr = null;
+ try {
+ mngr = ServiceUtils.getInstance().getIPageMngr(registry);
+ } catch (ServiceException e) {
+ Activator.log.error(Messages.CloseEditorTriggerListener_ICantFoundTheIPageManager, e);
+ }
+
+ final IPageMngr mngr2 = mngr;
+ if(notifier instanceof PageRef) {
+ final PageRef ref = (PageRef)notifier;
+ final EObject pageId = ref.getEmfPageIdentifier();
+ if(pageId == rawModel) {
+ final CompoundCommand command = new CompoundCommand();
+ final Command sashRemoveComd = new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ mngr2.removePage(rawModel);
+ }
+ };
+ EList<EObject> tabls = rawModel.eResource().getContents();
+ command.append(sashRemoveComd);
+ command.append(new RemoveCommand(domain, tabls, rawModel));
+ final Command removeListener = new RecordingCommand(domain) {
+
+ @Override
+ protected void doExecute() {
+ //we remove this listener from the editingdomain
+ //it can't be done in the class which set it, because it would be removed too early
+ domain.removeResourceSetListener(CloseEditorTriggerListener.this);
+ }
+ };
+ command.append(removeListener);
+ return command;
+ }
+ }
+ return null;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/factory/AbstractEMFCompareEditorFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/factory/AbstractEMFCompareEditorFactory.java new file mode 100644 index 00000000000..94077194016 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/factory/AbstractEMFCompareEditorFactory.java @@ -0,0 +1,204 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.factory;
+
+import java.lang.reflect.Constructor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.infra.core.editor.BackboneException;
+import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
+import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.compare.common.Activator;
+import org.eclipse.papyrus.infra.emf.compare.common.utils.EMFCompareUtils;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.EditorActionBarContributor;
+
+public abstract class AbstractEMFCompareEditorFactory extends AbstractEditorFactory {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param editorClass
+ * the editor class
+ * @param editorType
+ * the type of editor
+ */
+ public AbstractEMFCompareEditorFactory(final Class<?> editorClass, final String type) {
+ super(editorClass, type);
+ }
+
+ /**
+ * Create the IPageModel that is used by the SashWindows to manage the editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * The model pushed in the sashmodel by the creation command
+ * @return A model implementing the IPageModel
+ */
+ public IPageModel createIPageModel(Object pageIdentifier) {
+ return new CompareEditorModel(pageIdentifier, getServiceRegistry());
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
+ *
+ * @param pageIdentifier
+ * @return
+ */
+ public boolean isPageModelFactoryFor(Object pageIdentifier) {
+ if(pageIdentifier instanceof PapyrusEMFCompareInstance) {
+ return ((PapyrusEMFCompareInstance)pageIdentifier).getType().equals(this.getExpectedType());
+ }
+ return false;
+ }
+
+ /**
+ * IEditorModel used internally by the SashContainer. This model know how to handle IEditor creation.
+ *
+ *
+ *
+ */
+ private class CompareEditorModel implements IEditorModel {
+
+
+ /**
+ * The servicesRegistry provided at creation.
+ */
+ private ServicesRegistry servicesRegistry;
+
+ /**
+ * The created editor.
+ */
+ private IEditorPart editor;
+
+ /**
+ * The raw model stored in the SashProvider.
+ */
+ private PapyrusEMFCompareInstance rawModel;
+
+ /**
+ *
+ * Constructor.
+ */
+ public CompareEditorModel(Object pageIdentifier, ServicesRegistry servicesRegistry) {
+ rawModel = (PapyrusEMFCompareInstance)pageIdentifier;
+ this.servicesRegistry = servicesRegistry;
+ }
+
+ /**
+ * Create the IEditor for the diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
+ * @return
+ * @throws PartInitException
+ *
+ */
+ public IEditorPart createIEditorPart() throws PartInitException {
+ try {
+ Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusEMFCompareInstance.class);
+ editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
+ return editor;
+
+ } catch (Exception e) {
+ // Lets propagate. This is an implementation problem that should be solved by
+ // programmer.
+ throw new PartInitException("Can't create CompareEditor", e); //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * Get the action bar requested by the Editor.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
+ * @return
+ *
+ */
+ public EditorActionBarContributor getActionBarContributor() {
+
+ String actionBarId = editorDescriptor.getActionBarContributorId();
+
+ // Do nothing if no EditorActionBarContributor is specify.
+ if(actionBarId == null || actionBarId.length() == 0) {
+ return null;
+ }
+
+ // Try to get it.
+
+ // Get ServiceRegistry
+ // ServicesRegistry serviceRegistry = getServicesRegistry();
+ ActionBarContributorRegistry registry;
+ try {
+ registry = servicesRegistry.getService(ActionBarContributorRegistry.class);
+ } catch (ServiceException e) {
+ // Service not found
+ Activator.log.error(e);
+ return null;
+ }
+
+ try {
+ return registry.getActionBarContributor(actionBarId);
+ } catch (BackboneException e) {
+ Activator.log.error(e);
+ return null;
+ }
+ }
+
+ /**
+ * Get the underlying RawModel. Return the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
+ * @return
+ *
+ */
+ public Object getRawModel() {
+ return rawModel;
+ }
+
+ /**
+ * Get the icon to be shown by Tabs
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
+ * @return
+ *
+ */
+ public Image getTabIcon() {
+ ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
+ if(imageDescriptor == null) {
+ return null;
+ }
+ return imageDescriptor.createImage();
+ }
+
+ /**
+ * Get the title of the Diagram.
+ *
+ * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
+ * @return
+ *
+ */
+ public String getTabTitle() {
+ return EMFCompareUtils.getCompareEditorTitle(editor, rawModel);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/handler/AbstractEMFCompareEditorHandler.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/handler/AbstractEMFCompareEditorHandler.java new file mode 100644 index 00000000000..c0e8c6ce386 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/handler/AbstractEMFCompareEditorHandler.java @@ -0,0 +1,174 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.handler;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.commands.CheckedOperationHistory;
+import org.eclipse.papyrus.infra.core.resource.NotFoundException;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
+import org.eclipse.papyrus.infra.emf.compare.common.Activator;
+import org.eclipse.papyrus.infra.emf.compare.common.modelresource.EMFCompareEditorModel;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstanceFactory;
+import org.eclipse.ui.PlatformUI;
+
+
+public abstract class AbstractEMFCompareEditorHandler extends AbstractHandler {
+
+ final private String type;
+
+ public AbstractEMFCompareEditorHandler(final String type) {
+ this.type = type;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ return getSelection().size() == 2;
+ }
+
+
+ //TODO essayer de merger cet handler avec un autre fournissant une commande et la sélection!
+ protected List<EObject> getSelection() {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ List<EObject> currentSelection = new ArrayList<EObject>();
+ Iterator<?> iter = ((IStructuredSelection)selection).iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IAdaptable) {
+ EObject tmp = (EObject)((IAdaptable)current).getAdapter(EObject.class);
+ if(tmp != null) {
+ currentSelection.add(tmp);
+ }
+ }
+ }
+ return currentSelection;
+ }
+
+ /**
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ try {
+
+ runAsTransaction();
+ } catch (ServiceException e) {
+ throw new ExecutionException("I can't create CompareEditor", e); //$NON-NLS-1$
+ }
+ return null;
+ }
+
+ /**
+ * Run the command as a transaction.
+ * Create a Transaction and delegate the command to {@link #doExecute(ServicesRegistry)}.
+ *
+ * @throws ServiceException
+ *
+ */
+ public void runAsTransaction() throws ServiceException {
+ final ServicesRegistry serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
+ TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
+
+ //Create the transactional command
+ AbstractEMFOperation command = new AbstractEMFOperation(domain, "Create CompareEditor") { //$NON-NLS-1$
+
+ @Override
+ protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ try {
+ AbstractEMFCompareEditorHandler.this.doExecute(serviceRegistry);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ return Status.CANCEL_STATUS;
+ } catch (NotFoundException e) {
+ Activator.log.error(e);
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
+ }
+ };
+
+ // Execute the command
+ try {
+ CheckedOperationHistory.getInstance().execute(command, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ Activator.log.error("I can't create CompareEditor", e); //$NON-NLS-1$
+ }
+
+ }
+
+
+ /**
+ * Do the execution of the command.
+ *
+ * @param serviceRegistry
+ * @throws ServiceException
+ * @throws NotFoundException
+ */
+ public void doExecute(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ Object editorModel = createEditorModel(serviceRegistry);
+ // Get the mngr allowing to add/open new editor.
+ IPageMngr pageMngr = ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
+ // add the new editor model to the sash.
+ pageMngr.openPage(editorModel);
+
+ }
+
+ /**
+ * Create a model identifying the editor. This model will be saved with the sash
+ *
+ * @return
+ * @throws ServiceException
+ * @throws NotFoundException
+ * The model where to save the TableInstance is not found.
+ */
+ protected Object createEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ PapyrusEMFCompareInstance editor = PapyrusemfcompareinstanceFactory.eINSTANCE.createPapyrusEMFCompareInstance();
+ editor.setLeft(getSelection().get(0));
+ editor.setRight(getSelection().get(1));
+ editor.setType(this.type);
+ EMFCompareEditorModel model = (EMFCompareEditorModel)ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(EMFCompareEditorModel.MODEL_ID);
+ model.addEMFCompareEditorInstance(editor);
+ return editor;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/Messages.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/Messages.java new file mode 100644 index 00000000000..7e04def1dbd --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/Messages.java @@ -0,0 +1,23 @@ +package org.eclipse.papyrus.infra.emf.compare.common.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.compare.common.messages.messages"; //$NON-NLS-1$
+
+ public static String CloseEditorTriggerListener_ICantFoundTheIPageManager;
+
+ public static String EMFCompareEditor_EditingDomainNotFound;
+
+ public static String EMFCompareUtils_CompareTitle;
+
+ public static String PapyrusModelCompareEditorInput_CompareTitle;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/messages.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/messages.properties new file mode 100644 index 00000000000..ba07d46048a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/messages/messages.properties @@ -0,0 +1,4 @@ +CloseEditorTriggerListener_ICantFoundTheIPageManager=I can't find the IPageManager
+EMFCompareEditor_EditingDomainNotFound=TransactionalEditingDomain not found
+EMFCompareUtils_CompareTitle=Compare (''{0}'' - ''{1}'')
+PapyrusModelCompareEditorInput_CompareTitle=Compare (''{0}'' - ''{1}'')
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/modelresource/EMFCompareEditorModel.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/modelresource/EMFCompareEditorModel.java new file mode 100644 index 00000000000..149c4dec57c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/modelresource/EMFCompareEditorModel.java @@ -0,0 +1,108 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.modelresource;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
+import org.eclipse.papyrus.infra.core.resource.IModel;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
+
+
+public class EMFCompareEditorModel extends AbstractModelWithSharedResource<PapyrusEMFCompareInstance> implements IModel {
+
+ /*
+ * To save in a new file :
+ * the class should extends AbstractBaseModel and NOTATION_FILE_EXTENSION = "nattable" for example
+ */
+
+
+ /**
+ * File extension used for notation.
+ */
+ public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
+
+ /**
+ * Model ID.
+ */
+ public static final String MODEL_ID = "org.eclipse.papyrus.emf.compare.resource.EMFCompareEditorModel"; //$NON-NLS-1$
+
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public EMFCompareEditorModel() {
+
+ }
+
+
+ /**
+ * Get the file extension used for this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
+ *
+ * @return
+ */
+ @Override
+ protected String getModelFileExtension() {
+ return NOTATION_FILE_EXTENSION;
+ }
+
+ /**
+ * Get the identifier used to register this model.
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
+ *
+ * @return
+ */
+ @Override
+ public String getIdentifier() {
+ return MODEL_ID;
+ }
+
+
+ /**
+ * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
+ *
+ * @param compareInstance
+ * The compareInstance to add.
+ */
+ public void addEMFCompareEditorInstance(PapyrusEMFCompareInstance compareInstance) {
+ getResource().getContents().add(compareInstance);
+ }
+
+ /**
+ * Add a new initialized {@link PapyrusEMFCompareInstance} to the model.
+ *
+ * @param compareInstance
+ * The compareInstance to add.
+ */
+ public void removeEMFCompareEditorInstance(PapyrusEMFCompareInstance compareInstance) {
+ getResource().getContents().remove(compareInstance);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ protected boolean isModelRoot(EObject object) {
+ return false;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/EMFCompareUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/EMFCompareUtils.java new file mode 100644 index 00000000000..efdfa3d06aa --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/EMFCompareUtils.java @@ -0,0 +1,53 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.utils;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.emf.compare.common.messages.Messages;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
+import org.eclipse.papyrus.infra.emf.compare.ui.provider.EMFCompareLabelProvider;
+import org.eclipse.papyrus.infra.emf.compare.ui.utils.ICustomizableEditor;
+import org.eclipse.ui.IEditorPart;
+
+
+
+public class EMFCompareUtils {
+
+ private EMFCompareUtils() {
+ //nothing to do
+ }
+
+
+ /**
+ *
+ * @param editor
+ * the editor
+ * @param rawModel
+ * the raw model
+ * @return
+ * the name for the editor
+ */
+ public static String getCompareEditorTitle(final IEditorPart editor, final PapyrusEMFCompareInstance rawModel) {
+ if(editor instanceof ICustomizableEditor) {
+ EMFCompareLabelProvider labelProvider = (EMFCompareLabelProvider)((ICustomizableEditor)editor).getLabelProvider();
+ String leftLabel = labelProvider.getText(rawModel.getLeft());
+ String rightLabel = labelProvider.getText(rawModel.getRight());
+ String title = NLS.bind(Messages.EMFCompareUtils_CompareTitle, leftLabel, rightLabel);
+ return title;
+ }
+ return "";
+
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/ICompareViewerProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/ICompareViewerProvider.java new file mode 100644 index 00000000000..ed11d80beae --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/ICompareViewerProvider.java @@ -0,0 +1,40 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.utils;
+
+import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
+import org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer;
+
+/**
+ *
+ * This interface
+ *
+ */
+public interface ICompareViewerProvider {
+
+ /**
+ *
+ * @return
+ * the content merge viewer for this input. The returned value can be <code>null</code> if the viewer has not been yet created
+ */
+ public ContentMergeViewer getContentMergeViewer();
+
+ /**
+ *
+ * @return
+ * the structure merge viewer for this input. The returned value can be <code>null</code> if the viewer has not been yet created
+ */
+ public ModelStructureMergeViewer getStructureMergeViewer();
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/PapyrusModelCompareEditorInput.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/PapyrusModelCompareEditorInput.java new file mode 100644 index 00000000000..de33db83c16 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.common/src/org/eclipse/papyrus/infra/emf/compare/common/utils/PapyrusModelCompareEditorInput.java @@ -0,0 +1,178 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.common.utils;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareViewerPane;
+import org.eclipse.compare.Splitter;
+import org.eclipse.compare.contentmergeviewer.ContentMergeViewer;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot;
+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.transaction.TransactionalEditingDomain;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.emf.compare.common.messages.Messages;
+import org.eclipse.papyrus.infra.emf.compare.ui.content.transactional.viewer.PapyrusTransactionalModelContentMergeViewer;
+import org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer.PapyrusCustomizableParameterizedStructureMergeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * the ModelInput for Papyrus Compare
+ *
+ */
+public class PapyrusModelCompareEditorInput extends ModelCompareEditorInput implements ICompareViewerProvider {
+
+ /** the editor */
+ protected IEditorPart editor;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param snapshot
+ * the snapshot
+ * @param editor
+ * the editor for the comparison
+ * @param ancestor
+ * the ancestor
+ * @param left
+ * the left Object to compare (used to display the name of elementthe element
+ * @param right
+ */
+ public PapyrusModelCompareEditorInput(final ComparisonSnapshot snapshot, final IEditorPart editor) {
+ super(snapshot);
+ this.editor = editor;
+ }
+
+ /**
+ * This methods allows to set the labels displayed at the top of the content merger viewers
+ * These labels are used too for the title of the editor
+ *
+ * @param leftLabel
+ * the left label
+ * @param leftImage
+ * the left image
+ * @param rightLabel
+ * the right label
+ * @param rightImage
+ * the right image
+ */
+ public void initLabels(final String leftLabel, final Image leftImage, final String rightLabel, final Image rightImage) {
+ CompareConfiguration cc = getCompareConfiguration();
+ cc.setLeftLabel(leftLabel);
+ cc.setRightLabel(rightLabel);
+ cc.setLeftImage(leftImage);
+ cc.setRightImage(rightImage);
+ setTitle(NLS.bind(Messages.PapyrusModelCompareEditorInput_CompareTitle, leftLabel, rightLabel));
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput#createMergeViewer(org.eclipse.compare.CompareViewerPane,
+ * org.eclipse.compare.CompareConfiguration)
+ *
+ * @param pane
+ * @param config
+ * @return
+ */
+ @Override
+ protected ModelContentMergeViewer createMergeViewer(final CompareViewerPane pane, final CompareConfiguration config) {
+ return new PapyrusTransactionalModelContentMergeViewer(pane, config, editor);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see CompareEditorInput#createOutlineContents(Composite, int)
+ */
+ @Override
+ public Control createOutlineContents(final Composite parent, final int direction) {
+ final Splitter splitter = new Splitter(parent, direction);
+
+ final CompareViewerPane pane = new CompareViewerPane(splitter, SWT.NONE);
+
+ //structureMergeViewer = new ModelStructureMergeViewer(pane, getCompareConfiguration());
+ CompareConfiguration conf = getCompareConfiguration();
+ // conf.s
+ structureMergeViewer = new PapyrusCustomizableParameterizedStructureMergeViewer(pane, getCompareConfiguration(), editor);
+ pane.setContent(structureMergeViewer.getTree());
+
+ structureMergeViewer.setInput(preparedInput);
+
+ return splitter;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput#saveChanges(org.eclipse.core.runtime.IProgressMonitor)
+ *
+ * @param monitor
+ */
+ @Override
+ public void saveChanges(final IProgressMonitor monitor) {
+ //normally it ok, there is nothing to do to save notation and di files
+ super.saveChanges(monitor);
+ }
+
+ /**
+ *
+ * @return
+ * the content merge viewer for this input. The returned value can be <code>null</code> if the viewer has not been yet created
+ */
+ public ContentMergeViewer getContentMergeViewer() {
+ return this.contentMergeViewer;
+ }
+
+ /**
+ *
+ * @return
+ * the structure merge viewer for this input. The retruned value can be <code>null</code> if the viewer has not been yet created
+ */
+ public ModelStructureMergeViewer getStructureMergeViewer() {
+ return this.structureMergeViewer;
+ }
+
+ /**
+ *
+ * @return
+ * the prepared input
+ */
+ public ModelCompareInput getpreparedModelCompareInput() {
+ prepareInput(new NullProgressMonitor());
+ return this.preparedInput;
+ }
+
+ /**
+ *
+ * @return
+ * the EditingDomain for the current Editor, or <code>null</code> if not found
+ */
+ protected TransactionalEditingDomain getEditingDomain() {
+ TransactionalEditingDomain domain = null;
+ if(this.editor instanceof IAdaptable) {
+ domain = (TransactionalEditingDomain)this.editor.getAdapter(TransactionalEditingDomain.class);
+ }
+ return domain;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.classpath new file mode 100644 index 00000000000..11515e2650c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry excluding="org/eclipse/papyrus/emf/compare/merger/services/PapyrusMergeFactory.java|org/eclipse/papyrus/infra/emf/compare/diff/service/PapyrusMergeFactory.java" kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.project new file mode 100644 index 00000000000..a432349cb6e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.emf.compare.diff</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/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.settings/org.eclipse.jdt.core.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.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/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..6cee97758c5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/META-INF/MANIFEST.MF @@ -0,0 +1,35 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.compare,
+ org.eclipse.emf.compare.diff,
+ org.eclipse.emf.transaction,
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.0",
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="0.10.0",
+ com.google.guava;bundle-version="10.0.1",
+ org.eclipse.emf.compare.match
+Export-Package: org.eclipse.papyrus.infra.emf.compare.diff,
+ org.eclipse.papyrus.infra.emf.compare.diff.check,
+ org.eclipse.papyrus.infra.emf.compare.diff.internal.command,
+ org.eclipse.papyrus.infra.emf.compare.diff.internal.merger,
+ org.eclipse.papyrus.infra.emf.compare.diff.internal.provider,
+ org.eclipse.papyrus.infra.emf.compare.diff.internal.util,
+ org.eclipse.papyrus.infra.emf.compare.diff.merge,
+ org.eclipse.papyrus.infra.emf.compare.diff.provider,
+ org.eclipse.papyrus.infra.emf.compare.diff.service,
+ org.eclipse.papyrus.infra.emf.compare.diff.utils
+Bundle-Vendor: %Bundle-Vendor
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %Bundle-Name
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.emf.compare.diff.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.compare.diff;single
+ ton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/OSGI-INF/l10n/bundle.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/OSGI-INF/l10n/bundle.properties new file mode 100644 index 00000000000..c61ef00c81b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,4 @@ +#Properties file for org.eclipse.papyrus.infra.emf.compare.diff
+extension-point.name = org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Papyrus EMF Merger (Incubation)
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/build.properties new file mode 100644 index 00000000000..63b01ff7554 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/build.properties @@ -0,0 +1,11 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ build.properties,\
+ schema/,\
+ about.html,\
+ OSGI-INF/,\
+ plugin.pdoc
+src.includes = about.html
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/plugin.pdoc b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/plugin.pdoc new file mode 100644 index 00000000000..9ed59603112 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/plugin.pdoc @@ -0,0 +1,4 @@ +<?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 Transactional EMF Merger.">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/plugin.xml b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/plugin.xml new file mode 100644 index 00000000000..1735ddc95b2 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/plugin.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider" name="org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider" schema="schema/org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider.exsd"/>
+ <extension
+ point="org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider">
+ <mergerprovider
+ mergerProviderClass="org.eclipse.papyrus.infra.emf.compare.diff.internal.provider.DefaultTransactionalMergerProvider"
+ new_attribute="org.eclipse.papyrus.infra.emf.compare.diff.TransactionalMergerProvider1">
+ </mergerprovider>
+ </extension>
+
+
+</plugin>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/schema/org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider.exsd b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/schema/org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider.exsd new file mode 100644 index 00000000000..ad697e5aa43 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/schema/org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider.exsd @@ -0,0 +1,136 @@ +<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.papyrus.infra.emf.compare.diff" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.papyrus.infra.emf.compare.diff" id="org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider" name="org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="mergerprovider"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="mergerprovider">
+ <annotation>
+ <documentation>
+ This extension point allows to register merge provider for
+the Papyrus UML Compare. This extension point has been adapted from the EMF-Compare
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="fileExtension" type="string">
+ <annotation>
+ <documentation>
+ Comma separated list of the extensions this merger provider targets. * for any file extension.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="mergerProviderClass" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.papyrus.infra.emf.compare.diff.provider.ITransactionalMergerProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority">
+ <annotation>
+ <documentation>
+ The priority of this engine. Values can be <code>lowest</code>, <code>low</code>, <code>normal</code>, <code>high</code>, <code>highest</code>.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="lowest">
+ </enumeration>
+ <enumeration value="low">
+ </enumeration>
+ <enumeration value="normal">
+ </enumeration>
+ <enumeration value="high">
+ </enumeration>
+ <enumeration value="highest">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/Activator.java new file mode 100644 index 00000000000..2858c1d669e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/Activator.java @@ -0,0 +1,70 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.emf.compare.diff"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** the log helper for this plugin */
+ public static LogHelper log;
+
+ /**
+ * 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);
+ log = new LogHelper(this);
+ plugin = this;
+ }
+
+ /*
+ * (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;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/FeaturesCheck.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/FeaturesCheck.java new file mode 100644 index 00000000000..c43c699fadd --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/FeaturesCheck.java @@ -0,0 +1,106 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.check;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.compare.diff.engine.IMatchManager;
+import org.eclipse.emf.compare.diff.engine.check.AbstractCheck;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.emf.compare.diff.utils.PapyrusCompareOptions;
+
+/**
+ *
+ * This checker allow to know if differences on a feature should be ignored or not
+ *
+ */
+public class FeaturesCheck extends AbstractCheck implements IFeaturesCheck {
+
+ /**
+ * The list of the features that should be ignored in the whole diff
+ */
+ private final List<EStructuralFeature> ignoreAll;
+
+ /**
+ * the list of the features that should be ignored for some EObject
+ */
+ private final Map<EStructuralFeature, List<EObject>> ignoreSomeCase;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ * @param options
+ */
+ @SuppressWarnings("unchecked")
+ //cast on List and Map
+ public FeaturesCheck(final IMatchManager manager, final Map<String, Object> options) {
+ super(manager);
+
+ if(options != null && options.containsKey(PapyrusCompareOptions.KEY_IGNORE_ALL_CHANGES_ON_FEATURES)) {
+ this.ignoreAll = (List<EStructuralFeature>)options.get(PapyrusCompareOptions.KEY_IGNORE_ALL_CHANGES_ON_FEATURES);
+ } else {
+ this.ignoreAll = Collections.EMPTY_LIST;
+ }
+ if(options != null && options.containsKey(PapyrusCompareOptions.KEY_IGNORE_CHANGES_ON_FEATURES_FOR)) {
+ this.ignoreSomeCase = (Map<EStructuralFeature, List<EObject>>)options.get(PapyrusCompareOptions.KEY_IGNORE_CHANGES_ON_FEATURES_FOR);
+ } else {
+ this.ignoreSomeCase = Collections.EMPTY_MAP;
+ }
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param manager
+ */
+ public FeaturesCheck(final IMatchManager manager) {
+ this(manager, null);
+ }
+
+ /**
+ * This method is used to know if a feature should always be ignored
+ *
+ * @param feature
+ * @return
+ */
+ public boolean shouldBeIgnored(final EStructuralFeature feature) {
+ return this.ignoreAll.contains(feature);
+ }
+
+ /**
+ * This method begins by testing the feature must ALWAYS be ignored using shouldBeIgnored(feature).
+ * If not, we verify is the feature should be ignored in some case, depending on its context
+ *
+ *
+ * @param feature
+ * @param context
+ * @return
+ */
+ public boolean shouldBeIgnored(final EStructuralFeature feature, final EObject context) {
+ if(shouldBeIgnored(feature)) {
+ return true;
+ }
+ final List<EObject> values = this.ignoreSomeCase.get(feature);
+ if(values != null) {
+ return values.contains(context);
+ }
+ return false;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/IFeaturesCheck.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/IFeaturesCheck.java new file mode 100644 index 00000000000..7ad0443c4a3 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/IFeaturesCheck.java @@ -0,0 +1,45 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.check;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ *
+ * This interface allows to define checker enable to ignore differences following the context
+ *
+ */
+public interface IFeaturesCheck {
+
+ /**
+ * return <code>true</code> if the feature should be ignored
+ *
+ * @param feature
+ * @return
+ */
+ public boolean shouldBeIgnored(final EStructuralFeature feature);
+
+ /**
+ * return <code>true</code> if the feature should be ignored in this context
+ *
+ * @param feature
+ * a feature
+ * @param context
+ * the context of this attribute
+ * @return
+ */
+ public boolean shouldBeIgnored(final EStructuralFeature feature, final EObject context);
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/PapyrusAttributesCheck.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/PapyrusAttributesCheck.java new file mode 100644 index 00000000000..5f78f3657ab --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/PapyrusAttributesCheck.java @@ -0,0 +1,128 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.check;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.diff.engine.IMatchManager;
+import org.eclipse.emf.compare.diff.engine.check.AttributesCheck;
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.compare.match.metamodel.Match2Elements;
+import org.eclipse.emf.compare.match.metamodel.Match3Elements;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+
+
+public class PapyrusAttributesCheck extends AttributesCheck {
+
+ /**
+ * a checker used to manage diff configuration
+ */
+ private final FeaturesCheck checker;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param matchManager
+ * @param featuresCheck
+ * the checker used to manage diff configuration
+ */
+ public PapyrusAttributesCheck(final IMatchManager matchManager, final FeaturesCheck featuresCheck) {
+ super(matchManager);
+ this.checker = featuresCheck;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.diff.engine.check.AttributesCheck#shouldBeIgnored(org.eclipse.emf.ecore.EAttribute)
+ *
+ * @param attribute
+ * @return
+ */
+ @Override
+ protected boolean shouldBeIgnored(final EAttribute attribute) {
+ boolean shouldBeIgnored = super.shouldBeIgnored(attribute);
+ return shouldBeIgnored || this.checker.shouldBeIgnored(attribute);
+ }
+
+ /**
+ * return <code>true</code> if the attribute should be ignored in this context
+ *
+ * @param attribute
+ * an attribute
+ * @param context
+ * the context of this attribute
+ * @return
+ */
+ protected boolean shouldBeIgnored(final EAttribute attribute, final EObject context) {
+ return this.checker.shouldBeIgnored(attribute, context);
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.diff.engine.check.AttributesCheck#checkAttributesUpdates(org.eclipse.emf.compare.diff.metamodel.DiffGroup, org.eclipse.emf.compare.match.metamodel.Match2Elements)
+ *
+ * @param root
+ * @param mapping
+ * @throws FactoryException
+ */
+ @Override
+ public void checkAttributesUpdates(DiffGroup root, Match2Elements mapping) throws FactoryException {
+ final EClass eClass = mapping.getLeftElement().eClass();
+
+ final List<EAttribute> eclassAttributes = eClass.getEAllAttributes();
+ // for each feature, compare the value
+ final Iterator<EAttribute> it = eclassAttributes.iterator();
+ while(it.hasNext()) {
+ final EAttribute next = it.next();
+ if(!shouldBeIgnored(next) && !shouldBeIgnored(next, mapping.getLeftElement())) {
+ checkAttributeUpdates(root, mapping, next);
+ }
+ }
+ }
+
+ /**
+ * This will iterate through all the attributes of the <code>mapping</code>'s three elements to check if
+ * any of them has been modified.
+ *
+ * @param root
+ * {@link DiffGroup root} of the {@link DiffElement} to create if one of the attribute has
+ * actually been changed.
+ * @param mapping
+ * This contains the mapping information about the elements we need to check for a move.
+ * @throws FactoryException
+ * Thrown if one of the checks fails.
+ */
+ public void checkAttributesUpdates(DiffGroup root, Match3Elements mapping) throws FactoryException {
+ // Ignores matchElements when they don't have origin (no updates on
+ // these)
+ if(mapping.getOriginElement() == null)
+ return;
+ final EClass eClass = mapping.getOriginElement().eClass();
+
+ final List<EAttribute> eclassAttributes = eClass.getEAllAttributes();
+ // for each feature, compare the value
+ final Iterator<EAttribute> it = eclassAttributes.iterator();
+ while(it.hasNext()) {
+ final EAttribute next = it.next();
+ if(!shouldBeIgnored(next) && !shouldBeIgnored(next, mapping.getOriginElement())) {
+ checkAttributeUpdates(root, mapping, next);
+ }
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/PapyrusReferencesCheck.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/PapyrusReferencesCheck.java new file mode 100644 index 00000000000..226b2b7b52a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/check/PapyrusReferencesCheck.java @@ -0,0 +1,147 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.check;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.diff.engine.IMatchManager;
+import org.eclipse.emf.compare.diff.engine.check.ReferencesCheck;
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.compare.match.metamodel.Match2Elements;
+import org.eclipse.emf.compare.match.metamodel.Match3Elements;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+
+/**
+ *
+ * This reference checker allows to ignore differences on features for the comparison
+ *
+ */
+public class PapyrusReferencesCheck extends ReferencesCheck {
+
+ /**
+ * the checker used to take in account the ignored features for the Diff
+ */
+ private final FeaturesCheck checker;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param matchManager
+ * @param checker
+ * the checker used to take in account the ignored features for the Diff
+ */
+ public PapyrusReferencesCheck(final IMatchManager matchManager, final FeaturesCheck checker) {
+ super(matchManager);
+ this.checker = checker;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.diff.engine.check.ReferencesCheck#shouldBeIgnored(org.eclipse.emf.ecore.EReference)
+ *
+ * @param reference
+ * @return
+ */
+ @Override
+ protected boolean shouldBeIgnored(final EReference reference) {
+ boolean shouldBeIgnored = super.shouldBeIgnored(reference);
+ return shouldBeIgnored || this.checker.shouldBeIgnored(reference);
+ }
+
+ /**
+ * return <code>true</code> if the attribute should be ignored in this context
+ *
+ * @param reference
+ * a reference
+ * @param context
+ * the context of this reference
+ * @return
+ */
+ protected boolean shouldBeIgnored(final EReference reference, final EObject context) {
+ return this.checker.shouldBeIgnored(reference, context);
+ }
+
+ /**
+ * Checks if there's been references updates in the model.<br/>
+ * <p>
+ * A reference is considered updated if its value(s) has been changed (either removal or addition of an element if the reference is multi-valued
+ * or update of a single-valued reference) between the left and the right model.
+ * </p>
+ *
+ * @param root
+ * {@link DiffGroup root} of the {@link DiffElement} to create.
+ * @param mapping
+ * Contains informations about the left and right model elements we have to compare.
+ * @throws FactoryException
+ * Thrown if we cannot fetch the references' values.
+ */
+ public void checkReferencesUpdates(DiffGroup root, Match2Elements mapping) throws FactoryException {
+ final EClass eClass = mapping.getLeftElement().eClass();
+ final List<EReference> eclassReferences = eClass.getEAllReferences();
+
+ final Iterator<EReference> it = eclassReferences.iterator();
+ while(it.hasNext()) {
+ final EReference next = it.next();
+ if(!shouldBeIgnored(next, mapping.getLeftElement())) {
+ if(!shouldBeIgnored(next)) {
+ checkReferenceUpdates(root, mapping, next);
+ } else if(next.isContainment() && next.isOrdered()) {
+ checkContainmentReferenceOrderChange(root, mapping, next);
+ }
+ }
+ }
+ }
+
+ /**
+ * Checks if there's been references updates in the model.<br/>
+ * <p>
+ * A reference is considered updated if its value(s) has been changed (either removal or addition of an element if the reference is multi-valued
+ * or update of a single-valued reference) between the left and the ancestor model, the right and the ancestor or between the left and the right
+ * model.
+ * </p>
+ *
+ * @param root
+ * {@link DiffGroup root} of the {@link DiffElement} to create.
+ * @param mapping
+ * Contains informations about the left, right and origin model elements we have to compare.
+ * @throws FactoryException
+ * Thrown if we cannot fetch the references' values.
+ */
+ public void checkReferencesUpdates(DiffGroup root, Match3Elements mapping) throws FactoryException {
+ // Ignores matchElements when they don't have origin (no updates on these)
+ if(mapping.getOriginElement() == null)
+ return;
+ final EClass eClass = mapping.getOriginElement().eClass();
+ final List<EReference> eclassReferences = eClass.getEAllReferences();
+
+ final Iterator<EReference> it = eclassReferences.iterator();
+ while(it.hasNext()) {
+ final EReference next = it.next();
+ if(!shouldBeIgnored(next, mapping.getLeftElement())) {
+ if(!shouldBeIgnored(next)) {
+ checkReferenceUpdates(root, mapping, next);
+ } else if(next.isContainment() && next.isOrdered()) {
+ checkContainmentReferenceOrderChange(root, mapping, next);
+ }
+ }
+ }
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/AbstractFireMergeCommand.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/AbstractFireMergeCommand.java new file mode 100644 index 00000000000..e6fea11c30a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/AbstractFireMergeCommand.java @@ -0,0 +1,76 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.command;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.compare.diff.merge.IMergeListener;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+
+
+public abstract class AbstractFireMergeCommand extends AbstractCommand {
+
+ /**
+ * the list of the listeners
+ */
+ private final List<IMergeListener> listeners;
+
+ /**
+ * a list of the diff element
+ */
+ private final List<DiffElement> diffs;
+
+ private final DiffElement diffElement;
+
+ public AbstractFireMergeCommand(final DiffElement diffElement, final List<IMergeListener> listeners) {
+ this.diffElement = diffElement;
+ this.diffs = Collections.emptyList();
+ this.listeners = new ArrayList<IMergeListener>(listeners);
+ }
+
+ public AbstractFireMergeCommand(final List<DiffElement> diffs, final List<IMergeListener> listeners) {
+ this.diffElement = null;
+ this.diffs = new ArrayList<DiffElement>(diffs);
+ this.listeners = new ArrayList<IMergeListener>(listeners);
+ }
+
+ public boolean canRedo() {
+ return canExecute();
+ }
+
+ public List<IMergeListener> getMergeListeners() {
+ return Collections.unmodifiableList(listeners);
+ }
+
+ public List<DiffElement> getDiffElementsList() {
+ return Collections.unmodifiableList(this.diffs);
+ }
+
+ public DiffElement getDiffElement() {
+ return this.diffElement;
+ }
+
+ @Override
+ protected boolean prepare() {
+ return true;
+ }
+
+ public void redo() {
+ execute();
+
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/CopyXMIIDCommand.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/CopyXMIIDCommand.java new file mode 100644 index 00000000000..ca2070468a5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/CopyXMIIDCommand.java @@ -0,0 +1,111 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.command;
+
+import org.eclipse.emf.common.command.AbstractCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+
+/**
+ *
+ * This command allows to copy the XMI_ID from one EObject to another one, only if they are not owned by the same resource
+ *
+ */
+//TODO should be moved in infra.emf plugin when the problem of the saùme resource will be corrected in Papyrus
+public class CopyXMIIDCommand extends AbstractCommand {
+
+ /**
+ * the EObject which provides the XMI_ID
+ */
+ private final EObject source;
+
+ /**
+ * the EObject which receive the XMI_ID
+ */
+ private final EObject target;
+
+ /**
+ * the initial XMI_ID of the target
+ */
+ private String initialID;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param source
+ * the EObject which provides the XMI_ID
+ * @param target
+ * the EObject which receive the XMI_ID
+ */
+ public CopyXMIIDCommand(final EObject source, final EObject target) {
+ this.source = source;
+ this.target = target;
+ this.initialID = null;
+ setLabel("Copy XMI_ID command"); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.Command#execute()
+ *
+ */
+ public void execute() {
+ final Resource sourceResource = source.eResource();
+ final Resource targetResource = target.eResource();
+ if(sourceResource instanceof XMIResource && targetResource instanceof XMIResource) {
+ if(sourceResource != targetResource) {//see bug 377189: [Nested UML Compare] the merged elements have the same XMI ID
+ final String xmi_id = EMFHelper.getXMIID(this.source);
+ this.initialID = EMFHelper.getXMIID(target);
+ ((XMIResource)this.target.eResource()).setID(this.target, xmi_id);
+ }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.Command#redo()
+ *
+ */
+ public void redo() {
+ execute();
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#prepare()
+ *
+ * @return
+ */
+ @Override
+ protected boolean prepare() {
+ return true;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.common.command.AbstractCommand#undo()
+ *
+ */
+ @Override
+ public void undo() {
+ final Resource targetResource = target.eResource();
+ if(targetResource instanceof XMIResource) {
+ ((XMIResource)this.target.eResource()).setID(this.target, this.initialID);
+ }
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeDiffEndCommand.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeDiffEndCommand.java new file mode 100644 index 00000000000..8f69d5dc751 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeDiffEndCommand.java @@ -0,0 +1,43 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.command;
+
+import java.util.List;
+
+import org.eclipse.emf.compare.diff.merge.IMergeListener;
+import org.eclipse.emf.compare.diff.merge.MergeEvent;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+
+
+public class FireMergeDiffEndCommand extends AbstractFireMergeCommand {
+
+ public FireMergeDiffEndCommand(final DiffElement diffElement, final List<IMergeListener> listeners) {
+ super(diffElement, listeners);
+ }
+
+ public void execute() {
+ List<IMergeListener> listeners = getMergeListeners();
+ if(getDiffElement() != null) {
+ for(IMergeListener current : listeners) {
+ current.mergeDiffStart(new MergeEvent(getDiffElement()));
+ }
+
+ }
+ }
+
+ @Override
+ public void undo() {
+ //TODO?
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeDiffStartCommand.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeDiffStartCommand.java new file mode 100644 index 00000000000..cbbf8bdc1f1 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeDiffStartCommand.java @@ -0,0 +1,43 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.command;
+
+import java.util.List;
+
+import org.eclipse.emf.compare.diff.merge.IMergeListener;
+import org.eclipse.emf.compare.diff.merge.MergeEvent;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+
+
+public class FireMergeDiffStartCommand extends AbstractFireMergeCommand {
+
+ public FireMergeDiffStartCommand(final DiffElement diffElement, final List<IMergeListener> listeners) {
+ super(diffElement, listeners);
+ }
+
+ public void execute() {
+ List<IMergeListener> listeners = getMergeListeners();
+ if(getDiffElement() != null) {
+ for(IMergeListener current : listeners) {
+ current.mergeDiffEnd(new MergeEvent(getDiffElement()));
+ }
+
+ }
+ }
+
+ @Override
+ public void undo() {
+ //TODO?
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeOperationEndCommand.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeOperationEndCommand.java new file mode 100644 index 00000000000..62efe3df121 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeOperationEndCommand.java @@ -0,0 +1,52 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.command;
+
+import java.util.List;
+
+import org.eclipse.emf.compare.diff.merge.IMergeListener;
+import org.eclipse.emf.compare.diff.merge.MergeEvent;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+
+
+public class FireMergeOperationEndCommand extends AbstractFireMergeCommand {
+
+ public FireMergeOperationEndCommand(final DiffElement diffElement, final List<IMergeListener> listeners) {
+ super(diffElement, listeners);
+ }
+
+ public FireMergeOperationEndCommand(final List<DiffElement> diffs, final List<IMergeListener> listeners) {
+ super(diffs, listeners);
+ }
+
+ public void execute() {
+ List<IMergeListener> listeners = getMergeListeners();
+ if(!getDiffElementsList().isEmpty()) {
+ for(IMergeListener current : listeners) {
+ current.mergeOperationEnd(new MergeEvent(getDiffElementsList()));
+ }
+ }
+ if(getDiffElement() != null) {
+ for(IMergeListener current : listeners) {
+ current.mergeOperationEnd(new MergeEvent(getDiffElement()));
+ }
+
+ }
+ }
+
+ @Override
+ public void undo() {
+ //TODO?
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeOperationStartCommand.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeOperationStartCommand.java new file mode 100644 index 00000000000..76f611bc7a7 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/FireMergeOperationStartCommand.java @@ -0,0 +1,52 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.command;
+
+import java.util.List;
+
+import org.eclipse.emf.compare.diff.merge.IMergeListener;
+import org.eclipse.emf.compare.diff.merge.MergeEvent;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+
+
+public class FireMergeOperationStartCommand extends AbstractFireMergeCommand {
+
+ public FireMergeOperationStartCommand(final DiffElement diffElement, final List<IMergeListener> listeners) {
+ super(diffElement, listeners);
+ }
+
+ public FireMergeOperationStartCommand(final List<DiffElement> diffs, final List<IMergeListener> listeners) {
+ super(diffs, listeners);
+ }
+
+ public void execute() {
+ List<IMergeListener> listeners = getMergeListeners();
+ if(!getDiffElementsList().isEmpty()) {
+ for(IMergeListener current : listeners) {
+ current.mergeOperationStart(new MergeEvent(getDiffElementsList()));
+ }
+ }
+ if(getDiffElement() != null) {
+ for(IMergeListener current : listeners) {
+ current.mergeOperationStart(new MergeEvent(getDiffElement()));
+ }
+
+ }
+ }
+
+ @Override
+ public void undo() {
+ //TODO?
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/MoveWithIndexCommand.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/MoveWithIndexCommand.java new file mode 100644 index 00000000000..1150ea6df39 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/MoveWithIndexCommand.java @@ -0,0 +1,257 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.command;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand;
+import org.eclipse.gmf.runtime.emf.type.core.internal.l10n.EMFTypeCoreMessages;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+
+//TODO move this class and create it in the service edit
+//TODO : breaks this class into 2 classes : 1 for the move and another one for the reorder?
+public class MoveWithIndexCommand extends MoveElementsCommand {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param request
+ */
+ public MoveWithIndexCommand(final MoveRequest request) {
+ super(request);
+ }
+
+ /**
+ *
+ * @see org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.core.runtime.IAdaptable)
+ *
+ * @param monitor
+ * @param info
+ * @return
+ * @throws ExecutionException
+ */
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final int index = getIndex();
+ if(index != -1) {
+ for(Iterator<?> i = getElementsToMove().keySet().iterator(); i.hasNext();) {
+ final EObject element = (EObject)i.next();
+ final EReference feature = getTargetFeature(element);
+ if(feature != null) {
+ if(FeatureMapUtil.isMany(getTargetContainer(), feature)) {
+ if(shouldReorder()) {
+ //we attach the real position to the object
+ attachRealPositionEAdapter(element, index);
+ }
+ final Object value = getTargetContainer().eGet(feature);
+ if(value instanceof List<?>) {
+ final List<?> listValue = (List<?>)value;
+ final int indexMax = listValue.size() - 1;
+ if(indexMax < index) {
+ //we add the element at the end of the list
+ final List values = ((List<?>)getTargetContainer().eGet(feature));
+ values.add(element);
+ if(shouldReorder()) {
+ reorderList(values);
+ }
+ } else {
+ ((List)value).add(index, element);
+ if(shouldReorder()) {
+ reorderList((List)value);
+ }
+ }
+
+ } else {
+ ((Collection)getTargetContainer().eGet(feature)).add(element);
+ if(shouldReorder()) {
+ reorderList((List)((Collection)getTargetContainer().eGet(feature)));
+ }
+ }
+ } else {
+ getTargetContainer().eSet(feature, element);
+ }
+ } else {
+ return CommandResult.newErrorCommandResult(EMFTypeCoreMessages.moveElementsCommand_noTargetFeature);
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ @Override
+ public boolean canExecute() {
+ super.canExecute();
+ return true;
+ }
+
+ /**
+ *
+ * @return
+ * the index for the move command
+ */
+ protected int getIndex() {
+ IEditCommandRequest req = getRequest();
+ if(req instanceof MoveWithIndexRequest) {
+ return ((MoveWithIndexRequest)req).getIndex();
+ }
+ return -1;
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> when the list should be reorderded
+ */
+ protected boolean shouldReorder() {
+ final IEditCommandRequest req = getRequest();
+ boolean shouldReoder = false;
+ if(req instanceof MoveWithIndexRequest) {
+ shouldReoder = ((MoveWithIndexRequest)req).shouldReoder();
+ }
+ return shouldReoder;
+ }
+
+ /**
+ * Duplicate code from EFactory
+ * If we could not merge a given object at its expected position in a list, we'll attach an Adapter to it
+ * in order to "remember" that "expected" position. That will allow us to reorder the list later on if
+ * need be.
+ *
+ * @param object
+ * The object on which to attach an Adapter.
+ * @param expectedPosition
+ * The expected position of <code>object</code> in its list.
+ */
+ private void attachRealPositionEAdapter(final Object object, final int expectedPosition) {
+ if(object instanceof EObject) {
+ ((EObject)object).eAdapters().add(new PositionAdapter(expectedPosition));
+ }
+ }
+
+ /**
+ * Reorders the given list if it contains EObjects associated with a PositionAdapter which are not located
+ * at their expected positions.
+ *
+ * @param list
+ * The list that is to be reordered.
+ * @param <T>
+ * type of the list's elements.
+ */
+ private <T> void reorderList(final List<T> list) {
+ List<T> newList = new ArrayList<T>(list);
+ Collections.sort(newList, new EObjectComparator());
+ for(int i = 0; i < list.size(); i++) {
+ int oldIndex = list.indexOf(newList.get(i));
+ list.add(i, list.remove(oldIndex));
+ }
+ return;
+ }
+
+ /**
+ * duplicate code from Efactory
+ * This adapter will be used to remember the accurate position of an EObject in its target list.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+ private static class PositionAdapter extends AdapterImpl {
+
+ /** The index at which we expect to find this object. */
+ private final int expectedIndex;
+
+ /**
+ * Creates our adapter.
+ *
+ * @param index
+ * The index at which we expect to find this object.
+ */
+ public PositionAdapter(final int index) {
+ this.expectedIndex = index;
+ }
+
+ /**
+ * Returns the index at which we expect to find this object.
+ *
+ * @return The index at which we expect to find this object.
+ */
+ public int getExpectedIndex() {
+ return expectedIndex;
+ }
+ }
+
+ /**
+ *
+ * This class allows to compare EObject using the PositionAdapter.
+ *
+ *
+ */
+ private static class EObjectComparator<T> implements Comparator<T> {
+
+ /**
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ public int compare(final T o1, final T o2) {
+ if(o1 instanceof EObject && o2 instanceof EObject) {
+ final int position1 = getWantedPosition((EObject)o1);
+ final int position2 = getWantedPosition((EObject)o2);
+ if(position1 != -1 && position2 != -1) {
+ return position1 - position2;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @param obj1
+ * an EObject
+ * @return
+ * the wanted position for this object
+ */
+ private int getWantedPosition(final EObject obj1) {
+ final Iterator<Adapter> adapters = obj1.eAdapters().iterator();
+ int expectedIndex = -1;
+ while(expectedIndex == -1 && adapters.hasNext()) {
+ final Adapter adapter = adapters.next();
+ if(adapter instanceof PositionAdapter) {
+ expectedIndex = ((PositionAdapter)adapter).getExpectedIndex();
+ }
+ }
+ return expectedIndex;
+ }
+
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/MoveWithIndexRequest.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/MoveWithIndexRequest.java new file mode 100644 index 00000000000..64abe2dc988 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/MoveWithIndexRequest.java @@ -0,0 +1,56 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.command;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+
+//TODO : move this class
+/**
+ *
+ * Created for EMF-Compare, for MoveModelElementMerger
+ *
+ *
+ */
+public class MoveWithIndexRequest extends MoveRequest {
+
+ /**
+ * the wanted index for the moved element
+ */
+ private final int index;
+
+ /**
+ * indicates if the list should be reordered after the move
+ */
+ private final boolean reorder;
+
+ //TODO : and the other constructor?
+ public MoveWithIndexRequest(final TransactionalEditingDomain editingDomain, final EObject targetContainer, final EReference targetFeature, final EObject elementToMove, final int index, final boolean reorder) {
+ super(editingDomain, targetContainer, targetFeature, elementToMove);
+ this.index = index;
+ this.reorder = reorder;
+ }
+
+
+ public int getIndex() {
+ return this.index;
+ }
+
+ public boolean shouldReoder() {
+ return this.reorder;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/PapyrusMergeCommandProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/PapyrusMergeCommandProvider.java new file mode 100644 index 00000000000..b0260226a9f --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/command/PapyrusMergeCommandProvider.java @@ -0,0 +1,78 @@ +/*****************************************************************************
+ * 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.diff.internal.command;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+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.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+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;
+
+//TODO : try to merge with the PapyrusTableCommandFactory?
+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);
+ }
+
+ //TODO elementToEdit and targetContainer are the same
+ public Command getMoveCommand(final TransactionalEditingDomain domain, final EObject elementToEdit, final EObject targetContainer, final EReference targetFeature, final EObject elementToMove) {
+ final IEditCommandRequest request = new MoveRequest(domain, targetContainer, targetFeature, elementToMove);
+ return getCommand(elementToEdit, request);
+ }
+
+ public Command getCommand(final EObject elementToEdit, final IEditCommandRequest request) {
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToEdit);
+ if(request instanceof MoveWithIndexRequest) {//TODO remove this test when the move with index will be in the service edit
+ return new GMFtoEMFCommandWrapper(new MoveWithIndexCommand((MoveRequest)request));
+ }
+ if(provider != null) {
+ return new GMFtoEMFCommandWrapper(provider.getEditCommand(request));
+ }
+ return null;
+ }
+
+ public Command getDestroyReferenceCommand(final TransactionalEditingDomain editingDomain, final EObject container, final EReference containingFeature, final EObject referencedObject, final boolean confirmationRequired) {
+ final IEditCommandRequest request = new DestroyReferenceRequest(editingDomain, container, containingFeature, referencedObject, confirmationRequired);
+ return getCommand(container, request);
+ }
+
+ 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);
+ }
+
+
+ //TODO elementToEdit and targetContainer are the same
+ public Command getMoveWithIndexCommand(final TransactionalEditingDomain domain, final EObject elementToEdit, final EObject targetContainer, final EReference targetFeature, final EObject elementToMove, final int index, final boolean reorder) {
+ final IEditCommandRequest request = new MoveWithIndexRequest(domain, targetContainer, targetFeature, elementToMove, index, reorder);
+ return getCommand(elementToEdit, request);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AbstractDefaultMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AbstractDefaultMerger.java new file mode 100644 index 00000000000..b35b092fa0a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AbstractDefaultMerger.java @@ -0,0 +1,29 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import org.eclipse.emf.compare.diff.merge.IMerger;
+
+
+public abstract class AbstractDefaultMerger implements IMerger {
+
+ final public void applyInOrigin() {
+ throw new UnsupportedOperationException("This method is not available in a Transactional Compare Editor");
+ }
+
+ final public void undoInTarget() {
+ throw new UnsupportedOperationException("This method is not available in a Transactional Compare Editor");
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeChangeLeftTargetTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeChangeLeftTargetTransactionalMerger.java new file mode 100644 index 00000000000..377b95f0a25 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeChangeLeftTargetTransactionalMerger.java @@ -0,0 +1,125 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.List;
+
+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.metamodel.AttributeChangeLeftTarget;
+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.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusEFactory;
+
+/**
+ *
+ * Transactional version of the class {@link AttributeChangeLeftTargetMerger}
+ *
+ */
+public class AttributeChangeLeftTargetTransactionalMerger extends DefaultTransactionalMerger {
+
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link AttributeChangeLeftTargetMerger}
+ // *
+ // * {@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);
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link AttributeChangeLeftTargetMerger} {@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);
+ // }
+ // }
+
+
+
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ final AttributeChangeLeftTarget theDiff = (AttributeChangeLeftTarget)this.diff;
+ final EObject origin = theDiff.getLeftElement();
+ final Object value = theDiff.getLeftTarget();
+ final EAttribute attr = theDiff.getAttribute();
+ try {
+ cmd = PapyrusEFactory.getERemoveCommand(domain, origin, attr.getName(), value);
+ } catch (FactoryException e) {
+ EMFComparePlugin.log(e, true);
+ }
+ return cmd;
+ }
+
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ 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);
+ }
+ }
+ cmd = PapyrusEFactory.getEAddCommand(domain, target, attr.getName(), value, valueIndex);
+ } catch (FactoryException e) {
+ Activator.log.error(e);
+ }
+ return cmd;
+
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeChangeRightTargetTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeChangeRightTargetTransactionalMerger.java new file mode 100644 index 00000000000..32501ba0853 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeChangeRightTargetTransactionalMerger.java @@ -0,0 +1,117 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.diff.metamodel.AttributeChangeRightTarget;
+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.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusEFactory;
+
+/**
+ *
+ * Transactional version of the class {@link AttributeChangeRightTargetMerger}
+ *
+ */
+public class AttributeChangeRightTargetTransactionalMerger extends DefaultTransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link AttributeChangeRightTargetMerger} {@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);
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link AttributeChangeRightTargetMerger}
+ // *
+ // * {@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);
+ // }
+ // }
+
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ 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);
+ }
+ }
+ cmd = PapyrusEFactory.getEAddCommand(domain, origin, attr.getName(), value, valueIndex);
+ } catch (FactoryException e) {
+ Activator.log.error(e);
+ }
+ return cmd;
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ final AttributeChangeRightTarget theDiff = (AttributeChangeRightTarget)this.diff;
+ final EObject target = theDiff.getRightElement();
+ final Object value = theDiff.getRightTarget();
+ final EAttribute attr = theDiff.getAttribute();
+ try {
+ cmd = PapyrusEFactory.getERemoveCommand(domain, target, attr.getName(), value);
+ } catch (FactoryException e) {
+ Activator.log.error(e);
+ }
+ return cmd;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeOrderChangeTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeOrderChangeTransactionalMerger.java new file mode 100644 index 00000000000..51eeb52bb4b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/AttributeOrderChangeTransactionalMerger.java @@ -0,0 +1,300 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.compare.diff.internal.merge.impl.AttributeOrderChangeMerger;
+import org.eclipse.emf.compare.diff.metamodel.AttributeOrderChange;
+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.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+import org.eclipse.papyrus.infra.tools.util.ReflectHelper;
+
+/**
+ *
+ * Transactional version of the class {@link AttributeOrderChangeMerger}
+ *
+ */
+public class AttributeOrderChangeTransactionalMerger extends DefaultTransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link AttributeOrderChangeMerger} {@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);
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link AttributeOrderChangeMerger} {@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);
+ // }
+
+
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ 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);
+ return PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, leftElement, attribute, result);
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ 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);
+ return PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, rightElement, attribute, result);
+ }
+
+
+ /**
+ * This method uses the reflexive way to call the static method of the super class
+ *
+ * @param left
+ * the left object
+ * @param right
+ * the right object
+ * @return
+ * <code>true</code> if the 2 objects are dictinct.
+ */
+ //TODO write a JUnit test to be sure that this methods is always accessible
+ protected boolean areDistinctValues(final Object left, final Object right) {
+
+ final Class<?>[] parameterTypes = new Class[2];
+ parameterTypes[0] = java.lang.Object.class;
+ parameterTypes[1] = java.lang.Object.class;
+ Method m = null;
+ try {
+ m = ReflectHelper.getMethod(AttributeOrderChangeMerger.class, "areDistinctValues", parameterTypes); //$NON-NLS-1$
+ } catch (SecurityException e) {
+ Activator.log.error(e);
+ } catch (NoSuchMethodException e) {
+ Activator.log.error(e);
+ }
+
+ Object[] parameters = new Object[2];
+ parameters[0] = left;
+ parameters[1] = right;
+
+ Object result = null;
+ try {
+ result = m.invoke(AttributeOrderChangeMerger.class, parameters);
+ } catch (IllegalArgumentException e) {
+ Activator.log.error(e);
+ } catch (IllegalAccessException e) {
+ Activator.log.error(e);
+ } catch (InvocationTargetException e) {
+ Activator.log.error(e);
+ }
+ assert (result instanceof Boolean);
+ return ((Boolean)result).booleanValue();
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DefaultExtensionTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DefaultExtensionTransactionalMerger.java new file mode 100644 index 00000000000..5cc9046a09d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DefaultExtensionTransactionalMerger.java @@ -0,0 +1,81 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ * Adapted code from EMF-Compare
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.IdentityCommand;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+
+public class DefaultExtensionTransactionalMerger extends DefaultTransactionalMerger {
+
+ public Command getDoApplyInOriginCommand(TransactionalEditingDomain domain) {
+ return IdentityCommand.INSTANCE;
+ }
+
+ public Command getDoUndoInTargetCommand(TransactionalEditingDomain domain) {
+ return IdentityCommand.INSTANCE;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.DefaultMerger#getDependencies(boolean)
+ */
+ @Override
+ protected List<DiffElement> getDependencies(boolean applyInOrigin) {
+ final List<DiffElement> requiredDiffs = diff.getRequires();
+ return getBusinessDependencies(applyInOrigin, requiredDiffs);
+ }
+
+ /**
+ * Get the difference dependencies to consider in the context of the merge process.
+ *
+ * @param applyInOrigin
+ * Direction of merge.
+ * @param requiredDiffs
+ * The required differences.
+ * @return The required differences to keep.
+ */
+ protected List<DiffElement> getBusinessDependencies(boolean applyInOrigin, List<DiffElement> requiredDiffs) {
+ final List<DiffElement> result = new ArrayList<DiffElement>();
+ for (DiffElement diffElement : requiredDiffs) {
+ if (!(diffElement instanceof AbstractDiffExtension)
+ || diffElement instanceof AbstractDiffExtension
+ && isBusinessDependency(applyInOrigin, (AbstractDiffExtension)diffElement)) {
+ result.add(diffElement);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Check if the given required difference extension has to be considered in relation to the direction of
+ * merge.
+ *
+ * @param applyInOrigin
+ * Direction of merge.
+ * @param requiredDiff
+ * The required difference.
+ * @return True if it has to be considered in the merge.
+ */
+ protected boolean isBusinessDependency(boolean applyInOrigin, final AbstractDiffExtension requiredDiff) {
+ return true;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DefaultTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DefaultTransactionalMerger.java new file mode 100644 index 00000000000..52eaf63e37b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DefaultTransactionalMerger.java @@ -0,0 +1,724 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+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.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.IdentityCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.diff.merge.EMFCompareEObjectCopier;
+import org.eclipse.emf.compare.diff.merge.IMergeListener;
+import org.eclipse.emf.compare.diff.merge.IMerger;
+import org.eclipse.emf.compare.diff.merge.MergeEvent;
+import org.eclipse.emf.compare.diff.merge.service.MergeFactory;
+import org.eclipse.emf.compare.diff.merge.service.MergeService;
+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.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeLeftTarget;
+import org.eclipse.emf.compare.diff.metamodel.ModelElementChangeRightTarget;
+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.UpdateReference;
+import org.eclipse.emf.compare.util.ClassUtils;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EGenericType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.CopyWithReferenceCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.merge.ITransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeFactory;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeService;
+import org.eclipse.papyrus.infra.emf.compare.diff.utils.PapyrusCompareOptionsUtils;
+import org.eclipse.papyrus.infra.emf.compare.diff.utils.PapyrusOptionsAdapter;
+
+/**
+ *
+ * should replace DefaultMerger
+ *
+ */
+//TODO can we remove IMerger?
+public class DefaultTransactionalMerger extends AbstractDefaultMerger implements ITransactionalMerger {
+
+ //---------------------These methods comes from ITransactionalMerger
+ public Command getApplyInOriginCommand(TransactionalEditingDomain domain, Collection<DiffElement> alreadyManaged) {
+ final PapyrusOptionsAdapter adapter = PapyrusCompareOptionsUtils.getPapyrusOptionsAdapter(diff);
+ //cf bug 396267: [UML Compare] it is not possible to merge a difference on a stereotype property
+ //final CompoundCommand cmd = new CompoundCommand(NLS.bind("Apply in Origin Command for {0}", this.diff)); //$NON-NLS-1$
+ final CompoundCommand cmd = new CompoundCommand(NLS.bind("Apply in Origin Command for {0}", this.diff.getClass())); //$NON-NLS-1$
+ if(adapter==null || adapter.canApplyInOrigin()) {
+ cmd.append(getMergeRequiredDifferencesCommand(domain, true, alreadyManaged));
+ cmd.append(getDoApplyInOriginCommand(domain));
+ cmd.append(getPostProcessCommand(domain));
+ } else {
+ cmd.append(UnexecutableCommand.INSTANCE);
+ }
+ return cmd;
+ }
+
+ public Command getUndoInTargetCommand(TransactionalEditingDomain domain, Collection<DiffElement> alreadyManaged) {
+ final PapyrusOptionsAdapter adapter = PapyrusCompareOptionsUtils.getPapyrusOptionsAdapter(diff);
+ //cf bug 396267: [UML Compare] it is not possible to merge a difference on a stereotype property
+ //final CompoundCommand cmd = new CompoundCommand(NLS.bind("Undo in Target Command for {0}", this.diff)); //$NON-NLS-1$
+ final CompoundCommand cmd = new CompoundCommand(NLS.bind("Undo in Target Command for {0}", this.diff.getClass())); //$NON-NLS-1$
+ if(adapter == null || adapter.canUndoInTarget()) {
+ cmd.append(getMergeRequiredDifferencesCommand(domain, false, alreadyManaged));
+ cmd.append(getDoUndoInTargetCommand(domain));
+ cmd.append(getPostProcessCommand(domain));
+ } else {
+ cmd.append(UnexecutableCommand.INSTANCE);
+ }
+ return cmd;
+ }
+
+ public Command getDoApplyInOriginCommand(TransactionalEditingDomain domain) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ public Command getDoUndoInTargetCommand(TransactionalEditingDomain domain) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ public Command getMergeRequiredDifferencesCommand(TransactionalEditingDomain domain, boolean applyInOrigin, Collection<DiffElement> alreadyManaged) {
+ CompoundCommand cmd = new CompoundCommand("Merge required differences"); //$NON-NLS-1$
+ // if(mergedDiffs == null) { //we need to clean it, to avoid that the command creation duplicate elements in this list
+ mergedDiffs = new ArrayList<DiffElement>();
+ if(mergedDiffslistener == null) {
+ //TODO : improve that, and use command!
+ mergedDiffslistener = new MergedDiffsListener();
+ TransactionalMergeService.addMergeListener(mergedDiffslistener);
+ }
+ // }
+ mergedDiffs.add(diff);
+
+ for(DiffElement requiredDiff : getDependencies(applyInOrigin)) {
+ if(requiredDiff.eContainer() != null && !alreadyManaged.contains(requiredDiff)) {
+ final ITransactionalMerger merger = TransactionalMergeFactory.createMerger(requiredDiff);
+ alreadyManaged.add(requiredDiff);
+ if(applyInOrigin) {
+ cmd.append(((ITransactionalMerger)merger).getApplyInOriginCommand(domain, alreadyManaged));
+ } else {
+ cmd.append(((ITransactionalMerger)merger).getUndoInTargetCommand(domain, alreadyManaged));
+ }
+ }
+ }
+ if(cmd.isEmpty()) {
+ return IdentityCommand.INSTANCE;
+ }
+ return cmd;
+ }
+
+ public Command getPostProcessCommand(TransactionalEditingDomain domain) {
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ handleMutuallyDerivedReferences();
+ //ensureXMIIDCopied();
+ if(getDiffModel() != null) {//383515: [UML Compare] NPE with ReferenceChangeRightTarget leftToRight and ReferenceChangeLeftTarget rightToLeft
+ final EMFCompareEObjectCopier copier = TransactionalMergeService.getCopier(diff);
+ copier.copyXMIIDs();
+ }
+ removeFromContainer(diff);
+ return null;
+ }
+ });
+ }
+
+ //TODO move it in an upper class
+ protected static TransactionalEditingDomain getTransactionalEditingDomain(final DiffElement diff) {
+ DiffElement diffElement = diff;
+ final Iterator<EObject> iter = diff.eAllContents();
+ while(iter.hasNext()) {
+ final EObject current = iter.next();
+ if(current instanceof DiffElement && !(current instanceof DiffGroup)) {
+ diffElement = (DiffElement)current;
+ break;
+ }
+ }
+ //we try to get the EditingDomain using the left object AND the rightObject,
+ //because in some case it should be interesting to do a comparison between an object contained by a resource
+ //and an other object no contained by a resource
+ EObject element = (EObject)ClassUtils.invokeMethod(diffElement, "getRightElement"); //$NON-NLS-1$
+ if(element == null) {
+ element = (EObject)ClassUtils.invokeMethod(diffElement, "getLeftElement"); //$NON-NLS-1$
+ }
+ TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(element);
+
+ if(domain == null) {
+ element = (EObject)ClassUtils.invokeMethod(diffElement, "getRightParent"); //$NON-NLS-1$
+ if(element == null) {
+ element = (EObject)ClassUtils.invokeMethod(diffElement, "getLeftParent"); //$NON-NLS-1$
+ }
+ domain = TransactionUtil.getEditingDomain(element);
+ }
+ assert domain!=null; //cf bug 396267: [UML Compare] it is not possible to merge a difference on a stereotype property
+// Assert.isNotNull(domain, NLS.bind("I didn't found the EditingDomain for {0}", diff)); //$NON-NLS-1$
+ return domain;
+
+ }
+
+ public boolean canApplyInOrigin() {
+ return getApplyInOriginCommand(getTransactionalEditingDomain(diff), new ArrayList<DiffElement>()).canExecute();
+ }
+
+
+ public boolean canUndoInTarget() {
+ return getUndoInTargetCommand(getTransactionalEditingDomain(diff), new ArrayList<DiffElement>()).canExecute();
+ }
+
+ //---------------------from Here to the end : duplicated and adapted code from DefaultMerger
+ /** The scheme used for all of EMF Compare's internal proxies. */
+ private static final String PROXY_SCHEME = "emfCompareProxy"; //$NON-NLS-1$
+
+ /** Stores the differences which are merged or being merged during a merge operation. */
+ private static List<DiffElement> mergedDiffs;
+
+ /** This listener will be used to reset the {@link mergedDiffs} list at the end of a merge operation. */
+ private static MergedDiffsListener mergedDiffslistener;
+
+ /** {@link DiffElement} to be merged by this merger. */
+ protected DiffElement diff;
+
+ /** Keeps a reference on the left resource for this merger. */
+ @Deprecated
+ protected Resource leftResource;
+
+ /** Keeps a reference on the right resource for this merger. */
+ @Deprecated
+ protected Resource rightResource;
+
+ /**
+ * Reset the {@link mergedDiffs} list.
+ *
+ * @since 1.3
+ */
+ protected static void resetMergedDiffs() {
+ mergedDiffs = null;
+ }
+
+ /**
+ * Returns <code>true</code> if the given URI is an internal EMF Compare proxy.
+ *
+ * @param uri
+ * The URI to check.
+ * @return <code>true</code> if the given URI is an internal EMF Compare proxy.
+ * @since 1.3
+ */
+ public static boolean isEMFCompareProxy(URI uri) {
+ return uri.scheme() != null && uri.scheme().equals(PROXY_SCHEME);
+ }
+
+ /**
+ * Checks whether the two given proxy URIs are equal, ignoring EMF Compare's internal {@link #PROXY_PREFIX}.
+ *
+ * @param uri1
+ * First of the two URIs to compare.
+ * @param uri2
+ * Second of the two URIs to compare.
+ * @return <code>true</code> if the two given URIs are equal.
+ *
+ * @since 1.3
+ */
+ public static boolean equalProxyURIs(URI uri1, URI uri2) {
+ String stringValue1 = uri1.toString();
+ String stringValue2 = uri2.toString();
+ if(isEMFCompareProxy(uri1)) {
+ stringValue1 = stringValue1.substring(PROXY_SCHEME.length() + 2);
+ }
+ if(isEMFCompareProxy(uri2)) {
+ stringValue2 = stringValue2.substring(PROXY_SCHEME.length() + 2);
+ }
+ return stringValue1.equals(stringValue2);
+ }
+
+ // /**
+ // * {@inheritDoc}
+ // *
+ // * @see org.eclipse.emf.compare.diff.merge.IMerger#applyInOrigin()
+ // */
+ // public void applyInOrigin() {
+ // mergeRequiredDifferences(true);
+ // doApplyInOrigin();
+ // postProcess();
+ // }
+ //
+ // /**
+ // * Applies the modification in the original (left) model.
+ // *
+ // * @since 1.3
+ // */
+ // protected void doApplyInOrigin() {
+ // // To specialize in child class.
+ // }
+ //
+ // /**
+ // * Applies a post processing.
+ // *
+ // * @since 1.3
+ // */
+ // protected void postProcess() {
+ // handleMutuallyDerivedReferences();
+ // ensureXMIIDCopied();
+ // removeFromContainer(diff);
+ // }
+
+ // /**
+ // * {@inheritDoc}
+ // *
+ // * @see org.eclipse.emf.compare.diff.merge.IMerger#canApplyInOrigin()
+ // */
+ // public boolean canApplyInOrigin() {
+ // return true;
+ // }
+ //
+ // /**
+ // * {@inheritDoc}
+ // *
+ // * @see org.eclipse.emf.compare.diff.merge.IMerger#canUndoInTarget()
+ // */
+ // public boolean canUndoInTarget() {
+ // return true;
+ // }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.IMerger#setDiffElement(org.eclipse.emf.compare.diff.metamodel.DiffElement)
+ */
+ public void setDiffElement(DiffElement element) {
+ diff = element;
+ }
+
+ // /**
+ // * {@inheritDoc}
+ // *
+ // * @see org.eclipse.emf.compare.diff.merge.IMerger#undoInTarget()
+ // */
+ // public void undoInTarget() {
+ // mergeRequiredDifferences(false);
+ // doUndoInTarget();
+ // postProcess();
+ // }
+ //
+ // /**
+ // * Cancels the modification in the target (right) model.
+ // *
+ // * @since 1.3
+ // */
+ // protected void doUndoInTarget() {
+ // // To specialize in child class.
+ // }
+
+ /**
+ * Removes the given {@link DiffGroup} from its container if it was its last child, also calls for the
+ * same cleanup operation on its hierarchy.
+ *
+ * @param diffGroup
+ * {@link DiffGroup} we want to cleanup.
+ */
+ protected void cleanDiffGroup(DiffGroup diffGroup) {
+ if(diffGroup != null && diffGroup.getSubDiffElements().size() == 0) {
+ final EObject parent = diffGroup.eContainer();
+ if(parent instanceof DiffGroup) {
+ EcoreUtil.remove(diffGroup);
+ cleanDiffGroup((DiffGroup)parent);
+ }
+ }
+ }
+
+ // /**
+ // * Creates a copy of the given EObject as would {@link EcoreUtil#copy(EObject)} would, except we use
+ // * specific handling for unmatched references.
+ // *
+ // * @param eObject
+ // * The object to copy.
+ // * @return the copied object.
+ // */
+ // protected EObject copy(EObject eObject) {
+ // final EMFCompareEObjectCopier copier = TransactionalMergeService.getCopier(diff);
+ // if(copier.containsKey(eObject)) {
+ // //385289: [UML Compare] Bad result after merginf UMLStereotypeApplicationAddition/Removal
+ // //in some case, the elements are copied and merged twice!
+ // return copier.get(eObject);
+ // }
+ // final EObject result = copier.copy(eObject);
+ // copier.copyReferences();
+ // copier.copyXMIIDs();
+ // return result;
+ // }
+
+ /**
+ *
+ * @param eObject
+ * the eobject copy
+ * @return
+ * the result of the command is the copiedObject
+ * the copied object is immediately available doing copyCommand.getCommandResult().getReturnValue();
+ */
+ protected AbstractTransactionalCommand getCopyWithReferenceCommand(final EObject eObject) {
+ return new CopyWithReferenceCommand(getTransactionalEditingDomain(diff), TransactionalMergeService.getCopier(diff), eObject);
+ }
+
+ /**
+ * This can be called after a merge operation to ensure that all objects created by the operation share
+ * the same XMI ID as their original.
+ * <p>
+ * Implemented because of bug 351591 : some of the objects we copy mays not have been added to a resource when we check their IDs. We thus need to
+ * wait till the merge operation has completed.
+ * </p>
+ *
+ * @since 1.3
+ */
+ protected void ensureXMIIDCopied() {
+ final EMFCompareEObjectCopier copier = TransactionalMergeService.getCopier(diff);
+ copier.copyXMIIDs();
+ }
+
+ /**
+ * Returns the {@link DiffModel} containing the {@link DiffElement} this merger is intended to merge.
+ *
+ * @return The {@link DiffModel} containing the {@link DiffElement} this merger is intended to merge.
+ */
+ protected DiffModel getDiffModel() {
+ EObject container = diff.eContainer();
+ while(container != null) {
+ if(container instanceof DiffModel)
+ return (DiffModel)container;
+ container = container.eContainer();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the XMI ID of the given {@link EObject} or <code>null</code> if it cannot be resolved.
+ *
+ * @param object
+ * Object which we seek the XMI ID of.
+ * @return <code>object</code>'s XMI ID, <code>null</code> if not applicable.
+ */
+ protected String getXMIID(EObject object) {
+ String objectID = null;
+ if(object != null && object.eResource() instanceof XMIResource) {
+ objectID = ((XMIResource)object.eResource()).getID(object);
+ }
+ return objectID;
+ }
+
+ /**
+ * Removes all references to the given {@link EObject} from the {@link DiffModel}.
+ *
+ * @param deletedObject
+ * Object to remove all references to.
+ */
+ protected void removeDanglingReferences(EObject deletedObject) {
+ // EObject root = EcoreUtil.getRootContainer(deletedObject);
+ // if (root instanceof ComparisonResourceSnapshot) {
+ // root = ((ComparisonResourceSnapshot)root).getDiff();
+ // }
+ // if (root != null) {
+ // // FIXME performance, find a way to cache this referencer
+ // final Resource res = root.eResource();
+ // final EcoreUtil.CrossReferencer referencer;
+ // if (res != null && res.getResourceSet() != null) {
+ // referencer = new EcoreUtil.CrossReferencer(res.getResourceSet()) {
+ // private static final long serialVersionUID = 616050158241084372L;
+ //
+ // // initializer for this anonymous class
+ // {
+ // crossReference();
+ // }
+ //
+ // @Override
+ // protected boolean crossReference(EObject eObject, EReference eReference,
+ // EObject crossReferencedEObject) {
+ // if (eReference.isChangeable() && !eReference.isDerived())
+ // return crossReferencedEObject.eResource() == null;
+ // return false;
+ // }
+ // };
+ // } else if (res != null) {
+ // referencer = new EcoreUtil.CrossReferencer(res) {
+ // private static final long serialVersionUID = 616050158241084372L;
+ //
+ // // initializer for this anonymous class
+ // {
+ // crossReference();
+ // }
+ //
+ // @Override
+ // protected boolean crossReference(EObject eObject, EReference eReference,
+ // EObject crossReferencedEObject) {
+ // if (eReference.isChangeable() && !eReference.isDerived())
+ // return crossReferencedEObject.eResource() == null;
+ // return false;
+ // }
+ // };
+ // } else {
+ // referencer = new EcoreUtil.CrossReferencer(root) {
+ // private static final long serialVersionUID = 616050158241084372L;
+ //
+ // // initializer for this anonymous class
+ // {
+ // crossReference();
+ // }
+ //
+ // @Override
+ // protected boolean crossReference(EObject eObject, EReference eReference,
+ // EObject crossReferencedEObject) {
+ // if (eReference.isChangeable() && !eReference.isDerived())
+ // return crossReferencedEObject.eResource() == null;
+ // return false;
+ // }
+ // };
+ // }
+ // final Iterator<Map.Entry<EObject, Collection<EStructuralFeature.Setting>>> i = referencer
+ // .entrySet().iterator();
+ // while (i.hasNext()) {
+ // final Map.Entry<EObject, Collection<EStructuralFeature.Setting>> entry = i.next();
+ // final Iterator<EStructuralFeature.Setting> j = entry.getValue().iterator();
+ // while (j.hasNext()) {
+ // EcoreUtil.remove(j.next(), entry.getKey());
+ // }
+ // }
+ // }
+ }
+
+ /**
+ * Removes a {@link DiffElement} from its {@link DiffGroup}.
+ *
+ * @param diffElement
+ * {@link DiffElement} to remove from its container.
+ */
+ protected void removeFromContainer(DiffElement diffElement) {
+ final EObject parent = diffElement.eContainer();
+ EcoreUtil.remove(diffElement);
+ removeDanglingReferences(parent);
+
+ // If diff was contained by a ConflictingDiffElement, we call back this on it
+ if(parent instanceof ConflictingDiffElement) {
+ removeFromContainer((DiffElement)parent);
+ }
+
+ // if diff was in a diffGroup and it was the last one, we also remove the diffgroup
+ if(parent instanceof DiffGroup) {
+ cleanDiffGroup((DiffGroup)parent);
+ }
+ }
+
+ /**
+ * Sets the XMI ID of the given {@link EObject} if it belongs in an {@link XMIResource}.
+ *
+ * @param object
+ * Object we want to set the XMI ID of.
+ * @param id
+ * XMI ID to give to <code>object</code>.
+ */
+ protected void setXMIID(EObject object, String id) {
+ if(object != null && object.eResource() instanceof XMIResource) {
+ ((XMIResource)object.eResource()).setID(object, id);
+ }
+ }
+
+ /**
+ * Merge the differences required by the current difference.
+ *
+ * @param applyInOrigin
+ * True if the merge has to apply in origin.
+ * @since 1.3
+ */
+ protected void mergeRequiredDifferences(boolean applyInOrigin) {
+ if(mergedDiffs == null) {
+ mergedDiffs = new ArrayList<DiffElement>();
+ if(mergedDiffslistener == null) {
+ mergedDiffslistener = new MergedDiffsListener();
+ MergeService.addMergeListener(mergedDiffslistener);
+ }
+ }
+ mergedDiffs.add(diff);
+
+ for(DiffElement requiredDiff : getDependencies(applyInOrigin)) {
+ if(requiredDiff.eContainer() != null && !mergedDiffs.contains(requiredDiff)) {
+ final IMerger merger = MergeFactory.createMerger(requiredDiff);
+ if(applyInOrigin) {
+ merger.applyInOrigin();
+ } else {
+ merger.undoInTarget();
+ }
+ }
+ }
+ }
+
+ /**
+ * This default merge listener will allow us to reset the {@link #mergedDiffs} list at the end of the
+ * merge operation.
+ *
+ * @author <a href="mailto:cedric.notot@obeo.fr">Cedric Notot</a>
+ */
+ private class MergedDiffsListener implements IMergeListener {
+
+ /**
+ * Default constructor.
+ */
+ public MergedDiffsListener() {
+ // Enhance visibility of the default constructor.
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.IMergeListener#mergeDiffEnd(org.eclipse.emf.compare.diff.merge.MergeEvent)
+ */
+ public void mergeDiffEnd(MergeEvent event) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.IMergeListener#mergeDiffStart(org.eclipse.emf.compare.diff.merge.MergeEvent)
+ */
+ public void mergeDiffStart(MergeEvent event) {
+ // do nothing
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.IMergeListener#mergeOperationEnd(org.eclipse.emf.compare.diff.merge.MergeEvent)
+ */
+ public void mergeOperationEnd(MergeEvent event) {
+ resetMergedDiffs();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.IMergeListener#mergeOperationStart(org.eclipse.emf.compare.diff.merge.MergeEvent)
+ */
+ public void mergeOperationStart(MergeEvent event) {
+ // do nothing
+ }
+ }
+
+ /**
+ * Get the dependencies of the difference {@link diff} to merge. These dependencies will be merged before
+ * itself. This method may be overridden by a specific merger to choose to exploit or not the 'requires'
+ * link of the {@link diff} according to the nature of the merger and the direction of the merge.
+ *
+ * @param applyInOrigin
+ * The direction of the merge.
+ * @return The list of the dependencies to exploit.
+ * @since 1.3
+ */
+ protected List<DiffElement> getDependencies(boolean applyInOrigin) {
+ return new ArrayList<DiffElement>();
+ }
+
+ /**
+ * Mutually derived references need specific handling : merging one will implicitely merge the other and
+ * there are no way to tell such references apart.
+ * <p>
+ * Currently known references raising such issues :
+ * <table>
+ * <tr>
+ * <td>{@link EcorePackage#ECLASS__ESUPER_TYPES}</td>
+ * <td>{@link EcorePackage#ECLASS__EGENERIC_SUPER_TYPES}</td>
+ * </tr>
+ * </table>
+ * </p>
+ */
+ private void handleMutuallyDerivedReferences() {
+ DiffElement toRemove = null;
+ if(diff instanceof ReferenceChange) {
+ final EReference reference = ((ReferenceChange)diff).getReference();
+ if(reference == EcorePackage.eINSTANCE.getEClass_ESuperTypes()) {
+ EObject referenceType = null;
+ if(diff instanceof ReferenceChangeLeftTarget) {
+ referenceType = ((ReferenceChangeLeftTarget)diff).getRightTarget();
+ } else if(diff instanceof ReferenceChangeRightTarget) {
+ referenceType = ((ReferenceChangeRightTarget)diff).getLeftTarget();
+ } else if(diff instanceof UpdateReference) {
+ referenceType = ((UpdateReference)diff).getLeftTarget();
+ } else {
+ // we did cover all the subclasses, we should have a RferenceOrderChange
+ }
+ for(final DiffElement siblingDiff : ((DiffGroup)diff.eContainer()).getSubDiffElements()) {
+ if(siblingDiff instanceof ModelElementChangeLeftTarget) {
+ if(((ModelElementChangeLeftTarget)siblingDiff).getLeftElement() instanceof EGenericType && ((EGenericType)((ModelElementChangeLeftTarget)siblingDiff).getLeftElement()).getEClassifier() == referenceType) {
+ toRemove = siblingDiff;
+ break;
+ }
+ } else if(siblingDiff instanceof ModelElementChangeRightTarget) {
+ if(((ModelElementChangeRightTarget)siblingDiff).getRightElement() instanceof EGenericType && ((EGenericType)((ModelElementChangeRightTarget)siblingDiff).getRightElement()).getEClassifier() == referenceType) {
+ toRemove = siblingDiff;
+ break;
+ }
+ }
+ }
+ }
+ } else if(diff instanceof ModelElementChangeLeftTarget && ((ModelElementChangeLeftTarget)diff).getLeftElement() instanceof EGenericType) {
+ final ModelElementChangeLeftTarget theDiff = (ModelElementChangeLeftTarget)diff;
+ final EClassifier referenceType = ((EGenericType)theDiff.getLeftElement()).getEClassifier();
+ for(final DiffElement siblingDiff : ((DiffGroup)diff.eContainer()).getSubDiffElements()) {
+ if(siblingDiff instanceof ReferenceChangeLeftTarget && ((ReferenceChangeLeftTarget)siblingDiff).getReference().getFeatureID() == EcorePackage.ECLASS__ESUPER_TYPES) {
+ if(((ReferenceChangeLeftTarget)siblingDiff).getRightTarget() == referenceType) {
+ toRemove = siblingDiff;
+ break;
+ }
+ }
+ }
+ } else if(diff instanceof ModelElementChangeRightTarget && ((ModelElementChangeRightTarget)diff).getRightElement() instanceof EGenericType) {
+ final ModelElementChangeRightTarget theDiff = (ModelElementChangeRightTarget)diff;
+ final EClassifier referenceType = ((EGenericType)theDiff.getRightElement()).getEClassifier();
+ for(final DiffElement siblingDiff : ((DiffGroup)diff.eContainer()).getSubDiffElements()) {
+ if(siblingDiff instanceof ReferenceChangeRightTarget && ((ReferenceChangeRightTarget)siblingDiff).getReference().getFeatureID() == EcorePackage.ECLASS__ESUPER_TYPES) {
+ if(((ReferenceChangeRightTarget)siblingDiff).getLeftTarget() == referenceType) {
+ toRemove = siblingDiff;
+ break;
+ }
+ }
+ }
+ }
+ if(toRemove != null) {
+ removeFromContainer(toRemove);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DiffGroupTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DiffGroupTransactionalMerger.java new file mode 100644 index 00000000000..5aa5b3e36c7 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/DiffGroupTransactionalMerger.java @@ -0,0 +1,106 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeService;
+
+/**
+ *
+ * Transactional version of the class DiffGroupMerger provided by EMF Compare
+ *
+ */
+public class DiffGroupTransactionalMerger extends DefaultTransactionalMerger {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultTransactionalMerger#getApplyInOriginCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, Collection)
+ *
+ * @param domain
+ * @return
+ */
+ public Command getApplyInOriginCommand(final TransactionalEditingDomain domain, Collection<DiffElement> alreadyManaged) {
+ if(somethingToMerge((DiffGroup)diff)) {
+ return TransactionalMergeService.getMergeCommand(domain, diff.getSubDiffElements(), false);
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultTransactionalMerger#getUndoInTargetCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, Collection)
+ *
+ * @param domain
+ * @return
+ */
+ public Command getUndoInTargetCommand(final TransactionalEditingDomain domain, Collection<DiffElement> alreadyManaged) {
+ if(somethingToMerge((DiffGroup)diff)) {
+ return TransactionalMergeService.getMergeCommand(domain, diff.getSubDiffElements(), true); // doUndoInTarget();
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ *
+ * @param group
+ * @return
+ * <code>true</code> if we found DiffElement that is not a DiffGroup in the content of the DiffElement
+ */
+ protected boolean somethingToMerge(final DiffGroup group) {
+ final Iterator<EObject> iter = group.eAllContents();
+ while(iter.hasNext()) {
+ final EObject current = iter.next();
+ if(current instanceof DiffElement && !(current instanceof DiffGroup)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultTransactionalMerger#canApplyInOrigin()
+ *
+ * @return
+ */
+ @Override
+ public boolean canApplyInOrigin() {
+ if(somethingToMerge(((DiffGroup)diff))) {
+ return super.canApplyInOrigin();
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultTransactionalMerger#canUndoInTarget()
+ *
+ * @return
+ */
+ @Override
+ public boolean canUndoInTarget() {
+ if(somethingToMerge(((DiffGroup)diff))) {
+ return super.canUndoInTarget();
+ }
+ return false;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ModelElementChangeLeftTargetTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ModelElementChangeLeftTargetTransactionalMerger.java new file mode 100644 index 00000000000..35efe3e008f --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ModelElementChangeLeftTargetTransactionalMerger.java @@ -0,0 +1,229 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+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.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.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.commands.AddToResourceCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.CopyXMIIDCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusEFactory;
+
+
+/**
+ *
+ * Transactional version of the class {@link ModelElementChangeLeftTargetMerger}
+ *
+ */
+public class ModelElementChangeLeftTargetTransactionalMerger extends DefaultTransactionalMerger {//ModelElementChangeLeftTargetMerger implements ITransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link ModelElementChangeLeftTargetMerger} {@inheritDoc}
+ // *
+ // * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#doApplyInOrigin()
+ // */
+ // @Override
+ // protected void doApplyInOrigin() {
+ // final ModelElementChangeLeftTarget theDiff = (ModelElementChangeLeftTarget)this.diff;
+ // final EObject element = theDiff.getLeftElement();
+ // final EObject parent = theDiff.getLeftElement().eContainer();
+ // EcoreUtil.remove(element);
+ // // now removes all the dangling references
+ // removeDanglingReferences(parent);
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link ModelElementChangeLeftTargetMerger} {@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;
+ // }
+ // }
+ // }
+ // }
+ // }
+ // }
+
+ //TODO verify that I use this method in the transactional version
+ /**
+ * The native implementation, duplicated Code from {@link ModelElementChangeLeftTargetMerger} {@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 getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ final ModelElementChangeLeftTarget theDiff = (ModelElementChangeLeftTarget)this.diff;
+ final EObject element = theDiff.getLeftElement();
+ return PapyrusMergeCommandProvider.INSTANCE.getDestroyCommand(domain, element);
+ //removeDanglingReferences(parent); not used
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ CompoundCommand cmd = new CompoundCommand("Command CModelElementChangeLeftTargetMerger#getDoUndoInTargetCommand"); //$NON-NLS-1$
+ 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 ICommand copyCommand = getCopyWithReferenceCommand(element);
+ cmd.append(new GMFtoEMFCommandWrapper(copyCommand));
+ final EObject newOne = (EObject)copyCommand.getCommandResult().getReturnValue();
+ 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));
+ cmd.append(PapyrusEFactory.getEAddCommand(domain, origin, ref.getName(), newOne, elementIndex, true));
+ cmd.append(new CopyXMIIDCommand(element, newOne));
+ } catch (final FactoryException e) {
+ Activator.log.error(e);
+ }
+ } else if(origin == null && getDiffModel().getRightRoots().size() > 0) {
+ // getDiffModel().getRightRoots().get(0).eResource().getContents().add(newOne);
+ cmd.append(new AddToResourceCommand(getDiffModel().getRightRoots().get(0).eResource(), newOne));
+ } else if(origin != null) {
+ // origin.eResource().getContents().add(newOne);
+ cmd.append(new AddToResourceCommand(origin.eResource(), newOne));
+ } else {
+ // FIXME throw exception : couldn't merge this
+ }
+ cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // we should now have a look for RemovedReferencesLinks needing elements to apply
+ final DiffModel diffModel = getDiffModel();//see bug 385263: [UML Compare] NPE merging a DiffGroup owning a UMLStereotypeApplicationAddition/Removal
+ if(diffModel != null) {
+ final Iterator<EObject> siblings = diffModel.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;
+ }
+ }
+ }
+ }
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ }));
+
+ return cmd;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ModelElementChangeRightTargetTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ModelElementChangeRightTargetTransactionalMerger.java new file mode 100644 index 00000000000..28ecd6891ac --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ModelElementChangeRightTargetTransactionalMerger.java @@ -0,0 +1,235 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+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.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.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.commands.AddToResourceCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.CopyXMIIDCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusEFactory;
+
+/**
+ *
+ * Transactional version of the class {@link ModelElementChangeRightTargetMerger}
+ *
+ */
+
+public class ModelElementChangeRightTargetTransactionalMerger extends DefaultTransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link ModelElementChangeRightTargetMerger} {@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;
+ // }
+ // }
+ // }
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link ModelElementChangeRightTargetMerger} {@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);
+ // }
+
+ /**
+ * The native implementation, duplicated Code from {@link ModelElementChangeRightTargetMerger} {@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;
+ }
+
+ //TODO verify if I use this method
+ /**
+ * The native implementation, duplicated Code from {@link ModelElementChangeRightTargetMerger} {@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 getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ final CompoundCommand cmd = new CompoundCommand("Command CModelElementChangeRightTargetMerger#getDoApplyInOriginCommand"); //$NON-NLS-1$
+ final ModelElementChangeRightTarget theDiff = (ModelElementChangeRightTarget)this.diff;
+ final EObject origin = theDiff.getLeftParent();
+ final EObject element = theDiff.getRightElement();
+ final ICommand copyCommand = getCopyWithReferenceCommand(element);
+ cmd.append(new GMFtoEMFCommandWrapper(copyCommand));
+ final EObject newOne = (EObject)copyCommand.getCommandResult().getReturnValue();
+ 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));
+ cmd.append(PapyrusEFactory.getEAddCommand(domain, origin, ref.getName(), newOne, expectedIndex, true));
+ cmd.append(new CopyXMIIDCommand(element, newOne));
+ } catch (final FactoryException e) {
+ Activator.log.error(e);
+ }
+ } else if(origin == null && getDiffModel().getLeftRoots().size() > 0) {
+ cmd.append(new AddToResourceCommand(getDiffModel().getLeftRoots().get(0).eResource(), newOne));
+ } else if(origin != null) {
+ cmd.append(new AddToResourceCommand(origin.eResource(), newOne));
+ } else {
+ // FIXME Throw exception : couldn't merge this
+ }
+ cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, null, null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // we should now have a look for AddReferencesLinks needing this object
+ final DiffModel diffModel = getDiffModel();////see bug 385263: [UML Compare] NPE merging a DiffGroup owning a UMLStereotypeApplicationAddition/Removal
+ if(diffModel != null) {
+ final Iterator<EObject> siblings = diffModel.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;
+ }
+ }
+ }
+ }
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ }));
+ return cmd;
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ final ModelElementChangeRightTarget theDiff = (ModelElementChangeRightTarget)this.diff;
+ final EObject element = theDiff.getRightElement();
+ return PapyrusMergeCommandProvider.INSTANCE.getDestroyCommand(domain, element);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/MoveModelElementTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/MoveModelElementTransactionalMerger.java new file mode 100644 index 00000000000..2d40055f550 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/MoveModelElementTransactionalMerger.java @@ -0,0 +1,226 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+
+/**
+ *
+ * Transactional version of the class {@link MoveModelElementMerger}
+ *
+ */
+public class MoveModelElementTransactionalMerger extends DefaultTransactionalMerger {//MoveModelElementMerger implements ITransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link MoveModelElementMerger} {@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;
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link MoveModelElementMerger} {@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;
+ // }
+ // }
+
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ final CompoundCommand cmd = new CompoundCommand("CMoveModelElementMerger#getDoApplyInOriginCommand"); //$NON-NLS-1$
+ 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());
+ }
+
+
+ // We'll store the element's ID because moving an element deletes its XMI ID
+ final String elementID = getXMIID(leftElement);
+
+ if(rightRefValue instanceof List<?>) {
+ cmd.append(PapyrusMergeCommandProvider.INSTANCE.getMoveWithIndexCommand(domain, leftTarget, leftTarget, ref, leftElement, index, true));
+ } else {
+ cmd.append(PapyrusMergeCommandProvider.INSTANCE.getMoveCommand(domain, leftTarget, leftTarget, ref, leftElement));
+ }
+ cmd.append(getPreserveXMIIDCommand(domain, leftElement, elementID));
+
+ } else {
+ // shouldn't be here
+ cmd.append(UnexecutableCommand.INSTANCE);
+ }
+ return cmd;
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ final CompoundCommand cmd = new CompoundCommand("CMoveModelElementMerger#getDoUndoInTargetCommand"); //$NON-NLS-1$
+ 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());
+ }
+ if(leftRefValue instanceof List<?>) {
+ cmd.append(PapyrusMergeCommandProvider.INSTANCE.getMoveWithIndexCommand(domain, rightTarget, rightTarget, ref, rightElement, index, true));
+ } else {
+ cmd.append(PapyrusMergeCommandProvider.INSTANCE.getMoveCommand(domain, rightTarget, rightTarget, ref, rightElement));
+ }
+ final String elementID = getXMIID(rightElement);
+ cmd.append(getPreserveXMIIDCommand(domain, rightElement, elementID));
+ } else {
+ // shouldn't be here
+ cmd.append(UnexecutableCommand.INSTANCE);
+ }
+ return cmd;
+ }
+
+
+ // public Command getMergeRequiredDifferencesCommand(final TransactionalEditingDomain domain, final boolean applyInOrigin) {
+ // // TODO the super method mergeRequiredDifferences should be rewritten to use cmd too
+ // return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
+ //
+ // @Override
+ // protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // MoveModelElementTransactionalMerger.this.mergeRequiredDifferences(applyInOrigin);
+ // return null;
+ // }
+ // });
+ // }
+ //
+ // public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
+ // return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
+ //
+ // @Override
+ // protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // MoveModelElementTransactionalMerger.this.postProcess();
+ // return null;
+ // }
+ // });
+ // }
+
+ /**
+ * This command is not the the class PapyrusUMLMergeProvider because it only should be used to preserve the xmi_id after a move,
+ * but not to change the id
+ *
+ * @param domain
+ * @param element
+ * @param id
+ * @return
+ * the command to set the ID
+ */
+ private Command getPreserveXMIIDCommand(final TransactionalEditingDomain domain, final EObject element, final String id) {
+ //TODO change for an EMFCommand
+ return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Set XMI Command", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ if(element != null && element.eResource() instanceof XMIResource) {
+ ((XMIResource)element.eResource()).setID(element, id);
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ });
+
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceChangeLeftTargetTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceChangeLeftTargetTransactionalMerger.java new file mode 100644 index 00000000000..c5c6b27e414 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceChangeLeftTargetTransactionalMerger.java @@ -0,0 +1,274 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+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.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;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.compare.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusCompareEObjectCopier;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusEFactory;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeService;
+
+/**
+ *
+ * Transactional version of the class {@link ReferenceChangeLeftTargetMerger}
+ *
+ */
+public class ReferenceChangeLeftTargetTransactionalMerger extends DefaultTransactionalMerger {//ReferenceChangeLeftTargetMerger implements ITransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link ReferenceChangeLeftTargetMerger} {@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();
+ // }
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link ReferenceChangeLeftTargetMerger} {@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;
+ // }
+ // }
+ // }
+ // }
+ // }
+ // }
+
+ //TODO : verify if I use this method
+ /**
+ * The native implementation, duplicated Code from {@link ReferenceChangeLeftTargetMerger} {@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 getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ final CompoundCommand cmd = new CompoundCommand("CReferenceChangeLeftTargetMerger#getDoApplyInOriginCommand"); //$NON-NLS-1$
+ final ReferenceChangeLeftTarget theDiff = (ReferenceChangeLeftTarget)this.diff;
+ final EObject element = theDiff.getLeftElement();
+ final EObject leftTarget = theDiff.getLeftTarget();
+ try {
+ cmd.append(PapyrusEFactory.getERemoveCommand(domain, element, theDiff.getReference().getName(), leftTarget));
+ } catch (final FactoryException e) {
+ Activator.log.error(e);
+ }
+ cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, null, null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final DiffModel diffModel = getDiffModel();
+ if(diffModel != null) {//383515: [UML Compare] NPE with ReferenceChangeRightTarget leftToRight and ReferenceChangeLeftTarget rightToLeft
+ // we should now have a look for AddReferencesLinks needing this object
+ final Iterator<EObject> siblings = diffModel.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();
+ }
+ }
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ }));
+ return cmd;
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ final CompoundCommand cmd = new CompoundCommand();
+ 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 PapyrusCompareEObjectCopier copier = (PapyrusCompareEObjectCopier)TransactionalMergeService.getCopier(diff);
+ Command copierCommand = copier.getCopyReferenceValueCommand(domain, reference, element, leftTarget, rightTarget, index);
+ cmd.append(copierCommand);
+ final AbstractTransactionalCommand updateDiffModelCommand = new AbstractTransactionalCommand(domain, "Update Diff Model", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final EObject copiedValue = copier.getCopiedValue(leftTarget);
+ 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;
+ }
+ }
+ }
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ cmd.append(new GMFtoEMFCommandWrapper(updateDiffModelCommand));
+ return cmd;
+ }
+
+ // public Command getMergeRequiredDifferencesCommand(final TransactionalEditingDomain domain, final boolean applyInOrigin) {
+ // return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
+ //
+ // @Override
+ // protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // ReferenceChangeLeftTargetTransactionalMerger.this.mergeRequiredDifferences(applyInOrigin);
+ // return null;
+ // }
+ // });
+ // }
+ //
+ // public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
+ // return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
+ //
+ // @Override
+ // protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // ReferenceChangeLeftTargetTransactionalMerger.this.postProcess();
+ // return null;
+ // }
+ // });
+ // }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceChangeRightTargetTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceChangeRightTargetTransactionalMerger.java new file mode 100644 index 00000000000..e50c2c80806 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceChangeRightTargetTransactionalMerger.java @@ -0,0 +1,277 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+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.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;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.compare.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusCompareEObjectCopier;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusEFactory;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeService;
+
+/**
+ *
+ * Transactional version of the class {@link ReferenceChangeRightTargetMerger}
+ *
+ */
+public class ReferenceChangeRightTargetTransactionalMerger extends DefaultTransactionalMerger {//ReferenceChangeRightTargetMerger implements ITransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link ReferenceChangeRightTargetMerger} {@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;
+ // }
+ // }
+ // }
+ // }
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link ReferenceChangeRightTargetMerger} {@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();
+ // }
+ // }
+ // }
+ // }
+
+ //TODO : verify that I use this method
+ /**
+ * The native implementation, duplicated Code from {@link ReferenceChangeRightTargetMerger} {@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 getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeRightTargetMerger#getDoApplyInOriginCommand"); //$NON-NLS-1$
+ 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 PapyrusCompareEObjectCopier copier = (PapyrusCompareEObjectCopier)TransactionalMergeService.getCopier(diff);
+ cmd.append(copier.getCopyReferenceValueCommand(domain, reference, element, rightTarget, leftTarget, index));
+
+ cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final EObject copiedValue = copier.getCopiedValue(rightTarget);
+ // 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;
+ }
+ }
+ }
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ }));
+
+ return cmd;
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ CompoundCommand cmd = new CompoundCommand("Undo In Target Command for CReferenceChangeRightTargetMerger#getDoUndoInTargetCommand"); //$NON-NLS-1$
+ final ReferenceChangeRightTarget theDiff = (ReferenceChangeRightTarget)this.diff;
+ final EObject element = theDiff.getRightElement();
+ final EObject rightTarget = theDiff.getRightTarget();
+ try {
+ cmd.append(PapyrusEFactory.getERemoveCommand(domain, element, theDiff.getReference().getName(), rightTarget));
+ } catch (final FactoryException e) {
+ Activator.log.error(e);
+ }
+ cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, null, null) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final DiffModel diffModel = getDiffModel();
+ if(diffModel != null) {//383515: [UML Compare] NPE with ReferenceChangeRightTarget leftToRight and ReferenceChangeLeftTarget rightToLeft
+ // we should now have a look for AddReferencesLinks needing this object
+ final Iterator<EObject> related = diffModel.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();
+ }
+ }
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ }));
+
+ return cmd;
+ }
+
+ // public Command getMergeRequiredDifferencesCommand(final TransactionalEditingDomain domain, final boolean applyInOrigin) {
+ // // TODO the super method mergeRequiredDifferences should be rewritten to use cmd too
+ // return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
+ //
+ // @Override
+ // protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // ReferenceChangeRightTargetTransactionalMerger.this.mergeRequiredDifferences(applyInOrigin);
+ // return null;
+ // }
+ // });
+ // }
+ //
+ // public Command getPostProcessCommand(final TransactionalEditingDomain domain) {
+ // return new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Merge Required Differences", null) { //$NON-NLS-1$
+ //
+ // @Override
+ // protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ // ReferenceChangeRightTargetTransactionalMerger.this.postProcess();
+ // return null;
+ // }
+ // });
+ // }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceOrderChangeTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceOrderChangeTransactionalMerger.java new file mode 100644 index 00000000000..3c849443364 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/ReferenceOrderChangeTransactionalMerger.java @@ -0,0 +1,128 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+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.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.compare.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusEFactory;
+
+import com.google.common.base.Predicate;
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+
+/**
+ *
+ * Transactional version of the class {@link ReferenceOrderChangeMerger}
+ *
+ */
+public class ReferenceOrderChangeTransactionalMerger extends DefaultTransactionalMerger {
+
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link ReferenceOrderChangeMerger} {@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 = Lists.newArrayList(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);
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link ReferenceOrderChangeMerger} {@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 = Lists.newArrayList(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);
+ // }
+ // }
+
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ final ReferenceOrderChange theDiff = (ReferenceOrderChange)this.diff;
+ final EObject leftElement = theDiff.getLeftElement();
+
+ final Collection<EObject> target = Lists.newArrayList(Collections2.filter(theDiff.getLeftTarget(), new Predicate<EObject>() {
+
+ public boolean apply(final EObject input) {
+ return !input.eIsProxy() || !DefaultMerger.isEMFCompareProxy(((InternalEObject)input).eProxyURI());
+ }
+ }));
+
+ try {
+ cmd = PapyrusEFactory.getESetCommand(domain, leftElement, theDiff.getReference().getName(), target);
+ } catch (final FactoryException e) {
+ Activator.log.error(e);
+ }
+ return cmd;
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ final ReferenceOrderChange theDiff = (ReferenceOrderChange)this.diff;
+ final EObject rightElement = theDiff.getRightElement();
+
+ final Collection<EObject> target = Lists.newArrayList(Collections2.filter(theDiff.getRightTarget(), new Predicate<EObject>() {
+
+ public boolean apply(final EObject input) {
+ return !input.eIsProxy() || !DefaultMerger.isEMFCompareProxy(((InternalEObject)input).eProxyURI());
+ }
+ }));
+
+ try {
+ cmd = PapyrusEFactory.getESetCommand(domain, rightElement, theDiff.getReference().getName(), target);
+ } catch (final FactoryException e) {
+ Activator.log.error(e);
+ }
+ return cmd;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/UpdateAttributeTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/UpdateAttributeTransactionalMerger.java new file mode 100644 index 00000000000..d623cf73d40 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/UpdateAttributeTransactionalMerger.java @@ -0,0 +1,101 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.compare.FactoryException;
+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.diff.Activator;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusEFactory;
+
+/**
+ *
+ * Transactional version of the class {@link UpdateAttributeMerger}
+ *
+ */
+public class UpdateAttributeTransactionalMerger extends DefaultTransactionalMerger {//UpdateAttributeMerger implements ITransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link 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();
+ // try {
+ // EFactory.eSet(origin, attr.getName(), EFactory.eGet(element, attr.getName()));
+ // } catch (FactoryException e) {
+ // EMFComparePlugin.log(e, true);
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link UpdateAttributeMerger} {@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();
+ // try {
+ // EFactory.eSet(element, attr.getName(), EFactory.eGet(origin, attr.getName()));
+ // } catch (FactoryException e) {
+ // EMFComparePlugin.log(e, true);
+ // }
+ // }
+
+
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ final UpdateAttribute theDiff = (UpdateAttribute)this.diff;
+ final EObject element = theDiff.getRightElement();
+ final EObject origin = theDiff.getLeftElement();
+ final EAttribute attr = theDiff.getAttribute();
+ try {
+ cmd = PapyrusEFactory.getESetCommand(domain, origin, attr.getName(), EFactory.eGet(element, attr.getName()));
+ } catch (FactoryException e) {
+ Activator.log.error(e);
+ }
+ return cmd;
+ }
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ final UpdateAttribute theDiff = (UpdateAttribute)this.diff;
+ final EObject element = theDiff.getRightElement();
+ final EObject origin = theDiff.getLeftElement();
+ final EAttribute attr = theDiff.getAttribute();
+ try {
+ cmd = PapyrusEFactory.getESetCommand(domain, element, attr.getName(), EFactory.eGet(origin, attr.getName()));
+ } catch (FactoryException e) {
+ Activator.log.error(e);
+ }
+ return cmd;
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/UpdateReferenceTransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/UpdateReferenceTransactionalMerger.java new file mode 100644 index 00000000000..4b211ec345a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/merger/UpdateReferenceTransactionalMerger.java @@ -0,0 +1,164 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.merger;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+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;
+import org.eclipse.emf.ecore.util.FeatureMapUtil;
+import org.eclipse.emf.edit.command.SetCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusCompareEObjectCopier;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeService;
+
+/**
+ *
+ * Transactional version of the class {@link UpdateReferenceMerger}
+ *
+ */
+public class UpdateReferenceTransactionalMerger extends DefaultTransactionalMerger {
+
+ // /**
+ // * The native implementation, duplicated Code from {@link UpdateReferenceMerger} {@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);
+ // }
+ // }
+ //
+ // /**
+ // * The native implementation, duplicated Code from {@link UpdateReferenceMerger} {@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);
+ // }
+ // }
+
+ //TODO verify if I use this method
+ /**
+ * The native implementation, duplicated Code from {@link UpdateReferenceMerger} {@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;
+ }
+
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ 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) {
+ if(FeatureMapUtil.isMany(element, reference)) {
+ //TODO : I didn't find an example to test this case.
+ throw new UnsupportedOperationException("Not Yet Supported"); //$NON-NLS-1$
+ } else {
+ final Object value = theDiff.getLeftElement().eGet(reference);
+ if(value instanceof EObject) {
+ cmd = PapyrusMergeCommandProvider.INSTANCE.getDestroyReferenceCommand(domain, element, reference, (EObject)value, false);
+ } else {
+ //TODO : we don't use the ServiceEdit
+ //TODO : not tested
+ // element.eUnset(reference);
+ cmd = new SetCommand(domain, element, reference, null);
+ }
+ }
+ } else {
+ final PapyrusCompareEObjectCopier copier = (PapyrusCompareEObjectCopier)TransactionalMergeService.getCopier(diff);
+ cmd = copier.getCopyReferenceValueCommand(domain, reference, element, leftTarget, matchedLeftTarget, -1);
+ }
+ return cmd;
+ }
+
+
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain) {
+ Command cmd = null;
+ 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) {
+ if(FeatureMapUtil.isMany(element, reference)) {
+ //TODO : I didn't find an example to test this case.
+ throw new UnsupportedOperationException("Not Yet Supported"); //$NON-NLS-1$
+ } else {
+ final Object value = theDiff.getRightElement().eGet(reference);
+ if(value instanceof EObject) {
+ cmd = PapyrusMergeCommandProvider.INSTANCE.getDestroyReferenceCommand(domain, element, reference, (EObject)value, false);
+ } else {
+ //TODO : we don't use the ServiceEdit
+ //TODO : not tested
+ // element.eUnset(reference);
+ cmd = new SetCommand(domain, element, reference, null);
+ }
+ }
+ } else {
+ final PapyrusCompareEObjectCopier copier = (PapyrusCompareEObjectCopier)TransactionalMergeService.getCopier(diff);
+ cmd = copier.getCopyReferenceValueCommand(domain, reference, element, rightTarget, matchedRightTarget, -1);
+ }
+ return cmd;
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/provider/DefaultTransactionalMergerProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/provider/DefaultTransactionalMergerProvider.java new file mode 100644 index 00000000000..ee95e68275b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/provider/DefaultTransactionalMergerProvider.java @@ -0,0 +1,83 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.provider;
+
+import java.util.Map;
+
+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.papyrus.infra.emf.compare.diff.internal.merger.AttributeChangeLeftTargetTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.AttributeChangeRightTargetTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.AttributeOrderChangeTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DiffGroupTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.ModelElementChangeLeftTargetTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.ModelElementChangeRightTargetTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.MoveModelElementTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.ReferenceChangeLeftTargetTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.ReferenceChangeRightTargetTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.ReferenceOrderChangeTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.UpdateAttributeTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.UpdateReferenceTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusCompareMap;
+import org.eclipse.papyrus.infra.emf.compare.diff.merge.ITransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.provider.ITransactionalMergerProvider;
+
+
+public class DefaultTransactionalMergerProvider implements ITransactionalMergerProvider {
+
+ /**
+ * 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 ITransactionalMerger>> mergerTypes;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.IMergerProvider#getMergers()
+ */
+ public Map<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>> getMergers() {
+ if(mergerTypes == null) {
+ mergerTypes = new PapyrusCompareMap<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>>();
+ mergerTypes.put(DiffGroup.class, DiffGroupTransactionalMerger.class);
+ mergerTypes.put(ModelElementChangeRightTarget.class, ModelElementChangeRightTargetTransactionalMerger.class);
+ mergerTypes.put(ModelElementChangeLeftTarget.class, ModelElementChangeLeftTargetTransactionalMerger.class);
+ mergerTypes.put(MoveModelElement.class, MoveModelElementTransactionalMerger.class);
+ mergerTypes.put(ReferenceChangeRightTarget.class, ReferenceChangeRightTargetTransactionalMerger.class);
+ mergerTypes.put(ReferenceChangeLeftTarget.class, ReferenceChangeLeftTargetTransactionalMerger.class);
+ mergerTypes.put(UpdateReference.class, UpdateReferenceTransactionalMerger.class);
+ mergerTypes.put(AttributeChangeRightTarget.class, AttributeChangeRightTargetTransactionalMerger.class);
+ mergerTypes.put(AttributeChangeLeftTarget.class, AttributeChangeLeftTargetTransactionalMerger.class);
+ mergerTypes.put(UpdateAttribute.class, UpdateAttributeTransactionalMerger.class);
+ mergerTypes.put(ReferenceOrderChange.class, ReferenceOrderChangeTransactionalMerger.class);
+ mergerTypes.put(AttributeOrderChange.class, AttributeOrderChangeTransactionalMerger.class);
+ //TODO DiffExtensionMerger : not used for the moment
+ //TODO DefaultExtensionMerger : not used for the moment
+ }
+ return mergerTypes;
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/CopyWithReferenceCommand.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/CopyWithReferenceCommand.java new file mode 100644 index 00000000000..7a7114408fd --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/CopyWithReferenceCommand.java @@ -0,0 +1,72 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.util;
+
+import java.util.Collections;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.compare.diff.merge.EMFCompareEObjectCopier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+
+/**
+ *
+ * This command allows to copy an EObject getting the copy before the command execution. (copyCommand.getCommandResult().getReturnValue();)
+ * The references and the XMI_Dis are copied during the command excetion
+ *
+ */
+public class CopyWithReferenceCommand extends AbstractTransactionalCommand {
+
+ /**
+ * The copied used to do the copy
+ */
+ final EMFCompareEObjectCopier copier;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * the editing domain
+ * @param diff
+ * the diffElement
+ * @param eObjectToCopy
+ * the object to copy
+ */
+ public CopyWithReferenceCommand(final TransactionalEditingDomain domain, final EMFCompareEObjectCopier copier, final EObject eObjectToCopy) {
+ super(domain, "CopyWithReferenceCommand", Collections.EMPTY_LIST); //$NON-NLS-1$
+ this.copier = copier;
+ final EObject copiedElement;
+ if(copier.containsKey(eObjectToCopy)) {
+ //385289: [UML Compare] Bad result after merginf UMLStereotypeApplicationAddition/Removal
+ //in some case, the elements are copied and merged twice!
+ copiedElement = this.copier.get(eObjectToCopy);
+ } else {
+ copiedElement = this.copier.copy(eObjectToCopy);
+ }
+ final CommandResult result = CommandResult.newOKCommandResult(copiedElement);
+ setResult(result);
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ this.copier.copyReferences();
+ this.copier.copyXMIIDs();
+ return getCommandResult();
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusCompareEObjectCopier.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusCompareEObjectCopier.java new file mode 100644 index 00000000000..3105d2fd810 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusCompareEObjectCopier.java @@ -0,0 +1,440 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.diff.merge.EMFCompareEObjectCopier;
+import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSnapshot;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.DiffResourceSet;
+import org.eclipse.emf.compare.match.metamodel.Match2Elements;
+import org.eclipse.emf.compare.match.metamodel.MatchElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+import org.eclipse.papyrus.infra.emf.utils.ResourceUtils;
+
+/**
+ *
+ * This class copies the code of {@link EMFCompareEObjectCopier}, to do the actions with EMFCommands
+ *
+ */
+public class PapyrusCompareEObjectCopier extends EMFCompareEObjectCopier {
+
+ /**
+ * the serial UID
+ */
+ private static final long serialVersionUID = -6723632034214667973L;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param diff
+ */
+ public PapyrusCompareEObjectCopier(final DiffResourceSet diff) {
+ super(diff);
+ throw new UnsupportedOperationException("not yet implemented");//we should initialize the map as it is done in the 2nd constructor //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param diff
+ */
+ public PapyrusCompareEObjectCopier(final DiffModel diff) {
+ super(diff);
+ final EObject container = diff.eContainer();
+ if(container instanceof ComparisonResourceSnapshot) {
+ final ComparisonResourceSnapshot snapshot = (ComparisonResourceSnapshot)container;
+ final EList<MatchElement> matchedElements = snapshot.getMatch().getMatchedElements();
+ for(MatchElement current : matchedElements) {
+ if(current instanceof Match2Elements) {
+ initializeCopier((Match2Elements)current);
+
+ }
+ }
+ }
+ }
+
+ /**
+ * Initialize the copier with the couple of Object matched during the diff
+ * It is useful for comparison between stereotyped elements in the nested editor
+ * see bug 384490: [UML Compare] Comparison between stereotyped elements doesn't work in the nested Compare Editor
+ *
+ * @param matchElement
+ *
+ */
+ protected void initializeCopier(final Match2Elements matchElement) {
+ final EObject left = ((Match2Elements)matchElement).getLeftElement();
+ final EObject right = ((Match2Elements)matchElement).getRightElement();
+ put(left, right);
+ put(right, left);
+ for(final MatchElement current : matchElement.getSubMatchElements()) {
+ if(current instanceof Match2Elements) {
+ initializeCopier((Match2Elements)current);
+ }
+ }
+ }
+
+ /**
+ * Copy the XMi_ID only when the id doesn't exist in the target resource
+ *
+ * @see org.eclipse.emf.compare.diff.merge.EMFCompareEObjectCopier#copyXMIIDs()
+ *
+ */
+ @Override
+ public void copyXMIIDs() {
+ for(final Map.Entry<EObject, EObject> entry : entrySet()) {
+ final EObject original = entry.getKey();
+ final EObject copy = entry.getValue();
+ if(original.eResource() instanceof XMIResource && copy.eResource() instanceof XMIResource) {
+ final XMIResource originResource = (XMIResource)original.eResource();
+ final XMIResource copyResource = (XMIResource)copy.eResource();
+ if(originResource.getID(original) != null) {
+ if(original.eResource() == copy.eResource()) {
+ final String currentID = originResource.getID(original);
+ if(ResourceUtils.getAllResourceIds(copyResource).contains(currentID)) {
+ continue;
+ }
+ }
+ copyResource.setID(copy, originResource.getID(original));
+ final TreeIterator<EObject> originalIterator = original.eAllContents();
+ final TreeIterator<EObject> copyIterator = copy.eAllContents();
+ while(originalIterator.hasNext() && copyIterator.hasNext()) {
+ final EObject nextOriginalChild = originalIterator.next();
+ final EObject nextCopyChild = copyIterator.next();
+ if(nextOriginalChild.eResource() == nextCopyChild.eResource()) {
+ final String currentID = originResource.getID(nextOriginalChild);
+ if(ResourceUtils.getAllResourceIds(copyResource).contains(currentID)) {
+ continue;
+ }
+ }
+ copyResource.setID(nextCopyChild, originResource.getID(nextOriginalChild));
+ }
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Adapted from copyReferenceValue(EReference targetReference, EObject target, EObject value,
+ * EObject matchedValue, int index)
+ *
+ * @param targetReference
+ * @param target
+ * @param value
+ * @param matchedValue
+ * @param index
+ * @return
+ */
+ public Command getCopyReferenceValueCommand(final TransactionalEditingDomain domain, final EReference targetReference, final EObject target, final EObject value, final EObject matchedValue, final int index) {
+ EObject actualValue = value;
+ if(value == null && matchedValue != null) {
+ // handleLinkedResourceDependencyChange(matchedValue);
+ // actualValue = get(matchedValue);
+ //TODO
+ throw new UnsupportedOperationException("Not yet supported"); //$NON-NLS-1$
+ }
+ if(matchedValue != null) {
+ put(actualValue, matchedValue);
+
+ final Object referenceValue = target.eGet(targetReference);
+ if(referenceValue instanceof Collection<?>) {
+ //tested with ReferenceChangeLefttargetExample
+ return getAddAtIndexCommand(domain, target, targetReference, (Collection<EObject>)referenceValue, matchedValue, index);
+
+ } else {
+ //target.eSet(targetReference, matchedValue);
+ //tested with the project UpdateReferenceExample2
+ return PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, target, targetReference, matchedValue);
+ }
+ }
+ //tested with ReferenceChangeLefttargetExample2
+ return getCopyValueReferenceCommand(domain, targetReference, target, actualValue, index);
+ }
+
+ private Command getCopyValueReferenceCommand(final TransactionalEditingDomain domain, final EReference targetReference, final EObject target, final EObject value, final int index) {
+ final Command copyValueCommand = new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
+ final EObject copy;
+ final EObject targetValue = PapyrusCompareEObjectCopier.this.get(value);
+ if(targetValue != null) {
+ copy = targetValue;
+ } else {
+ if(value.eResource() == null || value.eResource().getURI().isPlatformPlugin()) {
+ // We can't copy that object
+ copy = value;
+ } else {
+ copy = PapyrusCompareEObjectCopier.this.copy(value);
+ }
+ }
+ Command cmd = null;
+ final Object referenceValue = target.eGet(targetReference);
+ if(referenceValue instanceof List && targetReference.isMany()) {
+ if(copy.eIsProxy() && copy instanceof InternalEObject) {
+ // only add if the element is not already there.
+ final URI proxURI = ((InternalEObject)copy).eProxyURI();
+ boolean found = false;
+ final Iterator<EObject> it = ((List<EObject>)referenceValue).iterator();
+ while(!found && it.hasNext()) {
+ final EObject obj = it.next();
+ if(obj instanceof InternalEObject) {
+ found = proxURI.equals(((InternalEObject)obj).eProxyURI());
+ }
+ }
+ if(!found) {
+ final List<EObject> targetList = (List<EObject>)referenceValue;
+ //addAtIndex(targetList, copy, index);
+ //not tested
+ cmd = getAddAtIndexCommand(domain, target, targetReference, targetList, copy, index);
+ }
+ } else {
+ final List<EObject> targetList = (List<EObject>)referenceValue;
+ final int currentIndex = targetList.indexOf(copy);
+ if(currentIndex == -1) {
+ //addAtIndex(targetList, copy, index);
+ //not tested
+ cmd = getAddAtIndexCommand(domain, target, targetReference, targetList, copy, index);
+ } else {
+ // The order could be wrong in case of eOpposites
+ // movetoIndex(targetList, currentIndex, index);
+ cmd = getMoveAtIndexCommand(domain, target, targetList, targetReference, copy, currentIndex, index);
+ // throw new UnsupportedOperationException("Not yet supported");
+ }
+ }
+ } else {
+ if(copy.eIsProxy() && copy instanceof InternalEObject) {
+ // only change value if the URI changes
+ final URI proxURI = ((InternalEObject)copy).eProxyURI();
+ if(referenceValue instanceof InternalEObject) {
+ if(!proxURI.equals(((InternalEObject)referenceValue).eProxyURI())) {
+ //not tested
+ //target.eSet(targetReference, copy);
+ cmd = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, target, targetReference, copy);
+ }
+ }
+ } else {
+ //not tested
+ //target.eSet(targetReference, copy);
+ cmd = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, target, targetReference, copy);
+ }
+ }
+
+ if(cmd != null) {
+ cmd.execute();
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+ });
+ return copyValueCommand;
+ }
+
+ /**
+ *
+ * @param key
+ * @return
+ * the copied object
+ */
+ public EObject getCopiedValue(final EObject key) {
+ return get(key);
+ }
+
+
+ private Command getMoveAtIndexCommand(final TransactionalEditingDomain domain, final EObject target, final List<EObject> targetList, final EReference targetReference, final EObject copy, final int currentIndex, final int expectedIndex) {
+ final List<EObject> newColl = new ArrayList<EObject>(targetList);
+ final int size = targetList.size();
+ if(size <= 1 || currentIndex < 0 || currentIndex >= size) {
+ // return;
+ //do nothing
+ } else if(expectedIndex != -1 && expectedIndex != currentIndex && expectedIndex <= size - 1) {
+ newColl.add(expectedIndex, newColl.remove(currentIndex));
+ }
+
+ return PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, target, targetReference, newColl);
+ }
+
+ /**
+ * Returns the command to set the wanted object at the wanted index
+ *
+ * @param domain
+ * @param editedElement
+ * @param feature
+ * @param collection
+ * @param newValue
+ * @param index
+ * @return
+ */
+ private Command getAddAtIndexCommand(final TransactionalEditingDomain domain, final EObject editedElement, final EStructuralFeature feature, final Collection<EObject> collection, final EObject newValue, final int index) {
+ final List<EObject> newColl = new ArrayList<EObject>(collection);
+ final int listSize = collection.size();
+ if(index > -1 && index < listSize) {
+ newColl.add(index, newValue);
+ } else {
+ newColl.add(newValue);
+ }
+ attachRealPositionEAdapter(newValue, index);
+ reorderList(newColl);
+ return PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, editedElement, feature, newColl);
+ }
+
+ /**
+ * Duplicate code from EFactory
+ * If we could not merge a given object at its expected position in a list, we'll attach an Adapter to it
+ * in order to "remember" that "expected" position. That will allow us to reorder the list later on if
+ * need be.
+ *
+ * @param object
+ * The object on which to attach an Adapter.
+ * @param expectedPosition
+ * The expected position of <code>object</code> in its list.
+ */
+ private void attachRealPositionEAdapter(final Object object, final int expectedPosition) {
+ if(object instanceof EObject) {
+ ((EObject)object).eAdapters().add(new PositionAdapter(expectedPosition));
+ }
+ }
+
+ /**
+ * Duplicate code from EFactory
+ * Reorders the given list if it contains EObjects associated with a PositionAdapter which are not located
+ * at their expected positions.
+ *
+ * @param list
+ * The list that is to be reordered.
+ * @param <T>
+ * type of the list's elements.
+ */
+ private <T> void reorderList(final List<T> list) {
+ final List<T> newList = new ArrayList<T>(list);
+ Collections.sort(newList, new EObjectComparator());
+ for(int i = 0; i < list.size(); i++) {
+ int oldIndex = list.indexOf(newList.get(i));
+ list.add(i, list.remove(oldIndex));
+ }
+ return;
+ }
+
+
+ /**
+ * This class exists in several classes of this plugin. It is not an error : the same obejct can be referenced by different
+ * feature and different position at the same time. So we need to have a class PositionAdapter for each context!
+ * duplicate code from Efactory
+ * This adapter will be used to remember the accurate position of an EObject in its target list.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+ private class PositionAdapter extends AdapterImpl {
+
+ /** The index at which we expect to find this object. */
+ private final int expectedIndex;
+
+ /**
+ * Creates our adapter.
+ *
+ * @param index
+ * The index at which we expect to find this object.
+ */
+ public PositionAdapter(final int index) {
+ this.expectedIndex = index;
+ }
+
+ /**
+ * Returns the index at which we expect to find this object.
+ *
+ * @return The index at which we expect to find this object.
+ */
+ public int getExpectedIndex() {
+ return expectedIndex;
+ }
+ }
+
+ /**
+ *
+ * This class allows to compare EObject using the PositionAdapter.
+ *
+ *
+ */
+ private class EObjectComparator<T> implements Comparator<T> {
+
+ /**
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ public int compare(final T o1, final T o2) {
+ if(o1 instanceof EObject && o2 instanceof EObject) {
+ final int position1 = getWantedPosition((EObject)o1);
+ final int position2 = getWantedPosition((EObject)o2);
+ if(position1 != -1 && position2 != -1) {
+ return position1 - position2;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @param obj1
+ * an EObject
+ * @return
+ * the wanted position for this object
+ */
+ private int getWantedPosition(final EObject obj1) {
+ final Iterator<Adapter> adapters = obj1.eAdapters().iterator();
+ int expectedIndex = -1;
+ while(expectedIndex == -1 && adapters.hasNext()) {
+ final Adapter adapter = adapters.next();
+ if(adapter instanceof PositionAdapter) {
+ expectedIndex = ((PositionAdapter)adapter).getExpectedIndex();
+ }
+ }
+ return expectedIndex;
+ }
+
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusCompareMap.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusCompareMap.java new file mode 100644 index 00000000000..a48c4b4d68e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusCompareMap.java @@ -0,0 +1,104 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.papyrus.infra.emf.compare.diff.Activator;
+
+/**
+ * This map log an error when a wanted element is unknown in the map
+ *
+ * @author VL222926
+ *
+ * @param <K>
+ * @param <V>
+ */
+public class PapyrusCompareMap<K, V> extends HashMap<K, V> {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructs an empty <tt>HashMap</tt> with the specified initial
+ * capacity and load factor.
+ *
+ * @param initialCapacity
+ * The initial capacity.
+ * @param loadFactor
+ * The load factor.
+ * @throws IllegalArgumentException
+ * if the initial capacity is negative
+ * or the load factor is nonpositive.
+ */
+ public PapyrusCompareMap(final int initialCapacity, final float loadFactor) {
+ super(initialCapacity, loadFactor);
+ }
+
+ /**
+ * Constructs an empty <tt>HashMap</tt> with the specified initial
+ * capacity and the default load factor (0.75).
+ *
+ * @param initialCapacity
+ * the initial capacity.
+ * @throws IllegalArgumentException
+ * if the initial capacity is negative.
+ */
+ public PapyrusCompareMap(final int initialCapacity) {
+ super(initialCapacity);
+ }
+
+ /**
+ * Constructs an empty <tt>HashMap</tt> with the default initial capacity
+ * (16) and the default load factor (0.75).
+ */
+ public PapyrusCompareMap() {
+ super();
+ }
+
+ /**
+ * Constructs a new <tt>HashMap</tt> with the same mappings as the
+ * specified <tt>Map</tt>. The <tt>HashMap</tt> is created with
+ * default load factor (0.75) and an initial capacity sufficient to
+ * hold the mappings in the specified <tt>Map</tt>.
+ *
+ * @param m
+ * the map whose mappings are to be placed in this map.
+ * @throws NullPointerException
+ * if the specified map is null.
+ */
+ public PapyrusCompareMap(final Map<? extends K, ? extends V> m) {
+ super(m);
+ }
+
+ /**
+ * We display an error when a wanted element is not included in the Map
+ *
+ * @see java.util.HashMap#get(java.lang.Object)
+ *
+ * @param key
+ * @return
+ */
+ @Override
+ public V get(final Object key) {
+ V obj = super.get(key);
+ if(obj == null) {
+ Activator.log.error("The following element is unknown in the map : " + key, new NullPointerException()); //$NON-NLS-1$
+ }
+ return obj;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusEFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusEFactory.java new file mode 100644 index 00000000000..0bb27cd9442 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/internal/util/PapyrusEFactory.java @@ -0,0 +1,297 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.internal.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.compare.EMFCompareMessages;
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.util.EFactory;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+
+//TODO : merge with thepapyrus table command factory?
+/**
+ *
+ * This class is adapted from {@link EFactory}
+ *
+ */
+/**
+ *
+ * This class is adapted from {@link EFactory}
+ *
+ */
+public class PapyrusEFactory {
+
+
+ private PapyrusEFactory() {
+ //nothing to do
+ }
+
+ public static final <T> Command getEAddCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final T arg) throws FactoryException {
+ return getEAddCommand(domain, object, name, arg, -1);
+ }
+
+ public static final <T> Command getEAddCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final T arg, final int elementIndex) throws FactoryException {
+ return getEAddCommand(domain, object, name, arg, elementIndex, false);
+ }
+
+ public static final <T> Command getEAddCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final T arg, final int elementIndex, final boolean reorder) throws FactoryException {
+ Command returnedCommand = null;
+ final EStructuralFeature feature = eStructuralFeature(object, name);
+ if(feature.isMany() && arg != null) {
+ final Object manyValue = object.eGet(feature);
+ // if (manyValue instanceof InternalEList<?>) {
+ // final InternalEList<? super T> internalEList = (InternalEList<? super T>)manyValue;
+ // final int listSize = internalEList.size();
+ // if (elementIndex > -1 && elementIndex < listSize) {
+ // internalEList.addUnique(elementIndex, arg);
+ // } else {
+ // internalEList.addUnique(arg);
+ // }
+ // if (reorder) {
+ // attachRealPositionEAdapter(arg, elementIndex);
+ // reorderList(internalEList);
+ // }
+ // } else if (manyValue instanceof List<?>) {
+ // final List<? super T> list = (List<? super T>)manyValue;
+ // final int listSize = list.size();
+ // if (elementIndex > -1 && elementIndex < listSize) {
+ // list.add(elementIndex, arg);
+ // } else {
+ // list.add(arg);
+ // }
+ // if (reorder) {
+ // attachRealPositionEAdapter(arg, elementIndex);
+ // reorderList(list);
+ // }
+ // } else if (manyValue instanceof Collection<?>) {
+ // ((Collection<? super T>)manyValue).add(arg);
+ // }
+
+ if(manyValue instanceof Collection<?>) {
+ List<Object> newValue = new ArrayList<Object>((Collection<?>)manyValue);
+ final int listSize = newValue.size();
+ if(manyValue instanceof List<?>) {
+ if(elementIndex > -1 && elementIndex < listSize) {
+ newValue.add(elementIndex, arg);
+ } else {
+ newValue.add(arg);
+ }
+ if(reorder) {
+ attachRealPositionEAdapter(arg, elementIndex);
+ reorderList((List<?>)newValue);
+ }
+ } else if(manyValue instanceof Collection<?>) {
+ newValue.add(arg);
+ }
+ returnedCommand = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, object, feature, newValue);
+ }
+ } else if(!feature.isMany()) {
+ // eSet(object, name, arg);
+ returnedCommand = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, object, feature, arg);
+ }
+ return returnedCommand;
+ }
+
+ //TODO not tested
+ public static final Command getERemoveCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final Object arg) throws FactoryException {
+ // final Object list = object.eGet(eStructuralFeature(object, name));
+ // if (list instanceof List) {
+ // if (arg != null) {
+ // ((List<?>)list).remove(arg);
+ // }
+ // } else {
+ // eSet(object, name, null);
+ // }
+ final Object list = object.eGet(eStructuralFeature(object, name));
+ if(list instanceof List) {
+ if(arg != null) {
+ List<?> newValue = new ArrayList((List<?>)list);
+ ((List<?>)newValue).remove(arg);
+ return getESetCommand(domain, object, name, newValue);
+ }
+ } else {
+ return getESetCommand(domain, object, name, null);
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param object
+ * @param name
+ * @param arg
+ * @return
+ * @throws FactoryException
+ */
+ public static final Command getESetCommand(final TransactionalEditingDomain domain, final EObject object, final String name, final Object arg) throws FactoryException {
+ Command returnedCommand;
+ final EStructuralFeature feature = eStructuralFeature(object, name);
+ if(!feature.isChangeable())
+ throw new FactoryException(EMFCompareMessages.getString("EFactory.UnSettableFeature", name)); //$NON-NLS-1$
+
+ if(feature.getEType() instanceof EEnum && arg instanceof String) {
+ final EEnumLiteral literal = ((EEnum)feature.getEType()).getEEnumLiteral((String)arg);
+ //object.eSet(feature, literal);
+ returnedCommand = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, object, feature, literal);
+ } else {
+ if(arg == null && feature.isMany()) {
+ //object.eSet(feature, Collections.EMPTY_LIST);
+ returnedCommand = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, object, feature, Collections.EMPTY_LIST);
+ } else if(arg == null) {
+ //object.eSet(feature, feature.getDefaultValue());
+ returnedCommand = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, object, feature, feature.getDefaultValue());
+ } else {
+ //object.eSet(feature, arg);
+ returnedCommand = PapyrusMergeCommandProvider.INSTANCE.getSetCommand(domain, object, feature, arg);
+ }
+ }
+ return returnedCommand;
+ }
+
+
+ public static EStructuralFeature eStructuralFeature(final EObject object, final String name) throws FactoryException {
+ return EFactory.eStructuralFeature(object, name);
+ }
+
+ /**
+ * Duplicate code from EFactory
+ * If we could not merge a given object at its expected position in a list, we'll attach an Adapter to it
+ * in order to "remember" that "expected" position. That will allow us to reorder the list later on if
+ * need be.
+ *
+ * @param object
+ * The object on which to attach an Adapter.
+ * @param expectedPosition
+ * The expected position of <code>object</code> in its list.
+ */
+ private static void attachRealPositionEAdapter(final Object object, final int expectedPosition) {
+ if(object instanceof EObject) {
+ ((EObject)object).eAdapters().add(new PositionAdapter(expectedPosition));
+ }
+ }
+
+ /**
+ * Reorders the given list if it contains EObjects associated with a PositionAdapter which are not located
+ * at their expected positions.
+ *
+ * @param list
+ * The list that is to be reordered.
+ * @param <T>
+ * type of the list's elements.
+ */
+ private static <T> void reorderList(final List<T> list) {
+ List<T> newList = new ArrayList<T>(list);
+ Collections.sort(newList, new EObjectComparator());
+ for(int i = 0; i < list.size(); i++) {
+ int oldIndex = list.indexOf(newList.get(i));
+ list.add(i, list.remove(oldIndex));
+ }
+ return;
+ }
+
+
+ /**
+ * duplicate code from Efactory
+ * This adapter will be used to remember the accurate position of an EObject in its target list.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+ private static class PositionAdapter extends AdapterImpl {
+
+ /** The index at which we expect to find this object. */
+ private final int expectedIndex;
+
+ /**
+ * Creates our adapter.
+ *
+ * @param index
+ * The index at which we expect to find this object.
+ */
+ public PositionAdapter(final int index) {
+ this.expectedIndex = index;
+ }
+
+ /**
+ * Returns the index at which we expect to find this object.
+ *
+ * @return The index at which we expect to find this object.
+ */
+ public int getExpectedIndex() {
+ return expectedIndex;
+ }
+ }
+
+ /**
+ *
+ * This class allows to compare EObject using the PositionAdapter.
+ *
+ *
+ */
+ private static class EObjectComparator<T> implements Comparator<T> {
+
+ /**
+ *
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ *
+ * @param o1
+ * @param o2
+ * @return
+ */
+ public int compare(final T o1, final T o2) {
+ if(o1 instanceof EObject && o2 instanceof EObject) {
+ final int position1 = getWantedPosition((EObject)o1);
+ final int position2 = getWantedPosition((EObject)o2);
+ if(position1 != -1 && position2 != -1) {
+ return position1 - position2;
+ }
+ }
+ return 0;
+ }
+
+ /**
+ *
+ * @param obj1
+ * an EObject
+ * @return
+ * the wanted position for this object
+ */
+ private int getWantedPosition(final EObject obj1) {
+ final Iterator<Adapter> adapters = obj1.eAdapters().iterator();
+ int expectedIndex = -1;
+ while(expectedIndex == -1 && adapters.hasNext()) {
+ final Adapter adapter = adapters.next();
+ if(adapter instanceof PositionAdapter) {
+ expectedIndex = ((PositionAdapter)adapter).getExpectedIndex();
+ }
+ }
+ return expectedIndex;
+ }
+
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/merge/ITransactionalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/merge/ITransactionalMerger.java new file mode 100644 index 00000000000..2a34daeba32 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/merge/ITransactionalMerger.java @@ -0,0 +1,114 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.merge;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.compare.diff.merge.DefaultMerger;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+
+/**
+ *
+ * The mergers which implement this interface are able to provide commands for the merge actions
+ *
+ */
+public interface ITransactionalMerger {
+
+ /**
+ * This command should have the same behavior as {@link DefaultMerger#applyInOrigin()}
+ *
+ * @param alreadyManaged
+ * the list of the DiffElement already managed buy the command that we are creating
+ * @return
+ * the command to do the action
+ */
+ public Command getApplyInOriginCommand(final TransactionalEditingDomain domain, final Collection<DiffElement> alreadyManaged);
+
+ /**
+ * This command should have the same behavior as {@link DefaultMerger#undoInTarget()}
+ *
+ * @param domain
+ * @param alreadyManaged
+ * the list of the DiffElement already managed buy the command that we are creating
+ * @return
+ * the command to do the action
+ */
+ public Command getUndoInTargetCommand(final TransactionalEditingDomain domain, final Collection<DiffElement> alreadyManaged);
+
+ /**
+ * This command should have the same behavior as {@link DefaultMerger#doApplyInOrigin}
+ *
+ * @param domain
+ * @return
+ * the command to do the action
+ */
+ public Command getDoApplyInOriginCommand(final TransactionalEditingDomain domain);
+
+ /**
+ * This command should have the same behavior as {@link DefaultMerger#doUndoInTarget}
+ *
+ * @param domain
+ * @return
+ * the command to do the action
+ */
+ public Command getDoUndoInTargetCommand(final TransactionalEditingDomain domain);
+
+ /**
+ * This command should have the same behavior as {@link DefaultMerger#mergeRequiredDifferences}
+ *
+ * @param domain
+ * @param applyInOrigin
+ * @param alreadyManaged
+ * the list of the DiffElement already managed buy the command that we are creating
+ * @return
+ * the command to do the action
+ */
+ public Command getMergeRequiredDifferencesCommand(final TransactionalEditingDomain domain, final boolean applyInOrigin, final Collection<DiffElement> alreadyManaged);
+
+ /**
+ * This command should have the same behavior as {@link DefaultMerger#postProcess}
+ *
+ * @param domain
+ * @return
+ * the command to do the action
+ */
+ public Command getPostProcessCommand(final TransactionalEditingDomain domain);
+
+ /**
+ *
+ * @return
+ * <code>true</code> if the command can be executed, <code>false</code> if not
+ */
+ public boolean canApplyInOrigin();
+
+ /**
+ *
+ * @return
+ * <code>true</code> if the command can be executed, <code>false</code> if not
+ */
+ public boolean canUndoInTarget();
+
+
+ /**
+ * Sets the {@link DiffElement} to be merged.
+ *
+ * @param element
+ * The {@link DiffElement} to be merged.
+ */
+ void setDiffElement(DiffElement element);
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/provider/ITransactionalMergerProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/provider/ITransactionalMergerProvider.java new file mode 100644 index 00000000000..9481746f3ed --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/provider/ITransactionalMergerProvider.java @@ -0,0 +1,25 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.provider;
+
+import java.util.Map;
+
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.papyrus.infra.emf.compare.diff.merge.ITransactionalMerger;
+
+
+public interface ITransactionalMergerProvider {
+
+ Map<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>> getMergers();
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/MergerProviderDescriptor.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/MergerProviderDescriptor.java new file mode 100644 index 00000000000..93c35cfbe07 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/MergerProviderDescriptor.java @@ -0,0 +1,222 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ * Adapted code from EMF-Compare
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.service;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.emf.compare.EMFComparePlugin;
+import org.eclipse.emf.compare.diff.EMFCompareDiffMessages;
+import org.eclipse.emf.compare.util.EngineConstants;
+import org.eclipse.papyrus.infra.emf.compare.diff.provider.ITransactionalMergerProvider;
+
+/**
+ * This descriptor represents a merger provider contribution via the extension point <code>org.eclipse.emf.compare.diff.mergerprovider</code>.
+ *
+ * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
+ */
+/* package */class MergerProviderDescriptor implements Comparable<MergerProviderDescriptor> {
+
+ /** Configuration element of this descriptor. */
+ protected final IConfigurationElement element;
+
+ /** File extensions this merger takes into account. */
+ protected final String fileExtension;
+
+ /** Class name of the described merger provider. */
+ protected final String mergerProviderClassName;
+
+ /**
+ * Priority of this descriptor. Should be one of
+ * <ul>
+ * <li>{@link EngineConstants#PRIORITY_HIGHEST}</li>
+ * <li>{@link EngineConstants#PRIORITY_HIGH}</li>
+ * <li>{@link EngineConstants#PRIORITY_NORMAL}</li>
+ * <li>{@link EngineConstants#PRIORITY_LOW}</li>
+ * <li>{@link EngineConstants#PRIORITY_LOWEST}</li>
+ * </ul>
+ */
+ protected final String priority;
+
+ /** {@link IMergerProvider} this descriptor describes. */
+ private ITransactionalMergerProvider mergerProvider;
+
+ /**
+ * Instantiate the descriptor given its configuration.
+ *
+ * @param configuration
+ * {@link IConfigurationElement Configuration element} of this descriptor.
+ */
+ public MergerProviderDescriptor(IConfigurationElement configuration) {
+ element = configuration;
+ fileExtension = getAttribute("fileExtension", "*"); //$NON-NLS-1$ //$NON-NLS-2$
+ priority = getAttribute("priority", "low"); //$NON-NLS-1$//$NON-NLS-2$
+ mergerProviderClassName = getAttribute("mergerProviderClass", null); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(MergerProviderDescriptor other) {
+ final int nombre1 = other.getPriorityValue(other.getPriority());
+ final int nombre2 = getPriorityValue(getPriority());
+ return nombre2 - nombre1;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ boolean isEqual = true;
+ if(this == obj) {
+ isEqual = true;
+ } else if(obj == null || getClass() != obj.getClass()) {
+ isEqual = false;
+ } else if(obj instanceof MergerProviderDescriptor) {
+ final MergerProviderDescriptor other = (MergerProviderDescriptor)obj;
+ if(mergerProviderClassName == null && other.mergerProviderClassName != null) {
+ isEqual = false;
+ } else if(mergerProviderClassName != null && !mergerProviderClassName.equals(other.mergerProviderClassName)) {
+ isEqual = false;
+ } else if(fileExtension == null && other.fileExtension != null) {
+ isEqual = false;
+ } else if(fileExtension != null && !fileExtension.equals(other.fileExtension)) {
+ isEqual = false;
+ } else if(priority == null && other.priority != null) {
+ isEqual = false;
+ } else if(priority != null && !priority.equals(other.priority)) {
+ isEqual = false;
+ }
+ } else {
+ isEqual = false;
+ }
+ return isEqual;
+ }
+
+ /**
+ * Returns the file extension this engine should handle.
+ *
+ * @return The file extension this engine should handle.
+ */
+ public String getFileExtension() {
+ return fileExtension;
+ }
+
+ /**
+ * Returns the engine instance.
+ *
+ * @return The engine instance.
+ */
+ public ITransactionalMergerProvider getMergerProviderInstance() {
+ if(mergerProvider == null) {
+ try {
+ mergerProvider = (ITransactionalMergerProvider)element.createExecutableExtension("mergerProviderClass"); //$NON-NLS-1$
+ } catch (final CoreException e) {
+ EMFComparePlugin.log(e, false);
+ }
+ }
+ return mergerProvider;
+ }
+
+ /**
+ * Returns the engine priority.
+ *
+ * @return The engine priority.
+ */
+ public String getPriority() {
+ return priority.toLowerCase();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int classNameHash = 0;
+ if(mergerProviderClassName != null) {
+ classNameHash = mergerProviderClassName.hashCode();
+ }
+ int extensionHash = 0;
+ if(fileExtension != null) {
+ extensionHash = fileExtension.hashCode();
+ }
+ int priorityHash = 0;
+ if(priority != null) {
+ priorityHash = priority.hashCode();
+ }
+
+ return (((prime + classNameHash) * prime) + extensionHash) * prime + priorityHash;
+ }
+
+ /*
+ * created as package visibility method to allow access from MergeFactory
+ */
+ /**
+ * Returns the value of the priority described by the given {@link String}.<br/>
+ * Returned values according
+ * to <code>priorityString</code> value :
+ * <ul>
+ * <li>"lowest" => {@value EngineConstants#PRIORITY_LOWEST}</li>
+ * <li>"low" => {@value EngineConstants#PRIORITY_LOW}</li>
+ * <li>"high" => {@value EngineConstants#PRIORITY_HIGH}</li>
+ * <li>"highest" => {@value EngineConstants#PRIORITY_HIGHEST}</li>
+ * <li>anything else => {@value EngineConstants#PRIORITY_NORMAL}</li>
+ * </ul>
+ *
+ * @param priorityString
+ * {@link String} value of the priority we seek.
+ * @return <code>int</code> corresponding to the given priority {@link String}.
+ */
+ /* package */int getPriorityValue(String priorityString) {
+ if(priorityString == null)
+ throw new IllegalArgumentException(EMFCompareDiffMessages.getString("Descriptor.IllegalPriority")); //$NON-NLS-1$
+ int priorityValue = EngineConstants.PRIORITY_NORMAL;
+ if("lowest".equals(priorityString)) { //$NON-NLS-1$
+ priorityValue = EngineConstants.PRIORITY_LOWEST;
+ } else if("low".equals(priorityString)) { //$NON-NLS-1$
+ priorityValue = EngineConstants.PRIORITY_LOW;
+ } else if("high".equals(priorityString)) { //$NON-NLS-1$
+ priorityValue = EngineConstants.PRIORITY_HIGH;
+ } else if("highest".equals(priorityString)) { //$NON-NLS-1$
+ priorityValue = EngineConstants.PRIORITY_HIGHEST;
+ }
+ return priorityValue;
+ }
+
+ /**
+ * Returns the value of the attribute <code>name</code> of this descriptor's configuration element. if the
+ * attribute hasn't been set, we'll return <code>defaultValue</code> instead.
+ *
+ * @param name
+ * Name of the attribute we seek the value of.
+ * @param defaultValue
+ * Value to return if the attribute hasn't been set.
+ * @return The value of the attribute <code>name</code>, <code>defaultValue</code> if it hasn't been set.
+ */
+ private String getAttribute(String name, String defaultValue) {
+ final String value = element.getAttribute(name);
+ if(value != null)
+ return value;
+ if(defaultValue != null)
+ return defaultValue;
+ throw new IllegalArgumentException(EMFCompareDiffMessages.getString("Descriptor.MissingAttribute", name)); //$NON-NLS-1$
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/TransactionalMergeFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/TransactionalMergeFactory.java new file mode 100644 index 00000000000..2a2227f7611 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/TransactionalMergeFactory.java @@ -0,0 +1,292 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.common.EMFPlugin;
+import org.eclipse.emf.compare.EMFComparePlugin;
+import org.eclipse.emf.compare.diff.merge.IMerger;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.util.ClassUtils;
+import org.eclipse.emf.compare.util.EMFCompareMap;
+import org.eclipse.emf.compare.util.EngineConstants;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.provider.DefaultTransactionalMergerProvider;
+import org.eclipse.papyrus.infra.emf.compare.diff.merge.ITransactionalMerger;
+
+
+/**
+ *
+ * replaces MergeFactory
+ *
+ */
+public class TransactionalMergeFactory {
+
+ /** Wild card for file extensions. */
+ private static final String ALL_EXTENSIONS = "*"; //$NON-NLS-1$
+
+ /** Remembers the last file extension for which we've populated {@link #MERGER_TYPES}. */
+ private static String lastExtension = ""; //$NON-NLS-1$
+
+ /** Name of the extension point to parse for merger providers. */
+ private static final String MERGER_PROVIDER_EXTENSION_POINT = "org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider"; //$NON-NLS-1$
+
+ /**
+ * This map will be populated with the merger associated to given {@link DiffElement}s. Each diff element
+ * will be mapped to the merger provided by the MergerProvider contributed with the highest priority.
+ */
+ private static final Map<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>> MERGER_TYPES = new EMFCompareMap<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>>();
+
+ /** Keeps track of all the providers we've parsed. */
+ private static final Map<String, ArrayList<MergerProviderDescriptor>> PARSED_PROVIDERS = new EMFCompareMap<String, ArrayList<MergerProviderDescriptor>>();
+
+ /** Externalized here to avoid too many distinct usages. */
+ private static final String TAG_PROVIDER = "mergerprovider"; //$NON-NLS-1$
+
+ /** These are the possible priorities for the provided mergers. */
+ private static final int[] MERGER_PRIORITIES = { EngineConstants.PRIORITY_LOWEST, EngineConstants.PRIORITY_LOW, EngineConstants.PRIORITY_NORMAL, EngineConstants.PRIORITY_HIGH, EngineConstants.PRIORITY_HIGHEST, };
+
+ static {
+ parseExtensionMetadata();
+ }
+
+ /**
+ * Utility classes don't need to (and shouldn't) be instantiated.
+ */
+ private TransactionalMergeFactory() {
+ // prevents instantiation
+ }
+
+ /**
+ * Handles the creation of the merger for a given {@link DiffElement}.
+ *
+ * @param element
+ * {@link DiffElement} for which we need a merger.
+ * @return The merger adapted to <code>element</code>, <code>null</code> if it cannot be instantiated.
+ */
+ public static ITransactionalMerger createMerger(DiffElement element) {
+ // If the merger provides a default constructor, we instantiate it
+ ITransactionalMerger elementMerger = null;
+
+
+ //EMF-Compare implementation
+ // if (element instanceof AbstractDiffExtension) {
+ // elementMerger = ((AbstractDiffExtension)element).provideMerger();
+ // if (elementMerger == null) {
+ // elementMerger = new DefaultExtensionMerger();
+ // }
+ // }
+
+ // Papyrus EMF-Compare Implementation
+ if(element instanceof AbstractDiffExtension) {
+ try {
+ IMerger merger = ((AbstractDiffExtension)element).provideMerger();
+ if(merger != null) {
+ if(merger instanceof ITransactionalMerger) {
+ elementMerger = (ITransactionalMerger)merger;
+ }
+ }
+ } catch (UnsupportedOperationException e) {
+ //we ignore the exception, this exception comes from the Generated Code when the developper don't use Generated NOT
+ }
+ }
+ //TODO : and the default extension merger ?
+
+ if(elementMerger == null) {
+ try {
+ final Class<? extends ITransactionalMerger> mergerClass = getBestMerger(element);
+ elementMerger = mergerClass.newInstance();
+ } catch (final InstantiationException e) {
+ EMFComparePlugin.log(e.getMessage(), false);
+ } catch (final IllegalAccessException e) {
+ EMFComparePlugin.log(e.getMessage(), false);
+ }
+ }
+
+ if(elementMerger != null) {
+ elementMerger.setDiffElement(element);
+ }
+ //cf bug 396267: [UML Compare] it is not possible to merge a difference on a stereotype property
+ //Assert.isNotNull(elementMerger, NLS.bind("Merger for {0} not found", element));
+ Assert.isNotNull(elementMerger, NLS.bind("Merger for {0} not found", element.getClass()));
+ return elementMerger;
+ }
+
+ /**
+ * Returns the merger class that is best suited for the given {@link DiffElement}. Merger classes can be
+ * managed via {@link #addMergerType(Class, Class)} and {@link #removeMergerType(Class)}.
+ *
+ * @param element
+ * {@link DiffElement} we want a merger for.
+ * @return The merger class that is best suited for the given {@link DiffElement}.
+ */
+ private static Class<? extends ITransactionalMerger> getBestMerger(DiffElement element) {
+ Class<? extends ITransactionalMerger> mergerClass = DefaultTransactionalMerger.class;
+
+ EObject rightElement = (EObject)ClassUtils.invokeMethod(element, "getRightElement"); //$NON-NLS-1$
+ if(rightElement == null) {
+ rightElement = (EObject)ClassUtils.invokeMethod(element, "getRightParent"); //$NON-NLS-1$
+ }
+ String resourceFileExtension = null;
+ if(rightElement != null && rightElement.eResource() != null) {
+ resourceFileExtension = rightElement.eResource().getURI().fileExtension();
+ }
+
+ if(resourceFileExtension == null) {//Papyrus code
+ EObject leftElement = (EObject)ClassUtils.invokeMethod(element, "getLeftElement"); //$NON-NLS-1$
+ if(leftElement == null) {
+ leftElement = (EObject)ClassUtils.invokeMethod(element, "getLeftParent"); //$NON-NLS-1$
+ }
+
+ if(leftElement != null && leftElement.eResource() != null) {
+ resourceFileExtension = leftElement.eResource().getURI().fileExtension();
+ }
+ }
+
+ if(resourceFileExtension == null) {
+ resourceFileExtension = ALL_EXTENSIONS;
+ }
+
+ final Map<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>> mergersMap;
+ if(EMFPlugin.IS_ECLIPSE_RUNNING) {
+ mergersMap = getMergerTypes(resourceFileExtension);
+ } else {
+ mergersMap = MERGER_TYPES;
+ }
+
+ // If we know the merger for this class, we return it
+ if(mergersMap.containsKey(element.getClass())) {
+ mergerClass = mergersMap.get(element.getClass());
+ // Else we seek through the map if our element is an instance of one of the class keys.
+ } else {
+ for(final Entry<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>> entry : mergersMap.entrySet()) {
+ if(entry.getKey().isInstance(element)) {
+ mergerClass = entry.getValue();
+ break;
+ }
+ }
+ }
+ return mergerClass;
+ }
+
+ /**
+ * This will iterate through the list of the parsed providers from the lowest to the highest priority and
+ * associate each known {@link DiffElement} to a merger in order of their provider's priority.
+ *
+ * @param fileExtension
+ * File extension on which the provider can apply its mergers.
+ * @return The map of the merger associated to given {@link DiffElement}s.
+ */
+ private static Map<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>> getMergerTypes(String fileExtension) {
+ if(!fileExtension.equals(lastExtension)) {
+ lastExtension = fileExtension;
+ MERGER_TYPES.clear();
+ /*
+ * TODO We'll iterate n times over all the parsed providers (one loop for each priority). See if
+ * we can optimize this.
+ */
+ for(final int priority : MERGER_PRIORITIES) {
+ final Map<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>> mergers = new EMFCompareMap<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>>();
+ // Iterates through the list of providers registered for all extensions
+ if(PARSED_PROVIDERS.containsKey(ALL_EXTENSIONS)) {
+ final List<MergerProviderDescriptor> list = PARSED_PROVIDERS.get(ALL_EXTENSIONS);
+ Collections.sort(list);
+ for(final MergerProviderDescriptor descriptor : list) {
+ if(descriptor.getPriorityValue(descriptor.priority) == priority) {
+ mergers.putAll(descriptor.getMergerProviderInstance().getMergers());
+ }
+ }
+ }
+ if(PARSED_PROVIDERS.containsKey(fileExtension)) {
+ final List<MergerProviderDescriptor> list = PARSED_PROVIDERS.get(fileExtension);
+ Collections.sort(list);
+ for(final MergerProviderDescriptor descriptor : list) {
+ if(descriptor.getPriorityValue(descriptor.priority) == priority) {
+ mergers.putAll(descriptor.getMergerProviderInstance().getMergers());
+ }
+ }
+ }
+ MERGER_TYPES.putAll(mergers);
+ }
+ }
+ return MERGER_TYPES;
+ }
+
+ /**
+ * This will parse the currently running platform for extensions and store all the diff engines and diff
+ * extensions that can be found.
+ */
+ private static void parseExtensionMetadata() {
+ if(EMFPlugin.IS_ECLIPSE_RUNNING) {
+ final IExtension[] extensions = Platform.getExtensionRegistry().getExtensionPoint(MERGER_PROVIDER_EXTENSION_POINT).getExtensions();
+ for(int i = 0; i < extensions.length; i++) {
+ final IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
+ for(int j = 0; j < configElements.length; j++) {
+ final MergerProviderDescriptor desc = parseProvider(configElements[j]);
+ storeProviderDescriptor(desc);
+ }
+ }
+ } else {
+ MERGER_TYPES.putAll(new DefaultTransactionalMergerProvider().getMergers());
+ }
+ }
+
+ /**
+ * This will parse the given {@link IConfigurationElement configuration element} and return a descriptor
+ * for it if it describes a merger provider.
+ *
+ * @param configElement
+ * Configuration element to parse.
+ * @return {@link MergerProviderDescriptor} wrapped around <code>configElement</code> if it describes a
+ * merger provider, <code>null</code> otherwise.
+ */
+ private static MergerProviderDescriptor parseProvider(IConfigurationElement configElement) {
+ if(!configElement.getName().equals(TAG_PROVIDER))
+ return null;
+ final MergerProviderDescriptor desc = new MergerProviderDescriptor(configElement);
+ return desc;
+ }
+
+ /**
+ * Stores the given descriptor in the list of known {@link MergerProviderDescriptor}s.
+ *
+ * @param desc
+ * Descriptor to be added to the list of all know descriptors.
+ */
+ private static void storeProviderDescriptor(MergerProviderDescriptor desc) {
+ if(desc.getFileExtension() == null)
+ return;
+
+ final String[] extensions = desc.getFileExtension().split(","); //$NON-NLS-1$
+ for(final String mergerExtension : extensions) {
+ if(!PARSED_PROVIDERS.containsKey(mergerExtension)) {
+ PARSED_PROVIDERS.put(mergerExtension, new ArrayList<MergerProviderDescriptor>());
+ }
+ final List<MergerProviderDescriptor> set = PARSED_PROVIDERS.get(mergerExtension);
+ set.add(desc);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/TransactionalMergeService.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/TransactionalMergeService.java new file mode 100644 index 00000000000..438190c7724 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/service/TransactionalMergeService.java @@ -0,0 +1,466 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.service;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.compare.diff.merge.EMFCompareEObjectCopier;
+import org.eclipse.emf.compare.diff.merge.IMergeListener;
+import org.eclipse.emf.compare.diff.merge.IMerger;
+import org.eclipse.emf.compare.diff.merge.MergeEvent;
+import org.eclipse.emf.compare.diff.merge.service.MergeFactory;
+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.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.DiffResourceSet;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.FireMergeDiffEndCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.FireMergeDiffStartCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.FireMergeOperationEndCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.FireMergeOperationStartCommand;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DiffGroupTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusCompareEObjectCopier;
+import org.eclipse.papyrus.infra.emf.compare.diff.merge.ITransactionalMerger;
+
+
+
+/**
+ *
+ * This service should replace the EMF-Compare MergeService
+ *
+ */
+public class TransactionalMergeService {
+
+ // private static Method addMergeListenerMethod = null;
+ //
+ // private static Method removeMergeListenerMethod = null;
+
+ /** This copier will be used when merging references. */
+ private static EMFCompareEObjectCopier copier;
+
+ // private static Object copier;
+
+
+ /**
+ * Default constructor.
+ */
+ private TransactionalMergeService() {
+ // hides default constructor
+ }
+
+ // /**
+ // * TODO this method should be covered with a JUnit test
+ // * Registers a new merge listener for notifications about merge operations. Has no effect if the listener
+ // * is already registered.
+ // *
+ // * @param listener
+ // * New Listener to register for notifications.
+ // */
+ // public static void addMergeListener(final IMergeListener listener) {
+ // if(addMergeListenerMethod == null) {
+ // Class<?>[] parameterTypes = new Class[1];
+ // parameterTypes[0] = IMergeListener.class;
+ // try {
+ // addMergeListenerMethod = ReflectHelper.getMethod(MergeService.class, "addMergeListener", parameterTypes); //$NON-NLS-1$
+ // } catch (SecurityException e) {
+ // Activator.log.error(e);
+ // } catch (NoSuchMethodException e) {
+ // Activator.log.error(e);
+ // }
+ // }
+ // final Object[] parameters = new Object[1];
+ // parameters[0] = listener;
+ // try {
+ // addMergeListenerMethod.invoke(null, parameters);
+ // } catch (IllegalArgumentException e) {
+ // Activator.log.error(e);
+ // } catch (IllegalAccessException e) {
+ // Activator.log.error(e);
+ // } catch (InvocationTargetException e) {
+ // Activator.log.error(e);
+ // }
+ // }
+
+
+
+
+ public static Command getMergeCommand(final TransactionalEditingDomain domain, final DiffElement element, final boolean leftToRight) {
+ CompoundCommand cmd = new CompoundCommand("MergeCommand"); //$NON-NLS-1$
+ cmd.append(new FireMergeOperationStartCommand(element, getMergeListeners()));
+ cmd.append(getDoMergeCommand(domain, element, leftToRight));
+ cmd.append(new FireMergeOperationEndCommand(element, getMergeListeners()));
+ return cmd;
+ }
+
+
+
+ private static Command getDoMergeCommand(final TransactionalEditingDomain domain, final DiffElement element, final boolean leftToRight) {
+ final CompoundCommand cmd = new CompoundCommand("DoMergeCommand"); //$NON-NLS-1$
+ cmd.append(new FireMergeDiffStartCommand(element, getMergeListeners()));
+ final ITransactionalMerger merger;
+ //TODO post a bug to EMF-Compare -> we can't define our own merger for DiffGroup Element
+ if(element instanceof DiffGroup) {
+ merger = new DiffGroupTransactionalMerger();
+ merger.setDiffElement(element);
+ } else if(element instanceof ConflictingDiffElement) {
+ merger = TransactionalMergeFactory.createMerger(element.getSubDiffElements().get(0));
+ } else {
+ merger = TransactionalMergeFactory.createMerger(element);
+ }
+ final Collection<DiffElement> alreadyManaged = new ArrayList<DiffElement>();
+ if(merger instanceof ITransactionalMerger) {
+ if(leftToRight) {
+ cmd.append(((ITransactionalMerger)merger).getUndoInTargetCommand(domain, alreadyManaged));
+ } else {
+ cmd.append(((ITransactionalMerger)merger).getApplyInOriginCommand(domain, alreadyManaged));
+ }
+ } else {
+ throw new UnsupportedOperationException(NLS.bind("I can't found the Papyrus Merger for {0}.", element)); //$NON-NLS-1$
+ }
+ alreadyManaged.clear();
+ cmd.append(new FireMergeDiffEndCommand(element, getMergeListeners()));
+ return cmd;
+ }
+
+
+ /**
+ * Execute the command to merge The DiffElement
+ *
+ * @param domain
+ * the {@link TransactionalEditingDomain}
+ * @param element
+ * the DiffElement to merger
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left to the right model, <code>False</code> when they have to be applied the
+ * other way around.
+ */
+ public static void merge(final TransactionalEditingDomain domain, final DiffElement element, boolean leftToRight) {
+ final Command cmd = getMergeCommand(domain, element, leftToRight);
+ domain.getCommandStack().execute(cmd);
+ }
+
+ /**
+ * Execute the command to merge The DiffElement
+ *
+ * @param domain
+ * the {@link TransactionalEditingDomain}
+ * @param elements
+ * the elements to merge
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left to the right model, <code>False</code> when they have to be applied the
+ * other way around.
+ */
+ public static void merge(final TransactionalEditingDomain domain, final List<DiffElement> elements, final boolean leftToRight) {
+ final Command cmd = getMergeCommand(domain, elements, leftToRight);
+ domain.getCommandStack().execute(cmd);
+ }
+
+
+ public static Command getMergeCommand(final TransactionalEditingDomain domain, final List<DiffElement> elements, final boolean leftToRight) {
+ final CompoundCommand cmd = new CompoundCommand("MergeCommand"); //$NON-NLS-1$
+ cmd.append(new FireMergeOperationStartCommand(elements, getMergeListeners()));
+ for(DiffElement element : new ArrayList<DiffElement>(elements)) {
+ // we might remove the diff from the list before merging it
+ // (eOpposite reference)
+ if(element.eContainer() != null) {
+ cmd.append(getDoMergeCommand(domain, element, leftToRight));
+ }
+ }
+ cmd.append(new FireMergeOperationEndCommand(elements, getMergeListeners()));
+ return cmd;
+ }
+
+
+ // /**
+ // * removes a merge listener from the list of registered listeners. This will have no effect if the given
+ // * listener is not registered for notifications on this service.
+ // *
+ // * @param listener
+ // * New Listener to register for notifications.
+ // */
+ // public static void removeMergeListener(final IMergeListener listener) {
+ // if(removeMergeListenerMethod == null) {
+ // Class<?>[] parameterTypes = new Class[1];
+ // parameterTypes[0] = IMergeListener.class;
+ // try {
+ // removeMergeListenerMethod = ReflectHelper.getMethod(MergeService.class, "removeMergeListener", parameterTypes); //$NON-NLS-1$
+ // } catch (SecurityException e) {
+ // Activator.log.error(e);
+ // } catch (NoSuchMethodException e) {
+ // Activator.log.error(e);
+ // }
+ // }
+ // final Object[] parameters = new Object[1];
+ // parameters[0] = listener;
+ // try {
+ // removeMergeListenerMethod.invoke(null, parameters);
+ // } catch (IllegalArgumentException e) {
+ // Activator.log.error(e);
+ // } catch (IllegalAccessException e) {
+ // Activator.log.error(e);
+ // } catch (InvocationTargetException e) {
+ // Activator.log.error(e);
+ // }
+ // }
+
+
+ // @SuppressWarnings("unchecked")
+ // //we suppress this warning because the field is always a List of IMergeListener
+ // private static List<IMergeListener> getMergeListeners() {
+ // List<IMergeListener> listeners = null;
+ // Field myField = null;
+ // try {
+ // myField = MergeService.class.getDeclaredField("MERGE_LISTENERS"); //$NON-NLS-1$
+ // } catch (SecurityException e) {
+ // Activator.log.error(e);
+ // } catch (NoSuchFieldException e) {
+ // Activator.log.error(e);
+ // }
+ // myField.setAccessible(true);
+ // try {
+ // listeners = (List<IMergeListener>)myField.get(null);
+ // } catch (IllegalArgumentException e) {
+ // Activator.log.error(e);
+ // } catch (IllegalAccessException e) {
+ // Activator.log.error(e);
+ // }
+ // return listeners;
+ // }
+
+ private static List<IMergeListener> getMergeListeners() {
+ return MERGE_LISTENERS;
+ }
+
+
+ //FIXME : from HERE to the end : duplicated code from MergeService
+ /** This copier will be used when merging references. */
+ // private static EMFCompareEObjectCopier copier;
+
+ /**
+ * Holds a list of all the merge listeners registered for notifications on merge operations.
+ */
+ private static final List<IMergeListener> MERGE_LISTENERS = new ArrayList<IMergeListener>();
+
+
+ /**
+ * Registers a new merge listener for notifications about merge operations. Has no effect if the listener
+ * is already registered.
+ *
+ * @param listener
+ * New Listener to register for notifications.
+ */
+ //TODO should be done with a command...
+ public static void addMergeListener(IMergeListener listener) {
+ MERGE_LISTENERS.add(listener);
+ }
+
+ /**
+ * Returns the copier given the diff it should merge.
+ *
+ * @param diff
+ * The DiffElement for which a copier is needed.
+ * @return The copier for a given diff.
+ */
+ public static EMFCompareEObjectCopier getCopier(DiffElement diff) {
+ final DiffModel diffModel = getContainerDiffModel(diff);
+ if(diffModel == null)
+ throw new IllegalArgumentException("The diff element should be contained in a DiffModel instance"); //$NON-NLS-1$
+ if(diffModel.eContainer() instanceof DiffResourceSet) {
+ if(copier == null) {
+ copier = new PapyrusCompareEObjectCopier((DiffResourceSet)diffModel.eContainer());
+ } else if(copier.getDiffResourceSet() != diffModel.eContainer()) {
+ copier.clear();
+ copier = new PapyrusCompareEObjectCopier((DiffResourceSet)diffModel.eContainer());
+ }
+ } else {
+ if(copier == null) {
+ copier = new PapyrusCompareEObjectCopier(diffModel);
+ } else if(copier.getDiffModel() != diffModel) {
+ copier.clear();
+ copier = new PapyrusCompareEObjectCopier(diffModel);
+ }
+ }
+ return copier;
+ }
+
+ /**
+ * Browse the diff model from the leaf to the top to find the containing {@link DiffModel} instance.
+ *
+ * @param diff
+ * any {@link DiffElement}.
+ * @return the containing {@link DiffModel} instance, null if not found.
+ */
+ private static DiffModel getContainerDiffModel(DiffElement diff) {
+ EObject container = diff.eContainer();
+ while(container != null) {
+ if(container instanceof DiffModel)
+ return (DiffModel)container;
+ container = container.eContainer();
+ }
+ return null;
+ }
+
+ /**
+ * Merges a single DiffElement in the direction specified by <code>leftToRight</code>.
+ * <p>
+ * Will notify the list of its merge listeners before, and after the operation.
+ * </p>
+ *
+ * @param element
+ * {@link DiffElement} containing the information to merge.
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left to the right model, <code>False</code> when they have to be applied the
+ * other way around.
+ */
+ public static void merge(DiffElement element, boolean leftToRight) {
+ fireMergeOperationStart(element);
+ doMerge(element, leftToRight);
+ fireMergeOperationEnd(element);
+ }
+
+ /**
+ * Merges a list of DiffElements in the direction specified by <code>leftToRight</code>.
+ * <p>
+ * Will notify the list of its merge listeners before, and after the operation.
+ * </p>
+ *
+ * @param elements
+ * {@link DiffElement}s containing the information to merge.
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left to the right model, <code>False</code> when they have to be applied the
+ * other way around.
+ */
+ public static void merge(List<DiffElement> elements, boolean leftToRight) {
+ fireMergeOperationStart(elements);
+ for(DiffElement element : new ArrayList<DiffElement>(elements))
+ // we might remove the diff from the list before merging it
+ // (eOpposite reference)
+ if(element.eContainer() != null)
+ doMerge(element, leftToRight);
+ fireMergeOperationEnd(elements);
+ }
+
+ /**
+ * removes a merge listener from the list of registered listeners. This will have no effect if the given
+ * listener is not registered for notifications on this service.
+ *
+ * @param listener
+ * New Listener to register for notifications.
+ */
+ //TODO should be done with a command
+ public static void removeMergeListener(IMergeListener listener) {
+ MERGE_LISTENERS.remove(listener);
+ }
+
+ /**
+ * Applies the changes implied by a given {@link DiffElement} in the direction specified by <code>leftToRight</code>.
+ * <p>
+ * Will notify the list of its merge listeners before, and after the merge.
+ * </p>
+ *
+ * @param element
+ * {@link DiffElement} containing the information to merge.
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left to the right model, <code>False</code> when they have to be applied the
+ * other way around.
+ */
+ protected static void doMerge(DiffElement element, boolean leftToRight) {
+ fireMergeDiffStart(element);
+ final IMerger merger;
+ if(element instanceof ConflictingDiffElement)
+ merger = MergeFactory.createMerger(element.getSubDiffElements().get(0));
+ else
+ merger = MergeFactory.createMerger(element);
+ if(leftToRight && merger.canUndoInTarget()) {
+ merger.undoInTarget();
+ } else if(!leftToRight && merger.canApplyInOrigin()) {
+ merger.applyInOrigin();
+ }
+ fireMergeDiffEnd(element);
+ }
+
+ /**
+ * Notifies all registered listeners that a {@link DiffElement} has just been merged.
+ *
+ * @param diff
+ * {@link DiffElement} which has just been merged.
+ */
+ protected static void fireMergeDiffEnd(DiffElement diff) {
+ for(IMergeListener listener : MERGE_LISTENERS)
+ listener.mergeDiffEnd(new MergeEvent(diff));
+ }
+
+ /**
+ * Notifies all registered listeners that a DiffElement is about to be merged.
+ *
+ * @param diff
+ * {@link DiffElement} which is about to be merged.
+ */
+ protected static void fireMergeDiffStart(DiffElement diff) {
+ for(IMergeListener listener : MERGE_LISTENERS)
+ listener.mergeDiffStart(new MergeEvent(diff));
+ }
+
+ /**
+ * Notifies all registered listeners that a merge operation on a single diff just ended.
+ *
+ * @param diff
+ * {@link DiffElement} which has just been merged.
+ */
+ protected static void fireMergeOperationEnd(DiffElement diff) {
+ for(IMergeListener listener : MERGE_LISTENERS)
+ listener.mergeOperationEnd(new MergeEvent(diff));
+ }
+
+ /**
+ * Notifies all registered listeners that a merge operation has ended for a list of differences.
+ *
+ * @param diffs
+ * {@link DiffElement}s which have been merged.
+ */
+ protected static void fireMergeOperationEnd(List<DiffElement> diffs) {
+ for(IMergeListener listener : MERGE_LISTENERS)
+ listener.mergeOperationEnd(new MergeEvent(diffs));
+ }
+
+ /**
+ * Notifies all registered listeners that a merge operation is about to start for a single diff.
+ *
+ * @param diff
+ * {@link DiffElement} which is about to be merged.
+ */
+ protected static void fireMergeOperationStart(DiffElement diff) {
+ for(IMergeListener listener : MERGE_LISTENERS)
+ listener.mergeOperationStart(new MergeEvent(diff));
+ }
+
+ /**
+ * Notifies all registered listeners that a merge operation is about to start for a list of differences.
+ *
+ * @param diffs
+ * {@link DiffElement}s which are about to be merged.
+ */
+ protected static void fireMergeOperationStart(List<DiffElement> diffs) {
+ for(IMergeListener listener : MERGE_LISTENERS)
+ listener.mergeOperationStart(new MergeEvent(diffs));
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusCompareOptions.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusCompareOptions.java new file mode 100644 index 00000000000..fcbb24040c8 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusCompareOptions.java @@ -0,0 +1,53 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.utils;
+
+/**
+ *
+ * This class provides the keys for options managed by Papyrus Compare
+ *
+ */
+public class PapyrusCompareOptions {
+
+ private PapyrusCompareOptions() {
+ //to prevent instanciation
+ }
+
+ /**
+ * the keys to define the merge from left to right is enabled or not
+ */
+ public static final String KEY_ALLOW_MERGE_LEFT_TO_RIGHT = "allow_merge_left_to_right"; //$NON-NLS-1$
+
+ public static final String KEY_ALLOW_UNDO_IN_TARGET = KEY_ALLOW_MERGE_LEFT_TO_RIGHT;
+
+ /**
+ * the keys to define the merge from right to left is enabled or not
+ */
+ public static final String KEY_ALLOW_MERGE_RIGHT_TO_LEFT = "allow_merge_right_to_left"; //$NON-NLS-1$
+
+ public static final String KEY_ALLOW_APPLY_IN_ORIGIN = KEY_ALLOW_MERGE_RIGHT_TO_LEFT;
+
+ /**
+ * this key allows to ignore all changes on features
+ * the value associated to this key must be a list of EStructuralFeature to ignore
+ */
+ public static final String KEY_IGNORE_ALL_CHANGES_ON_FEATURES = "ignore_all_changes_on_features";
+
+ /**
+ * this key allows to define features changes to ignore for some elements
+ * the value linked to this key should be a Map<EStructuralFeature, List<EObject>>
+ */
+ public static final String KEY_IGNORE_CHANGES_ON_FEATURES_FOR = "ignore_changes_on_features_for";
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusCompareOptionsUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusCompareOptionsUtils.java new file mode 100644 index 00000000000..f54cc7005b1 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusCompareOptionsUtils.java @@ -0,0 +1,45 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.utils;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+
+/**
+ *
+ * Utils class for Papyrus Compare Options
+ *
+ */
+public class PapyrusCompareOptionsUtils {
+
+ private PapyrusCompareOptionsUtils() {
+ //to prevent instanciation
+ }
+
+ /**
+ *
+ * @param el
+ * a DiffElement
+ * @return
+ * the PapyrusCompareOptions instances attached to the DiffElement if it exists, or <code>null</code> if not found
+ */
+ public static final PapyrusOptionsAdapter getPapyrusOptionsAdapter(final DiffElement el) {
+ for(final Adapter current : el.eAdapters()) {
+ if(current instanceof PapyrusOptionsAdapter) {
+ return (PapyrusOptionsAdapter)current;
+ }
+ }
+ return null;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusOptionsAdapter.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusOptionsAdapter.java new file mode 100644 index 00000000000..b5d389f1798 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.diff/src/org/eclipse/papyrus/infra/emf/compare/diff/utils/PapyrusOptionsAdapter.java @@ -0,0 +1,93 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.diff.utils;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+
+/**
+ *
+ * This class is used to "add" options to DiffElement for the merge action
+ *
+ */
+public class PapyrusOptionsAdapter extends AdapterImpl {
+
+ /**
+ * the options used for the comparison
+ */
+ final private Map<String, Object> options;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param options
+ * the options used for the comparison
+ */
+ public PapyrusOptionsAdapter(final Map<String, Object> options) {
+ this.options = options;
+ }
+
+ /**
+ *
+ */
+ public PapyrusOptionsAdapter() {
+ this.options = new HashMap<String, Object>();
+ }
+
+ /**
+ *
+ * @return
+ * true if the registered options allows to apply the diff in origin (right to left)
+ */
+ public boolean canApplyInOrigin() {
+ final Boolean value = (Boolean)this.options.get(PapyrusCompareOptions.KEY_ALLOW_APPLY_IN_ORIGIN);
+ if(value == null) {
+ return true;
+ }
+ return value.booleanValue();
+ }
+
+ /**
+ *
+ * @return
+ * true if the registered options allows to undo the diff in target (left to right)
+ */
+ public boolean canUndoInTarget() {
+ final Boolean value = (Boolean)this.options.get(PapyrusCompareOptions.KEY_ALLOW_UNDO_IN_TARGET);
+ if(value == null) {
+ return true;
+ }
+ return value.booleanValue();
+ }
+
+ /**
+ * @see #canApplyInOrigin()
+ *
+ */
+ public boolean canMergeRightToLeft() {
+ return canApplyInOrigin();
+ }
+
+ /**
+ *
+ * @see #canUndoInTarget()
+ */
+ public boolean canMergeLeftToRight() {
+ return canUndoInTarget();
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/.classpath new file mode 100644 index 00000000000..cedf0d0d0b5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/.project new file mode 100644 index 00000000000..ac1aeaf01e8 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.emf.compare.instance</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..34090d0977d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance,
+ org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl,
+ org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.util
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.ecore;visibility:=reexport
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.compare.instance;si
+ ngleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/build.properties new file mode 100644 index 00000000000..ada6fef661e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/build.properties @@ -0,0 +1,23 @@ +# Copyright (c) 2012 CEA LIST.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+#
+#
+
+bin.includes = .,\
+ model/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+jars.compile.order = .
+source.. = src-gen/
+output.. = bin/
+src.includes = about.html,\
+ plugin.pdoc
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/model/papyrusemfcompareinstance.ecore b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/model/papyrusemfcompareinstance.ecore new file mode 100644 index 00000000000..ec1c6a57241 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/model/papyrusemfcompareinstance.ecore @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="papyrusemfcompareinstance" nsURI="http://www.eclipse.org/Papyrus/EMFCompare/0.9.0/papyrusemfcompareinstance"
+ nsPrefix="papyrusemfcompareinstance">
+ <eClassifiers xsi:type="ecore:EClass" name="PapyrusEMFCompareInstance" eSuperTypes="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="left" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="right" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
+ changeable="false" volatile="true" transient="true" derived="true"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/model/papyrusemfcompareinstance.genmodel b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/model/papyrusemfcompareinstance.genmodel new file mode 100644 index 00000000000..a7c11d9a84e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/model/papyrusemfcompareinstance.genmodel @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText=" Copyright (c) 2012 CEA LIST.

 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at
 http://www.eclipse.org/legal/epl-v10.html

 Contributors:
 Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation

"
+ modelDirectory="/org.eclipse.papyrus.infra.emf.compare.instance/src-gen" editDirectory="/org.eclipse.papyrus.infra.emf.compare.instance.edit/src-gen"
+ editorDirectory="/org.eclipse.papyrus.infra.emf.compare.instance.editor/src-gen"
+ modelPluginID="org.eclipse.papyrus.infra.emf.compare.instance" modelName="Papyrusemfcompareinstance"
+ testsDirectory="/org.eclipse.papyrus.infra.emf.compare.instance.tests/src-gen"
+ importerID="org.eclipse.emf.importer.ecore" complianceLevel="5.0" copyrightFields="false"
+ language="" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore">
+ <foreignModel>papyrusemfcompareinstance.ecore</foreignModel>
+ <genPackages prefix="Papyrusemfcompareinstance" basePackage="org.eclipse.papyrus.infra.emf.compare.instance"
+ disposableProviderFactory="true" ecorePackage="papyrusemfcompareinstance.ecore#/">
+ <genClasses ecoreClass="papyrusemfcompareinstance.ecore#//PapyrusEMFCompareInstance">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference papyrusemfcompareinstance.ecore#//PapyrusEMFCompareInstance/left"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference papyrusemfcompareinstance.ecore#//PapyrusEMFCompareInstance/right"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute papyrusemfcompareinstance.ecore#//PapyrusEMFCompareInstance/type"/>
+ <genFeatures property="Readonly" createChild="false" ecoreFeature="ecore:EAttribute papyrusemfcompareinstance.ecore#//PapyrusEMFCompareInstance/name"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.pdoc b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.pdoc new file mode 100644 index 00000000000..ee8ae1c0c5d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.pdoc @@ -0,0 +1,4 @@ +<?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 the model for the CompareEditor.">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.properties new file mode 100644 index 00000000000..6b8785aebaa --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.properties @@ -0,0 +1,12 @@ +# 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
+#
+
+pluginName = Papyrus Compare Editor Model (Incubation)
+providerName = Eclipse Modeling Project
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.xml b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.xml new file mode 100644 index 00000000000..562ac33eed1 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/plugin.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.emf.ecore.generated_package">
+ <package
+ class="org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage"
+ genModel="model/papyrusemfcompareinstance.genmodel"
+ uri="http://www.eclipse.org/Papyrus/EMFCompare/0.9.0/papyrusemfcompareinstance">
+ </package>
+ </extension>
+
+</plugin>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusEMFCompareInstance.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusEMFCompareInstance.java new file mode 100644 index 00000000000..4faf447f738 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusEMFCompareInstance.java @@ -0,0 +1,132 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance;
+
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Papyrus EMF Compare Instance</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getLeft <em>Left</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getRight <em>Right</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getType <em>Type</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage#getPapyrusEMFCompareInstance()
+ * @model
+ * @generated
+ */
+public interface PapyrusEMFCompareInstance extends EModelElement {
+ /**
+ * Returns the value of the '<em><b>Left</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Left</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Left</em>' reference.
+ * @see #setLeft(EObject)
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage#getPapyrusEMFCompareInstance_Left()
+ * @model
+ * @generated
+ */
+ EObject getLeft();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getLeft <em>Left</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Left</em>' reference.
+ * @see #getLeft()
+ * @generated
+ */
+ void setLeft(EObject value);
+
+ /**
+ * Returns the value of the '<em><b>Right</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Right</em>' reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Right</em>' reference.
+ * @see #setRight(EObject)
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage#getPapyrusEMFCompareInstance_Right()
+ * @model
+ * @generated
+ */
+ EObject getRight();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getRight <em>Right</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Right</em>' reference.
+ * @see #getRight()
+ * @generated
+ */
+ void setRight(EObject value);
+
+ /**
+ * Returns the value of the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Type</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Type</em>' attribute.
+ * @see #setType(String)
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage#getPapyrusEMFCompareInstance_Type()
+ * @model
+ * @generated
+ */
+ String getType();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getType <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Type</em>' attribute.
+ * @see #getType()
+ * @generated
+ */
+ void setType(String value);
+
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage#getPapyrusEMFCompareInstance_Name()
+ * @model transient="true" changeable="false" volatile="true" derived="true"
+ * @generated
+ */
+ String getName();
+
+} // PapyrusEMFCompareInstance
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusemfcompareinstanceFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusemfcompareinstanceFactory.java new file mode 100644 index 00000000000..592998ebd58 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusemfcompareinstanceFactory.java @@ -0,0 +1,53 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage
+ * @generated
+ */
+public interface PapyrusemfcompareinstanceFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ PapyrusemfcompareinstanceFactory eINSTANCE = org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusemfcompareinstanceFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Papyrus EMF Compare Instance</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Papyrus EMF Compare Instance</em>'.
+ * @generated
+ */
+ PapyrusEMFCompareInstance createPapyrusEMFCompareInstance();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ PapyrusemfcompareinstancePackage getPapyrusemfcompareinstancePackage();
+
+} //PapyrusemfcompareinstanceFactory
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusemfcompareinstancePackage.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusemfcompareinstancePackage.java new file mode 100644 index 00000000000..462487ee04b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/PapyrusemfcompareinstancePackage.java @@ -0,0 +1,255 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstanceFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface PapyrusemfcompareinstancePackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "papyrusemfcompareinstance";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/Papyrus/EMFCompare/0.9.0/papyrusemfcompareinstance";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "papyrusemfcompareinstance";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ PapyrusemfcompareinstancePackage eINSTANCE = org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusemfcompareinstancePackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusEMFCompareInstanceImpl <em>Papyrus EMF Compare Instance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusEMFCompareInstanceImpl
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusemfcompareinstancePackageImpl#getPapyrusEMFCompareInstance()
+ * @generated
+ */
+ int PAPYRUS_EMF_COMPARE_INSTANCE = 0;
+
+ /**
+ * The feature id for the '<em><b>EAnnotations</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_EMF_COMPARE_INSTANCE__EANNOTATIONS = EcorePackage.EMODEL_ELEMENT__EANNOTATIONS;
+
+ /**
+ * The feature id for the '<em><b>Left</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_EMF_COMPARE_INSTANCE__LEFT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Right</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_EMF_COMPARE_INSTANCE__TYPE = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_EMF_COMPARE_INSTANCE__NAME = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 3;
+
+ /**
+ * The number of structural features of the '<em>Papyrus EMF Compare Instance</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int PAPYRUS_EMF_COMPARE_INSTANCE_FEATURE_COUNT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 4;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance <em>Papyrus EMF Compare Instance</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Papyrus EMF Compare Instance</em>'.
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance
+ * @generated
+ */
+ EClass getPapyrusEMFCompareInstance();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getLeft <em>Left</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Left</em>'.
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getLeft()
+ * @see #getPapyrusEMFCompareInstance()
+ * @generated
+ */
+ EReference getPapyrusEMFCompareInstance_Left();
+
+ /**
+ * Returns the meta object for the reference '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getRight <em>Right</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the reference '<em>Right</em>'.
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getRight()
+ * @see #getPapyrusEMFCompareInstance()
+ * @generated
+ */
+ EReference getPapyrusEMFCompareInstance_Right();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getType <em>Type</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Type</em>'.
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getType()
+ * @see #getPapyrusEMFCompareInstance()
+ * @generated
+ */
+ EAttribute getPapyrusEMFCompareInstance_Type();
+
+ /**
+ * Returns the meta object for the attribute '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getName <em>Name</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for the attribute '<em>Name</em>'.
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance#getName()
+ * @see #getPapyrusEMFCompareInstance()
+ * @generated
+ */
+ EAttribute getPapyrusEMFCompareInstance_Name();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ PapyrusemfcompareinstanceFactory getPapyrusemfcompareinstanceFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusEMFCompareInstanceImpl <em>Papyrus EMF Compare Instance</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusEMFCompareInstanceImpl
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusemfcompareinstancePackageImpl#getPapyrusEMFCompareInstance()
+ * @generated
+ */
+ EClass PAPYRUS_EMF_COMPARE_INSTANCE = eINSTANCE.getPapyrusEMFCompareInstance();
+
+ /**
+ * The meta object literal for the '<em><b>Left</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference PAPYRUS_EMF_COMPARE_INSTANCE__LEFT = eINSTANCE.getPapyrusEMFCompareInstance_Left();
+
+ /**
+ * The meta object literal for the '<em><b>Right</b></em>' reference feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EReference PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT = eINSTANCE.getPapyrusEMFCompareInstance_Right();
+
+ /**
+ * The meta object literal for the '<em><b>Type</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PAPYRUS_EMF_COMPARE_INSTANCE__TYPE = eINSTANCE.getPapyrusEMFCompareInstance_Type();
+
+ /**
+ * The meta object literal for the '<em><b>Name</b></em>' attribute feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ EAttribute PAPYRUS_EMF_COMPARE_INSTANCE__NAME = eINSTANCE.getPapyrusEMFCompareInstance_Name();
+
+ }
+
+} //PapyrusemfcompareinstancePackage
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusEMFCompareInstanceImpl.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusEMFCompareInstanceImpl.java new file mode 100644 index 00000000000..b9124f606e4 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusEMFCompareInstanceImpl.java @@ -0,0 +1,323 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.EModelElementImpl;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Papyrus EMF Compare Instance</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusEMFCompareInstanceImpl#getLeft <em>Left</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusEMFCompareInstanceImpl#getRight <em>Right</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusEMFCompareInstanceImpl#getType <em>Type</em>}</li>
+ * <li>{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl.PapyrusEMFCompareInstanceImpl#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class PapyrusEMFCompareInstanceImpl extends EModelElementImpl implements PapyrusEMFCompareInstance {
+ /**
+ * The cached value of the '{@link #getLeft() <em>Left</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLeft()
+ * @generated
+ * @ordered
+ */
+ protected EObject left;
+
+ /**
+ * The cached value of the '{@link #getRight() <em>Right</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRight()
+ * @generated
+ * @ordered
+ */
+ protected EObject right;
+
+ /**
+ * The default value of the '{@link #getType() <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected static final String TYPE_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getType() <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getType()
+ * @generated
+ * @ordered
+ */
+ protected String type = TYPE_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getName() <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getName()
+ * @generated
+ * @ordered
+ */
+ protected static final String NAME_EDEFAULT = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PapyrusEMFCompareInstanceImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return PapyrusemfcompareinstancePackage.Literals.PAPYRUS_EMF_COMPARE_INSTANCE;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getLeft() {
+ if (left != null && left.eIsProxy()) {
+ InternalEObject oldLeft = (InternalEObject)left;
+ left = eResolveProxy(oldLeft);
+ if (left != oldLeft) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__LEFT, oldLeft, left));
+ }
+ }
+ return left;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetLeft() {
+ return left;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLeft(EObject newLeft) {
+ EObject oldLeft = left;
+ left = newLeft;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__LEFT, oldLeft, left));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getRight() {
+ if (right != null && right.eIsProxy()) {
+ InternalEObject oldRight = (InternalEObject)right;
+ right = eResolveProxy(oldRight);
+ if (right != oldRight) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT, oldRight, right));
+ }
+ }
+ return right;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetRight() {
+ return right;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setRight(EObject newRight) {
+ EObject oldRight = right;
+ right = newRight;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT, oldRight, right));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setType(String newType) {
+ String oldType = type;
+ type = newType;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__TYPE, oldType, type));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ // TODO: use the method described here :
+ //http://www.eclipse.org/articles/article.php?file=Article-EMF-Codegen-with-OCL/index.html
+
+ return "Compare" + left.toString() + "/" + right.toString();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__LEFT:
+ if (resolve) return getLeft();
+ return basicGetLeft();
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT:
+ if (resolve) return getRight();
+ return basicGetRight();
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__TYPE:
+ return getType();
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__NAME:
+ return getName();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__LEFT:
+ setLeft((EObject)newValue);
+ return;
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT:
+ setRight((EObject)newValue);
+ return;
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__TYPE:
+ setType((String)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__LEFT:
+ setLeft((EObject)null);
+ return;
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT:
+ setRight((EObject)null);
+ return;
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__TYPE:
+ setType(TYPE_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__LEFT:
+ return left != null;
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT:
+ return right != null;
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__TYPE:
+ return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE__NAME:
+ return NAME_EDEFAULT == null ? getName() != null : !NAME_EDEFAULT.equals(getName());
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (type: ");
+ result.append(type);
+ result.append(')');
+ return result.toString();
+ }
+
+} //PapyrusEMFCompareInstanceImpl
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusemfcompareinstanceFactoryImpl.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusemfcompareinstanceFactoryImpl.java new file mode 100644 index 00000000000..db26f1cab43 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusemfcompareinstanceFactoryImpl.java @@ -0,0 +1,106 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class PapyrusemfcompareinstanceFactoryImpl extends EFactoryImpl implements PapyrusemfcompareinstanceFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static PapyrusemfcompareinstanceFactory init() {
+ try {
+ PapyrusemfcompareinstanceFactory thePapyrusemfcompareinstanceFactory = (PapyrusemfcompareinstanceFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/Papyrus/EMFCompare/0.9.0/papyrusemfcompareinstance");
+ if (thePapyrusemfcompareinstanceFactory != null) {
+ return thePapyrusemfcompareinstanceFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new PapyrusemfcompareinstanceFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrusemfcompareinstanceFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE: return createPapyrusEMFCompareInstance();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrusEMFCompareInstance createPapyrusEMFCompareInstance() {
+ PapyrusEMFCompareInstanceImpl papyrusEMFCompareInstance = new PapyrusEMFCompareInstanceImpl();
+ return papyrusEMFCompareInstance;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrusemfcompareinstancePackage getPapyrusemfcompareinstancePackage() {
+ return (PapyrusemfcompareinstancePackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static PapyrusemfcompareinstancePackage getPackage() {
+ return PapyrusemfcompareinstancePackage.eINSTANCE;
+ }
+
+} //PapyrusemfcompareinstanceFactoryImpl
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusemfcompareinstancePackageImpl.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusemfcompareinstancePackageImpl.java new file mode 100644 index 00000000000..b0cdf465582 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/impl/PapyrusemfcompareinstancePackageImpl.java @@ -0,0 +1,230 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.impl;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstanceFactory;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class PapyrusemfcompareinstancePackageImpl extends EPackageImpl implements PapyrusemfcompareinstancePackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass papyrusEMFCompareInstanceEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private PapyrusemfcompareinstancePackageImpl() {
+ super(eNS_URI, PapyrusemfcompareinstanceFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link PapyrusemfcompareinstancePackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static PapyrusemfcompareinstancePackage init() {
+ if (isInited) return (PapyrusemfcompareinstancePackage)EPackage.Registry.INSTANCE.getEPackage(PapyrusemfcompareinstancePackage.eNS_URI);
+
+ // Obtain or create and register package
+ PapyrusemfcompareinstancePackageImpl thePapyrusemfcompareinstancePackage = (PapyrusemfcompareinstancePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof PapyrusemfcompareinstancePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new PapyrusemfcompareinstancePackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ EcorePackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ thePapyrusemfcompareinstancePackage.createPackageContents();
+
+ // Initialize created meta-data
+ thePapyrusemfcompareinstancePackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ thePapyrusemfcompareinstancePackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(PapyrusemfcompareinstancePackage.eNS_URI, thePapyrusemfcompareinstancePackage);
+ return thePapyrusemfcompareinstancePackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getPapyrusEMFCompareInstance() {
+ return papyrusEMFCompareInstanceEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getPapyrusEMFCompareInstance_Left() {
+ return (EReference)papyrusEMFCompareInstanceEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getPapyrusEMFCompareInstance_Right() {
+ return (EReference)papyrusEMFCompareInstanceEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getPapyrusEMFCompareInstance_Type() {
+ return (EAttribute)papyrusEMFCompareInstanceEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getPapyrusEMFCompareInstance_Name() {
+ return (EAttribute)papyrusEMFCompareInstanceEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrusemfcompareinstanceFactory getPapyrusemfcompareinstanceFactory() {
+ return (PapyrusemfcompareinstanceFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ papyrusEMFCompareInstanceEClass = createEClass(PAPYRUS_EMF_COMPARE_INSTANCE);
+ createEReference(papyrusEMFCompareInstanceEClass, PAPYRUS_EMF_COMPARE_INSTANCE__LEFT);
+ createEReference(papyrusEMFCompareInstanceEClass, PAPYRUS_EMF_COMPARE_INSTANCE__RIGHT);
+ createEAttribute(papyrusEMFCompareInstanceEClass, PAPYRUS_EMF_COMPARE_INSTANCE__TYPE);
+ createEAttribute(papyrusEMFCompareInstanceEClass, PAPYRUS_EMF_COMPARE_INSTANCE__NAME);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ EcorePackage theEcorePackage = (EcorePackage)EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ papyrusEMFCompareInstanceEClass.getESuperTypes().add(theEcorePackage.getEModelElement());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(papyrusEMFCompareInstanceEClass, PapyrusEMFCompareInstance.class, "PapyrusEMFCompareInstance", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getPapyrusEMFCompareInstance_Left(), theEcorePackage.getEObject(), null, "left", null, 0, 1, PapyrusEMFCompareInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEReference(getPapyrusEMFCompareInstance_Right(), theEcorePackage.getEObject(), null, "right", null, 0, 1, PapyrusEMFCompareInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPapyrusEMFCompareInstance_Type(), ecorePackage.getEString(), "type", null, 0, 1, PapyrusEMFCompareInstance.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getPapyrusEMFCompareInstance_Name(), ecorePackage.getEString(), "name", null, 0, 1, PapyrusEMFCompareInstance.class, IS_TRANSIENT, IS_VOLATILE, !IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //PapyrusemfcompareinstancePackageImpl
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/util/PapyrusemfcompareinstanceAdapterFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/util/PapyrusemfcompareinstanceAdapterFactory.java new file mode 100644 index 00000000000..f86f310f188 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/util/PapyrusemfcompareinstanceAdapterFactory.java @@ -0,0 +1,150 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage
+ * @generated
+ */
+public class PapyrusemfcompareinstanceAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static PapyrusemfcompareinstancePackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrusemfcompareinstanceAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = PapyrusemfcompareinstancePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected PapyrusemfcompareinstanceSwitch<Adapter> modelSwitch =
+ new PapyrusemfcompareinstanceSwitch<Adapter>() {
+ @Override
+ public Adapter casePapyrusEMFCompareInstance(PapyrusEMFCompareInstance object) {
+ return createPapyrusEMFCompareInstanceAdapter();
+ }
+ @Override
+ public Adapter caseEModelElement(EModelElement object) {
+ return createEModelElementAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance <em>Papyrus EMF Compare Instance</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance
+ * @generated
+ */
+ public Adapter createPapyrusEMFCompareInstanceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.ecore.EModelElement <em>EModel Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.ecore.EModelElement
+ * @generated
+ */
+ public Adapter createEModelElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //PapyrusemfcompareinstanceAdapterFactory
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/util/PapyrusemfcompareinstanceSwitch.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/util/PapyrusemfcompareinstanceSwitch.java new file mode 100644 index 00000000000..8ceef32a19a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.instance/src-gen/org/eclipse/papyrus/infra/emf/compare/instance/papyrusemfcompareinstance/util/PapyrusemfcompareinstanceSwitch.java @@ -0,0 +1,138 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.util;
+
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusemfcompareinstancePackage
+ * @generated
+ */
+public class PapyrusemfcompareinstanceSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static PapyrusemfcompareinstancePackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public PapyrusemfcompareinstanceSwitch() {
+ if (modelPackage == null) {
+ modelPackage = PapyrusemfcompareinstancePackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case PapyrusemfcompareinstancePackage.PAPYRUS_EMF_COMPARE_INSTANCE: {
+ PapyrusEMFCompareInstance papyrusEMFCompareInstance = (PapyrusEMFCompareInstance)theEObject;
+ T result = casePapyrusEMFCompareInstance(papyrusEMFCompareInstance);
+ if (result == null) result = caseEModelElement(papyrusEMFCompareInstance);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Papyrus EMF Compare Instance</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Papyrus EMF Compare Instance</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T casePapyrusEMFCompareInstance(PapyrusEMFCompareInstance object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EModel Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseEModelElement(EModelElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //PapyrusemfcompareinstanceSwitch
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.classpath new file mode 100644 index 00000000000..56a612970ab --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry excluding="org/eclipse/papyrus/infra/emf/compare/ui/provider/ElementContentMergeContentProvider.java|org/eclipse/papyrus/infra/emf/compare/ui/provider/StyledDiffLabelSwitch.java|org/eclipse/papyrus/infra/emf/compare/ui/provider/UMLStyledStructureLabelProvider.java|org/eclipse/papyrus/infra/emf/compare/ui/handler/CompareTwoElementsAction.java" kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.project new file mode 100644 index 00000000000..feedf1324a1 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.project @@ -0,0 +1,29 @@ +<?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.emf.facet.common.ProjectNature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..5152edbd2ac --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,22 @@ +#Thu Dec 01 17:05:06 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.ui.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..4772e74af97 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,59 @@ +#Thu Dec 01 17:06:59 CET 2011
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=true
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=false
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=true
+cleanup.always_use_this_for_non_static_method_access=true
+cleanup.convert_to_enhanced_for_loop=true
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=true
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=true
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=true
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=false
+cleanup_profile=_CustomPapyrusCleanUpProfile
+cleanup_settings_version=2
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..767c5df4c56 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/META-INF/MANIFEST.MF @@ -0,0 +1,42 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.compare,
+ org.eclipse.emf.compare.ui;bundle-version="1.3.1",
+ org.eclipse.emf.facet.infra.browser.custom,
+ org.eclipse.emf.facet.infra.browser.custom.core,
+ org.eclipse.emf.compare;bundle-version="1.3.1",
+ org.eclipse.emf.facet.infra.browser.custom.ui;bundle-version="0.1.1",
+ org.eclipse.emf.workspace.ui,
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.tools;bundle-version="0.10.0",
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="0.10.0",
+ org.eclipse.emf.compare.diff.edit;bundle-version="1.3.1",
+ org.eclipse.emf.compare;bundle-version="1.3.1",
+ org.eclipse.papyrus.infra.emf.compare.diff;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0",
+ org.eclipse.emf.facet.infra.common.core;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0"
+Export-Package: org.eclipse.papyrus.infra.emf.compare.ui,
+ org.eclipse.papyrus.infra.emf.compare.ui.actions,
+ org.eclipse.papyrus.infra.emf.compare.ui.content.transactional.viewer,
+ org.eclipse.papyrus.infra.emf.compare.ui.content.viewer,
+ org.eclipse.papyrus.infra.emf.compare.ui.internal.utils,
+ org.eclipse.papyrus.infra.emf.compare.ui.messages,
+ org.eclipse.papyrus.infra.emf.compare.ui.provider,
+ org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer,
+ org.eclipse.papyrus.infra.emf.compare.ui.utils
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.emf.compare.ui.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.emf.compare.ui;singleto
+ n:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/build.properties new file mode 100644 index 00000000000..03b56f02261 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/build.properties @@ -0,0 +1,12 @@ +output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/,\
+ about.html,\
+ build.properties,\
+ plugin.pdoc,\
+ plugin.properties,\
+ resources/
+src.includes = about.html
+source.. = src/
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/PapyrusLogo16x16.gif b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/PapyrusLogo16x16.gif Binary files differnew file mode 100644 index 00000000000..8a31f458379 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/PapyrusLogo16x16.gif diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gif b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gif Binary files differnew file mode 100644 index 00000000000..bc86fbc897e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/addUiCustom.gif diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/add_ui_custom.gif b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/add_ui_custom.gif Binary files differnew file mode 100644 index 00000000000..bc86fbc897e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/add_ui_custom.gif diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/expandall.gif b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/expandall.gif Binary files differnew file mode 100644 index 00000000000..0205b29176d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/icons/expandall.gif diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.pdoc b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.pdoc new file mode 100644 index 00000000000..ba047240cde --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.pdoc @@ -0,0 +1,4 @@ +<?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 progin provides viewers which allows the customization of the viewer using emf-facet.
It provides a viewer for Undo/Redo actions too.
This plugin should not have dependencies on gmf.notation.diagram and uml.">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.properties new file mode 100644 index 00000000000..aae16d003fc --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.papyrus.infra.emf.compare.ui
+providerName = Eclipse Modeling Project
+pluginName = Papyrus Compare UI (Incubation)
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.xml b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.xml new file mode 100644 index 00000000000..b851b34add6 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/plugin.xml @@ -0,0 +1,51 @@ +<?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.content.viewer.PapyrusCustomizableContentMergeViewerCreator" extensions="ecore, uml" id="org.eclipse.papyrus.infra.emf.compare.ui.papyrus.viewer" label="Papyrus Customizable Content Merge Viewer">
+ </viewer>
+ </extension>
+ <extension point="org.eclipse.compare.structureMergeViewers">
+ <!--I add uml here, but it is not really a dependency-->
+ <viewer class="org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer.PapyrusStructureMergeViewerCreator" extensions="ecore, uml" id="org.eclipse.papyrus.infra.emf.compare.ui.structural.viewer" label="Papyrus Customizable Structure Merge Viewer">
+ </viewer>
+ </extension>
+
+
+ <extension point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
+ <browserCustomization file="resources/compare_diff.uiCustom" loadByDefault="true"/>
+ </extension>
+ <extension point="org.eclipse.emf.facet.infra.query.registration">
+ <modelqueryset file="resources/compare_diff.querySet"/>
+ </extension>
+ <!--
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.ui.popup.any">
+ <command
+ commandId="org.eclipse.compare.compareWithOther"
+ label="Papyrus Compare With Each Other"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.infra.emf.compare.ui.handler.CompareTwoElementsAction"
+ commandId="org.eclipse.compare.compareWithOther">
+ <activeWhen>
+ <with
+ variable="activePartId">
+ <equals
+ value="org.eclipse.papyrus.views.modelexplorer.modelexplorer">
+ </equals>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+ -->
+</plugin>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/resources/compare_diff.querySet b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/resources/compare_diff.querySet new file mode 100644 index 00000000000..bd43e9ea6b7 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/resources/compare_diff.querySet @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="ASCII"?>
+<query:ModelQuerySet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="compare_diff">
+ <associatedMetamodels href="http://www.eclipse.org/emf/2002/Ecore#/"/>
+ <queries xsi:type="query:JavaModelQuery" name="GetDiffElementLabel" description="This query returns the label for the element" implementationClassName="org.eclipse.papyrus.infra.emf.compare.ui.queries.GetDiffElementLabel">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <scope href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ </queries>
+</query:ModelQuerySet>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/resources/compare_diff.uiCustom b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/resources/compare_diff.uiCustom new file mode 100644 index 00000000000..a4e58fbe85a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/resources/compare_diff.uiCustom @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="ASCII"?>
+<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/emf/compare/diff/1.1">
+ <types metaclassName="diff.DiffElement">
+ <customizedFeatures customizedFeature="hideMetaclassName">
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
+ </customizedFeatures>
+ <customizedFeatures customizedFeature="label">
+ <defaultValue xsi:type="uicustom:DerivedFeatureValue">
+ <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/compare_diff#GetDiffElementLabel"/>
+ </defaultValue>
+ </customizedFeatures>
+ </types>
+</uicustom:MetamodelView>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/Activator.java new file mode 100644 index 00000000000..2fdb141a171 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/Activator.java @@ -0,0 +1,71 @@ +/*****************************************************************************
+ * 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 org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ /** The plug-in ID */
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.emf.compare.ui"; //$NON-NLS-1$
+
+ /** the activator */
+ private static Activator plugin;
+
+ /** the log helper for this plugin */
+ 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);
+ log = new LogHelper(this);
+ Activator.plugin = this;
+ }
+
+ /*
+ * (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);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CollapseAllAction.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CollapseAllAction.java new file mode 100644 index 00000000000..4b68d5bc691 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CollapseAllAction.java @@ -0,0 +1,89 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.actions;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.ui.messages.Messages;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ *
+ * This action allows to collpase TreeViewer
+ *
+ */
+public class CollapseAllAction extends Action {
+
+ /** icon path for the collapse all action */
+ private static final String TOOLTIPTEXT = Messages.CollapseAllAction_CollapseAll;
+
+ /** the list of the TreeViewer expanded by this action */
+ final private Collection<TreeViewer> treeList;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tree
+ * the tree to manage
+ */
+ public CollapseAllAction(final TreeViewer tree) {
+ super(IAction.TOOL_TIP_TEXT, IAction.AS_PUSH_BUTTON);
+ treeList = new ArrayList<TreeViewer>();
+ treeList.add(tree);
+ init();
+
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param trees
+ * the list of the tree to expand
+ */
+ public CollapseAllAction(final Collection<TreeViewer> trees) {
+ super(IAction.TOOL_TIP_TEXT, IAction.AS_PUSH_BUTTON);
+ treeList = new ArrayList<TreeViewer>(trees);
+ init();
+
+
+ }
+
+ /**
+ * set the image and the tooltip for this action
+ */
+ protected void init() {
+ setToolTipText(CollapseAllAction.TOOLTIPTEXT);
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, ISharedImages.IMG_ELCL_COLLAPSEALL));
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ *
+ */
+ @Override
+ public void run() {
+ for(TreeViewer tree : treeList) {
+ tree.collapseAll();
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CustomizationAction.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CustomizationAction.java new file mode 100644 index 00000000000..19a27df0146 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/CustomizationAction.java @@ -0,0 +1,118 @@ +/*****************************************************************************
+ * 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.compare.CompareEditorInput;
+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.resource.ImageDescriptor;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.CustomizationAndViewerActionDispatcher;
+import org.eclipse.papyrus.infra.emf.compare.ui.messages.Messages;
+import org.eclipse.papyrus.infra.tools.util.EditorHelper;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * @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 = Messages.CustomizationAction_ManageAppliedCustomization;
+
+ //FIXME imageProvider: avoid to duplicate this image, use the future service image provider?
+ private static final String CUSTOMIZATION_IMAGE_PATH = "icons/add_ui_custom.gif"; //$NON-NLS-1$
+
+ /**
+ * 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);
+ ImageDescriptor desc = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor(Activator.PLUGIN_ID, CustomizationAction.CUSTOMIZATION_IMAGE_PATH);
+ setImageDescriptor(desc);
+ this.registeredMetamodel = registeredMetamodel;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ */
+ //FIXME duplicate code from ModelExplorer
+ //FIXME duplicate in the table ?
+ @Override
+ public void run() {
+ IEditorPart currentEditor = EditorHelper.getCurrentEditor();
+ if(currentEditor instanceof IMultiPageEditorPart) {
+ currentEditor = ((IMultiPageEditorPart)currentEditor).getActiveEditor();
+ }
+
+ final CustomizationManager customizationManager = CustomizationAndViewerActionDispatcher.getCustomizationManager(currentEditor);
+ assert customizationManager != null;
+
+ 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();
+ }
+
+
+ if(currentEditor instanceof IPropertyChangeListener) {//implemented by CompareEditor
+ //we refresh the name of the tab in Papyrus
+ ((IPropertyChangeListener)currentEditor).propertyChange(new PropertyChangeEvent(IAction.class, CompareEditorInput.PROP_TITLE, "", "")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ CustomizationAndViewerActionDispatcher.refreshViewers(currentEditor);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/ExpandAllAction.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/ExpandAllAction.java new file mode 100644 index 00000000000..0f3f162cd91 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/actions/ExpandAllAction.java @@ -0,0 +1,89 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.actions;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.ui.messages.Messages;
+
+/**
+ *
+ * This action allows to expand TreeViewer
+ *
+ */
+public class ExpandAllAction extends Action {
+
+ /** Tooltip for the expand all action */
+ private static final String TOOLTIPTEXT = Messages.ExpandAllAction_ExpandAll;
+
+ /** icon path for the expand all action */
+ private static final String EXPAND_ALL_IMAGE_PATH = "icons/expandall.gif"; //$NON-NLS-1$
+
+ /** the list of the TreeViewer expanded by this action */
+ final private Collection<TreeViewer> treeList;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param tree
+ * the tree to manage
+ */
+ public ExpandAllAction(final TreeViewer tree) {
+ super(IAction.TOOL_TIP_TEXT, IAction.AS_PUSH_BUTTON);
+ treeList = new ArrayList<TreeViewer>();
+ treeList.add(tree);
+ init();
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param trees
+ * the list of the tree to expand
+ */
+ public ExpandAllAction(final Collection<TreeViewer> trees) {
+ super(IAction.TOOL_TIP_TEXT, IAction.AS_PUSH_BUTTON);
+ treeList = new ArrayList<TreeViewer>(trees);
+ init();
+ }
+
+ /**
+ * set the image and the tooltip for this action
+ */
+ protected void init() {
+ setToolTipText(ExpandAllAction.TOOLTIPTEXT);
+ ImageDescriptor desc = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImageDescriptor(Activator.PLUGIN_ID, EXPAND_ALL_IMAGE_PATH);
+ setImageDescriptor(desc);
+ }
+
+ /**
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ *
+ */
+ @Override
+ public void run() {
+ for(TreeViewer tree : treeList) {
+ tree.expandAll();
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/transactional/viewer/PapyrusTransactionalContentMergeViewerCreator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/transactional/viewer/PapyrusTransactionalContentMergeViewerCreator.java new file mode 100644 index 00000000000..25bafb70510 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/transactional/viewer/PapyrusTransactionalContentMergeViewerCreator.java @@ -0,0 +1,55 @@ +/*****************************************************************************
+ * 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.content.transactional.viewer;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.IViewerCreator;
+import org.eclipse.compare.internal.CompareEditor;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.tools.util.EditorHelper;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * This class allows to create the MergeViewer when we change the viewer used in CompareEditor
+ *
+ */
+//unused for the moment
+public class PapyrusTransactionalContentMergeViewerCreator implements IViewerCreator {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public PapyrusTransactionalContentMergeViewerCreator() {
+ //nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.compare.IViewerCreator#createViewer(org.eclipse.swt.widgets.Composite, org.eclipse.compare.CompareConfiguration)
+ *
+ * @param parent
+ * @param config
+ * @return
+ */
+ public Viewer createViewer(final Composite parent, final CompareConfiguration config) {
+ final IEditorPart editor = EditorHelper.getCurrentEditor();//the current CompareEditor
+ Assert.isTrue(editor instanceof CompareEditor);
+ return new PapyrusTransactionalModelContentMergeViewer(parent, config, editor);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/transactional/viewer/PapyrusTransactionalModelContentMergeViewer.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/transactional/viewer/PapyrusTransactionalModelContentMergeViewer.java new file mode 100644 index 00000000000..b5718a1464a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/transactional/viewer/PapyrusTransactionalModelContentMergeViewer.java @@ -0,0 +1,211 @@ +/*****************************************************************************
+ * 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.content.transactional.viewer;
+
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.ui.internal.ModelComparator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.workspace.ui.actions.RedoActionWrapper;
+import org.eclipse.emf.workspace.ui.actions.UndoActionWrapper;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.papyrus.infra.emf.compare.diff.merge.ITransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeFactory;
+import org.eclipse.papyrus.infra.emf.compare.ui.content.viewer.PapyrusCustomizableModelContentMergeViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ * This viewer adds the Undo/Redo after a merge action
+ *
+ *
+ */
+public class PapyrusTransactionalModelContentMergeViewer extends PapyrusCustomizableModelContentMergeViewer {
+
+ private IAction _copyDiffLeftToRight;
+
+ private IAction _copyDiffRightToLeft;
+
+ private IAction _copyAllLeftToRight;
+
+ private IAction _copyAllRightToLeft;
+
+ private static final String COPY_ALL_RIGHT_TO_LEFT = "org.eclipse.compare.copyAllRightToLeft";
+
+ private static final String COPY_ALL_LEFT_TO_RIGHT = "org.eclipse.compare.copyAllLeftToRight";
+
+ private static final String COPY_CURRENT_SELECTION_LEFT_TO_RIGHT = "Copy Current Change to Right";
+
+ private static final String COPY_CURRENT_SELECTION_RIGHT_TO_LEFT = "Copy Current Change to Left";
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * @param config
+ */
+ public PapyrusTransactionalModelContentMergeViewer(final Composite parent, final CompareConfiguration config, final IEditorPart editor) {
+ super(parent, config, editor);
+ }
+
+ /**
+ *
+ * {@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) {
+ super.createToolItems(tbm);
+ final Action undoAction = getUndoAction();
+ final Action redoAction = getRedoAction();
+ tbm.insert(0, new ActionContributionItem(undoAction));
+ tbm.insert(1, new ActionContributionItem(redoAction));
+
+ tbm.insert(2, new Separator("undo_redo_group")); //$NON-NLS-1$
+
+ initializeIActionField(tbm);
+ }
+
+ protected Action getUndoAction() {
+ final UndoActionWrapper undoAction = new UndoActionWrapper();
+
+ //we need that the editor will be created to get it and initialize the actions
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ public void run() {
+ IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ undoAction.setActiveWorkbenchPart(editorPart);
+
+ }
+ });
+
+ ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
+ undoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
+
+ return undoAction;
+ }
+
+ protected Action getRedoAction() {
+ final RedoActionWrapper redoAction = new RedoActionWrapper();
+
+ //we need that the editor will be created to get it and initialize the actions
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ public void run() {
+ IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ redoAction.setActiveWorkbenchPart(editorPart);
+ }
+ });
+
+ ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
+ redoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
+ return redoAction;
+ }
+
+
+
+ private void initializeIActionField(final ToolBarManager tbm) {
+ for(IContributionItem item : tbm.getItems()) {
+ if(item instanceof ActionContributionItem) {
+ IAction action = ((ActionContributionItem)item).getAction();
+ final String id = action.getActionDefinitionId();
+ final String txt = action.getText();
+ if(COPY_ALL_LEFT_TO_RIGHT.equals(id)) {
+ _copyAllLeftToRight = action;
+ continue;
+ } else if(COPY_ALL_RIGHT_TO_LEFT.equals(id)) {
+ _copyAllRightToLeft = action;
+ continue;
+ }
+ //TODO post a bug to EMF-Compare in order to have an id for these actions
+ if(COPY_CURRENT_SELECTION_LEFT_TO_RIGHT.equals(txt)) {
+ _copyDiffLeftToRight = action;
+ continue;
+ } else if(COPY_CURRENT_SELECTION_RIGHT_TO_LEFT.equals(txt)) {
+ _copyDiffRightToLeft = action;
+ continue;
+ }
+ }
+ if(_copyAllLeftToRight != null && _copyAllRightToLeft != null && _copyDiffLeftToRight != null && _copyDiffRightToLeft != null) {
+ break;
+ }
+ }
+ }
+
+ @Override
+ protected void switchCopyState(boolean enabled) {
+ final ModelComparator comparator = ModelComparator.getComparator(configuration);
+
+ boolean leftEditable = configuration.isLeftEditable();
+ if(comparator != null)
+ leftEditable = leftEditable && !comparator.isLeftRemote();
+ boolean rightEditable = configuration.isRightEditable();
+ if(comparator != null)
+ rightEditable = rightEditable && !comparator.isRightRemote();
+
+ boolean canCopyLeftToRight = false;
+ boolean canCopyRightToLeft = false;
+
+ boolean canAllCopyLeftToRight = true;
+ boolean canAllCopyRightToLeft = true;
+
+ if(currentSelection.size() == 1) {
+ final ITransactionalMerger merger = TransactionalMergeFactory.createMerger(currentSelection.get(0));
+ canCopyLeftToRight = merger.canUndoInTarget();
+ canCopyRightToLeft = merger.canApplyInOrigin();
+ }
+
+ if(currentSelection.size() > 0) {
+ EObject diffModel = currentSelection.get(0);
+ while(!(diffModel instanceof DiffModel)) {
+ diffModel = diffModel.eContainer();
+ }
+ Assert.isNotNull(diffModel);
+
+ for(DiffElement current : ((DiffModel)diffModel).getDifferences()) {
+ final ITransactionalMerger merger = TransactionalMergeFactory.createMerger(current);
+ canAllCopyLeftToRight = canAllCopyLeftToRight && merger.canUndoInTarget();
+ canAllCopyRightToLeft = canAllCopyRightToLeft && merger.canApplyInOrigin();
+ }
+ }
+
+ if(_copyAllLeftToRight != null) {
+ _copyAllLeftToRight.setEnabled(rightEditable && enabled && canAllCopyLeftToRight);
+ }
+ if(_copyAllRightToLeft != null) {
+ _copyAllRightToLeft.setEnabled(leftEditable && enabled && canAllCopyRightToLeft);
+ }
+ if(_copyDiffLeftToRight != null) {
+ _copyDiffLeftToRight.setEnabled(rightEditable && enabled && canCopyLeftToRight);
+ }
+ if(_copyDiffRightToLeft != null) {
+ _copyDiffRightToLeft.setEnabled(leftEditable && enabled && canCopyRightToLeft);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusCustomizableContentMergeViewerCreator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusCustomizableContentMergeViewerCreator.java new file mode 100644 index 00000000000..00e564e6e6f --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusCustomizableContentMergeViewerCreator.java @@ -0,0 +1,54 @@ +/*****************************************************************************
+ * 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.content.viewer;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.IViewerCreator;
+import org.eclipse.compare.internal.CompareEditor;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.tools.util.EditorHelper;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * This class allows to create the MergeViewer
+ *
+ */
+public class PapyrusCustomizableContentMergeViewerCreator implements IViewerCreator {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public PapyrusCustomizableContentMergeViewerCreator() {
+ //nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.compare.IViewerCreator#createViewer(org.eclipse.swt.widgets.Composite, org.eclipse.compare.CompareConfiguration)
+ *
+ * @param parent
+ * @param config
+ * @return
+ */
+ public Viewer createViewer(Composite parent, CompareConfiguration config) {
+ final IEditorPart editor = EditorHelper.getCurrentEditor();//the current CompareEditor
+ Assert.isTrue(editor instanceof CompareEditor);
+ return new PapyrusCustomizableModelContentMergeViewer(parent, config, editor);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusCustomizableModelContentMergeViewer.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusCustomizableModelContentMergeViewer.java new file mode 100644 index 00000000000..b4bfa306b45 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusCustomizableModelContentMergeViewer.java @@ -0,0 +1,140 @@ +/*****************************************************************************
+ * 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.content.viewer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+
+import org.eclipse.compare.CompareConfiguration;
+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.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.emf.compare.ui.actions.CollapseAllAction;
+import org.eclipse.papyrus.infra.emf.compare.ui.actions.CustomizationAction;
+import org.eclipse.papyrus.infra.emf.compare.ui.actions.ExpandAllAction;
+import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.CustomizationAndViewerActionDispatcher;
+import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.EMFCompareUIUtils;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * This viewer allows to customize the displayed elements using EMF-Facet
+ *
+ */
+public class PapyrusCustomizableModelContentMergeViewer extends ModelContentMergeViewer {
+
+ /** the list of the metamodels referenced in the compared files. this field is used by the Customization Manager */
+ private Collection<EPackage> metamodels;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param parent
+ * @param config
+ */
+ public PapyrusCustomizableModelContentMergeViewer(final Composite parent, final CompareConfiguration config, final IEditorPart editor) {
+ super(parent, config);
+ final LabelProvider labelProvider = CustomizationAndViewerActionDispatcher.getLabelProvider(editor);
+ ((PapyrusModelContentMergeTabFolder)leftPart).setLabelProvider(labelProvider);
+ ((PapyrusModelContentMergeTabFolder)rightPart).setLabelProvider(labelProvider);
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * @param input
+ * the input
+ */
+ @Override
+ public void setInput(final Object input) {
+ super.setInput(input);
+ metamodels = EMFCompareUIUtils.getMetamodelForCustomization(input, metamodels);
+ updateToolItems();
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param composite
+ * @param side
+ * @return
+ */
+ @Override
+ protected ModelContentMergeTabFolder createModelContentMergeTabFolder(final Composite composite, final int side) {
+ return new PapyrusModelContentMergeTabFolder(this, composite, side);
+ }
+
+
+
+ /**
+ *
+ * {@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 to change the applied customization
+ if(metamodels == null) {
+ metamodels = new HashSet<EPackage>();
+ }
+
+ Collection<TreeViewer> viewers = new ArrayList<TreeViewer>();
+ viewers.add((TreeViewer)this.rightPart.getTreePart());
+ viewers.add((TreeViewer)this.leftPart.getTreePart());
+ //we add the expand all action
+ final IAction expandAllAction = new ExpandAllAction(viewers);
+ final ActionContributionItem expandAllContributionItem = new ActionContributionItem(expandAllAction);
+ tbm.insert(0, expandAllContributionItem);
+
+ //we add the collapse all action
+ final IAction collapseAllAction = new CollapseAllAction(viewers);
+ final ActionContributionItem collapseAllActionContributionItem = new ActionContributionItem(collapseAllAction);
+ tbm.insert(1, collapseAllActionContributionItem);
+
+ tbm.insert(2, new Separator("treeAction")); //$NON-NLS-1$
+
+
+ final IAction customizationAction = new CustomizationAction(Collections.unmodifiableCollection(metamodels));
+ final ActionContributionItem customizationContributionItem = new ActionContributionItem(customizationAction);
+ tbm.insert(3, customizationContributionItem);
+ super.createToolItems(tbm);
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer#handleDispose(org.eclipse.swt.events.DisposeEvent)
+ *
+ * @param event
+ */
+ @Override
+ protected void handleDispose(final DisposeEvent event) {
+ metamodels.clear();
+ super.handleDispose(event);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusModelContentMergeTabFolder.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusModelContentMergeTabFolder.java new file mode 100644 index 00000000000..39a46299d1d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/content/viewer/PapyrusModelContentMergeTabFolder.java @@ -0,0 +1,179 @@ +/***************************************************************************** + * 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.content.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.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.ui.viewer.content.part.diff.ModelContentMergeDiffTab; +import org.eclipse.emf.compare.util.AdapterUtils; +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.jface.viewers.LabelProvider; +import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.CustomizationAndViewerActionDispatcher; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + + +/** + * The Class UMLModelContentMergeTabFolder. + */ +public class PapyrusModelContentMergeTabFolder extends ModelContentMergeTabFolder { + + /** The my uml viewer. */ + protected final PapyrusCustomizableModelContentMergeViewer myUMLViewer; + + /** the label provider */ + private LabelProvider labelProvider; + + /** the diff tab */ + protected ModelContentMergeDiffTab diffTab; + + /** + * Instantiates a new uML model content merge tab folder. + * + * @param viewer + * the viewer + * @param composite + * the composite + * @param side + * the side + */ + public PapyrusModelContentMergeTabFolder(final ModelContentMergeViewer viewer, final Composite composite, final int side) { + super(viewer, composite, side); + myUMLViewer = (PapyrusCustomizableModelContentMergeViewer)viewer; + } + + /** + * Set the labelProvider for the viewer + * + * @param labelProvider + * the labelProvider + */ + public void setLabelProvider(final LabelProvider labelProvider) { + this.labelProvider = labelProvider; + CustomizationAndViewerActionDispatcher.associateViewerAndLabelProvider(diffTab, this.labelProvider); + diffTab.setLabelProvider(labelProvider); + } + + /** + * + * @see org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder#createModelContentMergeDiffTab(org.eclipse.swt.widgets.Composite) + * + * @param parent + * @return + */ + @Override + protected IModelContentMergeViewerTab createModelContentMergeDiffTab(final Composite parent) { + diffTab = new ModelContentMergeDiffTab(parent, partSide, this); + diffTab.setContentProvider(createDiffTabContentProvider()); + return diffTab; + + } + + /** + * + * @see org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder#createContents(org.eclipse.swt.widgets.Composite) + * + * @param composite + */ + @Override + protected void createContents(final Composite composite) { + super.createContents(composite); + //we set the layout here, because, it we don't set, we have a little treeviwer... + Control ctrl = tree.getControl(); + ctrl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + } + + /** + * + * @see org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder#dispose() + * + */ + @Override + public void dispose() { + if(labelProvider != null) { + CustomizationAndViewerActionDispatcher.dissociateTreeViewerAndLabelProvider(diffTab, labelProvider); + diffTab = null; + labelProvider = null; + } + super.dispose(); + } + + /** + * + * @return + */ + protected IContentProvider createDiffTabContentProvider() { + return new ModelContentMergeDiffTabContentProvider(AdapterUtils.getAdapterFactory()); + } + + + /** + * This implementation of an {@link AdapterFactoryContentProvider} will strip ComparisonSnapshots out of + * the view. + * + * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a> + * FIXME : duplicated code from the super class + */ + protected 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) + */ + @Override + public Object[] getElements(Object object) { + // overwritten to ensure contents of ResourceSets and List<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 List) { + // we may also display a list of resources + result = ((List<?>)object).toArray(); + } else { + result = super.getElements(object); + } + return result; + } + } + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handler/CompareTwoElementsAction.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handler/CompareTwoElementsAction.java new file mode 100644 index 00000000000..aa56ea79cfb --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/handler/CompareTwoElementsAction.java @@ -0,0 +1,287 @@ +/***************************************************************************** + * 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.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.compare.CompareConfiguration; +import org.eclipse.compare.CompareUI; +import org.eclipse.compare.CompareViewerPane; +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.compare.EMFCompareException; +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.MatchOptions; +import org.eclipse.emf.compare.match.engine.GenericMatchScopeProvider; +import org.eclipse.emf.compare.match.metamodel.MatchModel; +import org.eclipse.emf.compare.match.service.MatchService; +import org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput; +import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer; +import org.eclipse.emf.compare.util.EMFCompareMap; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.papyrus.infra.emf.compare.ui.Activator; +import org.eclipse.papyrus.infra.emf.compare.ui.content.transactional.viewer.PapyrusTransactionalModelContentMergeViewer; +import org.eclipse.ui.PlatformUI; +//import org.eclipse.papyrus.compare.diff.extension.UMLStyledStructureLabelProvider; +//import org.eclipse.papyrus.compare.element.ElementContentDiffEngine; +//import org.eclipse.papyrus.compare.element.ElementContentMatchEngine; +//import org.eclipse.papyrus.compare.ui.Messages; +//import org.eclipse.papyrus.compare.ui.PapyrusLabelProvider; +//import org.eclipse.papyrus.compare.ui.viewer.content.ElementContentMergeContentProvider; +//import org.eclipse.papyrus.compare.ui.viewer.content.UMLModelContentMergeViewer; + +/** + * Action to compare two arbitrary elements. + * Available in the context menu of the model explorer. + */ +//TODO : not used, remove it! +public class CompareTwoElementsAction extends AbstractHandler { + + /* + * (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.log.info("Two elements should be selected."); + } else { + EObject left = getElementFor(selectedElements[0]); + EObject right = getElementFor(selectedElements[1]); + if(left == null) { + Activator.log.info("The left element is null. I can't do the comparison"); + } else if(right == null) { + Activator.log.info("The right element is null. I can't do the comparison"); + } else { + ComparisonResourceSnapshot snapshot = doContentCompare(left, right); + openInCompare(snapshot); + } + } + } + + private Collection<Object> getSelection() { + ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); + Collection<Object> currentSelection = new ArrayList<Object>(); + Iterator<?> iter = ((IStructuredSelection)selection).iterator(); + while(iter.hasNext()) { + currentSelection.add(iter.next()); + } + return currentSelection; + } + + /* + * (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) { + ModelCompareEditorInput model = null; + + CompareUI.openCompareEditor(new ModelCompareEditorInput(snapshot) { + + @Override + protected ModelContentMergeViewer createMergeViewer(CompareViewerPane pane, CompareConfiguration config) { + return new PapyrusTransactionalModelContentMergeViewer(pane, config); + } + //TODO : uncomment. + // @Override + // protected ModelContentMergeViewer createMergeViewer(CompareViewerPane pane, CompareConfiguration config) { + // return new PapyrusCustomizableModelContentMergeViewer(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 = MatchService.doContentMatch(left, right, options); + // DiffModel diff = DiffService.doDiff(match); + 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.log.error(e); + } catch (final EMFCompareException e) { + Activator.log.error(e); + } catch (final InvocationTargetException e) { + Activator.log.error(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) { + //TODO + // 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; + return null; + } + + /** + * 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; + //TODO + return null; + } + + /** + * 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; + } + + public Object execute(ExecutionEvent event) throws ExecutionException { + Object[] selectedElements = getSelection().toArray(); + if(selectedElements.length != 2) { + //TODO + // Activator.logInfo(Messages.bind(Messages.CompareTwoElementsAction_only_only_element_is_selected, selectedElements.length)); + return null; + } + + EObject left = getElementFor(selectedElements[0]); + EObject right = getElementFor(selectedElements[1]); + if(left == null) { + //TODO + // Activator.logInfo(Messages.CompareTwoElementsAction_left_element_is_null); + return null; + } + + if(right == null) { + //TODO + // Activator.logInfo(Messages.CompareTwoElementsAction_right_element_is_null); + return null; + } + + ComparisonResourceSnapshot snapshot = doContentCompare(left, right); + openInCompare(snapshot); + return null; + } + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/CustomizationAndViewerActionDispatcher.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/CustomizationAndViewerActionDispatcher.java new file mode 100644 index 00000000000..e573cdb99fc --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/CustomizationAndViewerActionDispatcher.java @@ -0,0 +1,124 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.internal.utils;
+
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.emf.compare.ui.provider.EMFCompareLabelProvider;
+import org.eclipse.papyrus.infra.emf.compare.ui.utils.ICustomizableEditor;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * This class provides methods to manage the Labelprovider and the viewers for the CompareEditor.
+ *
+ *
+ */
+public class CustomizationAndViewerActionDispatcher {
+
+ private CustomizationAndViewerActionDispatcher() {
+ //to prevent instantiation
+ }
+
+ /**
+ *
+ * @param editor
+ * an editor
+ * @return
+ * Create if it is necessary and returns the Labelprovider for this editor
+ */
+ public static LabelProvider getLabelProvider(final IEditorPart editor) {
+ if(editor instanceof ICustomizableEditor) {
+ return ((ICustomizableEditor)editor).getLabelProvider();
+ } else {
+ return LabelProviderUtil.INSTANCE.getLabelProviderFor(editor);
+ }
+ }
+
+ /**
+ *
+ * @param editor
+ * an editor
+ * @return
+ * the labelprovider associated to this editor. The returned value can be <code>null</code>
+ */
+ public static LabelProvider getExistingLabelProvider(final IEditorPart editor) {
+ if(editor instanceof ICustomizableEditor) {
+ return ((ICustomizableEditor)editor).getLabelProvider();
+ } else {
+ return LabelProviderUtil.INSTANCE.getExistingLabelProviderFor(editor);
+ }
+ }
+
+ /**
+ *
+ * @param editor
+ * an editor
+ * @return
+ * the CustomizationManager associated to this editor (via its LabelProvider)
+ */
+ public static CustomizationManager getCustomizationManager(final IEditorPart editor) {
+ if(editor instanceof ICustomizableEditor) {
+ EMFCompareLabelProvider provider = ((ICustomizableEditor)editor).getLabelProvider();
+ return provider.getCustomizationManager();
+ } else {
+ EMFCompareLabelProvider provider = LabelProviderUtil.INSTANCE.getExistingLabelProviderFor(editor);
+ return provider.getCustomizationManager();
+ }
+ }
+
+ /**
+ * Refresh the viewers of the editor
+ *
+ * @param editor
+ * an editor
+ */
+ public static void refreshViewers(final IEditorPart editor) {
+ if(editor instanceof ICustomizableEditor) {
+ ((ICustomizableEditor)editor).refreshViewers();
+ } else {
+ EMFCompareLabelProviderRefreshingViewer provider = LabelProviderUtil.INSTANCE.getExistingLabelProviderFor(editor);
+ provider.refreshViewer();
+ }
+ }
+
+ /**
+ * Break the couple viewer/labelprovider if necessary
+ *
+ * @param viewer
+ * a viewer
+ * @param provider
+ * a label provider
+ */
+ public static void dissociateTreeViewerAndLabelProvider(final TreeViewer viewer, final LabelProvider provider) {
+ if(provider instanceof ILabelProviderRefreshingViewer) {
+ ((ILabelProviderRefreshingViewer)provider).unregisterViewer(viewer);
+ }
+ }
+
+ /**
+ * Create the couple viewer/labelprovider if necessary
+ *
+ * @param viewer
+ * a viewer
+ * @param provider
+ * a label provider
+ */
+ public static void associateViewerAndLabelProvider(final TreeViewer viewer, final LabelProvider provider) {
+ if(provider instanceof ILabelProviderRefreshingViewer) {
+ ((ILabelProviderRefreshingViewer)provider).registerViewer(viewer);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/EMFCompareLabelProviderRefreshingViewer.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/EMFCompareLabelProviderRefreshingViewer.java new file mode 100644 index 00000000000..f786f251c42 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/EMFCompareLabelProviderRefreshingViewer.java @@ -0,0 +1,82 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.internal.utils;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.papyrus.infra.emf.compare.ui.provider.EMFCompareLabelProvider;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+
+/**
+ *
+ * This Label provider is used when the editor doesn't manage itself the viewers.
+ * This label provider allows to refresh the viewers which used it
+ *
+ */
+//this class must have a package visibility
+final class EMFCompareLabelProviderRefreshingViewer extends EMFCompareLabelProvider implements ILabelProviderRefreshingViewer {
+
+ /** the list of the registered viewer */
+ private final Collection<TreeViewer> viewers;
+
+ public EMFCompareLabelProviderRefreshingViewer(final CustomizationManager customizationManager) {
+ super(customizationManager);
+ this.viewers = new HashSet<TreeViewer>();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.ILabelProviderRefreshingViewer#registerViewer(org.eclipse.jface.viewers.TreeViewer)
+ *
+ * @param viewer
+ */
+ public void registerViewer(final TreeViewer viewer) {
+ final DisposeListener listener = new DisposeListener() {
+
+ public void widgetDisposed(final DisposeEvent e) {
+ viewer.getTree().removeDisposeListener(this);
+ unregisterViewer(viewer);
+ }
+ };
+ viewer.getTree().addDisposeListener(listener);
+ viewers.add(viewer);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.ILabelProviderRefreshingViewer#refreshViewer()
+ *
+ */
+ public void refreshViewer() {
+ for(TreeViewer current : viewers) {
+ if(!current.getTree().isDisposed()) {
+ current.refresh();
+ }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.ILabelProviderRefreshingViewer#unregisterViewer(org.eclipse.jface.viewers.TreeViewer)
+ *
+ * @param viewer
+ */
+ public void unregisterViewer(final TreeViewer viewer) {
+ viewers.remove(viewer);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/EMFCompareUIUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/EMFCompareUIUtils.java new file mode 100644 index 00000000000..b99592b20e0 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/EMFCompareUIUtils.java @@ -0,0 +1,93 @@ +/*****************************************************************************
+ * 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.internal.utils;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.ui.ModelCompareInput;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+
+
+/**
+ *
+ * This class provides useful methods for the papyrus Viewer for EMF-Compare
+ *
+ */
+public class EMFCompareUIUtils {
+
+ private EMFCompareUIUtils() {
+ //nothing to do
+ }
+
+ /**
+ *
+ * @param input
+ * an input
+ * @param metamodels
+ * the list of the referenced metamodels
+ * @return
+ * if the parameter metamodels is <code>null</code>, this method initializes it
+ * it returns the parameter metamodels filled with the metamodels referenced by the compared model
+ */
+ public static final Collection<EPackage> getMetamodelForCustomization(final Object input, Collection<EPackage> metamodels) {
+ if(metamodels == null) {
+ metamodels = new HashSet<EPackage>();
+ }
+ if(input != null && input instanceof ModelCompareInput) {
+ Resource res = ((ModelCompareInput)input).getLeftResource();
+ metamodels.addAll(EMFHelper.getMetamodels(res));
+ res = ((ModelCompareInput)input).getRightResource();
+ metamodels.addAll(EMFHelper.getMetamodels(res));
+
+ //we returns the applicable customizations on DiffElement too
+ final List<DiffElement> diffs = ((ModelCompareInput)input).getDiffAsList();
+ for(DiffElement current : diffs) {
+ metamodels.add(current.eClass().getEPackage());
+ }
+ }
+ return metamodels;
+ }
+
+ /**
+ *
+ * @param input
+ * an input
+ * @param metamodels
+ * the list of the referenced metamodels
+ * @return
+ * if the parameter metamodels is <code>null</code>, this method initializes it
+ * it returns the parameter metamodels filled with the metamodels referenced by the diff element
+ */
+ //TODO not used, we display the all applicable customization for the 2 viewers see bug 384358: [UML Compare] problems with customizations applied on the viewers
+ @Deprecated //deprecated since July 2012
+ public static final Collection<EPackage> getMetamodelForDiffCustomization(final Object input, Collection<EPackage> metamodels) {
+ if(metamodels == null) {
+ metamodels = new HashSet<EPackage>();
+ }
+ if(input != null && input instanceof ModelCompareInput) {
+ List<DiffElement> diffs = ((ModelCompareInput)input).getDiffAsList();
+ for(DiffElement current : diffs) {
+ metamodels.add(current.eClass().getEPackage());
+ }
+ }
+ return metamodels;
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/ILabelProviderRefreshingViewer.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/ILabelProviderRefreshingViewer.java new file mode 100644 index 00000000000..a826705891b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/ILabelProviderRefreshingViewer.java @@ -0,0 +1,47 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.internal.utils;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.TreeViewer;
+
+/**
+ *
+ * The classes implements this interface when they are in charge of resfreshing Viewer
+ *
+ */
+//this interface must have a package visibility
+interface ILabelProviderRefreshingViewer extends ILabelProvider {
+
+ /**
+ * Register a viewer to refresh it
+ *
+ * @param viewer
+ * a viewer
+ */
+ public void registerViewer(TreeViewer viewer);
+
+ /**
+ * viewer are refresh in this methods
+ */
+ public void refreshViewer();
+
+ /**
+ * Unregister a viewer
+ *
+ * @param viewer
+ * a viewer
+ */
+ public void unregisterViewer(final TreeViewer viewer);
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/LabelProviderUtil.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/LabelProviderUtil.java new file mode 100644 index 00000000000..4ddaf018fb8 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/internal/utils/LabelProviderUtil.java @@ -0,0 +1,241 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.internal.utils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.compare.internal.CompareEditor;
+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.osgi.util.NLS;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.ui.messages.Messages;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IPartListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ * This class provides usefull methods to get a LabelProvider for the Editor.
+ * It allows to instanciate only 1 LabelProvider and one CustomizationManager for 1 Editor even if there are 2 customizable viewers in the editor
+ *
+ */
+//FIXME use the futur service for the label provider
+//this class must have a package visibility
+class LabelProviderUtil {
+
+ /**
+ * This map associates an IEditorPart with an ILabelProvider
+ */
+ private final Map<IEditorPart, EMFCompareLabelProviderRefreshingViewer> labelProviderMap;
+
+ /**
+ * This map associates an IEditorPart with a CustomizationManager
+ */
+ private final Map<IEditorPart, CustomizationManager> customizationMap;
+
+ /** LabelProviderUtil is a singleton */
+ public final static LabelProviderUtil INSTANCE = new LabelProviderUtil();
+
+ /**
+ * Constructor
+ */
+ private LabelProviderUtil() {
+ labelProviderMap = new HashMap<IEditorPart, EMFCompareLabelProviderRefreshingViewer>();
+ customizationMap = new HashMap<IEditorPart, CustomizationManager>() {
+
+ @Override
+ public String toString() {
+ String str = super.toString();
+ return str.replaceAll(", ", "\n");
+
+ }
+ };
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPartService().addPartListener(new CloseCompareEditorListener());
+ }
+
+ /**
+ *
+ * @param editor
+ * an editor
+ * @return
+ * the ILabelProvider associated to this editor
+ */
+ public EMFCompareLabelProviderRefreshingViewer getLabelProviderFor(final IEditorPart editor/* , final Set<EPackage> packages */) {
+ if(editor instanceof IMultiPageEditorPart) {
+ /*
+ * I set this exception because I think that we never want a customizable label provider for CoreMultiDiagramEditor.
+ * We want a label provider for embedded editor (or eclipse editor)
+ * -> when you get this exce^ption, it an error of the developper
+ */
+ throw new IllegalArgumentException(NLS.bind(Messages.LabelProviderUtil_CantProvideLabelProviderMessage, IMultiPageEditorPart.class));
+ }
+ EMFCompareLabelProviderRefreshingViewer provider = labelProviderMap.get(editor);
+ if(provider == null) {
+ CustomizationManager customizationManager = getCustomizationManager(editor);
+ provider = new EMFCompareLabelProviderRefreshingViewer(customizationManager);
+ labelProviderMap.put(editor, provider);
+ }
+ return provider;
+ }
+
+ /**
+ *
+ * @param editor
+ * an editor
+ * @return
+ * the LabelProvider associated to this editor
+ * @throws NullPointerException
+ * when no LabelProvider is associated to the editor
+ */
+ public EMFCompareLabelProviderRefreshingViewer getExistingLabelProviderFor(final IEditorPart editor) throws NullPointerException {
+ if(editor instanceof IMultiPageEditorPart) {
+ /*
+ * I set this exception because I think that we never want a customizable label provider for CoreMultiDiagramEditor.
+ * We want a label provider for embedded editor (or eclipse editor)
+ * -> when you get this exce^ption, it an error of the developper
+ */
+ throw new IllegalArgumentException(NLS.bind(Messages.LabelProviderUtil_CantProvideLabelProviderMessage, IMultiPageEditorPart.class));
+ }
+ final EMFCompareLabelProviderRefreshingViewer provider = labelProviderMap.get(editor);
+ if(provider == null) {
+ throw new NullPointerException();
+ }
+ return provider;
+ }
+
+ /**
+ * Remove the LabelProvider and the CustomizationManager registered for this editor
+ *
+ * @param editor
+ * an editor
+ */
+ public void destroyConfigurationFor(final IEditorPart editor) {
+ labelProviderMap.remove(editor);
+ customizationMap.remove(editor);
+ }
+
+ /**
+ * 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.log.error(e);
+ }
+ }
+
+ /**
+ *
+ * @param anEditor
+ * an editor
+ * @return
+ * a customization manager for this editor
+ */
+ public CustomizationManager getCustomizationManager(final IEditorPart anEditor) {
+ CustomizationManager manager = customizationMap.get(anEditor);
+ if(manager == null) {
+ manager = new CustomizationManager();
+ init(manager);
+ customizationMap.put(anEditor, manager);
+ }
+ return manager;
+ }
+
+ /**
+ *
+ * This listener allows to listen the close of the CompareEditor to remove it from the map
+ *
+ *
+ */
+ public class CloseCompareEditorListener implements IPartListener {
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partActivated(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partActivated(final IWorkbenchPart part) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partBroughtToTop(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partBroughtToTop(final IWorkbenchPart part) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partClosed(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partClosed(final IWorkbenchPart part) {
+ if(part instanceof CompareEditor) {
+ customizationMap.remove(part);
+ labelProviderMap.remove(part);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partDeactivated(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partDeactivated(final IWorkbenchPart part) {
+ //nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IPartListener#partOpened(org.eclipse.ui.IWorkbenchPart)
+ *
+ * @param part
+ */
+ public void partOpened(final IWorkbenchPart part) {
+ //nothing to do
+ }
+
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/messages/Messages.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/messages/Messages.java new file mode 100644 index 00000000000..9bcc9006216 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/messages/Messages.java @@ -0,0 +1,42 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.compare.ui.messages.messages"; //$NON-NLS-1$
+
+ public static String CollapseAllAction_CollapseAll;
+
+ public static String CustomizationAction_ManageAppliedCustomization;
+
+ public static String ExpandAllAction_ExpandAll;
+
+ public static String LabelProviderUtil_CantProvideLabelProviderMessage;
+
+ public static String LabelProviderUtil_CustomizationNotFound;
+
+ public static String PapyrusTransactionalModelContentMergeViewer_MergeCommandLabel;
+
+ public static String PapyrusTransactionalModelContentMergeViewer_TheCurrentEditorDontAllowToUseUndoRedo;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/messages/messages.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/messages/messages.properties new file mode 100644 index 00000000000..5f90c59b89d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/messages/messages.properties @@ -0,0 +1,7 @@ +CollapseAllAction_CollapseAll=Collapse All
+CustomizationAction_ManageAppliedCustomization=Manage the applied customizations
+ExpandAllAction_ExpandAll=Expand All
+LabelProviderUtil_CantProvideLabelProviderMessage=I can't provide a label provider for {0}.
+LabelProviderUtil_CustomizationNotFound=Custom {0} not found
+PapyrusTransactionalModelContentMergeViewer_MergeCommandLabel=Merge Command
+PapyrusTransactionalModelContentMergeViewer_TheCurrentEditorDontAllowToUseUndoRedo=The current editor doesn't allow to use Undo/Redo.
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/EMFCompareLabelProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/EMFCompareLabelProvider.java new file mode 100644 index 00000000000..c56d242a669 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/EMFCompareLabelProvider.java @@ -0,0 +1,160 @@ +/***************************************************************************** + * 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) + *****************************************************************************/ +package org.eclipse.papyrus.infra.emf.compare.ui.provider; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import org.eclipse.core.resources.IFile; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +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.infra.emf.compare.ui.Activator; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; + +/** + * This LabelProvider provides the same labels and icons as one can find in + * the Model Explorer. + * FIXME : is should have a part of duplicated code? + * + * + * TODO : this label provider should be able to support StyledString (as done by Tatiana). In order to do that, this label provider should be + * a CellLabelProvider (or (better ?) an {@link OwnerDrawLabelProvider}) Il will be easiest when we will use the last version of EMF-Facet + */ +public class EMFCompareLabelProvider extends CustomizableModelLabelProvider { + + /** The configuration. */ + private final AppearanceConfiguration configuration; + + + /** the customization manager for this label provider */ + private final CustomizationManager manager; + + /** + * Constructor. + * + * @param customizationManager + * the customization manager + */ + public EMFCompareLabelProvider(final CustomizationManager customizationManager) { + super(customizationManager); + this.manager = customizationManager; + this.configuration = getAppearanceConfiguration(customizationManager); + } + + + /** + * 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) { + Activator.log.error(e); + } catch (final NoSuchMethodException e) { + Activator.log.error(e); + } catch (final IllegalArgumentException e) { + Activator.log.error(e); + } catch (final IllegalAccessException e) { + Activator.log.error(e); + } catch (final InvocationTargetException e) { + Activator.log.error(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) { + String text = ""; //$NON-NLS-1$ + if(element != null) { + if(element instanceof IFile) { + text = ((IFile)element).getName(); + } else if(element instanceof Resource) { + text = ((Resource)element).getURI().lastSegment(); + } + if(element instanceof EObject) { + final ITreeElement treeElement = getTreeElement((EObject)element); + text = super.getText(treeElement); + } else { + text = super.getText(element); + } + }else{ + text="null"; + } + return text; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.emf.facet.infra.browser.uicore.CustomizableModelLabelProvider + * #getImage(java.lang.Object) + */ + @Override + public Image getImage(final Object element) { + Image image = null; + if(element instanceof IFile) { + image = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE); + } else if(element instanceof EObject) { + final ITreeElement treeElement = getTreeElement((EObject)element); + image = super.getImage(treeElement); + } else { + image = super.getImage(element); + } + return image; + + } + + /** + * 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); + } + + public CustomizationManager getCustomizationManager() { + return this.manager; + } + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ElementContentMergeContentProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ElementContentMergeContentProvider.java new file mode 100644 index 00000000000..eb264705fb8 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/ElementContentMergeContentProvider.java @@ -0,0 +1,90 @@ +/***************************************************************************** + * 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 org.eclipse.compare.CompareConfiguration; +import org.eclipse.emf.compare.ui.ModelCompareInput; +import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeContentProvider; +import org.eclipse.papyrus.infra.emf.compare.ecore_diff_extension.CompareTwoElementsDiffModel; + + +/** + * The ContentProvider used in the Merge Content Viewer. + */ +public class ElementContentMergeContentProvider extends ModelContentMergeContentProvider { + + /** + * Instantiates a new element content merge content provider. + * + * @param cc the cc + */ + public ElementContentMergeContentProvider(CompareConfiguration cc) { + super(cc); + } + + /* (non-Javadoc) + * @see org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeContentProvider#getLeftContent(java.lang.Object) + */ + @Override + public Object getLeftContent(Object element) { + //TODO verif this test! + if(element instanceof ModelCompareInput) { + // if we compared a complete resource set, we should display the different resources + final Object diff = ((ModelCompareInput)element).getDiff(); + //Bug 336361 - [UML Compare] Compare two elements: show right element as root + if(diff instanceof CompareTwoElementsDiffModel) { + return new RootObject(((CompareTwoElementsDiffModel)diff).getLeftRoots().get(0)); + } + } + return super.getLeftContent(element); + } + + /* (non-Javadoc) + * @see org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeContentProvider#getRightContent(java.lang.Object) + */ + @Override + public Object getRightContent(Object element) { + if(element instanceof ModelCompareInput) { + // if we compared a complete resource set, we should display the different resources + final Object diff = ((ModelCompareInput)element).getDiff(); + //Bug 336361 - [UML Compare] Compare two elements: show right element as root + if(diff instanceof CompareTwoElementsDiffModel) { + return new RootObject(((CompareTwoElementsDiffModel)diff).getRightRoots().get(0)); + } + } + return super.getRightContent(element); + } + + /** + * The Class RootObject. + */ + //Bug 336361 - [UML Compare] Compare two elements: show right element as root + //FIXME : why in static?! + public static class RootObject { + + /** The object. */ + public final Object object; + + /** + * Instantiates a new root object. + * + * @param object the object + */ + public RootObject(Object object) { + this.object = object; + } + } + + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/StyledDiffLabelSwitch.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/StyledDiffLabelSwitch.java new file mode 100644 index 00000000000..bae992a089e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/StyledDiffLabelSwitch.java @@ -0,0 +1,190 @@ +/***************************************************************************** + * 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.compare.diff.extension; + +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.DiffGroup; +import org.eclipse.emf.compare.diff.metamodel.DiffPackage; +import org.eclipse.emf.compare.diff.metamodel.ReferenceChange; +import org.eclipse.emf.compare.diff.metamodel.UpdateAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.papyrus.compare.Messages; +import org.eclipse.papyrus.compare.StyledMessageFormat; +import org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.CompareTwoElementsDiffModel; +import org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch; + + +/** + * Switch to return Styled label for the given DiffElement. + * Usually changed elements and number of chnages are shown in bold. + */ +//TODO use this to get the tatiana customization in the upper viewer +public class StyledDiffLabelSwitch extends UMLDiffSwitch<StyledString> { + + /** The my domain element label provider. */ + private final ILabelProvider myDomainElementLabelProvider; + + /** + * Instantiates a new styled diff label switch. + * + * @param labelProvider the label provider + */ + public StyledDiffLabelSwitch(ILabelProvider labelProvider) { + myDomainElementLabelProvider = labelProvider; + } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch#defaultCase(org.eclipse.emf.ecore.EObject) + */ + @Override + public StyledString defaultCase(EObject object) { + int classifierID = object.eClass().getClassifierID(); + switch(classifierID) { + case DiffPackage.DIFF_GROUP: + { + DiffGroup diffGroup = (DiffGroup)object; + return caseDiffGroup(diffGroup); + } + case DiffPackage.UPDATE_ATTRIBUTE: + { + UpdateAttribute updateAttribute = (UpdateAttribute)object; + return caseUpdateAttribute(updateAttribute); + } + } + return null; + } + + /** + * Gets the label provider. + * + * @return the label provider + */ + private ILabelProvider getLabelProvider() { + return myDomainElementLabelProvider; + } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch#caseCompareTwoElementsDiffModel(org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.CompareTwoElementsDiffModel) + */ + @Override + public StyledString caseCompareTwoElementsDiffModel(CompareTwoElementsDiffModel object) { + int subchanges = ((DiffGroup)object.getOwnedElements().get(0)).getSubchanges(); + EObject leftElement = object.getLeftRoots().get(0); + String leftName = getLabelProvider().getText(leftElement); + EObject rightElement = object.getRightRoots().get(0); + String rightName = getLabelProvider().getText(rightElement); + + // String message = "%s change(s) between elements [%s] and [%s]"; + // return String.StyledMessageFormat.format(message, subchanges, leftName, rightName); + + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_two_elements_model_text, String.valueOf(subchanges), leftName, rightName); + + } + + /** + * Case diff group. + * + * @param object the object + * @return the styled string + */ + public StyledString caseDiffGroup(DiffGroup object) { + final EObject parent = object.getRightParent(); + final String parentLabel; + if(parent != null) { + parentLabel = getLabelProvider().getText(parent); + } else { + parentLabel = Messages.StyledDiffLabelSwitch_root_text; + } + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_diff_group_text, String.valueOf(object.getSubchanges()), parentLabel); + } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch#caseAttributeChange(org.eclipse.emf.compare.diff.metamodel.AttributeChange) + */ + @Override + public StyledString caseAttributeChange(AttributeChange object) { + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_attribute_change_text, String.valueOf(object.isConflicting())); + } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch#caseAttributeChangeLeftTarget(org.eclipse.emf.compare.diff.metamodel.AttributeChangeLeftTarget) + */ + @Override + public StyledString caseAttributeChangeLeftTarget(AttributeChangeLeftTarget object) { + final String attributeLabel = getLabelProvider().getText(object.getAttribute()); + final String elementLabel = getLabelProvider().getText(object.getRightElement()); + + if(object.isRemote()) { + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_attribute_change_left_target_remote_text, attributeValueToString(object.getLeftTarget()), attributeLabel, elementLabel); + } + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_attribute_change_left_target_text, attributeValueToString(object.getLeftTarget()), attributeLabel, elementLabel); + } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch#caseAttributeChangeRightTarget(org.eclipse.emf.compare.diff.metamodel.AttributeChangeRightTarget) + */ + @Override + public StyledString caseAttributeChangeRightTarget(AttributeChangeRightTarget object) { + final String attributeLabel = getLabelProvider().getText(object.getAttribute()); + final String elementLabel = getLabelProvider().getText(object.getLeftElement()); + + if(object.isRemote()) { + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_attribute_change_right_target_remote_text, attributeValueToString(object.getRightTarget()), attributeLabel, elementLabel); + } + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_attribute_change_right_target_text, attributeValueToString(object.getRightTarget()), attributeLabel, elementLabel); + } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch#caseUpdateAttribute(org.eclipse.emf.compare.diff.metamodel.UpdateAttribute) + */ + @Override + public StyledString caseUpdateAttribute(UpdateAttribute object) { + final String attributeLabel = getLabelProvider().getText(object.getAttribute()); + final String elementLabel = getLabelProvider().getText(object.getLeftElement()); + final Object leftValue = object.getLeftElement().eGet(object.getAttribute()); + final Object rightValue = object.getRightElement().eGet(object.getAttribute()); + + if(object.isRemote()) { + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_update_attribute_remote_text, attributeLabel, elementLabel, attributeValueToString(leftValue), attributeValueToString(rightValue)); + } + + if(object.isConflicting()) { + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_update_attribute_conflicting_text, attributeLabel, attributeValueToString(rightValue), attributeValueToString(leftValue)); + } + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_update_attribute_text, attributeLabel, elementLabel, attributeValueToString(rightValue), attributeValueToString(leftValue)); + } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch#caseReferenceChange(org.eclipse.emf.compare.diff.metamodel.ReferenceChange) + */ + @Override + public StyledString caseReferenceChange(ReferenceChange object) { + return StyledMessageFormat.format(Messages.StyledDiffLabelSwitch_reference_chnage_text, String.valueOf(object.isConflicting())); + } + + /** + * Attribute value to string. + * + * @param attributeValue the attribute value + * @return the string + */ + private String attributeValueToString(Object attributeValue) { + return attributeValue == null ? Messages.StyledDiffLabelSwitch_null_value_text : attributeValue.toString(); + } + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/UMLStyledStructureLabelProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/UMLStyledStructureLabelProvider.java new file mode 100644 index 00000000000..7babdf7e34b --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/provider/UMLStyledStructureLabelProvider.java @@ -0,0 +1,100 @@ +/***************************************************************************** + * 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.compare.diff.extension; + +import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.papyrus.compare.diff.metamodel.uml_diff_extension.util.UMLDiffSwitch; +import org.eclipse.swt.graphics.Image; + + +/** + * LabelProvider that returns Styled label. + * Usually changed elements and number of changes are shown in bold. + */ +//TODO use this to get the tatiana customization in the upper viewer +public class UMLStyledStructureLabelProvider extends StyledCellLabelProvider implements ILabelProvider { + + /** The my delegate. */ + private final ILabelProvider myDelegate; + + /** The my diff label switch. */ + private final UMLDiffSwitch<StyledString> myDiffLabelSwitch; + + /** + * Instantiates a new uML styled structure label provider. + * + * @param delegate the delegate + */ + public UMLStyledStructureLabelProvider(ILabelProvider delegate) { + myDelegate = delegate; + myDiffLabelSwitch = new StyledDiffLabelSwitch(delegate); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) + */ + public Image getImage(Object element) { + if(element instanceof AbstractDiffExtension) { + return (Image)((AbstractDiffExtension)element).getImage(); + } + return myDelegate.getImage(element); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) + */ + public String getText(Object element) { + return getStyledText(element).getString(); + } + + /* (non-Javadoc) + * @see org.eclipse.jface.viewers.StyledCellLabelProvider#update(org.eclipse.jface.viewers.ViewerCell) + */ + public void update(ViewerCell cell) { + StyledString string = getStyledText(cell.getElement()); + cell.setText(string.getString()); + cell.setStyleRanges(string.getStyleRanges()); + cell.setImage(getImage(cell.getElement())); + super.update(cell); + } + + /** + * Gets the styled text. + * + * @param element the element + * @return the styled text + */ + public StyledString getStyledText(Object element) { + if(element instanceof EObject) { + StyledString diffElementLabel = myDiffLabelSwitch.doSwitch((EObject)element); + if(diffElementLabel != null) { + return diffElementLabel; + } + } + String elementText = myDelegate.getText(element); + if (elementText != null) { + StyledString styledString = new StyledString(); + styledString.append(myDelegate.getText(element)); + return styledString; + } + return null; + } + + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/queries/GetDiffElementLabel.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/queries/GetDiffElementLabel.java new file mode 100644 index 00000000000..929194287a2 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/queries/GetDiffElementLabel.java @@ -0,0 +1,293 @@ +/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.emf.compare.ui.queries; + +import org.eclipse.emf.common.notify.AdapterFactory; +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.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.UpdateContainmentFeature; +import org.eclipse.emf.compare.diff.metamodel.UpdateModelElement; +import org.eclipse.emf.compare.diff.metamodel.UpdateReference; +import org.eclipse.emf.compare.diff.provider.DiffElementItemProvider; +import org.eclipse.emf.compare.util.AdapterUtils; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart; +import org.eclipse.papyrus.infra.emf.Activator; +import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.CustomizationAndViewerActionDispatcher; +import org.eclipse.papyrus.infra.tools.util.EditorHelper; +import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder; +import org.eclipse.ui.IEditorPart; + +/** + * + * This query returns the label to display for DiffElement + * TODO : dispatch this class in several classes (1 by DiffElement subtype, when we are having agregate + * + */ +public class GetDiffElementLabel implements IJavaModelQuery<EObject, String> { + + /** + * The code of this method is adapter of the implementation of getText in the Default Label Provider for each of the managed DiffElement + * + * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, + * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) + * + * @param context + * @param parameterValues + * @return + * @throws ModelQueryExecutionException + */ + public String evaluate(final EObject context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { + final AdapterFactory adapter = AdapterUtils.getAdapterFactory(); + final DiffElementItemProvider itemProvider = new DiffElementItemProvider(adapter); + IEditorPart editor = EditorHelper.getCurrentEditor(); + + if(editor instanceof IMultiPageEditorPart) { + editor = ((IMultiPageEditorPart)editor).getActiveEditor(); + } + + if(editor == null) { + return null; + } + LabelProvider labelProvider; + try { + labelProvider = CustomizationAndViewerActionDispatcher.getExistingLabelProvider(editor); + } catch (NullPointerException e) { + return null; + } + String diffLabel = null; + + if(context instanceof UpdateAttribute) { //comes from UpdateAttributeItemProvider + //TODO : not tested + final UpdateAttribute updateOp = (UpdateAttribute)context; + final String attributeLabel = labelProvider.getText(updateOp.getAttribute()); + final String elementLabel = labelProvider.getText(updateOp.getLeftElement()); + final Object leftValue = updateOp.getLeftElement().eGet(updateOp.getAttribute()); + final Object rightValue = updateOp.getRightElement().eGet(updateOp.getAttribute()); + if(updateOp.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteUpdateAttribute_type", new Object[]{ attributeLabel, elementLabel, leftValue, rightValue, }); //$NON-NLS-1$ + } else { + if(updateOp.isConflicting()) { + diffLabel = itemProvider.getString("_UI_UpdateAttribute_conflicting", new Object[]{ attributeLabel, rightValue, leftValue, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_UpdateAttribute_type", new Object[]{ attributeLabel, elementLabel, rightValue, leftValue, }); //$NON-NLS-1$ + } + } + } else if(context instanceof AttributeOrderChange) { //comes from AttributeOrderChangeItemProvider + //TODO : not tested + //TODO : useful? + AttributeOrderChange attributeOrderChange = (AttributeOrderChange)context; + diffLabel = itemProvider.getString("_UI_AttributeOrderChange_type", new Object[]{ attributeOrderChange.getAttribute().getName() }); //$NON-NLS-1$ + + } else if(context instanceof AttributeChangeLeftTarget) {//comes from AttributeChangeLeftTargetItemProvider + //not tested + final AttributeChangeLeftTarget operation = (AttributeChangeLeftTarget)context; + final String attributeLabel = labelProvider.getText(operation.getAttribute()); + final String elementLabel = labelProvider.getText(operation.getRightElement()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteRemoveAttribute_type", new Object[]{ operation.getLeftTarget(), attributeLabel, elementLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_AddAttribute_type", new Object[]{ operation.getLeftTarget(), attributeLabel, elementLabel, }); //$NON-NLS-1$ + } + + } else if(context instanceof AttributeChangeRightTarget) { //comes from AttributeChangeRightTargetItemProvider + //TODO : not tested + final AttributeChangeRightTarget operation = (AttributeChangeRightTarget)context; + final String attributeLabel = labelProvider.getText(operation.getAttribute()); + final String elementLabel = labelProvider.getText(operation.getLeftElement()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteAddAttribute_type", new Object[]{ operation.getRightTarget(), attributeLabel, elementLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_RemoveAttribute_type", new Object[]{ operation.getRightTarget(), attributeLabel, elementLabel, }); //$NON-NLS-1$ + } + } else if(context instanceof AttributeChange) {//comes from AttributeChangeItemProvider + //TODO : not tested + //TODO : useful? + AttributeChange attributeChange = (AttributeChange)context; + diffLabel = itemProvider.getString("_UI_AttributeChange_type") + " " + attributeChange.isConflicting(); //$NON-NLS-1$ //$NON-NLS-2$ + } else if(context instanceof DiffGroup) { //comes from DiffGroupItemProvider + final DiffGroup group = (DiffGroup)context; + final EObject parent = group.getRightParent(); + if(parent != null) { + final String parentLabel = labelProvider.getText(parent); + diffLabel = itemProvider.getString("_UI_DiffGroup_type", new Object[]{ group.getSubchanges(), parentLabel }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_DiffGroup_type", new Object[]{ group.getSubchanges(), "model" }); //$NON-NLS-1$ //$NON-NLS-2$ + } + } else if(context instanceof UpdateContainmentFeature) {//comes from UpdateContainmentFeatureItemProvider + //TODO : not tested + //TODO : useful? + final UpdateContainmentFeature operation = (UpdateContainmentFeature)context; + final String leftContainmentFeature = operation.getLeftElement().eContainmentFeature().getName(); + final String rightContainmentFeature = operation.getRightElement().eContainmentFeature().getName(); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteUpdateContainmentFeature_type", new Object[]{ rightContainmentFeature, leftContainmentFeature, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_UpdateContainmentFeature_type", new Object[]{ rightContainmentFeature, leftContainmentFeature, }); //$NON-NLS-1$ + } + } else if(context instanceof MoveModelElement) {//comes from MoveModelElementItemProvider + //TODO : not tested + final MoveModelElement operation = (MoveModelElement)context; + + final String elementLabel = labelProvider.getText(operation.getLeftElement()); + final String oldParentLabel = labelProvider.getText(operation.getLeftTarget()); + final String newParentLabel = labelProvider.getText(operation.getRightTarget()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteMoveModelElement_type", new Object[]{ elementLabel, oldParentLabel, newParentLabel, }); //$NON-NLS-1$ + } else { + if(operation.isConflicting()) { + diffLabel = itemProvider.getString("_UI_MoveModelElement_conflicting", new Object[]{ elementLabel, oldParentLabel, newParentLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_MoveModelElement_type", new Object[]{ elementLabel, oldParentLabel, newParentLabel, }); //$NON-NLS-1$ + } + } + } else if(context instanceof UpdateModelElement) {//comes from UpdateModelElementItemProvider + //TODO : not tested + //TODO : useful ? + UpdateModelElement updateModelElement = (UpdateModelElement)context; + diffLabel = itemProvider.getString("_UI_UpdateModelElement_type") + " " + updateModelElement.isConflicting(); //$NON-NLS-1$ //$NON-NLS-2$ + } else if(context instanceof ModelElementChangeLeftTarget) { //comes from ModelElementChangeLeftTargetItemProvider + //TODO : not tested + final ModelElementChangeLeftTarget operation = (ModelElementChangeLeftTarget)context; + final String targetName = labelProvider.getText(operation.getLeftElement()); + if(operation.isRemote()) { + if(operation.isConflicting()) { + diffLabel = itemProvider.getString("_UI_RemoteRemoveModelElement_conflicting", new Object[]{ targetName }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_RemoteRemoveModelElement_type", new Object[]{ targetName }); //$NON-NLS-1$ + } + } else { + diffLabel = itemProvider.getString("_UI_AddModelElement_type", new Object[]{ targetName, }); //$NON-NLS-1$ + } + + } else if(context instanceof ModelElementChangeRightTarget) { //comes from ModelElementChangeRightTargetItemProvider + final ModelElementChangeRightTarget operation = (ModelElementChangeRightTarget)context; + final String targetName = labelProvider.getText(operation.getRightElement()); + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteAddModelElement_type", new Object[]{ targetName }); //$NON-NLS-1$ + } else { + if(operation.isConflicting()) { + diffLabel = itemProvider.getString("_UI_RemoveModelElement_conflicting", new Object[]{ targetName }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_RemoveModelElement_type", new Object[]{ targetName, }); //$NON-NLS-1$ + } + } + + + } else if(context instanceof UpdateReference) { //comes from UpdateReferenceItemProvider + //TODO : not tested + final UpdateReference operation = (UpdateReference)context; + final String elementLabel = labelProvider.getText(operation.getLeftElement()); + final String referenceLabel = AdapterUtils.getItemProviderText(operation.getReference());//TODO : use labelProvider ? + final String leftValueLabel = labelProvider.getText(getLeftValue(operation)); + final String rightValueLabel = labelProvider.getText(getRightValue(operation)); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteUpdateReference_type", new Object[]{ referenceLabel, elementLabel, leftValueLabel, rightValueLabel, }); //$NON-NLS-1$ + } else { + if(operation.isConflicting()) { + diffLabel = itemProvider.getString("_UI_UpdateReference_conflicting", new Object[]{ referenceLabel, elementLabel, rightValueLabel, leftValueLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_UpdateReference_type", new Object[]{ referenceLabel, elementLabel, rightValueLabel, leftValueLabel, }); //$NON-NLS-1$ + } + } + + } else if(context instanceof ReferenceOrderChange) { //comes from ReferenceOrderChangeItemProvider + //TODO not tested + //TODO : useful? + final ReferenceOrderChange referenceOrderChange = (ReferenceOrderChange)context; + diffLabel = itemProvider.getString("_UI_ReferenceOrderChange_type", new Object[]{ referenceOrderChange.getReference().getName() }); //$NON-NLS-1$ + } else if(context instanceof ReferenceChangeLeftTarget) { //comes from ReferenceChangeLeftTargetItemProvider + //TODO : not tested + final ReferenceChangeLeftTarget operation = (ReferenceChangeLeftTarget)context; + + final String valueLabel = labelProvider.getText(operation.getLeftTarget()); + final String referenceLabel = labelProvider.getText(operation.getReference()); + final String elementLabel = labelProvider.getText(operation.getRightElement()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteRemoveReferenceValue_type", new Object[]{ valueLabel, referenceLabel, elementLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_AddReferenceValue_type", new Object[]{ valueLabel, referenceLabel, elementLabel, }); //$NON-NLS-1$ + } + } else if(context instanceof ReferenceChangeRightTarget) { //comes from ReferenceChangeRightTargetItemProvider + //TODO : not tested + final ReferenceChangeRightTarget operation = (ReferenceChangeRightTarget)context; + + final String valueLabel = labelProvider.getText(operation.getRightTarget()); + final String referenceLabel = labelProvider.getText(operation.getReference()); + final String elementLabel = labelProvider.getText(operation.getLeftElement()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteAddReferenceValue_type", new Object[]{ valueLabel, referenceLabel, elementLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_RemoveReferenceValue_type", new Object[]{ valueLabel, referenceLabel, elementLabel, }); //$NON-NLS-1$ + } + } + if(diffLabel == null) { + final String message = NLS.bind("{0} doesn't manage {1}", new Object[]{ this.getClass().getSimpleName(), context.getClass().getSimpleName() });//$NON-NLS-1$ + Activator.log.warn(message); + NotificationBuilder.createAsyncPopup(message).run(); + // in this case the default Label will be displayed + } + return diffLabel; + } + + + /** + * Returns the value of the given operation's target reference for the left element. + * + * @param operation + * The update reference operation for which we need target information. + * @return The value of the given operation's target reference for the left element. + */ + private EObject getLeftValue(final UpdateReference operation) { + final EReference reference = operation.getReference(); + return (EObject)operation.getLeftElement().eGet(reference); + } + + /** + * Returns the value of the given operation's target reference for the right element. + * + * @param operation + * The update reference operation for which we need target information. + * @return The value of the given operation's target reference for the right element. + */ + private EObject getRightValue(final UpdateReference operation) { + final EReference reference = operation.getReference(); + return (EObject)operation.getRightElement().eGet(reference); + } + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusCustomizableParameterizedStructureMergeViewer.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusCustomizableParameterizedStructureMergeViewer.java new file mode 100644 index 00000000000..283fc4bc7ff --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusCustomizableParameterizedStructureMergeViewer.java @@ -0,0 +1,192 @@ +/*****************************************************************************
+ * 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.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareViewerPane;
+import org.eclipse.emf.compare.ui.ModelCompareInput;
+import org.eclipse.emf.compare.ui.viewer.structure.ParameterizedStructureContentProvider;
+import org.eclipse.emf.compare.ui.viewer.structure.ParameterizedStructureMergeViewer;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.papyrus.infra.emf.compare.ui.actions.CollapseAllAction;
+import org.eclipse.papyrus.infra.emf.compare.ui.actions.CustomizationAction;
+import org.eclipse.papyrus.infra.emf.compare.ui.actions.ExpandAllAction;
+import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.CustomizationAndViewerActionDispatcher;
+import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.EMFCompareUIUtils;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * This class allows to declare our own LabelProvider for the structural viewer
+ *
+ */
+public class PapyrusCustomizableParameterizedStructureMergeViewer extends ParameterizedStructureMergeViewer {
+
+ /**
+ * the list of the metamodels referenced by the input
+ */
+ private Collection<EPackage> metamodels;
+
+ /**
+ * The label provider
+ */
+ private LabelProvider labelProvider;
+
+ /** the current editor */
+ private final IEditorPart editor;
+
+ /**
+ *
+ * Constructor.
+ * see {@link ParameterizedStructureMergeViewer#ParameterizedStructureMergeViewer(Composite, CompareConfiguration)}
+ *
+ * @param parent
+ * @param compareConfiguration
+ */
+ public PapyrusCustomizableParameterizedStructureMergeViewer(final Composite parent, final CompareConfiguration compareConfiguration, final IEditorPart editor) {
+ super(parent, compareConfiguration);
+ this.editor = editor;
+ setLabelProvider(createLabelProvider());
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer#inputChanged(java.lang.Object, java.lang.Object)
+ *
+ * @param input
+ * @param oldInput
+ */
+ @Override
+ protected void inputChanged(final Object input, final Object oldInput) {
+ if(input instanceof ModelCompareInput) {
+ metamodels = EMFCompareUIUtils.getMetamodelForCustomization(input, metamodels);
+ }
+ super.inputChanged(input, oldInput);
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.ui.viewer.structure.ParameterizedStructureMergeViewer#createToolItems()
+ *
+ */
+ @Override
+ protected void createToolItems() {
+ final ToolBarManager tbm = CompareViewerPane.getToolBarManager(getControl().getParent());
+ tbm.removeAll();
+ super.createToolItems();
+ if(metamodels == null) {
+ metamodels = new HashSet<EPackage>();
+ }
+
+ //we add the expand all action
+ final IAction expandAllAction = new ExpandAllAction(this);
+ final ActionContributionItem expandAllContributionItem = new ActionContributionItem(expandAllAction);
+ tbm.insert(0, expandAllContributionItem);
+
+ //we add the collapse all action
+ final IAction collapseAllAction = new CollapseAllAction(this);
+ final ActionContributionItem collapseAllActionContributionItem = new ActionContributionItem(collapseAllAction);
+ tbm.insert(1, collapseAllActionContributionItem);
+
+ tbm.insert(2, new Separator("treeAction")); //$NON-NLS-1$
+
+ //we add an action to change the applied cuztomization
+ final IAction customizationAction = new CustomizationAction(Collections.unmodifiableCollection(metamodels));
+ final ActionContributionItem customizationContributionItem = new ActionContributionItem(customizationAction);
+ tbm.insert(3, customizationContributionItem);
+
+
+ tbm.update(true);
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.ui.viewer.structure.ModelStructureMergeViewer#handleDispose(org.eclipse.swt.events.DisposeEvent)
+ *
+ * @param event
+ */
+ @Override
+ protected void handleDispose(final DisposeEvent event) {
+ metamodels.clear();
+ CustomizationAndViewerActionDispatcher.dissociateTreeViewerAndLabelProvider(this, this.labelProvider);
+ super.handleDispose(event);
+ }
+
+ /**
+ *
+ * @param compareConfiguration
+ * @return
+ */
+ protected LabelProvider createLabelProvider() {
+ this.labelProvider = CustomizationAndViewerActionDispatcher.getLabelProvider(this.editor);
+ return this.labelProvider;
+ }
+
+ /**
+ * FIXME : in the default implementation, the root DiffGroup show that there are children, even if they are marked has hidden, it is a bad idea to
+ * do that here, I think
+ * Build the content provider in relation to the compare configuration and the preference values on
+ * filters to apply.
+ *
+ * @param compareConfiguration
+ * The compare configuration.
+ * @return The content provider.
+ * @since 1.3
+ */
+ protected ParameterizedStructureContentProvider buildContentProvider(CompareConfiguration compareConfiguration) {
+ final ParameterizedStructureContentProvider contentProvider = new ParameterizedStructureContentProvider(compareConfiguration, getDefaultOrdering(), getDefaultFilters()) {
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof ModelCompareInput) {
+ return super.getElements(((ModelCompareInput)inputElement).getDiff());
+ }
+ return super.getElements(inputElement);
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ if(element != null) {
+ Object[] children = getChildren(element);
+ if(children != null) {
+ return children.length != 0;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ Object[] child = super.getChildren(parentElement);
+ if(child != null) {
+ return child;
+ }
+ return new Object[0];
+ }
+ };
+ return contentProvider;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusStructureMergeViewerCreator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusStructureMergeViewerCreator.java new file mode 100644 index 00000000000..1b880a36019 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/structural/viewer/PapyrusStructureMergeViewerCreator.java @@ -0,0 +1,45 @@ +/*****************************************************************************
+ * 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.compare.internal.CompareEditor;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.papyrus.infra.tools.util.EditorHelper;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ *
+ * 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) {
+ final IEditorPart editor = EditorHelper.getCurrentEditor();//the current CompareEditor
+ Assert.isTrue(editor instanceof CompareEditor);
+ return new PapyrusCustomizableParameterizedStructureMergeViewer(parent, config, editor);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/utils/ICustomizableEditor.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/utils/ICustomizableEditor.java new file mode 100644 index 00000000000..e2ed739abd7 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/utils/ICustomizableEditor.java @@ -0,0 +1,24 @@ +package org.eclipse.papyrus.infra.emf.compare.ui.utils;
+
+import org.eclipse.papyrus.infra.emf.compare.ui.provider.EMFCompareLabelProvider;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * This interface provides useful methods to manage easily the customization of the viewers in an editor
+ *
+ */
+public interface ICustomizableEditor extends IEditorPart {
+
+ /**
+ *
+ * @return
+ * a LabelProvider
+ */
+ public EMFCompareLabelProvider getLabelProvider();
+
+ /**
+ * Refresh the viewers of the editor
+ */
+ public void refreshViewers();
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/utils/LabelProviderUtil.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/utils/LabelProviderUtil.java new file mode 100644 index 00000000000..bb9ee1d67fb --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.infra.emf.compare.ui/src/org/eclipse/papyrus/infra/emf/compare/ui/utils/LabelProviderUtil.java @@ -0,0 +1,98 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.emf.compare.ui.utils;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+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.osgi.util.NLS;
+import org.eclipse.papyrus.infra.emf.compare.ui.Activator;
+import org.eclipse.papyrus.infra.emf.compare.ui.messages.Messages;
+import org.eclipse.papyrus.infra.emf.compare.ui.provider.EMFCompareLabelProvider;
+
+/**
+ *
+ * This class provides methods to get the customizable LabelProvider for the CompareEditor and viewers
+ *
+ */
+//TODO : move this in the class EMFCompareLabelProvider (or not)
+//warning : there is a subclass to EMFCompareLabelProvider, with specific action with the CustomizationEngine
+public class LabelProviderUtil {
+
+ /**
+ * This list contains the name of the wanted customization to applied by default
+ * TODO add the plugins providing these customizations as dependencies ?
+ */
+ private static Collection<String> wantedCustomName;
+
+ private LabelProviderUtil() {
+ //to prevent intentiation
+ }
+
+ public static final EMFCompareLabelProvider createLabelProvider() {
+ CustomizationManager customizationManager = new CustomizationManager();
+ init(customizationManager);
+ return new EMFCompareLabelProvider(customizationManager);
+ }
+
+ /**
+ * FIXME : duplicated code with modelExplorer, table, ...?
+ * init the customization manager
+ *
+ * @param customizationManager
+ */
+ private static void init(final CustomizationManager customizationManager) {
+ if(wantedCustomName == null) {
+ wantedCustomName = new ArrayList<String>();
+ // the appearance can be customized here:
+ wantedCustomName.add("uml_compare_diff"); //$NON-NLS-1$
+ wantedCustomName.add("uml_emf_compare_diff"); //$NON-NLS-1$
+ wantedCustomName.add("compare_diff"); //$NON-NLS-1$
+ wantedCustomName.add("UMLPapyrusDefaultBrowserCustomization"); //$NON-NLS-1$
+ // wantedCustomName.add("SysMLDefaultExplorerCustomization");
+ }
+
+ customizationManager.setShowDerivedLinks(true);
+
+ try {
+
+
+ final Collection<MetamodelView> wantedCustom = new ArrayList<MetamodelView>();
+ for(final String current : wantedCustomName) {
+ final MetamodelView custom = CustomizationsCatalog.getInstance().getCustomization(current);
+ if(custom != null) {
+ wantedCustom.add(custom);
+ } else {
+ Activator.log.warn(NLS.bind(Messages.LabelProviderUtil_CustomizationNotFound, current));
+ }
+ }
+
+ // load customizations defined as default through the customization
+ // extension
+
+ for(final MetamodelView metamodelView : wantedCustom) {
+ customizationManager.registerCustomization(metamodelView);
+ }
+ customizationManager.loadCustomizations();
+ //TODO load the facets!
+ // loadFacetsForCustomizations(registryDefaultCustomizations,customizationManager);
+
+ } catch (final Throwable e) {
+ Activator.log.error(e);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.classpath new file mode 100644 index 00000000000..234a93f739d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.classpath @@ -0,0 +1,8 @@ +<?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 excluding="org/eclipse/papyrus/uml/merger/provider/MergeCommandProvider.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/AttributeChangeLeftTargetTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/AttributeChangeRightTargetTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/AttributeOrderChangeTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/DefaultExtensionTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/DiffExtensionTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/DiffGroupTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/ModelElementChangeLeftTargetTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/ModelElementChangeRightTargetTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/MoveModelElementTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/ReferenceChangeLeftTargetTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/ReferenceChangeRightTargetTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/ReferenceOrderChangeTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/TransactionalDefaultMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/UpdateAttributeTransactionalMerger.java|org/eclipse/papyrus/uml/compare/merger/internal/old/merger/UpdateReferenceTransactionalMerger.java|org/eclipse/papyrus/uml/compare/diff/services/nested/UMLDiffService.java|org/eclipse/papyrus/uml/compare/diff/services/nested/UMLDiffEngine.java|org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneDiffEngine.java|org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneDiffService.java" kind="src" path="src"/>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.project new file mode 100644 index 00000000000..8d9d62229d4 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.project @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.compare.diff</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.emf.facet.common.ProjectNature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.settings/org.eclipse.jdt.core.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.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/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..5e84aaa7fe2 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/META-INF/MANIFEST.MF @@ -0,0 +1,43 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.emf.compare.diff;bundle-version="1.3.1",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.emf.transaction,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.0",
+ org.eclipse.emf.compare;bundle-version="1.3.1",
+ org.eclipse.papyrus.infra.tools;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
+ com.google.guava,
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.emf.compare.match,
+ org.eclipse.papyrus.infra.emf.compare.common;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf.compare.diff;bundle-version="0.10.0",
+ org.eclipse.uml2.uml,
+ org.eclipse.emf.compare.diff.edit,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf.compare.ui;bundle-version="0.10.0",
+ org.eclipse.emf.facet.infra.browser.custom.core,
+ org.eclipse.emf.compare.uml2;bundle-version="1.3.1"
+Export-Package: org.eclipse.papyrus.uml.compare.diff,
+ org.eclipse.papyrus.uml.compare.diff.internal.merger,
+ org.eclipse.papyrus.uml.compare.diff.services,
+ org.eclipse.papyrus.uml.compare.diff.services.nested,
+ org.eclipse.papyrus.uml.compare.diff.services.standalone,
+ org.eclipse.papyrus.uml.compare.diff.uml_diff_extension,
+ org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl,
+ org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.util
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.compare.diff.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.uml.compare.diff;singleton:=t
+ rue
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/build.properties new file mode 100644 index 00000000000..2fe142429ae --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/build.properties @@ -0,0 +1,10 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.pdoc,\
+ build.properties,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/model/papyrus_uml_diff_extension.ecore b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/model/papyrus_uml_diff_extension.ecore new file mode 100644 index 00000000000..990417d6cbf --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/model/papyrus_uml_diff_extension.ecore @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="uml_diff_extension" nsURI="http://www.eclipse.org/papyrus/uml/compare/diff_ext/0.9"
+ nsPrefix="uml_diff_extension">
+ <eClassifiers xsi:type="ecore:EClass" name="GeneralizationTargetChangedExtension"
+ eSuperTypes="#//UMLDiffExtension platform:/plugin/org.eclipse.emf.compare.diff/model/diff.ecore#//UpdateReference"/>
+ <eClassifiers xsi:type="ecore:EClass" name="GeneralizationSourceChangedExtension"
+ eSuperTypes="#//UMLDiffExtension platform:/plugin/org.eclipse.emf.compare.diff/model/diff.ecore#//MoveModelElement"/>
+ <eClassifiers xsi:type="ecore:EClass" name="UMLDiffExtension" eSuperTypes="platform:/plugin/org.eclipse.emf.compare.diff/model/diff.ecore#//AbstractDiffExtension"/>
+</ecore:EPackage>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/model/papyrus_uml_diff_extension.genmodel b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/model/papyrus_uml_diff_extension.genmodel new file mode 100644 index 00000000000..ace8fa8ded4 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/model/papyrus_uml_diff_extension.genmodel @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel"
+ copyrightText="Copyright (c) 2012 CEA LIST.
 
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html

 Contributors:
 Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation

"
+ modelDirectory="/org.eclipse.papyrus.uml.compare.diff/src-gen" modelPluginID="org.eclipse.papyrus.uml.compare.diff"
+ modelName="Papyrus_uml_diff_extension" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0" copyrightFields="false" publicConstructors="true" usedGenPackages="platform:/plugin/org.eclipse.emf.compare.diff/model/diff.genmodel#//diff platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore platform:/plugin/org.eclipse.emf.compare.match/model/match.genmodel#//match">
+ <foreignModel>papyrus_uml_diff_extension.ecore</foreignModel>
+ <genPackages prefix="Uml_diff_extension" basePackage="org.eclipse.papyrus.uml.compare.diff"
+ disposableProviderFactory="true" ecorePackage="papyrus_uml_diff_extension.ecore#/">
+ <genClasses ecoreClass="papyrus_uml_diff_extension.ecore#//GeneralizationTargetChangedExtension"/>
+ <genClasses ecoreClass="papyrus_uml_diff_extension.ecore#//GeneralizationSourceChangedExtension"/>
+ <genClasses ecoreClass="papyrus_uml_diff_extension.ecore#//UMLDiffExtension"/>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.pdoc b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.pdoc new file mode 100644 index 00000000000..955d3907f13 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.pdoc @@ -0,0 +1,4 @@ +<?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 Transactional Merger for the Papyrus Compare Editors.">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.properties new file mode 100644 index 00000000000..d3cfd91de24 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.papyrus.uml.compare.diff
+providerName = Eclipse Modeling Project
+pluginName = Papyrus UML Merger (Incubation)
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.xml b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.xml new file mode 100644 index 00000000000..8944ed30092 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/plugin.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.emf.compare.diff.mergerprovider">
+ <mergerprovider
+ fileExtension="uml"
+ mergerProviderClass="org.eclipse.papyrus.uml.compare.diff.internal.provider.UMLTransactionalMergerProvider"
+ priority="high">
+ </mergerprovider>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.infra.query.registration">
+ <modelqueryset
+ file="resources/uml_compare_diff.querySet">
+ </modelqueryset>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
+ <browserCustomization
+ file="resources/uml_compare_diff.uiCustom"
+ loadByDefault="true">
+ </browserCustomization>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
+ <browserCustomization
+ file="resources/uml_emf_compare_diff.uiCustom"
+ loadByDefault="true">
+ </browserCustomization>
+ </extension>
+ <extension
+ point="org.eclipse.emf.ecore.generated_package">
+ <package
+ class="org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionPackageImpl"
+ genModel="model/papyrus_uml_diff_extension.genmodel"
+ uri="http://www.eclipse.org/papyrus/uml/compare/diff_ext/0.9">
+ </package>
+ </extension>
+
+</plugin>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_compare_diff.querySet b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_compare_diff.querySet new file mode 100644 index 00000000000..193139ef5cc --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_compare_diff.querySet @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="ASCII"?>
+<query:ModelQuerySet xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="uml_compare_diff">
+ <associatedMetamodels href="http://www.eclipse.org/emf/2002/Ecore#/"/>
+ <queries xsi:type="query:JavaModelQuery" name="GetDiffElementLabel" description="This query returns the label for the element" implementationClassName="org.eclipse.papyrus.uml.compare.diff.queries.GetDiffElementLabel">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <scope href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ </queries>
+</query:ModelQuerySet>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_compare_diff.uiCustom b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_compare_diff.uiCustom new file mode 100644 index 00000000000..eeb8561d2cc --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_compare_diff.uiCustom @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="ASCII"?>
+<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/papyrus/uml/compare/diff_ext/0.9">
+ <types metaclassName="uml_diff_extension.UMLDiffExtension">
+ <customizedFeatures customizedFeature="label">
+ <defaultValue xsi:type="uicustom:DerivedFeatureValue">
+ <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/uml_compare_diff#GetDiffElementLabel"/>
+ </defaultValue>
+ </customizedFeatures>
+ <customizedFeatures customizedFeature="hideMetaclassName">
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
+ </customizedFeatures>
+ </types>
+</uicustom:MetamodelView>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_emf_compare_diff.uiCustom b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_emf_compare_diff.uiCustom new file mode 100644 index 00000000000..31419544acb --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/resources/uml_emf_compare_diff.uiCustom @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="ASCII"?>
+<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/emf/compare/diff/uml2/1.0">
+ <types metaclassName="uml2diff.UMLDiffExtension">
+ <customizedFeatures customizedFeature="label">
+ <defaultValue xsi:type="uicustom:DerivedFeatureValue">
+ <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/uml_compare_diff#GetDiffElementLabel"/>
+ </defaultValue>
+ </customizedFeatures>
+ <customizedFeatures customizedFeature="hideMetaclassName">
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
+ </customizedFeatures>
+ </types>
+</uicustom:MetamodelView>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/GeneralizationSourceChangedExtension.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/GeneralizationSourceChangedExtension.java new file mode 100644 index 00000000000..b8147112f32 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/GeneralizationSourceChangedExtension.java @@ -0,0 +1,29 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension;
+
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Generalization Source Changed Extension</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage#getGeneralizationSourceChangedExtension()
+ * @model
+ * @generated
+ */
+public interface GeneralizationSourceChangedExtension extends UMLDiffExtension, MoveModelElement {
+} // GeneralizationSourceChangedExtension
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/GeneralizationTargetChangedExtension.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/GeneralizationTargetChangedExtension.java new file mode 100644 index 00000000000..e9c67424e2c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/GeneralizationTargetChangedExtension.java @@ -0,0 +1,29 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension;
+
+import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Generalization Target Changed Extension</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage#getGeneralizationTargetChangedExtension()
+ * @model
+ * @generated
+ */
+public interface GeneralizationTargetChangedExtension extends UMLDiffExtension, UpdateReference {
+} // GeneralizationTargetChangedExtension
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/UMLDiffExtension.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/UMLDiffExtension.java new file mode 100644 index 00000000000..a6c08e01802 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/UMLDiffExtension.java @@ -0,0 +1,29 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>UML Diff Extension</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage#getUMLDiffExtension()
+ * @model
+ * @generated
+ */
+public interface UMLDiffExtension extends AbstractDiffExtension {
+} // UMLDiffExtension
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/Uml_diff_extensionFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/Uml_diff_extensionFactory.java new file mode 100644 index 00000000000..31188d8a1e5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/Uml_diff_extensionFactory.java @@ -0,0 +1,71 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension;
+
+import org.eclipse.emf.ecore.EFactory;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage
+ * @generated
+ */
+public interface Uml_diff_extensionFactory extends EFactory {
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ Uml_diff_extensionFactory eINSTANCE = org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Generalization Target Changed Extension</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Generalization Target Changed Extension</em>'.
+ * @generated
+ */
+ GeneralizationTargetChangedExtension createGeneralizationTargetChangedExtension();
+
+ /**
+ * Returns a new object of class '<em>Generalization Source Changed Extension</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Generalization Source Changed Extension</em>'.
+ * @generated
+ */
+ GeneralizationSourceChangedExtension createGeneralizationSourceChangedExtension();
+
+ /**
+ * Returns a new object of class '<em>UML Diff Extension</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>UML Diff Extension</em>'.
+ * @generated
+ */
+ UMLDiffExtension createUMLDiffExtension();
+
+ /**
+ * Returns the package supported by this factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the package supported by this factory.
+ * @generated
+ */
+ Uml_diff_extensionPackage getUml_diff_extensionPackage();
+
+} //Uml_diff_extensionFactory
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/Uml_diff_extensionPackage.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/Uml_diff_extensionPackage.java new file mode 100644 index 00000000000..72e1eae231c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/Uml_diff_extensionPackage.java @@ -0,0 +1,472 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension;
+
+import org.eclipse.emf.compare.diff.metamodel.DiffPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Package</b> for the model.
+ * It contains accessors for the meta objects to represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionFactory
+ * @model kind="package"
+ * @generated
+ */
+public interface Uml_diff_extensionPackage extends EPackage {
+ /**
+ * The package name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNAME = "uml_diff_extension";
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_URI = "http://www.eclipse.org/papyrus/uml/compare/diff_ext/0.9";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ String eNS_PREFIX = "uml_diff_extension";
+
+ /**
+ * The singleton instance of the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ Uml_diff_extensionPackage eINSTANCE = org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionPackageImpl.init();
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.UMLDiffExtensionImpl <em>UML Diff Extension</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.UMLDiffExtensionImpl
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionPackageImpl#getUMLDiffExtension()
+ * @generated
+ */
+ int UML_DIFF_EXTENSION = 2;
+
+ /**
+ * The feature id for the '<em><b>Hide Elements</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int UML_DIFF_EXTENSION__HIDE_ELEMENTS = DiffPackage.ABSTRACT_DIFF_EXTENSION__HIDE_ELEMENTS;
+
+ /**
+ * The feature id for the '<em><b>Is Collapsed</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int UML_DIFF_EXTENSION__IS_COLLAPSED = DiffPackage.ABSTRACT_DIFF_EXTENSION__IS_COLLAPSED;
+
+ /**
+ * The number of structural features of the '<em>UML Diff Extension</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int UML_DIFF_EXTENSION_FEATURE_COUNT = DiffPackage.ABSTRACT_DIFF_EXTENSION_FEATURE_COUNT + 0;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl <em>Generalization Target Changed Extension</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionPackageImpl#getGeneralizationTargetChangedExtension()
+ * @generated
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION = 0;
+
+ /**
+ * The feature id for the '<em><b>Hide Elements</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__HIDE_ELEMENTS = UML_DIFF_EXTENSION__HIDE_ELEMENTS;
+
+ /**
+ * The feature id for the '<em><b>Is Collapsed</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_COLLAPSED = UML_DIFF_EXTENSION__IS_COLLAPSED;
+
+ /**
+ * The feature id for the '<em><b>Sub Diff Elements</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS = UML_DIFF_EXTENSION_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Is Hidden By</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY = UML_DIFF_EXTENSION_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Conflicting</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__CONFLICTING = UML_DIFF_EXTENSION_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__KIND = UML_DIFF_EXTENSION_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Remote</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__REMOTE = UML_DIFF_EXTENSION_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Requires</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES = UML_DIFF_EXTENSION_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Required By</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY = UML_DIFF_EXTENSION_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Reference</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE = UML_DIFF_EXTENSION_FEATURE_COUNT + 7;
+
+ /**
+ * The feature id for the '<em><b>Right Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT = UML_DIFF_EXTENSION_FEATURE_COUNT + 8;
+
+ /**
+ * The feature id for the '<em><b>Left Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT = UML_DIFF_EXTENSION_FEATURE_COUNT + 9;
+
+ /**
+ * The feature id for the '<em><b>Left Target</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET = UML_DIFF_EXTENSION_FEATURE_COUNT + 10;
+
+ /**
+ * The feature id for the '<em><b>Right Target</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET = UML_DIFF_EXTENSION_FEATURE_COUNT + 11;
+
+ /**
+ * The number of structural features of the '<em>Generalization Target Changed Extension</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_TARGET_CHANGED_EXTENSION_FEATURE_COUNT = UML_DIFF_EXTENSION_FEATURE_COUNT + 12;
+
+ /**
+ * The meta object id for the '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl <em>Generalization Source Changed Extension</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionPackageImpl#getGeneralizationSourceChangedExtension()
+ * @generated
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION = 1;
+
+ /**
+ * The feature id for the '<em><b>Hide Elements</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__HIDE_ELEMENTS = UML_DIFF_EXTENSION__HIDE_ELEMENTS;
+
+ /**
+ * The feature id for the '<em><b>Is Collapsed</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_COLLAPSED = UML_DIFF_EXTENSION__IS_COLLAPSED;
+
+ /**
+ * The feature id for the '<em><b>Sub Diff Elements</b></em>' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS = UML_DIFF_EXTENSION_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Is Hidden By</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY = UML_DIFF_EXTENSION_FEATURE_COUNT + 1;
+
+ /**
+ * The feature id for the '<em><b>Conflicting</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__CONFLICTING = UML_DIFF_EXTENSION_FEATURE_COUNT + 2;
+
+ /**
+ * The feature id for the '<em><b>Kind</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__KIND = UML_DIFF_EXTENSION_FEATURE_COUNT + 3;
+
+ /**
+ * The feature id for the '<em><b>Remote</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__REMOTE = UML_DIFF_EXTENSION_FEATURE_COUNT + 4;
+
+ /**
+ * The feature id for the '<em><b>Requires</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES = UML_DIFF_EXTENSION_FEATURE_COUNT + 5;
+
+ /**
+ * The feature id for the '<em><b>Required By</b></em>' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY = UML_DIFF_EXTENSION_FEATURE_COUNT + 6;
+
+ /**
+ * The feature id for the '<em><b>Right Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT = UML_DIFF_EXTENSION_FEATURE_COUNT + 7;
+
+ /**
+ * The feature id for the '<em><b>Left Element</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT = UML_DIFF_EXTENSION_FEATURE_COUNT + 8;
+
+ /**
+ * The feature id for the '<em><b>Left Target</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET = UML_DIFF_EXTENSION_FEATURE_COUNT + 9;
+
+ /**
+ * The feature id for the '<em><b>Right Target</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET = UML_DIFF_EXTENSION_FEATURE_COUNT + 10;
+
+ /**
+ * The number of structural features of the '<em>Generalization Source Changed Extension</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ int GENERALIZATION_SOURCE_CHANGED_EXTENSION_FEATURE_COUNT = UML_DIFF_EXTENSION_FEATURE_COUNT + 11;
+
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationTargetChangedExtension <em>Generalization Target Changed Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Generalization Target Changed Extension</em>'.
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationTargetChangedExtension
+ * @generated
+ */
+ EClass getGeneralizationTargetChangedExtension();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationSourceChangedExtension <em>Generalization Source Changed Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Generalization Source Changed Extension</em>'.
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationSourceChangedExtension
+ * @generated
+ */
+ EClass getGeneralizationSourceChangedExtension();
+
+ /**
+ * Returns the meta object for class '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.UMLDiffExtension <em>UML Diff Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>UML Diff Extension</em>'.
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.UMLDiffExtension
+ * @generated
+ */
+ EClass getUMLDiffExtension();
+
+ /**
+ * Returns the factory that creates the instances of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the factory that creates the instances of the model.
+ * @generated
+ */
+ Uml_diff_extensionFactory getUml_diff_extensionFactory();
+
+ /**
+ * <!-- begin-user-doc -->
+ * Defines literals for the meta objects that represent
+ * <ul>
+ * <li>each class,</li>
+ * <li>each feature of each class,</li>
+ * <li>each enum,</li>
+ * <li>and each data type</li>
+ * </ul>
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ interface Literals {
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl <em>Generalization Target Changed Extension</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionPackageImpl#getGeneralizationTargetChangedExtension()
+ * @generated
+ */
+ EClass GENERALIZATION_TARGET_CHANGED_EXTENSION = eINSTANCE.getGeneralizationTargetChangedExtension();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl <em>Generalization Source Changed Extension</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionPackageImpl#getGeneralizationSourceChangedExtension()
+ * @generated
+ */
+ EClass GENERALIZATION_SOURCE_CHANGED_EXTENSION = eINSTANCE.getGeneralizationSourceChangedExtension();
+
+ /**
+ * The meta object literal for the '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.UMLDiffExtensionImpl <em>UML Diff Extension</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.UMLDiffExtensionImpl
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.Uml_diff_extensionPackageImpl#getUMLDiffExtension()
+ * @generated
+ */
+ EClass UML_DIFF_EXTENSION = eINSTANCE.getUMLDiffExtension();
+
+ }
+
+} //Uml_diff_extensionPackage
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/GeneralizationSourceChangedExtensionImpl.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/GeneralizationSourceChangedExtensionImpl.java new file mode 100644 index 00000000000..143f1aafd7a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/GeneralizationSourceChangedExtensionImpl.java @@ -0,0 +1,762 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffPackage;
+import org.eclipse.emf.compare.diff.metamodel.DifferenceKind;
+import org.eclipse.emf.compare.diff.metamodel.ModelElementChange;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.compare.diff.metamodel.UpdateModelElement;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationSourceChangedExtension;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Generalization Source Changed Extension</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getSubDiffElements <em>Sub Diff Elements</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getIsHiddenBy <em>Is Hidden By</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#isConflicting <em>Conflicting</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getKind <em>Kind</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#isRemote <em>Remote</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getRequires <em>Requires</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getRequiredBy <em>Required By</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getRightElement <em>Right Element</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getLeftElement <em>Left Element</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getLeftTarget <em>Left Target</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl#getRightTarget <em>Right Target</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class GeneralizationSourceChangedExtensionImpl extends UMLDiffExtensionImpl implements GeneralizationSourceChangedExtension {
+ /**
+ * The cached value of the '{@link #getSubDiffElements() <em>Sub Diff Elements</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSubDiffElements()
+ * @generated
+ * @ordered
+ */
+ protected EList<DiffElement> subDiffElements;
+
+ /**
+ * The cached value of the '{@link #getIsHiddenBy() <em>Is Hidden By</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIsHiddenBy()
+ * @generated
+ * @ordered
+ */
+ protected EList<AbstractDiffExtension> isHiddenBy;
+
+ /**
+ * The default value of the '{@link #isConflicting() <em>Conflicting</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isConflicting()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CONFLICTING_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isConflicting() <em>Conflicting</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isConflicting()
+ * @generated
+ * @ordered
+ */
+ protected boolean conflicting = CONFLICTING_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected static final DifferenceKind KIND_EDEFAULT = DifferenceKind.ADDITION;
+
+ /**
+ * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected DifferenceKind kind = KIND_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isRemote() <em>Remote</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isRemote()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean REMOTE_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isRemote() <em>Remote</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isRemote()
+ * @generated
+ * @ordered
+ */
+ protected boolean remote = REMOTE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getRequires() <em>Requires</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRequires()
+ * @generated
+ * @ordered
+ */
+ protected EList<DiffElement> requires;
+
+ /**
+ * The cached value of the '{@link #getRequiredBy() <em>Required By</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRequiredBy()
+ * @generated
+ * @ordered
+ */
+ protected EList<DiffElement> requiredBy;
+
+ /**
+ * The cached value of the '{@link #getRightElement() <em>Right Element</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRightElement()
+ * @generated
+ * @ordered
+ */
+ protected EObject rightElement;
+
+ /**
+ * The cached value of the '{@link #getLeftElement() <em>Left Element</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLeftElement()
+ * @generated
+ * @ordered
+ */
+ protected EObject leftElement;
+
+ /**
+ * The cached value of the '{@link #getLeftTarget() <em>Left Target</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLeftTarget()
+ * @generated
+ * @ordered
+ */
+ protected EObject leftTarget;
+
+ /**
+ * The cached value of the '{@link #getRightTarget() <em>Right Target</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRightTarget()
+ * @generated
+ * @ordered
+ */
+ protected EObject rightTarget;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GeneralizationSourceChangedExtensionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return Uml_diff_extensionPackage.Literals.GENERALIZATION_SOURCE_CHANGED_EXTENSION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<DiffElement> getSubDiffElements() {
+ if (subDiffElements == null) {
+ subDiffElements = new EObjectContainmentEList<DiffElement>(DiffElement.class, this, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS);
+ }
+ return subDiffElements;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<AbstractDiffExtension> getIsHiddenBy() {
+ if (isHiddenBy == null) {
+ isHiddenBy = new EObjectWithInverseResolvingEList.ManyInverse<AbstractDiffExtension>(AbstractDiffExtension.class, this, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY, DiffPackage.ABSTRACT_DIFF_EXTENSION__HIDE_ELEMENTS);
+ }
+ return isHiddenBy;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isConflicting() {
+ return conflicting;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DifferenceKind getKind() {
+ return kind;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isRemote() {
+ return remote;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setRemote(boolean newRemote) {
+ boolean oldRemote = remote;
+ remote = newRemote;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REMOTE, oldRemote, remote));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<DiffElement> getRequires() {
+ if (requires == null) {
+ requires = new EObjectWithInverseResolvingEList.ManyInverse<DiffElement>(DiffElement.class, this, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES, DiffPackage.DIFF_ELEMENT__REQUIRED_BY);
+ }
+ return requires;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<DiffElement> getRequiredBy() {
+ if (requiredBy == null) {
+ requiredBy = new EObjectWithInverseResolvingEList.ManyInverse<DiffElement>(DiffElement.class, this, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY, DiffPackage.DIFF_ELEMENT__REQUIRES);
+ }
+ return requiredBy;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getRightElement() {
+ if (rightElement != null && rightElement.eIsProxy()) {
+ InternalEObject oldRightElement = (InternalEObject)rightElement;
+ rightElement = eResolveProxy(oldRightElement);
+ if (rightElement != oldRightElement) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT, oldRightElement, rightElement));
+ }
+ }
+ return rightElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetRightElement() {
+ return rightElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setRightElement(EObject newRightElement) {
+ EObject oldRightElement = rightElement;
+ rightElement = newRightElement;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT, oldRightElement, rightElement));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getLeftElement() {
+ if (leftElement != null && leftElement.eIsProxy()) {
+ InternalEObject oldLeftElement = (InternalEObject)leftElement;
+ leftElement = eResolveProxy(oldLeftElement);
+ if (leftElement != oldLeftElement) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT, oldLeftElement, leftElement));
+ }
+ }
+ return leftElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetLeftElement() {
+ return leftElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLeftElement(EObject newLeftElement) {
+ EObject oldLeftElement = leftElement;
+ leftElement = newLeftElement;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT, oldLeftElement, leftElement));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getLeftTarget() {
+ if (leftTarget != null && leftTarget.eIsProxy()) {
+ InternalEObject oldLeftTarget = (InternalEObject)leftTarget;
+ leftTarget = eResolveProxy(oldLeftTarget);
+ if (leftTarget != oldLeftTarget) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET, oldLeftTarget, leftTarget));
+ }
+ }
+ return leftTarget;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetLeftTarget() {
+ return leftTarget;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLeftTarget(EObject newLeftTarget) {
+ EObject oldLeftTarget = leftTarget;
+ leftTarget = newLeftTarget;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET, oldLeftTarget, leftTarget));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getRightTarget() {
+ if (rightTarget != null && rightTarget.eIsProxy()) {
+ InternalEObject oldRightTarget = (InternalEObject)rightTarget;
+ rightTarget = eResolveProxy(oldRightTarget);
+ if (rightTarget != oldRightTarget) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET, oldRightTarget, rightTarget));
+ }
+ }
+ return rightTarget;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetRightTarget() {
+ return rightTarget;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setRightTarget(EObject newRightTarget) {
+ EObject oldRightTarget = rightTarget;
+ rightTarget = newRightTarget;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET, oldRightTarget, rightTarget));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getIsHiddenBy()).basicAdd(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getRequires()).basicAdd(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getRequiredBy()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ return ((InternalEList<?>)getSubDiffElements()).basicRemove(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ return ((InternalEList<?>)getIsHiddenBy()).basicRemove(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES:
+ return ((InternalEList<?>)getRequires()).basicRemove(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY:
+ return ((InternalEList<?>)getRequiredBy()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ return getSubDiffElements();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ return getIsHiddenBy();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__CONFLICTING:
+ return isConflicting();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__KIND:
+ return getKind();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REMOTE:
+ return isRemote();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES:
+ return getRequires();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY:
+ return getRequiredBy();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT:
+ if (resolve) return getRightElement();
+ return basicGetRightElement();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT:
+ if (resolve) return getLeftElement();
+ return basicGetLeftElement();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET:
+ if (resolve) return getLeftTarget();
+ return basicGetLeftTarget();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET:
+ if (resolve) return getRightTarget();
+ return basicGetRightTarget();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ getSubDiffElements().clear();
+ getSubDiffElements().addAll((Collection<? extends DiffElement>)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ getIsHiddenBy().clear();
+ getIsHiddenBy().addAll((Collection<? extends AbstractDiffExtension>)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REMOTE:
+ setRemote((Boolean)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES:
+ getRequires().clear();
+ getRequires().addAll((Collection<? extends DiffElement>)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY:
+ getRequiredBy().clear();
+ getRequiredBy().addAll((Collection<? extends DiffElement>)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT:
+ setRightElement((EObject)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT:
+ setLeftElement((EObject)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET:
+ setLeftTarget((EObject)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET:
+ setRightTarget((EObject)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ getSubDiffElements().clear();
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ getIsHiddenBy().clear();
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REMOTE:
+ setRemote(REMOTE_EDEFAULT);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES:
+ getRequires().clear();
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY:
+ getRequiredBy().clear();
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT:
+ setRightElement((EObject)null);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT:
+ setLeftElement((EObject)null);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET:
+ setLeftTarget((EObject)null);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET:
+ setRightTarget((EObject)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ return subDiffElements != null && !subDiffElements.isEmpty();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ return isHiddenBy != null && !isHiddenBy.isEmpty();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__CONFLICTING:
+ return conflicting != CONFLICTING_EDEFAULT;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__KIND:
+ return kind != KIND_EDEFAULT;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REMOTE:
+ return remote != REMOTE_EDEFAULT;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES:
+ return requires != null && !requires.isEmpty();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY:
+ return requiredBy != null && !requiredBy.isEmpty();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT:
+ return rightElement != null;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT:
+ return leftElement != null;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET:
+ return leftTarget != null;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET:
+ return rightTarget != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
+ if (baseClass == DiffElement.class) {
+ switch (derivedFeatureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS: return DiffPackage.DIFF_ELEMENT__SUB_DIFF_ELEMENTS;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY: return DiffPackage.DIFF_ELEMENT__IS_HIDDEN_BY;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__CONFLICTING: return DiffPackage.DIFF_ELEMENT__CONFLICTING;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__KIND: return DiffPackage.DIFF_ELEMENT__KIND;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REMOTE: return DiffPackage.DIFF_ELEMENT__REMOTE;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES: return DiffPackage.DIFF_ELEMENT__REQUIRES;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY: return DiffPackage.DIFF_ELEMENT__REQUIRED_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == ModelElementChange.class) {
+ switch (derivedFeatureID) {
+ default: return -1;
+ }
+ }
+ if (baseClass == UpdateModelElement.class) {
+ switch (derivedFeatureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT: return DiffPackage.UPDATE_MODEL_ELEMENT__RIGHT_ELEMENT;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT: return DiffPackage.UPDATE_MODEL_ELEMENT__LEFT_ELEMENT;
+ default: return -1;
+ }
+ }
+ if (baseClass == MoveModelElement.class) {
+ switch (derivedFeatureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET: return DiffPackage.MOVE_MODEL_ELEMENT__LEFT_TARGET;
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET: return DiffPackage.MOVE_MODEL_ELEMENT__RIGHT_TARGET;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
+ if (baseClass == DiffElement.class) {
+ switch (baseFeatureID) {
+ case DiffPackage.DIFF_ELEMENT__SUB_DIFF_ELEMENTS: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS;
+ case DiffPackage.DIFF_ELEMENT__IS_HIDDEN_BY: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__IS_HIDDEN_BY;
+ case DiffPackage.DIFF_ELEMENT__CONFLICTING: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__CONFLICTING;
+ case DiffPackage.DIFF_ELEMENT__KIND: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__KIND;
+ case DiffPackage.DIFF_ELEMENT__REMOTE: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REMOTE;
+ case DiffPackage.DIFF_ELEMENT__REQUIRES: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRES;
+ case DiffPackage.DIFF_ELEMENT__REQUIRED_BY: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__REQUIRED_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == ModelElementChange.class) {
+ switch (baseFeatureID) {
+ default: return -1;
+ }
+ }
+ if (baseClass == UpdateModelElement.class) {
+ switch (baseFeatureID) {
+ case DiffPackage.UPDATE_MODEL_ELEMENT__RIGHT_ELEMENT: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_ELEMENT;
+ case DiffPackage.UPDATE_MODEL_ELEMENT__LEFT_ELEMENT: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_ELEMENT;
+ default: return -1;
+ }
+ }
+ if (baseClass == MoveModelElement.class) {
+ switch (baseFeatureID) {
+ case DiffPackage.MOVE_MODEL_ELEMENT__LEFT_TARGET: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__LEFT_TARGET;
+ case DiffPackage.MOVE_MODEL_ELEMENT__RIGHT_TARGET: return Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION__RIGHT_TARGET;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (conflicting: ");
+ result.append(conflicting);
+ result.append(", kind: ");
+ result.append(kind);
+ result.append(", remote: ");
+ result.append(remote);
+ result.append(')');
+ return result.toString();
+ }
+
+} //GeneralizationSourceChangedExtensionImpl
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/GeneralizationTargetChangedExtensionImpl.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/GeneralizationTargetChangedExtensionImpl.java new file mode 100644 index 00000000000..cf6c090c187 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/GeneralizationTargetChangedExtensionImpl.java @@ -0,0 +1,814 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.NotificationChain;
+
+import org.eclipse.emf.common.util.EList;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffPackage;
+import org.eclipse.emf.compare.diff.metamodel.DifferenceKind;
+import org.eclipse.emf.compare.diff.metamodel.ReferenceChange;
+import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.InternalEObject;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+import org.eclipse.emf.ecore.util.EObjectContainmentEList;
+import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
+import org.eclipse.emf.ecore.util.InternalEList;
+
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationTargetChangedExtension;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Generalization Target Changed Extension</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getSubDiffElements <em>Sub Diff Elements</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getIsHiddenBy <em>Is Hidden By</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#isConflicting <em>Conflicting</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getKind <em>Kind</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#isRemote <em>Remote</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getRequires <em>Requires</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getRequiredBy <em>Required By</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getReference <em>Reference</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getRightElement <em>Right Element</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getLeftElement <em>Left Element</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getLeftTarget <em>Left Target</em>}</li>
+ * <li>{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl#getRightTarget <em>Right Target</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class GeneralizationTargetChangedExtensionImpl extends UMLDiffExtensionImpl implements GeneralizationTargetChangedExtension {
+ /**
+ * The cached value of the '{@link #getSubDiffElements() <em>Sub Diff Elements</em>}' containment reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getSubDiffElements()
+ * @generated
+ * @ordered
+ */
+ protected EList<DiffElement> subDiffElements;
+
+ /**
+ * The cached value of the '{@link #getIsHiddenBy() <em>Is Hidden By</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getIsHiddenBy()
+ * @generated
+ * @ordered
+ */
+ protected EList<AbstractDiffExtension> isHiddenBy;
+
+ /**
+ * The default value of the '{@link #isConflicting() <em>Conflicting</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isConflicting()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean CONFLICTING_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isConflicting() <em>Conflicting</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isConflicting()
+ * @generated
+ * @ordered
+ */
+ protected boolean conflicting = CONFLICTING_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected static final DifferenceKind KIND_EDEFAULT = DifferenceKind.ADDITION;
+
+ /**
+ * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getKind()
+ * @generated
+ * @ordered
+ */
+ protected DifferenceKind kind = KIND_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #isRemote() <em>Remote</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isRemote()
+ * @generated
+ * @ordered
+ */
+ protected static final boolean REMOTE_EDEFAULT = false;
+
+ /**
+ * The cached value of the '{@link #isRemote() <em>Remote</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isRemote()
+ * @generated
+ * @ordered
+ */
+ protected boolean remote = REMOTE_EDEFAULT;
+
+ /**
+ * The cached value of the '{@link #getRequires() <em>Requires</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRequires()
+ * @generated
+ * @ordered
+ */
+ protected EList<DiffElement> requires;
+
+ /**
+ * The cached value of the '{@link #getRequiredBy() <em>Required By</em>}' reference list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRequiredBy()
+ * @generated
+ * @ordered
+ */
+ protected EList<DiffElement> requiredBy;
+
+ /**
+ * The cached value of the '{@link #getReference() <em>Reference</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getReference()
+ * @generated
+ * @ordered
+ */
+ protected EReference reference;
+
+ /**
+ * The cached value of the '{@link #getRightElement() <em>Right Element</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRightElement()
+ * @generated
+ * @ordered
+ */
+ protected EObject rightElement;
+
+ /**
+ * The cached value of the '{@link #getLeftElement() <em>Left Element</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLeftElement()
+ * @generated
+ * @ordered
+ */
+ protected EObject leftElement;
+
+ /**
+ * The cached value of the '{@link #getLeftTarget() <em>Left Target</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getLeftTarget()
+ * @generated
+ * @ordered
+ */
+ protected EObject leftTarget;
+
+ /**
+ * The cached value of the '{@link #getRightTarget() <em>Right Target</em>}' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getRightTarget()
+ * @generated
+ * @ordered
+ */
+ protected EObject rightTarget;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GeneralizationTargetChangedExtensionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return Uml_diff_extensionPackage.Literals.GENERALIZATION_TARGET_CHANGED_EXTENSION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<DiffElement> getSubDiffElements() {
+ if (subDiffElements == null) {
+ subDiffElements = new EObjectContainmentEList<DiffElement>(DiffElement.class, this, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS);
+ }
+ return subDiffElements;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<AbstractDiffExtension> getIsHiddenBy() {
+ if (isHiddenBy == null) {
+ isHiddenBy = new EObjectWithInverseResolvingEList.ManyInverse<AbstractDiffExtension>(AbstractDiffExtension.class, this, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY, DiffPackage.ABSTRACT_DIFF_EXTENSION__HIDE_ELEMENTS);
+ }
+ return isHiddenBy;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isConflicting() {
+ return conflicting;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DifferenceKind getKind() {
+ return kind;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isRemote() {
+ return remote;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setRemote(boolean newRemote) {
+ boolean oldRemote = remote;
+ remote = newRemote;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REMOTE, oldRemote, remote));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<DiffElement> getRequires() {
+ if (requires == null) {
+ requires = new EObjectWithInverseResolvingEList.ManyInverse<DiffElement>(DiffElement.class, this, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES, DiffPackage.DIFF_ELEMENT__REQUIRED_BY);
+ }
+ return requires;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EList<DiffElement> getRequiredBy() {
+ if (requiredBy == null) {
+ requiredBy = new EObjectWithInverseResolvingEList.ManyInverse<DiffElement>(DiffElement.class, this, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY, DiffPackage.DIFF_ELEMENT__REQUIRES);
+ }
+ return requiredBy;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getReference() {
+ if (reference != null && reference.eIsProxy()) {
+ InternalEObject oldReference = (InternalEObject)reference;
+ reference = (EReference)eResolveProxy(oldReference);
+ if (reference != oldReference) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE, oldReference, reference));
+ }
+ }
+ return reference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference basicGetReference() {
+ return reference;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setReference(EReference newReference) {
+ EReference oldReference = reference;
+ reference = newReference;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE, oldReference, reference));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getRightElement() {
+ if (rightElement != null && rightElement.eIsProxy()) {
+ InternalEObject oldRightElement = (InternalEObject)rightElement;
+ rightElement = eResolveProxy(oldRightElement);
+ if (rightElement != oldRightElement) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT, oldRightElement, rightElement));
+ }
+ }
+ return rightElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetRightElement() {
+ return rightElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setRightElement(EObject newRightElement) {
+ EObject oldRightElement = rightElement;
+ rightElement = newRightElement;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT, oldRightElement, rightElement));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getLeftElement() {
+ if (leftElement != null && leftElement.eIsProxy()) {
+ InternalEObject oldLeftElement = (InternalEObject)leftElement;
+ leftElement = eResolveProxy(oldLeftElement);
+ if (leftElement != oldLeftElement) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT, oldLeftElement, leftElement));
+ }
+ }
+ return leftElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetLeftElement() {
+ return leftElement;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLeftElement(EObject newLeftElement) {
+ EObject oldLeftElement = leftElement;
+ leftElement = newLeftElement;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT, oldLeftElement, leftElement));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getLeftTarget() {
+ if (leftTarget != null && leftTarget.eIsProxy()) {
+ InternalEObject oldLeftTarget = (InternalEObject)leftTarget;
+ leftTarget = eResolveProxy(oldLeftTarget);
+ if (leftTarget != oldLeftTarget) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET, oldLeftTarget, leftTarget));
+ }
+ }
+ return leftTarget;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetLeftTarget() {
+ return leftTarget;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setLeftTarget(EObject newLeftTarget) {
+ EObject oldLeftTarget = leftTarget;
+ leftTarget = newLeftTarget;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET, oldLeftTarget, leftTarget));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject getRightTarget() {
+ if (rightTarget != null && rightTarget.eIsProxy()) {
+ InternalEObject oldRightTarget = (InternalEObject)rightTarget;
+ rightTarget = eResolveProxy(oldRightTarget);
+ if (rightTarget != oldRightTarget) {
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.RESOLVE, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET, oldRightTarget, rightTarget));
+ }
+ }
+ return rightTarget;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EObject basicGetRightTarget() {
+ return rightTarget;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setRightTarget(EObject newRightTarget) {
+ EObject oldRightTarget = rightTarget;
+ rightTarget = newRightTarget;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET, oldRightTarget, rightTarget));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getIsHiddenBy()).basicAdd(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getRequires()).basicAdd(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY:
+ return ((InternalEList<InternalEObject>)(InternalEList<?>)getRequiredBy()).basicAdd(otherEnd, msgs);
+ }
+ return super.eInverseAdd(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ return ((InternalEList<?>)getSubDiffElements()).basicRemove(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ return ((InternalEList<?>)getIsHiddenBy()).basicRemove(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES:
+ return ((InternalEList<?>)getRequires()).basicRemove(otherEnd, msgs);
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY:
+ return ((InternalEList<?>)getRequiredBy()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ return getSubDiffElements();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ return getIsHiddenBy();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__CONFLICTING:
+ return isConflicting();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__KIND:
+ return getKind();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REMOTE:
+ return isRemote();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES:
+ return getRequires();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY:
+ return getRequiredBy();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE:
+ if (resolve) return getReference();
+ return basicGetReference();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT:
+ if (resolve) return getRightElement();
+ return basicGetRightElement();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT:
+ if (resolve) return getLeftElement();
+ return basicGetLeftElement();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET:
+ if (resolve) return getLeftTarget();
+ return basicGetLeftTarget();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET:
+ if (resolve) return getRightTarget();
+ return basicGetRightTarget();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ getSubDiffElements().clear();
+ getSubDiffElements().addAll((Collection<? extends DiffElement>)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ getIsHiddenBy().clear();
+ getIsHiddenBy().addAll((Collection<? extends AbstractDiffExtension>)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REMOTE:
+ setRemote((Boolean)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES:
+ getRequires().clear();
+ getRequires().addAll((Collection<? extends DiffElement>)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY:
+ getRequiredBy().clear();
+ getRequiredBy().addAll((Collection<? extends DiffElement>)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE:
+ setReference((EReference)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT:
+ setRightElement((EObject)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT:
+ setLeftElement((EObject)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET:
+ setLeftTarget((EObject)newValue);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET:
+ setRightTarget((EObject)newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ getSubDiffElements().clear();
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ getIsHiddenBy().clear();
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REMOTE:
+ setRemote(REMOTE_EDEFAULT);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES:
+ getRequires().clear();
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY:
+ getRequiredBy().clear();
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE:
+ setReference((EReference)null);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT:
+ setRightElement((EObject)null);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT:
+ setLeftElement((EObject)null);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET:
+ setLeftTarget((EObject)null);
+ return;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET:
+ setRightTarget((EObject)null);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS:
+ return subDiffElements != null && !subDiffElements.isEmpty();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY:
+ return isHiddenBy != null && !isHiddenBy.isEmpty();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__CONFLICTING:
+ return conflicting != CONFLICTING_EDEFAULT;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__KIND:
+ return kind != KIND_EDEFAULT;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REMOTE:
+ return remote != REMOTE_EDEFAULT;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES:
+ return requires != null && !requires.isEmpty();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY:
+ return requiredBy != null && !requiredBy.isEmpty();
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE:
+ return reference != null;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT:
+ return rightElement != null;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT:
+ return leftElement != null;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET:
+ return leftTarget != null;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET:
+ return rightTarget != null;
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
+ if (baseClass == DiffElement.class) {
+ switch (derivedFeatureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS: return DiffPackage.DIFF_ELEMENT__SUB_DIFF_ELEMENTS;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY: return DiffPackage.DIFF_ELEMENT__IS_HIDDEN_BY;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__CONFLICTING: return DiffPackage.DIFF_ELEMENT__CONFLICTING;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__KIND: return DiffPackage.DIFF_ELEMENT__KIND;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REMOTE: return DiffPackage.DIFF_ELEMENT__REMOTE;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES: return DiffPackage.DIFF_ELEMENT__REQUIRES;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY: return DiffPackage.DIFF_ELEMENT__REQUIRED_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == ReferenceChange.class) {
+ switch (derivedFeatureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE: return DiffPackage.REFERENCE_CHANGE__REFERENCE;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT: return DiffPackage.REFERENCE_CHANGE__RIGHT_ELEMENT;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT: return DiffPackage.REFERENCE_CHANGE__LEFT_ELEMENT;
+ default: return -1;
+ }
+ }
+ if (baseClass == UpdateReference.class) {
+ switch (derivedFeatureID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET: return DiffPackage.UPDATE_REFERENCE__LEFT_TARGET;
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET: return DiffPackage.UPDATE_REFERENCE__RIGHT_TARGET;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
+ if (baseClass == DiffElement.class) {
+ switch (baseFeatureID) {
+ case DiffPackage.DIFF_ELEMENT__SUB_DIFF_ELEMENTS: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__SUB_DIFF_ELEMENTS;
+ case DiffPackage.DIFF_ELEMENT__IS_HIDDEN_BY: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__IS_HIDDEN_BY;
+ case DiffPackage.DIFF_ELEMENT__CONFLICTING: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__CONFLICTING;
+ case DiffPackage.DIFF_ELEMENT__KIND: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__KIND;
+ case DiffPackage.DIFF_ELEMENT__REMOTE: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REMOTE;
+ case DiffPackage.DIFF_ELEMENT__REQUIRES: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRES;
+ case DiffPackage.DIFF_ELEMENT__REQUIRED_BY: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REQUIRED_BY;
+ default: return -1;
+ }
+ }
+ if (baseClass == ReferenceChange.class) {
+ switch (baseFeatureID) {
+ case DiffPackage.REFERENCE_CHANGE__REFERENCE: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__REFERENCE;
+ case DiffPackage.REFERENCE_CHANGE__RIGHT_ELEMENT: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_ELEMENT;
+ case DiffPackage.REFERENCE_CHANGE__LEFT_ELEMENT: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_ELEMENT;
+ default: return -1;
+ }
+ }
+ if (baseClass == UpdateReference.class) {
+ switch (baseFeatureID) {
+ case DiffPackage.UPDATE_REFERENCE__LEFT_TARGET: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__LEFT_TARGET;
+ case DiffPackage.UPDATE_REFERENCE__RIGHT_TARGET: return Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION__RIGHT_TARGET;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (conflicting: ");
+ result.append(conflicting);
+ result.append(", kind: ");
+ result.append(kind);
+ result.append(", remote: ");
+ result.append(remote);
+ result.append(')');
+ return result.toString();
+ }
+
+} //GeneralizationTargetChangedExtensionImpl
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/UMLDiffExtensionImpl.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/UMLDiffExtensionImpl.java new file mode 100644 index 00000000000..9e169a72a5d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/UMLDiffExtensionImpl.java @@ -0,0 +1,52 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl;
+
+import org.eclipse.emf.compare.diff.metamodel.impl.AbstractDiffExtensionImpl;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.UMLDiffExtension;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>UML Diff Extension</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * </p>
+ *
+ * @generated
+ */
+public class UMLDiffExtensionImpl extends AbstractDiffExtensionImpl implements UMLDiffExtension {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public UMLDiffExtensionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return Uml_diff_extensionPackage.Literals.UML_DIFF_EXTENSION;
+ }
+
+} //UMLDiffExtensionImpl
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/Uml_diff_extensionFactoryImpl.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/Uml_diff_extensionFactoryImpl.java new file mode 100644 index 00000000000..bbe1d4e770f --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/Uml_diff_extensionFactoryImpl.java @@ -0,0 +1,128 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EFactoryImpl;
+
+import org.eclipse.emf.ecore.plugin.EcorePlugin;
+
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class Uml_diff_extensionFactoryImpl extends EFactoryImpl implements Uml_diff_extensionFactory {
+ /**
+ * Creates the default factory implementation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static Uml_diff_extensionFactory init() {
+ try {
+ Uml_diff_extensionFactory theUml_diff_extensionFactory = (Uml_diff_extensionFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/papyrus/uml/compare/diff_ext/0.9");
+ if (theUml_diff_extensionFactory != null) {
+ return theUml_diff_extensionFactory;
+ }
+ }
+ catch (Exception exception) {
+ EcorePlugin.INSTANCE.log(exception);
+ }
+ return new Uml_diff_extensionFactoryImpl();
+ }
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Uml_diff_extensionFactoryImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public EObject create(EClass eClass) {
+ switch (eClass.getClassifierID()) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION: return createGeneralizationTargetChangedExtension();
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION: return createGeneralizationSourceChangedExtension();
+ case Uml_diff_extensionPackage.UML_DIFF_EXTENSION: return createUMLDiffExtension();
+ default:
+ throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GeneralizationTargetChangedExtension createGeneralizationTargetChangedExtension() {
+ GeneralizationTargetChangedExtensionImpl generalizationTargetChangedExtension = new GeneralizationTargetChangedExtensionImpl();
+ return generalizationTargetChangedExtension;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public GeneralizationSourceChangedExtension createGeneralizationSourceChangedExtension() {
+ GeneralizationSourceChangedExtensionImpl generalizationSourceChangedExtension = new GeneralizationSourceChangedExtensionImpl();
+ return generalizationSourceChangedExtension;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public UMLDiffExtension createUMLDiffExtension() {
+ UMLDiffExtensionImpl umlDiffExtension = new UMLDiffExtensionImpl();
+ return umlDiffExtension;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Uml_diff_extensionPackage getUml_diff_extensionPackage() {
+ return (Uml_diff_extensionPackage)getEPackage();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @deprecated
+ * @generated
+ */
+ @Deprecated
+ public static Uml_diff_extensionPackage getPackage() {
+ return Uml_diff_extensionPackage.eINSTANCE;
+ }
+
+} //Uml_diff_extensionFactoryImpl
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/Uml_diff_extensionPackageImpl.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/Uml_diff_extensionPackageImpl.java new file mode 100644 index 00000000000..df1447027ae --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/impl/Uml_diff_extensionPackageImpl.java @@ -0,0 +1,231 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl;
+
+import org.eclipse.emf.compare.diff.metamodel.DiffPackage;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationSourceChangedExtension;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationTargetChangedExtension;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.UMLDiffExtension;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionFactory;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class Uml_diff_extensionPackageImpl extends EPackageImpl implements Uml_diff_extensionPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass generalizationTargetChangedExtensionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass generalizationSourceChangedExtensionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass umlDiffExtensionEClass = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private Uml_diff_extensionPackageImpl() {
+ super(eNS_URI, Uml_diff_extensionFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link Uml_diff_extensionPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static Uml_diff_extensionPackage init() {
+ if (isInited) return (Uml_diff_extensionPackage)EPackage.Registry.INSTANCE.getEPackage(Uml_diff_extensionPackage.eNS_URI);
+
+ // Obtain or create and register package
+ Uml_diff_extensionPackageImpl theUml_diff_extensionPackage = (Uml_diff_extensionPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof Uml_diff_extensionPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new Uml_diff_extensionPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ DiffPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theUml_diff_extensionPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theUml_diff_extensionPackage.initializePackageContents();
+
+ // Mark meta-data to indicate it can't be changed
+ theUml_diff_extensionPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(Uml_diff_extensionPackage.eNS_URI, theUml_diff_extensionPackage);
+ return theUml_diff_extensionPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getGeneralizationTargetChangedExtension() {
+ return generalizationTargetChangedExtensionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getGeneralizationSourceChangedExtension() {
+ return generalizationSourceChangedExtensionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getUMLDiffExtension() {
+ return umlDiffExtensionEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Uml_diff_extensionFactory getUml_diff_extensionFactory() {
+ return (Uml_diff_extensionFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ generalizationTargetChangedExtensionEClass = createEClass(GENERALIZATION_TARGET_CHANGED_EXTENSION);
+
+ generalizationSourceChangedExtensionEClass = createEClass(GENERALIZATION_SOURCE_CHANGED_EXTENSION);
+
+ umlDiffExtensionEClass = createEClass(UML_DIFF_EXTENSION);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ DiffPackage theDiffPackage = (DiffPackage)EPackage.Registry.INSTANCE.getEPackage(DiffPackage.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ generalizationTargetChangedExtensionEClass.getESuperTypes().add(this.getUMLDiffExtension());
+ generalizationTargetChangedExtensionEClass.getESuperTypes().add(theDiffPackage.getUpdateReference());
+ generalizationSourceChangedExtensionEClass.getESuperTypes().add(this.getUMLDiffExtension());
+ generalizationSourceChangedExtensionEClass.getESuperTypes().add(theDiffPackage.getMoveModelElement());
+ umlDiffExtensionEClass.getESuperTypes().add(theDiffPackage.getAbstractDiffExtension());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(generalizationTargetChangedExtensionEClass, GeneralizationTargetChangedExtension.class, "GeneralizationTargetChangedExtension", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(generalizationSourceChangedExtensionEClass, GeneralizationSourceChangedExtension.class, "GeneralizationSourceChangedExtension", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ initEClass(umlDiffExtensionEClass, UMLDiffExtension.class, "UMLDiffExtension", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+
+ // Create resource
+ createResource(eNS_URI);
+ }
+
+} //Uml_diff_extensionPackageImpl
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/util/Uml_diff_extensionAdapterFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/util/Uml_diff_extensionAdapterFactory.java new file mode 100644 index 00000000000..a50c58f305d --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/util/Uml_diff_extensionAdapterFactory.java @@ -0,0 +1,301 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.util;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notifier;
+
+import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.ModelElementChange;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.compare.diff.metamodel.ReferenceChange;
+import org.eclipse.emf.compare.diff.metamodel.UpdateModelElement;
+import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
+
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Adapter Factory</b> for the model.
+ * It provides an adapter <code>createXXX</code> method for each class of the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage
+ * @generated
+ */
+public class Uml_diff_extensionAdapterFactory extends AdapterFactoryImpl {
+ /**
+ * The cached model package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static Uml_diff_extensionPackage modelPackage;
+
+ /**
+ * Creates an instance of the adapter factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Uml_diff_extensionAdapterFactory() {
+ if (modelPackage == null) {
+ modelPackage = Uml_diff_extensionPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Returns whether this factory is applicable for the type of the object.
+ * <!-- begin-user-doc -->
+ * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model.
+ * <!-- end-user-doc -->
+ * @return whether this factory is applicable for the type of the object.
+ * @generated
+ */
+ @Override
+ public boolean isFactoryForType(Object object) {
+ if (object == modelPackage) {
+ return true;
+ }
+ if (object instanceof EObject) {
+ return ((EObject)object).eClass().getEPackage() == modelPackage;
+ }
+ return false;
+ }
+
+ /**
+ * The switch that delegates to the <code>createXXX</code> methods.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected Uml_diff_extensionSwitch<Adapter> modelSwitch =
+ new Uml_diff_extensionSwitch<Adapter>() {
+ @Override
+ public Adapter caseGeneralizationTargetChangedExtension(GeneralizationTargetChangedExtension object) {
+ return createGeneralizationTargetChangedExtensionAdapter();
+ }
+ @Override
+ public Adapter caseGeneralizationSourceChangedExtension(GeneralizationSourceChangedExtension object) {
+ return createGeneralizationSourceChangedExtensionAdapter();
+ }
+ @Override
+ public Adapter caseUMLDiffExtension(UMLDiffExtension object) {
+ return createUMLDiffExtensionAdapter();
+ }
+ @Override
+ public Adapter caseAbstractDiffExtension(AbstractDiffExtension object) {
+ return createAbstractDiffExtensionAdapter();
+ }
+ @Override
+ public Adapter caseDiffElement(DiffElement object) {
+ return createDiffElementAdapter();
+ }
+ @Override
+ public Adapter caseReferenceChange(ReferenceChange object) {
+ return createReferenceChangeAdapter();
+ }
+ @Override
+ public Adapter caseUpdateReference(UpdateReference object) {
+ return createUpdateReferenceAdapter();
+ }
+ @Override
+ public Adapter caseModelElementChange(ModelElementChange object) {
+ return createModelElementChangeAdapter();
+ }
+ @Override
+ public Adapter caseUpdateModelElement(UpdateModelElement object) {
+ return createUpdateModelElementAdapter();
+ }
+ @Override
+ public Adapter caseMoveModelElement(MoveModelElement object) {
+ return createMoveModelElementAdapter();
+ }
+ @Override
+ public Adapter defaultCase(EObject object) {
+ return createEObjectAdapter();
+ }
+ };
+
+ /**
+ * Creates an adapter for the <code>target</code>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param target the object to adapt.
+ * @return the adapter for the <code>target</code>.
+ * @generated
+ */
+ @Override
+ public Adapter createAdapter(Notifier target) {
+ return modelSwitch.doSwitch((EObject)target);
+ }
+
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationTargetChangedExtension <em>Generalization Target Changed Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationTargetChangedExtension
+ * @generated
+ */
+ public Adapter createGeneralizationTargetChangedExtensionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationSourceChangedExtension <em>Generalization Source Changed Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationSourceChangedExtension
+ * @generated
+ */
+ public Adapter createGeneralizationSourceChangedExtensionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.UMLDiffExtension <em>UML Diff Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.UMLDiffExtension
+ * @generated
+ */
+ public Adapter createUMLDiffExtensionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension <em>Abstract Diff Extension</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension
+ * @generated
+ */
+ public Adapter createAbstractDiffExtensionAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.diff.metamodel.DiffElement <em>Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.diff.metamodel.DiffElement
+ * @generated
+ */
+ public Adapter createDiffElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.diff.metamodel.ReferenceChange <em>Reference Change</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.diff.metamodel.ReferenceChange
+ * @generated
+ */
+ public Adapter createReferenceChangeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.diff.metamodel.UpdateReference <em>Update Reference</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.diff.metamodel.UpdateReference
+ * @generated
+ */
+ public Adapter createUpdateReferenceAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.diff.metamodel.ModelElementChange <em>Model Element Change</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.diff.metamodel.ModelElementChange
+ * @generated
+ */
+ public Adapter createModelElementChangeAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.diff.metamodel.UpdateModelElement <em>Update Model Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.diff.metamodel.UpdateModelElement
+ * @generated
+ */
+ public Adapter createUpdateModelElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for an object of class '{@link org.eclipse.emf.compare.diff.metamodel.MoveModelElement <em>Move Model Element</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.emf.compare.diff.metamodel.MoveModelElement
+ * @generated
+ */
+ public Adapter createMoveModelElementAdapter() {
+ return null;
+ }
+
+ /**
+ * Creates a new adapter for the default case.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @generated
+ */
+ public Adapter createEObjectAdapter() {
+ return null;
+ }
+
+} //Uml_diff_extensionAdapterFactory
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/util/Uml_diff_extensionSwitch.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/util/Uml_diff_extensionSwitch.java new file mode 100644 index 00000000000..460f45f2a74 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src-gen/org/eclipse/papyrus/uml/compare/diff/uml_diff_extension/util/Uml_diff_extensionSwitch.java @@ -0,0 +1,288 @@ +/**
+ * Copyright (c) 2012 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *
+ */
+package org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.util;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.ModelElementChange;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.compare.diff.metamodel.ReferenceChange;
+import org.eclipse.emf.compare.diff.metamodel.UpdateModelElement;
+import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+
+import org.eclipse.emf.ecore.util.Switch;
+
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.*;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Switch</b> for the model's inheritance hierarchy.
+ * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
+ * to invoke the <code>caseXXX</code> method for each class of the model,
+ * starting with the actual class of the object
+ * and proceeding up the inheritance hierarchy
+ * until a non-null result is returned,
+ * which is the result of the switch.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionPackage
+ * @generated
+ */
+public class Uml_diff_extensionSwitch<T> extends Switch<T> {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static Uml_diff_extensionPackage modelPackage;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Uml_diff_extensionSwitch() {
+ if (modelPackage == null) {
+ modelPackage = Uml_diff_extensionPackage.eINSTANCE;
+ }
+ }
+
+ /**
+ * Checks whether this is a switch for the given package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @parameter ePackage the package in question.
+ * @return whether this is a switch for the given package.
+ * @generated
+ */
+ @Override
+ protected boolean isSwitchFor(EPackage ePackage) {
+ return ePackage == modelPackage;
+ }
+
+ /**
+ * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the first non-null result returned by a <code>caseXXX</code> call.
+ * @generated
+ */
+ @Override
+ protected T doSwitch(int classifierID, EObject theEObject) {
+ switch (classifierID) {
+ case Uml_diff_extensionPackage.GENERALIZATION_TARGET_CHANGED_EXTENSION: {
+ GeneralizationTargetChangedExtension generalizationTargetChangedExtension = (GeneralizationTargetChangedExtension)theEObject;
+ T result = caseGeneralizationTargetChangedExtension(generalizationTargetChangedExtension);
+ if (result == null) result = caseUMLDiffExtension(generalizationTargetChangedExtension);
+ if (result == null) result = caseUpdateReference(generalizationTargetChangedExtension);
+ if (result == null) result = caseAbstractDiffExtension(generalizationTargetChangedExtension);
+ if (result == null) result = caseReferenceChange(generalizationTargetChangedExtension);
+ if (result == null) result = caseDiffElement(generalizationTargetChangedExtension);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Uml_diff_extensionPackage.GENERALIZATION_SOURCE_CHANGED_EXTENSION: {
+ GeneralizationSourceChangedExtension generalizationSourceChangedExtension = (GeneralizationSourceChangedExtension)theEObject;
+ T result = caseGeneralizationSourceChangedExtension(generalizationSourceChangedExtension);
+ if (result == null) result = caseUMLDiffExtension(generalizationSourceChangedExtension);
+ if (result == null) result = caseMoveModelElement(generalizationSourceChangedExtension);
+ if (result == null) result = caseAbstractDiffExtension(generalizationSourceChangedExtension);
+ if (result == null) result = caseUpdateModelElement(generalizationSourceChangedExtension);
+ if (result == null) result = caseModelElementChange(generalizationSourceChangedExtension);
+ if (result == null) result = caseDiffElement(generalizationSourceChangedExtension);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ case Uml_diff_extensionPackage.UML_DIFF_EXTENSION: {
+ UMLDiffExtension umlDiffExtension = (UMLDiffExtension)theEObject;
+ T result = caseUMLDiffExtension(umlDiffExtension);
+ if (result == null) result = caseAbstractDiffExtension(umlDiffExtension);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
+ default: return defaultCase(theEObject);
+ }
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Generalization Target Changed Extension</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Generalization Target Changed Extension</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseGeneralizationTargetChangedExtension(GeneralizationTargetChangedExtension object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Generalization Source Changed Extension</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Generalization Source Changed Extension</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseGeneralizationSourceChangedExtension(GeneralizationSourceChangedExtension object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>UML Diff Extension</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>UML Diff Extension</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseUMLDiffExtension(UMLDiffExtension object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Abstract Diff Extension</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Abstract Diff Extension</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseAbstractDiffExtension(AbstractDiffExtension object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseDiffElement(DiffElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Reference Change</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Reference Change</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseReferenceChange(ReferenceChange object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Update Reference</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Update Reference</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseUpdateReference(UpdateReference object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Model Element Change</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Model Element Change</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseModelElementChange(ModelElementChange object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Update Model Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Update Model Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseUpdateModelElement(UpdateModelElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>Move Model Element</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Move Model Element</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T caseMoveModelElement(MoveModelElement object) {
+ return null;
+ }
+
+ /**
+ * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch, but this is the last case anyway.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject)
+ * @generated
+ */
+ @Override
+ public T defaultCase(EObject object) {
+ return null;
+ }
+
+} //Uml_diff_extensionSwitch
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/Activator.java new file mode 100644 index 00000000000..0438a809b76 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/Activator.java @@ -0,0 +1,70 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.compare.diff"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** the Papyrus log helper */
+ public static LogHelper log;
+
+ /**
+ * 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;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (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;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/check/PapyrusUML2ReferencesCheck.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/check/PapyrusUML2ReferencesCheck.java new file mode 100644 index 00000000000..65a8d9050ba --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/check/PapyrusUML2ReferencesCheck.java @@ -0,0 +1,64 @@ +package org.eclipse.papyrus.uml.compare.diff.check;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.eclipse.emf.compare.diff.engine.IMatchManager;
+import org.eclipse.emf.compare.uml2.diff.UML2DiffEngine;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.papyrus.infra.emf.compare.diff.check.FeaturesCheck;
+import org.eclipse.papyrus.infra.emf.compare.diff.check.PapyrusReferencesCheck;
+
+//adapted code from EMF-Compare UML2ReferencesCheck
+public class PapyrusUML2ReferencesCheck extends PapyrusReferencesCheck {
+
+
+
+ /**
+ * Parameters.
+ */
+ private static final String SUBSETS_OF_CONTAINMENT_PROPERTIES = "/org/eclipse/emf/compare/uml2/diff/internal/subsets.of.containment.properties"; //$NON-NLS-1$
+
+ /**
+ * Properties for parameters.
+ */
+ private static final Properties SUBSETS_OF_CONTAINMENT = new Properties();
+
+ static {
+ try {
+ SUBSETS_OF_CONTAINMENT.load(UML2DiffEngine.class.getResourceAsStream(SUBSETS_OF_CONTAINMENT_PROPERTIES));
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param matchManager
+ * {@link IMatchManager}
+ */
+ public PapyrusUML2ReferencesCheck(final IMatchManager matchManager, final FeaturesCheck checker) {
+ super(matchManager, checker);
+ }
+
+ @Override
+ protected boolean shouldBeIgnored(EReference reference) {
+ final String fqn = fqn(reference);
+ boolean answer = super.shouldBeIgnored(reference) || SUBSETS_OF_CONTAINMENT.getProperty(fqn) != null;
+ return super.shouldBeIgnored(reference) || SUBSETS_OF_CONTAINMENT.getProperty(fqn) != null;
+ }
+
+ /**
+ * Transforms the {@link EReference} to a string.
+ *
+ * @param reference
+ * The {@link EReference}
+ * @return The string.
+ */
+ private String fqn(EReference reference) {
+ final StringBuilder fqn = new StringBuilder(reference.getEContainingClass().getName());
+ fqn.append('.').append(reference.getName());
+ return fqn.toString();
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/GeneralizationSourceMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/GeneralizationSourceMerger.java new file mode 100644 index 00000000000..836898bffeb --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/GeneralizationSourceMerger.java @@ -0,0 +1,55 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.merger;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.MoveModelElementTransactionalMerger;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationSourceChangedExtension;
+import org.eclipse.uml2.uml.Generalization;
+
+/**
+ *
+ * The merger for {@link GeneralizationSourceChangedExtension}
+ *
+ */
+public class GeneralizationSourceMerger extends MoveModelElementTransactionalMerger {
+
+
+ @Override
+ public Command getDoApplyInOriginCommand(TransactionalEditingDomain domain) {
+ final GeneralizationSourceChangedExtension theDiff = (GeneralizationSourceChangedExtension)this.diff;
+ final Generalization generalization = (Generalization)theDiff.getLeftElement();
+ final EObject oldEnd = theDiff.getRightTarget();
+ final EObject newEnd = theDiff.getLeftTarget();
+ final int direction = ReorientRequest.REORIENT_SOURCE;
+ final ReorientRelationshipRequest request = new ReorientRelationshipRequest(domain, generalization, newEnd, oldEnd, direction);
+ return PapyrusMergeCommandProvider.INSTANCE.getCommand(generalization, request);
+ }
+
+ @Override
+ public Command getDoUndoInTargetCommand(TransactionalEditingDomain domain) {
+ final GeneralizationSourceChangedExtension theDiff = (GeneralizationSourceChangedExtension)this.diff;
+ final Generalization generalization = (Generalization)theDiff.getRightElement();
+ final EObject oldEnd = theDiff.getLeftTarget();
+ final EObject newEnd = theDiff.getRightTarget();
+ final int direction = ReorientRequest.REORIENT_SOURCE;
+ final ReorientRelationshipRequest request = new ReorientRelationshipRequest(domain, generalization, newEnd, oldEnd, direction);
+ return PapyrusMergeCommandProvider.INSTANCE.getCommand(generalization, request);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/GeneralizationTargetMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/GeneralizationTargetMerger.java new file mode 100644 index 00000000000..270d9bbaff7 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/GeneralizationTargetMerger.java @@ -0,0 +1,54 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.merger;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.command.PapyrusMergeCommandProvider;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.UpdateReferenceTransactionalMerger;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationTargetChangedExtension;
+import org.eclipse.uml2.uml.Generalization;
+
+/**
+ *
+ * the merger for {@link GeneralizationTargetChangedExtension
+ *
+ */
+public class GeneralizationTargetMerger extends UpdateReferenceTransactionalMerger {
+
+ @Override
+ public Command getDoApplyInOriginCommand(TransactionalEditingDomain domain) {
+ final GeneralizationTargetChangedExtension theDiff = (GeneralizationTargetChangedExtension)this.diff;
+ final Generalization generalization = (Generalization)theDiff.getLeftElement();
+ final EObject oldEnd = theDiff.getRightTarget();
+ final EObject newEnd = theDiff.getLeftTarget();
+ final int direction = ReorientRequest.REORIENT_TARGET;
+ final ReorientRelationshipRequest request = new ReorientRelationshipRequest(domain, generalization, newEnd, oldEnd, direction);
+ return PapyrusMergeCommandProvider.INSTANCE.getCommand(generalization, request);
+ }
+
+ @Override
+ public Command getDoUndoInTargetCommand(TransactionalEditingDomain domain) {
+ final GeneralizationTargetChangedExtension theDiff = (GeneralizationTargetChangedExtension)this.diff;
+ final Generalization generalization = (Generalization)theDiff.getRightElement();
+ final EObject oldEnd = theDiff.getLeftTarget();
+ final EObject newEnd = theDiff.getRightTarget();
+ final int direction = ReorientRequest.REORIENT_TARGET;
+ final ReorientRelationshipRequest request = new ReorientRelationshipRequest(domain, generalization, newEnd, oldEnd, direction);
+ return PapyrusMergeCommandProvider.INSTANCE.getCommand(generalization, request);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLProfileApplicationAdditionMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLProfileApplicationAdditionMerger.java new file mode 100644 index 00000000000..ad3a3d65f8a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLProfileApplicationAdditionMerger.java @@ -0,0 +1,37 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ * Adapted code from EMF-Compare
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.merger;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultExtensionTransactionalMerger;
+
+/**
+ * Merger of UMLProfileApplicationAddition differences.
+ *
+ * @author Cedric Notot <a href="mailto:cedric.notot@obeo.fr">cedric.notot@obeo.fr</a>
+ */
+public class UMLProfileApplicationAdditionMerger extends DefaultExtensionTransactionalMerger {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.DefaultExtensionMerger#isBusinessDependency(boolean,
+ * org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension)
+ */
+ @Override
+ protected boolean isBusinessDependency(boolean applyInOrigin, AbstractDiffExtension requiredDiff) {
+ return applyInOrigin;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLProfileApplicationRemovalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLProfileApplicationRemovalMerger.java new file mode 100644 index 00000000000..e0be7777502 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLProfileApplicationRemovalMerger.java @@ -0,0 +1,37 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ * Adapted code from EMF-Compare
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.merger;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultExtensionTransactionalMerger;
+
+/**
+ * Merger of UMLProfileApplicationRemoval differences.
+ *
+ * @author Cedric Notot <a href="mailto:cedric.notot@obeo.fr">cedric.notot@obeo.fr</a>
+ */
+public class UMLProfileApplicationRemovalMerger extends DefaultExtensionTransactionalMerger {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.DefaultExtensionMerger#isBusinessDependency(boolean,
+ * org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension)
+ */
+ @Override
+ protected boolean isBusinessDependency(boolean applyInOrigin, AbstractDiffExtension requiredDiff) {
+ return !applyInOrigin;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLStereotypeApplicationAdditionMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLStereotypeApplicationAdditionMerger.java new file mode 100644 index 00000000000..6b47a883b48 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLStereotypeApplicationAdditionMerger.java @@ -0,0 +1,37 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ * Adapted code from EMF-Compare
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.merger;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultExtensionTransactionalMerger;
+
+/**
+ * Merger of UMLStereotypeApplicationAddition differences.
+ *
+ * @author Cedric Notot <a href="mailto:cedric.notot@obeo.fr">cedric.notot@obeo.fr</a>
+ */
+public class UMLStereotypeApplicationAdditionMerger extends DefaultExtensionTransactionalMerger {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.DefaultExtensionMerger#isBusinessDependency(boolean,
+ * org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension)
+ */
+ @Override
+ protected boolean isBusinessDependency(boolean applyInOrigin, AbstractDiffExtension requiredDiff) {
+ return !applyInOrigin;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLStereotypeApplicationRemovalMerger.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLStereotypeApplicationRemovalMerger.java new file mode 100644 index 00000000000..e4718dc2a00 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/merger/UMLStereotypeApplicationRemovalMerger.java @@ -0,0 +1,37 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ * Adapted code from EMF-Compare
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.merger;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultExtensionTransactionalMerger;
+
+/**
+ * Merger of UMLStereotypeApplicationRemoval differences.
+ *
+ * @author Cedric Notot <a href="mailto:cedric.notot@obeo.fr">cedric.notot@obeo.fr</a>
+ */
+public class UMLStereotypeApplicationRemovalMerger extends DefaultExtensionTransactionalMerger {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.DefaultExtensionMerger#isBusinessDependency(boolean,
+ * org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension)
+ */
+ @Override
+ protected boolean isBusinessDependency(boolean applyInOrigin, AbstractDiffExtension requiredDiff) {
+ return applyInOrigin;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/provider/UMLTransactionalMergerProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/provider/UMLTransactionalMergerProvider.java new file mode 100644 index 00000000000..83613202bc1 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/provider/UMLTransactionalMergerProvider.java @@ -0,0 +1,90 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.provider;
+
+import java.util.Map;
+
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.uml2diff.impl.UMLProfileApplicationAdditionImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLProfileApplicationRemovalImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeApplicationAdditionImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeApplicationRemovalImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeAttributeChangeLeftTargetImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeAttributeChangeRightTargetImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeReferenceChangeLeftTargetImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeReferenceChangeRightTargetImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeReferenceOrderChangeImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeUpdateAttributeImpl;
+import org.eclipse.emf.compare.uml2diff.impl.UMLStereotypeUpdateReferenceImpl;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.DefaultExtensionTransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.internal.util.PapyrusCompareMap;
+import org.eclipse.papyrus.infra.emf.compare.diff.merge.ITransactionalMerger;
+import org.eclipse.papyrus.infra.emf.compare.diff.provider.ITransactionalMergerProvider;
+import org.eclipse.papyrus.uml.compare.diff.internal.merger.GeneralizationSourceMerger;
+import org.eclipse.papyrus.uml.compare.diff.internal.merger.GeneralizationTargetMerger;
+import org.eclipse.papyrus.uml.compare.diff.internal.merger.UMLProfileApplicationAdditionMerger;
+import org.eclipse.papyrus.uml.compare.diff.internal.merger.UMLProfileApplicationRemovalMerger;
+import org.eclipse.papyrus.uml.compare.diff.internal.merger.UMLStereotypeApplicationAdditionMerger;
+import org.eclipse.papyrus.uml.compare.diff.internal.merger.UMLStereotypeApplicationRemovalMerger;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationSourceChangedExtensionImpl;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.impl.GeneralizationTargetChangedExtensionImpl;
+
+
+
+
+/**
+ *
+ * This class provides the mergers for the UML DiffElement
+ *
+ */
+public class UMLTransactionalMergerProvider implements ITransactionalMergerProvider {
+
+ /**
+ * 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 ITransactionalMerger>> mergerTypes;
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.diff.merge.IMergerProvider#getMergers()
+ */
+ public Map<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>> getMergers() {
+ if(mergerTypes == null) {
+ mergerTypes = new PapyrusCompareMap<Class<? extends DiffElement>, Class<? extends ITransactionalMerger>>();
+ //its it better to set MyClassImpl.class than MyInterface.class, in the 2nd case, we don't have guarantee that the method getBestMerger find the real best merger
+ //another workaround is to implemements the method providesMerger in the Extension
+ mergerTypes.put(GeneralizationSourceChangedExtensionImpl.class, GeneralizationSourceMerger.class);
+ mergerTypes.put(GeneralizationTargetChangedExtensionImpl.class, GeneralizationTargetMerger.class);
+ mergerTypes.put(UMLProfileApplicationAdditionImpl.class, UMLProfileApplicationAdditionMerger.class);
+ mergerTypes.put(UMLProfileApplicationRemovalImpl.class, UMLProfileApplicationRemovalMerger.class);
+ mergerTypes.put(UMLStereotypeApplicationAdditionImpl.class, UMLStereotypeApplicationAdditionMerger.class);
+ mergerTypes.put(UMLStereotypeApplicationRemovalImpl.class, UMLStereotypeApplicationRemovalMerger.class);
+
+ //the mergers for Stereotype properties
+ mergerTypes.put(UMLStereotypeAttributeChangeLeftTargetImpl.class, DefaultExtensionTransactionalMerger.class);
+ mergerTypes.put(UMLStereotypeAttributeChangeRightTargetImpl.class, DefaultExtensionTransactionalMerger.class);
+ mergerTypes.put(UMLStereotypeReferenceChangeLeftTargetImpl.class, DefaultExtensionTransactionalMerger.class);
+ mergerTypes.put(UMLStereotypeReferenceChangeRightTargetImpl.class, DefaultExtensionTransactionalMerger.class);
+ mergerTypes.put(UMLStereotypeReferenceOrderChangeImpl.class, DefaultExtensionTransactionalMerger.class);
+ mergerTypes.put(UMLStereotypeUpdateAttributeImpl.class, DefaultExtensionTransactionalMerger.class);
+ mergerTypes.put(UMLStereotypeUpdateReferenceImpl.class, DefaultExtensionTransactionalMerger.class);
+
+ }
+ return mergerTypes;
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/utils/MergerUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/utils/MergerUtils.java new file mode 100644 index 00000000000..69cc690f18c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/utils/MergerUtils.java @@ -0,0 +1,63 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.utils;
+
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart;
+import org.eclipse.papyrus.infra.tools.util.EditorHelper;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * This class provides useful method for the mergers
+ *
+ */
+//TODO used?
+public final class MergerUtils {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ private MergerUtils() {
+ //nothing to do
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> if we can use the Papyrus Mergers
+ */
+ public static boolean usePapyrusMerger() {
+ return getEditingDomain() != null;
+ }
+
+ /**
+ *
+ * @return
+ * the {@link TransactionalEditingDomain} to use for the merge action, or <code>null</code> if not found
+ */
+ public static TransactionalEditingDomain getEditingDomain() {
+ IEditorPart editor = EditorHelper.getCurrentEditor();
+ if(editor instanceof IMultiPageEditorPart) {
+ editor = ((IMultiPageEditorPart)editor).getActiveEditor();
+ }
+ if(editor instanceof IEditingDomainProvider) {
+ return (TransactionalEditingDomain)((IEditingDomainProvider)editor).getEditingDomain();
+ }
+ return null;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/utils/UMLDiffElementExtensionBuilder.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/utils/UMLDiffElementExtensionBuilder.java new file mode 100644 index 00000000000..d8870606965 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/internal/utils/UMLDiffElementExtensionBuilder.java @@ -0,0 +1,65 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.internal.utils;
+
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
+import org.eclipse.emf.compare.diff.metamodel.util.DiffSwitch;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationSourceChangedExtension;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.GeneralizationTargetChangedExtension;
+import org.eclipse.papyrus.uml.compare.diff.uml_diff_extension.Uml_diff_extensionFactory;
+import org.eclipse.uml2.uml.Generalization;
+
+
+
+public class UMLDiffElementExtensionBuilder extends DiffSwitch<AbstractDiffExtension> {
+
+ @Override
+ public AbstractDiffExtension caseMoveModelElement(final MoveModelElement moveModelElement) {
+ if(moveModelElement.getLeftElement() instanceof Generalization) {
+ return createGeneralizationSourceChangedExtension(moveModelElement);
+ }
+ return super.caseMoveModelElement(moveModelElement);
+ }
+
+ @Override
+ public AbstractDiffExtension caseUpdateReference(final UpdateReference updateReference) {
+ if(updateReference.getLeftElement() instanceof Generalization) {
+ return createGeneralizationTargetChangedExtension(updateReference);
+ }
+ return super.caseUpdateReference(updateReference);
+ }
+
+ private GeneralizationSourceChangedExtension createGeneralizationSourceChangedExtension(final MoveModelElement moveModelElement) {
+ final GeneralizationSourceChangedExtension newElement = Uml_diff_extensionFactory.eINSTANCE.createGeneralizationSourceChangedExtension();
+ newElement.setLeftElement(moveModelElement.getLeftElement());
+ newElement.setLeftTarget(moveModelElement.getLeftTarget());
+ newElement.setRightElement(moveModelElement.getRightElement());
+ newElement.setRightTarget(moveModelElement.getRightTarget());
+ return newElement;
+ }
+
+ private GeneralizationTargetChangedExtension createGeneralizationTargetChangedExtension(final UpdateReference updateReference) {
+ final GeneralizationTargetChangedExtension newElement = Uml_diff_extensionFactory.eINSTANCE.createGeneralizationTargetChangedExtension();
+ newElement.setLeftElement(updateReference.getLeftElement());
+ newElement.setLeftTarget(updateReference.getLeftTarget());
+ newElement.setReference(updateReference.getReference());
+ newElement.setRemote(updateReference.isRemote());
+ newElement.setRightElement(updateReference.getRightElement());
+ newElement.setRightTarget(updateReference.getRightTarget());
+ return newElement;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/Messages.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/Messages.java new file mode 100644 index 00000000000..379560a3197 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/Messages.java @@ -0,0 +1,17 @@ +package org.eclipse.papyrus.uml.compare.diff.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.compare.diff.messages.messages"; //$NON-NLS-1$
+
+ public static String GetDiffElementLabel_StereotypeAppliedOnAnElement;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/messages.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/messages.properties new file mode 100644 index 00000000000..a340ff643da --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/messages/messages.properties @@ -0,0 +1 @@ +GetDiffElementLabel_StereotypeAppliedOnAnElement=The stereotype {0} has been applied on the element
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/queries/GetDiffElementLabel.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/queries/GetDiffElementLabel.java new file mode 100644 index 00000000000..5f6fa9af8cb --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/queries/GetDiffElementLabel.java @@ -0,0 +1,321 @@ +/***************************************************************************** + * Copyright (c) 2012 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.compare.diff.queries; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension; +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.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.UpdateContainmentFeature; +import org.eclipse.emf.compare.diff.metamodel.UpdateModelElement; +import org.eclipse.emf.compare.diff.metamodel.UpdateReference; +import org.eclipse.emf.compare.diff.provider.DiffElementItemProvider; +import org.eclipse.emf.compare.uml2diff.UMLStereotypeApplicationAddition; +import org.eclipse.emf.compare.uml2diff.UMLStereotypeUpdateAttribute; +import org.eclipse.emf.compare.util.AdapterUtils; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException; +import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery; +import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart; +import org.eclipse.papyrus.infra.emf.Activator; +import org.eclipse.papyrus.infra.emf.compare.ui.internal.utils.CustomizationAndViewerActionDispatcher; +import org.eclipse.papyrus.infra.tools.util.EditorHelper; +import org.eclipse.papyrus.infra.widgets.toolbox.notification.builders.NotificationBuilder; +import org.eclipse.papyrus.uml.compare.diff.messages.Messages; +import org.eclipse.ui.IEditorPart; + +/** + * + * This query returns the label to display for DiffElement + * + * TODO duplicated code from infra.emf.compare.ui. Using the new metamodel , the inheritance between differents packages will allow to write this + * custom + * for AbstractDiffExtension in infra.emf.compare.ui + * + */ +public class GetDiffElementLabel implements IJavaModelQuery<EObject, String> { + + /** + * The code of this method is adapter of the implementation of getText in the Default Label Provider for each of the managed DiffElement + * + * @see org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery#evaluate(org.eclipse.emf.ecore.EObject, + * org.eclipse.emf.facet.infra.query.core.java.ParameterValueList) + * + * @param context + * @param parameterValues + * @return + * @throws ModelQueryExecutionException + */ + public String evaluate(final EObject context, final ParameterValueList parameterValues) throws ModelQueryExecutionException { + final AdapterFactory adapter = AdapterUtils.getAdapterFactory(); + final DiffElementItemProvider itemProvider = new DiffElementItemProvider(adapter); + IEditorPart editor = EditorHelper.getCurrentEditor(); + + if(editor instanceof IMultiPageEditorPart) { + editor = ((IMultiPageEditorPart)editor).getActiveEditor(); + } + + if(editor == null) { + return null; + } + LabelProvider labelProvider; + try { + labelProvider = CustomizationAndViewerActionDispatcher.getExistingLabelProvider(editor); + } catch (NullPointerException e) { + return null; + } + String diffLabel = null; + if(context instanceof UMLStereotypeUpdateAttribute) { + final UMLStereotypeUpdateAttribute updateOp = (UMLStereotypeUpdateAttribute)context; + final String elementLabel = labelProvider.getText(updateOp.getLeftElement()); + final UpdateAttribute hiddenDiffElement = (UpdateAttribute)updateOp.getHideElements().get(0); + final String attributeLabel = labelProvider.getText(hiddenDiffElement.getAttribute()); + final Object leftValue = hiddenDiffElement.getLeftElement().eGet(hiddenDiffElement.getAttribute()); + final Object rightValue = hiddenDiffElement.getRightElement().eGet(hiddenDiffElement.getAttribute()); + if(hiddenDiffElement.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteUpdateAttribute_type", new Object[]{ attributeLabel, elementLabel, leftValue, rightValue, }); //$NON-NLS-1$ + } else { + if(hiddenDiffElement.isConflicting()) { + diffLabel = itemProvider.getString("_UI_UpdateAttribute_conflicting", new Object[]{ attributeLabel, rightValue, leftValue, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_UpdateAttribute_type", new Object[]{ attributeLabel, elementLabel, rightValue, leftValue, }); //$NON-NLS-1$ + } + } + } else if(context instanceof UpdateAttribute) { //comes from UpdateAttributeItemProvider + //TODO : not tested + final UpdateAttribute updateOp = (UpdateAttribute)context; + final String attributeLabel = labelProvider.getText(updateOp.getAttribute()); + final String elementLabel = labelProvider.getText(updateOp.getLeftElement()); + final Object leftValue = updateOp.getLeftElement().eGet(updateOp.getAttribute()); + final Object rightValue = updateOp.getRightElement().eGet(updateOp.getAttribute()); + if(updateOp.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteUpdateAttribute_type", new Object[]{ attributeLabel, elementLabel, leftValue, rightValue, }); //$NON-NLS-1$ + } else { + if(updateOp.isConflicting()) { + diffLabel = itemProvider.getString("_UI_UpdateAttribute_conflicting", new Object[]{ attributeLabel, rightValue, leftValue, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_UpdateAttribute_type", new Object[]{ attributeLabel, elementLabel, rightValue, leftValue, }); //$NON-NLS-1$ + } + } + } else if(context instanceof AttributeOrderChange) { //comes from AttributeOrderChangeItemProvider + //TODO : not tested + //TODO : useful? + AttributeOrderChange attributeOrderChange = (AttributeOrderChange)context; + diffLabel = itemProvider.getString("_UI_AttributeOrderChange_type", new Object[]{ attributeOrderChange.getAttribute().getName() }); //$NON-NLS-1$ + + } else if(context instanceof AttributeChangeLeftTarget) {//comes from AttributeChangeLeftTargetItemProvider + //not tested + final AttributeChangeLeftTarget operation = (AttributeChangeLeftTarget)context; + final String attributeLabel = labelProvider.getText(operation.getAttribute()); + final String elementLabel = labelProvider.getText(operation.getRightElement()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteRemoveAttribute_type", new Object[]{ operation.getLeftTarget(), attributeLabel, elementLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_AddAttribute_type", new Object[]{ operation.getLeftTarget(), attributeLabel, elementLabel, }); //$NON-NLS-1$ + } + + } else if(context instanceof AttributeChangeRightTarget) { //comes from AttributeChangeRightTargetItemProvider + //TODO : not tested + final AttributeChangeRightTarget operation = (AttributeChangeRightTarget)context; + final String attributeLabel = labelProvider.getText(operation.getAttribute()); + final String elementLabel = labelProvider.getText(operation.getLeftElement()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteAddAttribute_type", new Object[]{ operation.getRightTarget(), attributeLabel, elementLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_RemoveAttribute_type", new Object[]{ operation.getRightTarget(), attributeLabel, elementLabel, }); //$NON-NLS-1$ + } + } else if(context instanceof AttributeChange) {//comes from AttributeChangeItemProvider + //TODO : not tested + //TODO : useful? + AttributeChange attributeChange = (AttributeChange)context; + diffLabel = itemProvider.getString("_UI_AttributeChange_type") + " " + attributeChange.isConflicting(); //$NON-NLS-1$ //$NON-NLS-2$ + } else if(context instanceof DiffGroup) { //comes from DiffGroupItemProvider + final DiffGroup group = (DiffGroup)context; + final EObject parent = group.getRightParent(); + if(parent != null) { + final String parentLabel = labelProvider.getText(parent); + diffLabel = itemProvider.getString("_UI_DiffGroup_type", new Object[]{ group.getSubchanges(), parentLabel }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_DiffGroup_type", new Object[]{ group.getSubchanges(), "model" }); //$NON-NLS-1$ //$NON-NLS-2$ + } + } else if(context instanceof UpdateContainmentFeature) {//comes from UpdateContainmentFeatureItemProvider + //TODO : not tested + //TODO : useful? + final UpdateContainmentFeature operation = (UpdateContainmentFeature)context; + final String leftContainmentFeature = operation.getLeftElement().eContainmentFeature().getName(); + final String rightContainmentFeature = operation.getRightElement().eContainmentFeature().getName(); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteUpdateContainmentFeature_type", new Object[]{ rightContainmentFeature, leftContainmentFeature, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_UpdateContainmentFeature_type", new Object[]{ rightContainmentFeature, leftContainmentFeature, }); //$NON-NLS-1$ + } + } else if(context instanceof MoveModelElement) {//comes from MoveModelElementItemProvider + //TODO : not tested + final MoveModelElement operation = (MoveModelElement)context; + + final String elementLabel = labelProvider.getText(operation.getLeftElement()); + final String oldParentLabel = labelProvider.getText(operation.getLeftTarget()); + final String newParentLabel = labelProvider.getText(operation.getRightTarget()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteMoveModelElement_type", new Object[]{ elementLabel, oldParentLabel, newParentLabel, }); //$NON-NLS-1$ + } else { + if(operation.isConflicting()) { + diffLabel = itemProvider.getString("_UI_MoveModelElement_conflicting", new Object[]{ elementLabel, oldParentLabel, newParentLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_MoveModelElement_type", new Object[]{ elementLabel, oldParentLabel, newParentLabel, }); //$NON-NLS-1$ + } + } + } else if(context instanceof UpdateModelElement) {//comes from UpdateModelElementItemProvider + //TODO : not tested + //TODO : useful ? + UpdateModelElement updateModelElement = (UpdateModelElement)context; + diffLabel = ""; //$NON-NLS-1$ + if(updateModelElement instanceof UMLStereotypeApplicationAddition){ + diffLabel = NLS.bind(Messages.GetDiffElementLabel_StereotypeAppliedOnAnElement,labelProvider.getText(((UMLStereotypeApplicationAddition)updateModelElement).getStereotype())); + } + else{ + diffLabel = itemProvider.getString("_UI_UpdateModelElement_type") + " " + updateModelElement.isConflicting(); //$NON-NLS-1$ //$NON-NLS-2$ + } + } else if(context instanceof ModelElementChangeLeftTarget) { //comes from ModelElementChangeLeftTargetItemProvider + //TODO : not tested + final ModelElementChangeLeftTarget operation = (ModelElementChangeLeftTarget)context; + final String targetName = labelProvider.getText(operation.getLeftElement()); + if(operation.isRemote()) { + if(operation.isConflicting()) { + diffLabel = itemProvider.getString("_UI_RemoteRemoveModelElement_conflicting", new Object[]{ targetName }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_RemoteRemoveModelElement_type", new Object[]{ targetName }); //$NON-NLS-1$ + } + } else { + diffLabel = itemProvider.getString("_UI_AddModelElement_type", new Object[]{ targetName, }); //$NON-NLS-1$ + } + + } else if(context instanceof ModelElementChangeRightTarget) { //comes from ModelElementChangeRightTargetItemProvider + final ModelElementChangeRightTarget operation = (ModelElementChangeRightTarget)context; + final String targetName = labelProvider.getText(operation.getRightElement()); + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteAddModelElement_type", new Object[]{ targetName }); //$NON-NLS-1$ + } else { + if(operation.isConflicting()) { + diffLabel = itemProvider.getString("_UI_RemoveModelElement_conflicting", new Object[]{ targetName }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_RemoveModelElement_type", new Object[]{ targetName, }); //$NON-NLS-1$ + } + } + + + } else if(context instanceof UpdateReference) { //comes from UpdateReferenceItemProvider + //TODO : not tested + final UpdateReference operation = (UpdateReference)context; + final String elementLabel = labelProvider.getText(operation.getLeftElement()); + final String referenceLabel = AdapterUtils.getItemProviderText(operation.getReference());//TODO : use labelProvider ? + final String leftValueLabel = labelProvider.getText(getLeftValue(operation)); + final String rightValueLabel = labelProvider.getText(getRightValue(operation)); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteUpdateReference_type", new Object[]{ referenceLabel, elementLabel, leftValueLabel, rightValueLabel, }); //$NON-NLS-1$ + } else { + if(operation.isConflicting()) { + diffLabel = itemProvider.getString("_UI_UpdateReference_conflicting", new Object[]{ referenceLabel, elementLabel, rightValueLabel, leftValueLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_UpdateReference_type", new Object[]{ referenceLabel, elementLabel, rightValueLabel, leftValueLabel, }); //$NON-NLS-1$ + } + } + + } else if(context instanceof ReferenceOrderChange) { //comes from ReferenceOrderChangeItemProvider + //TODO not tested + //TODO : useful? + final ReferenceOrderChange referenceOrderChange = (ReferenceOrderChange)context; + diffLabel = itemProvider.getString("_UI_ReferenceOrderChange_type", new Object[]{ referenceOrderChange.getReference().getName() }); //$NON-NLS-1$ + } else if(context instanceof ReferenceChangeLeftTarget) { //comes from ReferenceChangeLeftTargetItemProvider + //TODO : not tested + final ReferenceChangeLeftTarget operation = (ReferenceChangeLeftTarget)context; + + final String valueLabel = labelProvider.getText(operation.getLeftTarget()); + final String referenceLabel = labelProvider.getText(operation.getReference()); + final String elementLabel = labelProvider.getText(operation.getRightElement()); + + if(operation.isRemote()) { + diffLabel = itemProvider.getString("_UI_RemoteRemoveReferenceValue_type", new Object[]{ valueLabel, referenceLabel, elementLabel, }); //$NON-NLS-1$ + } else { + diffLabel = itemProvider.getString("_UI_AddReferenceValue_type", new Object[]{ valueLabel, referenceLabel, elementLabel, }); //$NON-NLS-1$ + } + } else if(context instanceof ReferenceChangeRightTarget) { //comes from ReferenceChangeRightTargetItemProvider + //TODO : not tested + final ReferenceChangeRightTarget operation = (ReferenceChangeRightTarget)context; + + final String valueLabel = labelProvider.getText(operation.getRightTarget()); + final String referenceLabel = labelProvider.getText(operation.getReference()); + final String elementLabel = labelProvider.getText(operation.getLeftElement()); + + if(operation.isRemote()) + diffLabel = itemProvider.getString("_UI_RemoteAddReferenceValue_type", new Object[]{ valueLabel, referenceLabel, elementLabel, }); //$NON-NLS-1$ + else { + diffLabel = itemProvider.getString("_UI_RemoveReferenceValue_type", new Object[]{ valueLabel, referenceLabel, elementLabel, }); //$NON-NLS-1$ + } + } + if(diffLabel == null) { + final String message = NLS.bind("{0} doesn't manage {1}", new Object[]{ this.getClass().getSimpleName(), context.getClass().getSimpleName() });//$NON-NLS-1$ + Activator.log.warn(message); + NotificationBuilder.createAsyncPopup(message).run(); + // in this case the default Label will be displayed + } + return diffLabel; + } + + + /** + * Returns the value of the given operation's target reference for the left element. + * + * @param operation + * The update reference operation for which we need target information. + * @return The value of the given operation's target reference for the left element. + */ + private EObject getLeftValue(final UpdateReference operation) { + final EReference reference = operation.getReference(); + return (EObject)operation.getLeftElement().eGet(reference); + } + + /** + * Returns the value of the given operation's target reference for the right element. + * + * @param operation + * The update reference operation for which we need target information. + * @return The value of the given operation's target reference for the right element. + */ + private EObject getRightValue(final UpdateReference operation) { + final EReference reference = operation.getReference(); + return (EObject)operation.getRightElement().eGet(reference); + } + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/UMLDiffEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/UMLDiffEngine.java new file mode 100644 index 00000000000..152a0b55a99 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/UMLDiffEngine.java @@ -0,0 +1,194 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.emf.compare.diff.engine.check.AttributesCheck;
+import org.eclipse.emf.compare.diff.engine.check.ReferencesCheck;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
+import org.eclipse.emf.compare.diff.metamodel.util.DiffSwitch;
+import org.eclipse.emf.compare.match.metamodel.Match2Elements;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.compare.uml2.diff.UML2DiffEngine;
+import org.eclipse.emf.ecore.EGenericType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.emf.compare.diff.check.FeaturesCheck;
+import org.eclipse.papyrus.infra.emf.compare.diff.check.PapyrusAttributesCheck;
+import org.eclipse.papyrus.infra.emf.compare.diff.utils.PapyrusOptionsAdapter;
+import org.eclipse.papyrus.uml.compare.diff.check.PapyrusUML2ReferencesCheck;
+import org.eclipse.papyrus.uml.compare.diff.internal.utils.UMLDiffElementExtensionBuilder;
+
+public class UMLDiffEngine extends UML2DiffEngine {//GenericDiffEngine {
+
+ private DiffSwitch<AbstractDiffExtension> extensionBuilder;
+
+ private Map<String, Object> options;
+
+ protected FeaturesCheck featuresCheck;
+
+ public UMLDiffEngine() {
+ this(null);
+ }
+
+ public UMLDiffEngine(final Map<String, Object> options) {
+ this.extensionBuilder = new UMLDiffElementExtensionBuilder();
+ this.options = options;
+ }
+
+ /**
+ * This will check if the elements matched by a given {@link Match2Elements} have been moved.
+ *
+ * @param root
+ * {@link DiffGroup root} of the {@link DiffElement} to create if the elements have actually
+ * been moved.
+ * @param matchElement
+ * This contains the mapping information about the elements we need to check for a move.
+ */
+ protected void checkMoves(DiffGroup root, Match2Elements matchElement) {
+ final EObject left = matchElement.getLeftElement();
+ final EObject right = matchElement.getRightElement();
+
+ if(left instanceof EGenericType || right instanceof EGenericType)
+ return;
+ if(left.eContainer() != null && right.eContainer() != null && getMatchManager().getMatchedEObject(left.eContainer()) != right.eContainer()) {
+ final EStructuralFeature leftFeature = left.eContainingFeature();
+ if(this.featuresCheck == null) {
+ this.featuresCheck = new FeaturesCheck(getMatchManager(), options);
+ }
+ if(!this.featuresCheck.shouldBeIgnored(leftFeature) && !this.featuresCheck.shouldBeIgnored(leftFeature, left)) {
+ super.checkMoves(root, matchElement);
+ }
+ }
+ }
+
+ @Override
+ public DiffModel doDiff(MatchModel match, boolean threeWay) {
+ DiffModel result = super.doDiff(match, threeWay);
+ result = papyrusPostProcess(result);
+ addMergeOptions(result);
+ return result;
+ }
+
+
+ /**
+ * Attach an adapter containing the merge options to each DiffElement
+ *
+ * @param diffModel
+ * the diffModel
+ */
+ private void addMergeOptions(final DiffModel diffModel) {
+ if(this.options != null) {
+ final Iterator<EObject> iter = diffModel.eAllContents();
+ while(iter.hasNext()) {
+ final EObject current = iter.next();
+ if(current instanceof DiffElement) {
+ final PapyrusOptionsAdapter adapter = new PapyrusOptionsAdapter(this.options);
+ current.eAdapters().add(adapter);
+ }
+ }
+ }
+ }
+
+ /**
+ * Post process default result of Diff.
+ * Processes changes stereotypes and tagged values
+ *
+ * @param diffModel
+ * the diff model
+ * @return the diff model
+ */
+ protected DiffModel papyrusPostProcess(DiffModel diffModel) {
+ final Iterator<EObject> it = diffModel.eAllContents();
+ while(it.hasNext()) {
+ DiffElement diffElement = (DiffElement)it.next();
+ visitElement(diffModel, diffElement);
+ }
+ return diffModel;
+ }
+
+ /**
+ * Visit element.
+ *
+ * @param root
+ * the root
+ * @param diffElement
+ * the diff element
+ */
+ protected void visitElement(DiffModel root, DiffElement diffElement) {
+ AbstractDiffExtension newElement = null;
+ if(diffElement instanceof MoveModelElement) {
+ newElement = (AbstractDiffExtension)extensionBuilder.doSwitch(diffElement);
+ } else if(diffElement instanceof UpdateReference) {
+ newElement = (AbstractDiffExtension)extensionBuilder.doSwitch(diffElement);
+ }
+ if(newElement != null) {
+ replaceElement(diffElement, newElement);
+ }
+ }
+
+ /**
+ * the newElement hides the old element
+ * TODO rename this method to be conpliant with EMF-Compare?
+ *
+ * @param oldElement
+ * @param newElement
+ */
+ private void replaceElement(final DiffElement oldElement, final AbstractDiffExtension newElement) {
+ DiffGroup parent = (DiffGroup)oldElement.eContainer();
+ parent.getSubDiffElements().add((DiffElement)newElement);
+ ((AbstractDiffExtension)newElement).getHideElements().add(oldElement);
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.diff.engine.GenericDiffEngine#getAttributesChecker()
+ *
+ * @return
+ */
+ @Override
+ protected AttributesCheck getAttributesChecker() {
+ return new PapyrusAttributesCheck(getMatchManager(), getFeatureChecker());
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.uml2.diff.UML2DiffEngine#getReferencesChecker()
+ *
+ * @return
+ */
+ @Override
+ protected ReferencesCheck getReferencesChecker() {
+ return new PapyrusUML2ReferencesCheck(getMatchManager(), getFeatureChecker());
+ }
+
+ /**
+ *
+ * @return
+ * the feature checker
+ */
+ protected FeaturesCheck getFeatureChecker() {
+ if(this.featuresCheck == null) {
+ this.featuresCheck = new FeaturesCheck(getMatchManager(), this.options);
+ }
+ return this.featuresCheck;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/UMLDiffService.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/UMLDiffService.java new file mode 100644 index 00000000000..8938f7bc110 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/UMLDiffService.java @@ -0,0 +1,162 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Map;
+
+import org.eclipse.emf.compare.diff.engine.IDiffEngine;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+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.ecore.EObject;
+import org.eclipse.papyrus.infra.tools.util.ReflectHelper;
+import org.eclipse.papyrus.uml.compare.diff.Activator;
+
+
+
+public class UMLDiffService {
+
+ private static Method fillRequiredDifferencesMethod = null;
+
+ /**
+ * Utility classes don't need to (and shouldn't) be instantiated.
+ */
+ private UMLDiffService() {
+ // prevents instantiation
+ }
+
+
+
+ /**
+ * Return a diffmodel created using the match model. This implementation is a generic and simple one.
+ *
+ * @param match
+ * the matching model
+ * @param threeWay
+ * <code>True</code> if we're computing a three way comparison, <code>False</code> otherwise.
+ * @return the corresponding diff model
+ */
+ public static DiffModel doDiff(MatchModel match, boolean threeWay) {
+ return doDiff(match, threeWay, null);
+ }
+
+ /**
+ * Return a diffmodel created using the match model. This implementation is a generic and simple one.
+ *
+ * @param match
+ * the matching model
+ * @param threeWay
+ * <code>True</code> if we're computing a three way comparison, <code>False</code> otherwise.
+ * @param options
+ * the options for the diff
+ * @return the corresponding diff model
+ */
+ public static DiffModel doDiff(MatchModel match, boolean threeWay, final Map<String, Object> options) {
+ // final IDiffEngine engine = getBestDiffEngine(match);
+ final IDiffEngine engine = new UMLDiffEngine(options); //TODO verify that it is the correct diff engine for UML
+ final DiffModel diff = engine.doDiff(match, threeWay);
+
+ final Collection<AbstractDiffExtension> extensions = DiffService.getCorrespondingDiffExtensions(match);
+ for(final AbstractDiffExtension ext : extensions) {
+ if(ext != null) {
+ ext.visit(diff);
+ }
+ }
+
+ engine.reset();
+
+ fillRequiredDifferences(diff);
+ //clean the diff
+// cleanDiff(diff);
+
+ return diff;
+ }
+
+
+
+// private static void cleanDiff(final DiffModel diffModel) {
+// EList<DiffElement> differences = diffModel.getDifferences();
+//
+// final List<DiffElement> toRemove = new ArrayList<DiffElement>();
+// for(DiffElement current : differences) {
+// if(current instanceof MoveModelElement) {//appears when we do a comparison between 2 elements of the same model (name change for example)
+// EObject leftTarget = ((MoveModelElement)current).getLeftTarget();
+// EObject rightTarget = ((MoveModelElement)current).getRightTarget();
+// if(leftTarget == null && rightTarget == null) {
+// toRemove.add(current);
+// }
+// }
+// }
+// for(DiffElement current : toRemove) {
+// EcoreUtil.remove(current);
+// }
+//
+// differences = diffModel.getOwnedElements();
+// if(differences.size() == 1 && differences.get(0) instanceof DiffGroup) {
+// DiffGroup group = (DiffGroup)differences.get(0);
+// if(group.getSubDiffElements().size() == 1 && group.getSubDiffElements().get(0) instanceof DiffGroup) {
+// DiffGroup group2 = (DiffGroup)group.getSubDiffElements().get(0);
+// if(!group2.isConflicting() && group2.getSubDiffElements().size() == 1) {
+// DiffGroup group3 = (DiffGroup)group.getSubDiffElements().get(0);
+// if(!group2.isConflicting() && group2.getSubDiffElements().size() == 1) {
+// //we should remove its parent!
+// // diffModel.getOwnedElements().add(group2);
+// // EcoreUtil.remove(group);
+// }
+// }
+// }
+// }
+// // EList<DiffElement> differences2 = diffModel.getDifferences();
+// // if(differences2.size() == 1) {
+// // DiffElement el = differences2.get(0);
+// // if(el instanceof DiffGroup) {
+// // DiffGroup group = (DiffGroup)el;
+// // if(group.getSubDiffElements().size() == 1 && group.getSubDiffElements().get(0) instanceof DiffGroup) {
+// // group = (DiffGroup)group.getSubDiffElements().get(0);
+// // int i = 0;
+// // i++;
+// //
+// // }
+// // }
+// // }
+// }
+
+ //TODO write a JUnit test to be sue that the method called reflexively is always available
+ private static void fillRequiredDifferences(final DiffModel diff) {
+ if(fillRequiredDifferencesMethod == null) {
+ try {
+ fillRequiredDifferencesMethod = ReflectHelper.getMethod(DiffService.class, "fillRequiredDifferences", new Class<?>[]{ EObject.class });
+ } catch (SecurityException e) {
+ Activator.log.error(e);
+ } catch (NoSuchMethodException e) {
+ Activator.log.error(e);
+ }
+ }
+ final Object[] parameters = new Object[1];
+ parameters[0] = diff;
+ try {
+ fillRequiredDifferencesMethod.invoke(null, parameters);
+ } catch (IllegalArgumentException e) {
+ Activator.log.error(e);
+ } catch (IllegalAccessException e) {
+ Activator.log.error(e);
+ } catch (InvocationTargetException e) {
+ Activator.log.error(e);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedMatchService.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedMatchService.java new file mode 100644 index 00000000000..19235d99e6e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedMatchService.java @@ -0,0 +1,59 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.nested;
+
+import java.util.Map;
+
+import org.eclipse.emf.compare.match.engine.IMatchEngine;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.ecore.EObject;
+
+//replace MatchService
+public class NestedMatchService {
+
+ /**
+ * Utility classes don't need to (and shouldn't) be instantiated.
+ */
+ private NestedMatchService() {
+ // prevents instantiation
+ }
+
+ /**
+ * Matches three objects along with their content, then return the corresponding match model.
+ *
+ * @param leftObject
+ * Left (local) of the three objects to get compared.
+ * @param rightObject
+ * Right (latest from repository) of the three objects to compare.
+ * @param ancestor
+ * Common ancestor of the two others.
+ * @param options
+ * Options to tweak the matching procedure. <code>null</code> or an empty map will result in
+ * the default options to be used.
+ * @return {@link MatchModel} for these three objects' comparison.
+ * @throws InterruptedException
+ * Thrown if the matching is interrupted somehow.
+ * @see org.eclipse.emf.compare.match.MatchOptions
+ * @see IMatchEngine#contentMatch(EObject, EObject, EObject, Map)
+ *
+ */
+ public static MatchModel doContentMatch(EObject leftObject, EObject rightObject, Map<String, Object> options) throws InterruptedException {
+ final IMatchEngine engine = new UMLMatchEngine();
+ final MatchModel result = engine.contentMatch(leftObject, rightObject, options);
+ engine.reset();
+ return result;
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedMergeUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedMergeUtils.java new file mode 100644 index 00000000000..4b7418bdcc6 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedMergeUtils.java @@ -0,0 +1,56 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.nested;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.compare.match.MatchOptions;
+import org.eclipse.emf.compare.match.engine.GenericMatchScopeProvider;
+import org.eclipse.emf.compare.util.EMFCompareMap;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.emf.compare.diff.utils.PapyrusCompareOptions;
+
+
+public class NestedMergeUtils {
+
+ public static final Map<String, Object> getMergeOptions(final IProgressMonitor monitor, final EObject left, final EObject right) {
+ final Map<String, Object> options = new EMFCompareMap<String, Object>();
+ Assert.isNotNull(left);
+ Assert.isNotNull(right);
+ options.put(MatchOptions.OPTION_PROGRESS_MONITOR, monitor);
+ options.put(MatchOptions.OPTION_IGNORE_ID, Boolean.TRUE);
+ options.put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.TRUE);
+ options.put(MatchOptions.OPTION_MATCH_SCOPE_PROVIDER, new GenericMatchScopeProvider(left, right));
+
+
+ //---------begin of bug 377154
+ //when we compare 2 elements owned by the same file, we don't verify their container
+
+ final Map<EStructuralFeature, List<EObject>> featuresOptions = new HashMap<EStructuralFeature, List<EObject>>();
+ List<EObject> objects = new ArrayList<EObject>();
+ objects.add(left);
+ objects.add(right);
+ featuresOptions.put(left.eContainingFeature(), objects);
+ featuresOptions.put(right.eContainingFeature(), objects);
+ options.put(PapyrusCompareOptions.KEY_IGNORE_CHANGES_ON_FEATURES_FOR, featuresOptions);
+ //---------end of bug 377154
+ return options;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScope.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScope.java new file mode 100644 index 00000000000..189020080bb --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScope.java @@ -0,0 +1,75 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.nested;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.compare.match.engine.DefaultMatchScope;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+/**
+ *
+ * This class allows to know which stereotype application should be known by the element to do the comparison
+ * see bug 384490: [UML Compare] Comparison between stereotyped elements doesn't work in the nested Compare Editor
+ */
+public class NestedUMLStereotypeApplicationMatchScope extends DefaultMatchScope {
+
+ /**
+ * The stereotype application known by the scope
+ */
+ private List<EObject> stereotypeApplication;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param el
+ * @param stereotypeApplication
+ */
+ public NestedUMLStereotypeApplicationMatchScope(final EObject el, final List<EObject> stereotypeApplication) {
+ super(el);
+ this.stereotypeApplication = new ArrayList<EObject>(stereotypeApplication);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param el
+ * the element
+ * @param stereotypeApplication
+ * the list of the stereotype application known by this scope
+ */
+ public NestedUMLStereotypeApplicationMatchScope(final Resource res, final List<EObject> stereotypeApplication){
+ super(res);
+ this.stereotypeApplication = new ArrayList<EObject>(stereotypeApplication);
+ }
+ /**
+ *
+ * @see org.eclipse.emf.compare.match.engine.GenericMatchScope#isInScope(org.eclipse.emf.ecore.EObject)
+ *
+ * @param eObject
+ * @return
+ */
+ @Override
+ public boolean isInScope(EObject eObject) {
+ if(UMLUtil.getStereotype(eObject) != null) {
+ return stereotypeApplication.contains(eObject);
+ }
+ return super.isInScope(eObject);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScopeProvider.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScopeProvider.java new file mode 100644 index 00000000000..c5b5694c1d9 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/NestedUMLStereotypeApplicationMatchScopeProvider.java @@ -0,0 +1,153 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.nested;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.compare.match.engine.GenericMatchScope;
+import org.eclipse.emf.compare.match.engine.IMatchScope;
+import org.eclipse.emf.compare.match.engine.IMatchScopeProvider;
+import org.eclipse.emf.compare.match.filter.IResourceFilter;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ *
+ * Created to resolve the bug 384490: [UML Compare] Comparison between stereotyped elements doesn't work in the nested Compare Editor
+ *
+ */
+public class NestedUMLStereotypeApplicationMatchScopeProvider implements IMatchScopeProvider {
+
+ /**
+ * The match scope used for the left side of comparison.
+ *
+ * @since 1.3
+ */
+ final protected IMatchScope leftScope;
+
+ /**
+ * The match scope used for the right side of comparison.
+ *
+ * @since 1.3
+ */
+ final protected IMatchScope rightScope;
+
+ /**
+ * The match scope used for the ancestor side of comparison.
+ *
+ * @since 1.3
+ */
+ protected IMatchScope ancestorScope;
+
+ /**
+ * Constructs a left and right {@link GenericMatchScope} with the given {@link EObject}s. No ancestor
+ * scope will be created, so calls to {@link #getAncestorScope()} will return <code>null</code>.
+ *
+ * @param leftObject
+ * the {@link EObject}, which will be used to construct the left scope
+ * @param rightObject
+ * the {@link EObject}, which will be used to construct the right scope
+ */
+ public NestedUMLStereotypeApplicationMatchScopeProvider(EObject leftObject, EObject rightObject) {
+ final List<EObject> leftSte = new ArrayList<EObject>();
+ final List<EObject> rightSte = new ArrayList<EObject>();
+ if(leftObject instanceof Element) {
+ leftSte.addAll(((Element)leftObject).getStereotypeApplications());
+ if(((Element)leftObject).getNearestPackage() != null) {
+ leftSte.addAll(((Element)leftObject).getNearestPackage().getAllProfileApplications());
+ }
+ }
+ if(rightObject instanceof Element) {
+ rightSte.addAll(((Element)rightObject).getStereotypeApplications());
+ if(((Element)rightObject).getNearestPackage() != null) {
+ rightSte.addAll(((Element)rightObject).getNearestPackage().getAllProfileApplications());
+ }
+ }
+ if(leftObject.eResource() != null) {
+ this.leftScope = new NestedUMLStereotypeApplicationMatchScope(leftObject.eResource(), leftSte);
+ } else {
+ this.leftScope = new NestedUMLStereotypeApplicationMatchScope(leftObject, leftSte);
+ }
+
+ if(rightObject.eResource() != null) {
+ this.rightScope = new NestedUMLStereotypeApplicationMatchScope(rightObject.eResource(), rightSte);
+ } else {
+ this.rightScope = new NestedUMLStereotypeApplicationMatchScope(rightObject, rightSte);
+ }
+ }
+
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.match.engine.IMatchScopeProvider#getAncestorScope()
+ */
+ public IMatchScope getAncestorScope() {
+ return ancestorScope;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.match.engine.IMatchScopeProvider#getLeftScope()
+ */
+ public IMatchScope getLeftScope() {
+ return leftScope;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.match.engine.IMatchScopeProvider#getRightScope()
+ */
+ public IMatchScope getRightScope() {
+ return rightScope;
+ }
+
+ /**
+ * Allows to apply an {@link IResourceFilter} to the contained scopes, to reduce them respectively. This
+ * will only have an effect, if this scope provider was instantiated using either a {@link Resource} or a {@link ResourceSet}, but not in case an
+ * {@link EObject} was used.
+ *
+ * @param filter
+ * the filter to apply to the resources of the left, right and (if provided) ancestor scope.
+ */
+ @SuppressWarnings("unchecked")
+ public void applyResourceFilter(IResourceFilter filter) {
+ if(ancestorScope != null) {
+ applyExternalFilter(filter, ((GenericMatchScope)leftScope).getResourcesInScope(), ((GenericMatchScope)rightScope).getResourcesInScope(), ((GenericMatchScope)ancestorScope).getResourcesInScope());
+ } else {
+ applyExternalFilter(filter, ((GenericMatchScope)leftScope).getResourcesInScope(), ((GenericMatchScope)rightScope).getResourcesInScope());
+ }
+ }
+
+ /**
+ * Applies the given filter to the list of resources.
+ *
+ * @param filter
+ * the filter to apply.
+ * @param resources
+ * the list of resources to be filtered (in place).
+ */
+ private static void applyExternalFilter(IResourceFilter filter, List<Resource>... resources) {
+ if(resources.length == 2) {
+ filter.filter(resources[0], resources[1]);
+ } else {
+ filter.filter(resources[0], resources[1], resources[2]);
+ }
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLDiffEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLDiffEngine.java new file mode 100644 index 00000000000..b3ff61e081a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLDiffEngine.java @@ -0,0 +1,41 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.nested;
+
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.compare.match.metamodel.Match2Elements;
+import org.eclipse.papyrus.uml.compare.diff.services.standalone.UMLStandaloneDiffEngine;
+
+/**
+ *
+ * A specific DiffEngine for the Nested UML Compare Editor
+ * see bug 377154
+ */
+//TODO verify the upper class for UML models
+public class UMLDiffEngine extends UMLStandaloneDiffEngine {
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.diff.engine.GenericDiffEngine#checkContainmentUpdate(org.eclipse.emf.compare.diff.metamodel.DiffGroup,
+ * org.eclipse.emf.compare.match.metamodel.Match2Elements)
+ *
+ * @param current
+ * @param matchElement
+ */
+ protected void checkContainmentUpdate(DiffGroup current, Match2Elements matchElement) {
+ //when we compare 2 elements owned by the same file, we don't verify their container
+ //see bug 377154
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLDiffService.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLDiffService.java new file mode 100644 index 00000000000..3745213edae --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLDiffService.java @@ -0,0 +1,159 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.nested;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.compare.diff.engine.IDiffEngine;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.compare.diff.service.DiffService;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.infra.tools.util.ReflectHelper;
+import org.eclipse.papyrus.uml.compare.diff.Activator;
+
+/**
+ *
+ * A specific DiffService for the Nested UML Compare Editor
+ *
+ * @see DiffService
+ * @see bug 377154
+ */
+//TODO ask to EMF-Compare to open their API
+public class UMLDiffService {
+
+ private static Method fillRequiredDifferencesMethod = null;
+
+ /**
+ * Utility classes don't need to (and shouldn't) be instantiated.
+ */
+ private UMLDiffService() {
+ // prevents instantiation
+ }
+
+
+
+ /**
+ * Return a diffmodel created using the match model. This implementation is a generic and simple one.
+ *
+ * @param match
+ * the matching model
+ * @param threeWay
+ * <code>True</code> if we're computing a three way comparison, <code>False</code> otherwise.
+ * @return the corresponding diff model
+ */
+ public static DiffModel doDiff(MatchModel match, boolean threeWay) {
+ // final IDiffEngine engine = getBestDiffEngine(match);
+ final IDiffEngine engine = new UMLDiffEngine(); //TODO verify that it is the correct diff engine for UML
+ final DiffModel diff = engine.doDiff(match, threeWay);
+
+ final Collection<AbstractDiffExtension> extensions = DiffService.getCorrespondingDiffExtensions(match);
+ for(final AbstractDiffExtension ext : extensions) {
+ if(ext != null) {
+ ext.visit(diff);
+ }
+ }
+
+ engine.reset();
+
+ fillRequiredDifferences(diff);
+ //clean the diff
+ cleanDiff(diff);
+
+ return diff;
+ }
+
+ private static void cleanDiff(final DiffModel diffModel) {
+ EList<DiffElement> differences = diffModel.getDifferences();
+
+ final List<DiffElement> toRemove = new ArrayList<DiffElement>();
+ for(DiffElement current : differences) {
+ if(current instanceof MoveModelElement) {//appears when we do a comparison between 2 elements of the same model (name change for example)
+ EObject leftTarget = ((MoveModelElement)current).getLeftTarget();
+ EObject rightTarget = ((MoveModelElement)current).getRightTarget();
+ if(leftTarget == null && rightTarget == null) {
+ toRemove.add(current);
+ }
+ }
+ }
+ for(DiffElement current : toRemove) {
+ EcoreUtil.remove(current);
+ }
+
+ differences = diffModel.getOwnedElements();
+ if(differences.size() == 1 && differences.get(0) instanceof DiffGroup) {
+ DiffGroup group = (DiffGroup)differences.get(0);
+ if(group.getSubDiffElements().size() == 1 && group.getSubDiffElements().get(0) instanceof DiffGroup) {
+ DiffGroup group2 = (DiffGroup)group.getSubDiffElements().get(0);
+ if(!group2.isConflicting() && group2.getSubDiffElements().size() == 1) {
+ DiffGroup group3 = (DiffGroup)group.getSubDiffElements().get(0);
+ if(!group2.isConflicting() && group2.getSubDiffElements().size() == 1) {
+ //we should remove its parent!
+ // diffModel.getOwnedElements().add(group2);
+ // EcoreUtil.remove(group);
+ }
+ }
+ }
+ }
+ int i = 0;
+ i++;
+ // EList<DiffElement> differences2 = diffModel.getDifferences();
+ // if(differences2.size() == 1) {
+ // DiffElement el = differences2.get(0);
+ // if(el instanceof DiffGroup) {
+ // DiffGroup group = (DiffGroup)el;
+ // if(group.getSubDiffElements().size() == 1 && group.getSubDiffElements().get(0) instanceof DiffGroup) {
+ // group = (DiffGroup)group.getSubDiffElements().get(0);
+ // int i = 0;
+ // i++;
+ //
+ // }
+ // }
+ // }
+ }
+
+ //TODO write a JUnit test to be sue that the method called reflexively is always available
+ private static void fillRequiredDifferences(final DiffModel diff) {
+ if(fillRequiredDifferencesMethod == null) {
+ try {
+ fillRequiredDifferencesMethod = ReflectHelper.getMethod(DiffService.class, "fillRequiredDifferences", new Class<?>[]{ EObject.class });
+ } catch (SecurityException e) {
+ Activator.log.error(e);
+ } catch (NoSuchMethodException e) {
+ Activator.log.error(e);
+ }
+ }
+ final Object[] parameters = new Object[1];
+ parameters[0] = diff;
+ try {
+ fillRequiredDifferencesMethod.invoke(null, parameters);
+ } catch (IllegalArgumentException e) {
+ Activator.log.error(e);
+ } catch (IllegalAccessException e) {
+ Activator.log.error(e);
+ } catch (InvocationTargetException e) {
+ Activator.log.error(e);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java new file mode 100644 index 00000000000..66fd4fcae44 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLMatchEngine.java @@ -0,0 +1,306 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.nested;
+
+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.compare.FactoryException;
+import org.eclipse.emf.compare.match.MatchOptions;
+import org.eclipse.emf.compare.match.engine.AbstractSimilarityChecker;
+import org.eclipse.emf.compare.match.engine.internal.GenericMatchEngineToCheckerBridge;
+import org.eclipse.emf.compare.match.internal.statistic.NameSimilarity;
+import org.eclipse.emf.compare.match.metamodel.Match2Elements;
+import org.eclipse.emf.compare.match.metamodel.MatchElement;
+import org.eclipse.emf.compare.match.metamodel.MatchFactory;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.compare.match.metamodel.Side;
+import org.eclipse.emf.compare.match.metamodel.UnmatchElement;
+import org.eclipse.emf.compare.match.metamodel.provider.MatchEditPlugin;
+import org.eclipse.emf.compare.util.EMFCompareMap;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.uml.compare.diff.Activator;
+import org.eclipse.papyrus.uml.compare.diff.services.standalone.UMLStandaloneMatchEngine;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Stereotype;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+//TODO verify the super class for UML models
+/**
+ *
+ * A specific match engine for the Nested UML Compare Editor
+ *
+ * @see bug 377154
+ */
+public class UMLMatchEngine extends UMLStandaloneMatchEngine {//GenericMatchEngine {
+
+ /** the left object to compare */
+ protected EObject leftObject;
+
+ /** the right object to compare */
+ protected EObject rightObject;
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.match.engine.GenericMatchEngine#contentMatch(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject,
+ * java.util.Map)
+ *
+ * @param leftObject
+ * @param rightObject
+ * @param optionMap
+ * @return
+ */
+ @Override
+ public MatchModel contentMatch(final EObject leftObject, final EObject rightObject, final Map<String, Object> optionMap) {
+ this.leftObject = leftObject;
+ this.rightObject = rightObject;
+ final MatchModel matchModel = super.contentMatch(leftObject, rightObject, optionMap);
+ if(this.leftObject.eResource() != null && this.rightObject.eResource() != null) {
+ completeMatchModelWithUMLDifferences(matchModel, leftObject, rightObject, optionMap);
+ completeMatchWithStereotypeApplications(matchModel, leftObject, rightObject);
+ }
+ return matchModel;
+ }
+
+ /**
+ *
+ * @param matchModel
+ * the match model
+ * @param leftObject
+ * the initial left element used for the comparison
+ * @param rightObject
+ * the initial right element used for the comparison
+ *
+ */
+ protected void completeMatchWithStereotypeApplications(MatchModel matchModel, EObject leftObject, EObject rightObject) {
+ //we check the stereotype application on the compared elements
+ AbstractSimilarityChecker checker = prepareChecker();
+ final List<MatchElement> supplementaryMatchElement = new ArrayList<MatchElement>();
+ final List<UnmatchElement> supplementaryUnmatchedElement = new ArrayList<UnmatchElement>();
+
+ if(leftObject instanceof Element && rightObject instanceof Element) {
+ List[] newValue = getAdditionalStereotypeApplicationModelElement(checker, (Element)leftObject, (Element)rightObject);
+ supplementaryMatchElement.addAll(newValue[0]);
+ supplementaryUnmatchedElement.addAll(newValue[1]);
+ }
+
+ //we check the stereotype application for all others matching children
+ //for(final MatchElement current : matchModel.getMatchedElements().get(0).getSubMatchElements()) {
+ for(final MatchElement current : matchModel.getMatchedElements()){
+ if(current instanceof Match2Elements) {
+ List[] newValue =crossMatchingElement(checker, current);
+ supplementaryMatchElement.addAll(newValue[0]);
+ supplementaryUnmatchedElement.addAll(newValue[1]);
+ }
+ }
+ matchModel.getMatchedElements().get(0).getSubMatchElements().addAll(supplementaryMatchElement);
+ matchModel.getUnmatchedElements().addAll(supplementaryUnmatchedElement);
+ }
+
+ protected List<?>[] crossMatchingElement(final AbstractSimilarityChecker checker, final MatchElement el){
+ final List<MatchElement> supplementaryMatchedElementElement = new ArrayList<MatchElement>();
+ final List<UnmatchElement> supplementaryUnmatchedElement = new ArrayList<UnmatchElement>();
+ if(el instanceof Match2Elements) {
+ final EObject left = ((Match2Elements)el).getLeftElement();
+ final EObject right = ((Match2Elements)el).getRightElement();
+ if(left instanceof Element && right instanceof Element) {
+ List[] newValue = getAdditionalStereotypeApplicationModelElement(checker, (Element)left, (Element)right);
+ supplementaryMatchedElementElement.addAll(newValue[0]);
+ supplementaryUnmatchedElement.addAll(newValue[1]);
+ }
+ for(final MatchElement current : el.getSubMatchElements()){
+ List[] newValue = crossMatchingElement(checker, current);
+ supplementaryMatchedElementElement.addAll(newValue[0]);
+ supplementaryUnmatchedElement.addAll(newValue[1]);
+ }
+ }
+ List<?>[] value = new List<?>[2];
+ value[0] = supplementaryMatchedElementElement;
+ value[1] = supplementaryUnmatchedElement;
+ return value;
+ }
+
+ /**
+ *
+ * @param checker
+ * the checker
+ * @param left
+ * the left element
+ * @param right
+ * the right element
+ * @return
+ * an array with 2 list : the first one contains the matchedelements to add and the 2nd one contains the unmatched elements to add
+ */
+ protected List<?>[] getAdditionalStereotypeApplicationModelElement(final AbstractSimilarityChecker checker, final Element left, final Element right) {
+ final List<MatchElement> supplementaryMatchedElementElement = new ArrayList<MatchElement>();
+ final List<UnmatchElement> supplementaryUnmatchedElement = new ArrayList<UnmatchElement>();
+ final Set<Stereotype> allAppliedStereotypes = new HashSet<Stereotype>();
+ allAppliedStereotypes.addAll(left.getAppliedStereotypes());
+ allAppliedStereotypes.addAll(right.getAppliedStereotypes());
+ for(final Stereotype ste : allAppliedStereotypes) {
+ final EObject rightApplication = ((Element)right).getStereotypeApplication(ste);
+ final EObject leftApplication = ((Element)left).getStereotypeApplication(ste);
+ if(rightApplication != null && leftApplication != null) {
+ Match2Elements newMatch = MatchFactory.eINSTANCE.createMatch2Elements();
+ newMatch.setLeftElement(leftApplication);
+ newMatch.setRightElement(rightApplication);
+ double metric = 0.0;
+ try {
+ metric = checker.absoluteMetric(leftApplication, rightApplication);
+ } catch (FactoryException e) {
+ Activator.log.error(e);
+ }
+ newMatch.setSimilarity(metric);
+ supplementaryMatchedElementElement.add(newMatch);
+ } else if(leftApplication == null) {
+ UnmatchElement unmatch = MatchFactory.eINSTANCE.createUnmatchElement();
+ unmatch.setConflicting(false);
+ unmatch.setElement(rightApplication);
+ unmatch.setSide(Side.RIGHT);
+ supplementaryUnmatchedElement.add(unmatch);
+ } else if(rightApplication == null) {
+ UnmatchElement unmatch = MatchFactory.eINSTANCE.createUnmatchElement();
+ unmatch.setConflicting(false);
+ unmatch.setElement(leftApplication);
+ unmatch.setSide(Side.LEFT);
+ supplementaryUnmatchedElement.add(unmatch);
+ }
+ }
+ List<?>[] value = new List<?>[2];
+ value[0] = supplementaryMatchedElementElement;
+ value[1] = supplementaryUnmatchedElement;
+ return value;
+ }
+
+ /**
+ * This method has been developped to correct the bug 384490: [UML Compare] Comparison between stereotyped elements doesn't work in the nested
+ * Compare Editor
+ *
+ * @param matchModel
+ * @param leftObject
+ * @param rightObject
+ * @param optionMap
+ */
+ protected void completeMatchModelWithUMLDifferences(final MatchModel matchModel, final EObject leftObject, final EObject rightObject, final Map<String, Object> optionMap) {
+ /*
+ * the matchModel should have LeftRoot and rightRoot in order to be able to do add the copied stereotype
+ * to the resource -> see mergers :
+ * org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.ModelElementChangeLeftTargetTransactionalMerger.getDoUndoInTargetCommand(
+ * TransactionalEditingDomain)
+ * org.eclipse.papyrus.infra.emf.compare.diff.internal.merger.ModelElementChangeRightTargetTransactionalMerger.getDoApplyInOriginCommand(
+ * TransactionalEditingDomain)
+ */
+ if(matchModel.getLeftRoots().size() == 0 && matchModel.getRightRoots().size() == 0) {
+ matchModel.getLeftRoots().addAll(leftObject.eResource().getContents());
+ matchModel.getLeftRoots().add(0, leftObject);
+ matchModel.getRightRoots().addAll(rightObject.eResource().getContents());
+ matchModel.getRightRoots().add(0, rightObject);
+ }
+
+ //we do a resourceMatch to get the stereotypeApplication differences
+ final Map<String, Object> stereotypeOptions = new EMFCompareMap<String, Object>(optionMap);
+ stereotypeOptions.put(MatchOptions.OPTION_MATCH_SCOPE_PROVIDER, new NestedUMLStereotypeApplicationMatchScopeProvider(leftObject, rightObject));
+ MatchModel steMatchModel = null;
+ try {
+ steMatchModel = super.resourceMatch(leftObject.eResource(), rightObject.eResource(), stereotypeOptions);
+ } catch (InterruptedException e) {
+ Activator.log.error(e);
+ }
+
+ if(steMatchModel != null) {//null when there is no diff...
+ final List<UnmatchElement> unmatchedElementToAdd = new ArrayList<UnmatchElement>();
+ for(final UnmatchElement current : steMatchModel.getUnmatchedElements()) {
+ final EObject stereotypeApplication = UMLUtil.getBaseElement(current.getElement());
+ if(stereotypeApplication != null) {
+ unmatchedElementToAdd.add(current);
+ }
+ }
+ if(!unmatchedElementToAdd.isEmpty()) {
+ matchModel.getUnmatchedElements().addAll(unmatchedElementToAdd);
+ }
+ }
+ }
+
+ /**
+ *
+ * @param sourceElement
+ * a uml element
+ * @param stereotypedElement
+ * a stereotyped element
+ * @return
+ * <code>true</code> if the stereotyped element is a subelement of the uml element
+ */
+ protected boolean isRequiredByTheDiff(final Element sourceElement, Element stereotypedElement) {
+ EObject container = stereotypedElement;
+ while(container != null) {
+ if(container == sourceElement) {
+ return true;
+ }
+ container = container.eContainer();
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.match.engine.GenericMatchEngine#prepareChecker()
+ *
+ * @return
+ */
+ protected AbstractSimilarityChecker prepareChecker() {
+ AbstractSimilarityChecker checker = null;
+ GenericMatchEngineToCheckerBridge bridge = new UMLGenericMatchEngineToCheckerBridge();
+ Assert.isNotNull(leftObject);
+ Assert.isNotNull(rightObject);
+ checker = new UMLSimilarityChecker(filter, bridge, leftObject, rightObject);
+ return checker;
+ }
+
+
+ /**
+ *
+ * Duplicate code from GenericMatchEngine
+ *
+ */
+ private class UMLGenericMatchEngineToCheckerBridge extends GenericMatchEngineToCheckerBridge {
+
+ @Override
+ public double contentSimilarity(EObject obj1, EObject obj2) throws FactoryException {
+ double similarity = 0d;
+ try {
+
+ similarity = NameSimilarity.nameSimilarityMetric(NameSimilarity.findName(obj1), NameSimilarity.findName(obj2));
+ } catch (final FactoryException e) {
+ // fails silently, will return a similarity of 0d
+ }
+ return similarity;
+ }
+
+ @Override
+ public double nameSimilarity(EObject obj1, EObject obj2) {
+ double similarity = 0d;
+ try {
+ similarity = NameSimilarity.nameSimilarityMetric(NameSimilarity.contentValue(obj1), NameSimilarity.contentValue(obj2));
+ } catch (FactoryException e) {
+ // fails silently, will return a similarity of 0d
+ }
+ return similarity;
+ }
+
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLSimilarityChecker.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLSimilarityChecker.java new file mode 100644 index 00000000000..ea8d7623d68 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/nested/UMLSimilarityChecker.java @@ -0,0 +1,90 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.nested;
+
+import org.eclipse.emf.compare.FactoryException;
+import org.eclipse.emf.compare.match.engine.internal.DistinctEcoreSimilarityChecker;
+import org.eclipse.emf.compare.match.engine.internal.GenericMatchEngineToCheckerBridge;
+import org.eclipse.emf.compare.match.statistic.MetamodelFilter;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+//TODO : verify the upper class for UML
+/**
+ *
+ * A specific similarity checker for the Nested UML Compare Editor
+ *
+ * @see bug 377154
+ */
+public class UMLSimilarityChecker extends DistinctEcoreSimilarityChecker {
+
+ /** the left object to compare */
+ private final EObject rootLeft;
+
+ /** the right object to compare */
+ private final EObject rootRight;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param filter
+ * @param bridge
+ * @param left
+ * the left object to compare
+ * @param right
+ * the right object to compare
+ */
+ public UMLSimilarityChecker(final MetamodelFilter filter, final GenericMatchEngineToCheckerBridge bridge, final EObject left, final EObject right) {
+ super(filter, bridge);
+ this.rootLeft = left;
+ this.rootRight = right;
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.match.engine.internal.DistinctEcoreSimilarityChecker#isSimilar(org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.ecore.EObject)
+ *
+ * @param obj1
+ * @param obj2
+ * @return
+ * @throws FactoryException
+ */
+ @Override
+ public boolean isSimilar(final EObject obj1, final EObject obj2) throws FactoryException {
+
+ /**
+ * We consider that the compared element are always similar (but there names can be different!)
+ */
+ if(obj1 == rootLeft || obj1 == rootRight) {
+ if(obj2 == rootLeft || obj2 == rootRight) {
+ return true;
+ }
+ }
+ //if the 2 elements are stereotypes applications, they are similar if the elements on which they are applied are similar
+ final Element base1 = UMLUtil.getBaseElement(obj1);
+ final Element base2 = UMLUtil.getBaseElement(obj2);
+ if(base1 != null && base2 != null) {
+ final EClass eClass1 = obj1.eClass();
+ final EClass eClass2 = obj2.eClass();
+ if(eClass1 == eClass2) {
+ return isSimilar(base1, base2);
+ }
+ }
+ return super.isSimilar(obj1, obj2);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/StandaloneMergeUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/StandaloneMergeUtils.java new file mode 100644 index 00000000000..2e48af3a741 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/StandaloneMergeUtils.java @@ -0,0 +1,37 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.standalone;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.compare.match.MatchOptions;
+import org.eclipse.emf.compare.match.engine.DefaultMatchScopeProvider;
+import org.eclipse.emf.ecore.EObject;
+
+
+public class StandaloneMergeUtils {
+
+ public static final Map<String, Object> getMergeOptions(final IProgressMonitor monitor, final EObject left, final EObject right) {
+ final Map<String, Object> options = new HashMap<String, Object>();
+ if(monitor != null) {
+ options.put(MatchOptions.OPTION_PROGRESS_MONITOR, monitor);
+ }
+ if(left != null && right != null) {
+ options.put(MatchOptions.OPTION_MATCH_SCOPE_PROVIDER, new DefaultMatchScopeProvider(left.eResource(), right.eResource()));
+ }
+ return options;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneDiffEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneDiffEngine.java new file mode 100644 index 00000000000..fc89d5818fe --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneDiffEngine.java @@ -0,0 +1,170 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.standalone;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.emf.compare.diff.engine.check.AttributesCheck;
+import org.eclipse.emf.compare.diff.engine.check.ReferencesCheck;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.compare.diff.metamodel.UpdateReference;
+import org.eclipse.emf.compare.diff.metamodel.util.DiffSwitch;
+import org.eclipse.emf.compare.match.metamodel.Match2Elements;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.compare.uml2.diff.UML2DiffEngine;
+import org.eclipse.emf.ecore.EGenericType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.papyrus.infra.emf.compare.diff.check.FeaturesCheck;
+import org.eclipse.papyrus.infra.emf.compare.diff.check.PapyrusAttributesCheck;
+import org.eclipse.papyrus.infra.emf.compare.diff.utils.PapyrusOptionsAdapter;
+import org.eclipse.papyrus.uml.compare.diff.check.PapyrusUML2ReferencesCheck;
+import org.eclipse.papyrus.uml.compare.diff.internal.utils.UMLDiffElementExtensionBuilder;
+
+public class UMLStandaloneDiffEngine extends UML2DiffEngine {//GenericDiffEngine {
+
+ private DiffSwitch<AbstractDiffExtension> extensionBuilder;
+
+ private Map<String, Object> options;
+
+ protected FeaturesCheck featuresCheck;
+
+ public UMLStandaloneDiffEngine() {
+ this(null);
+ }
+
+ public UMLStandaloneDiffEngine(final Map<String, Object> options) {
+ this.extensionBuilder = new UMLDiffElementExtensionBuilder();
+ this.options = options;
+ }
+
+ /**
+ * This will check if the elements matched by a given {@link Match2Elements} have been moved.
+ *
+ * @param root
+ * {@link DiffGroup root} of the {@link DiffElement} to create if the elements have actually
+ * been moved.
+ * @param matchElement
+ * This contains the mapping information about the elements we need to check for a move.
+ */
+ protected void checkMoves(DiffGroup root, Match2Elements matchElement) {
+ final EObject left = matchElement.getLeftElement();
+ final EObject right = matchElement.getRightElement();
+
+ if(left instanceof EGenericType || right instanceof EGenericType)
+ return;
+ if(left.eContainer() != null && right.eContainer() != null && getMatchManager().getMatchedEObject(left.eContainer()) != right.eContainer()) {
+ final EStructuralFeature leftFeature = left.eContainingFeature();
+ if(this.featuresCheck == null) {
+ this.featuresCheck = new FeaturesCheck(getMatchManager(), options);
+ }
+ if(!this.featuresCheck.shouldBeIgnored(leftFeature) && !this.featuresCheck.shouldBeIgnored(leftFeature, left)) {
+ super.checkMoves(root, matchElement);
+ }
+ }
+ }
+
+ @Override
+ public DiffModel doDiff(MatchModel match, boolean threeWay) {
+ DiffModel result = super.doDiff(match, threeWay);
+ result = papyrusPostProcess(result);
+ addMergeOptions(result);
+ return result;
+ }
+
+
+ /**
+ * Attach an adapter containing the merge options to each DiffElement
+ *
+ * @param diffModel
+ * the diffModel
+ */
+ private void addMergeOptions(final DiffModel diffModel) {
+ if(this.options != null) {
+ final Iterator<EObject> iter = diffModel.eAllContents();
+ while(iter.hasNext()) {
+ final EObject current = iter.next();
+ if(current instanceof DiffElement) {
+ final PapyrusOptionsAdapter adapter = new PapyrusOptionsAdapter(this.options);
+ current.eAdapters().add(adapter);
+ }
+ }
+ }
+ }
+
+ /**
+ * Post process default result of Diff.
+ * Processes changes stereotypes and tagged values
+ *
+ * @param diffModel
+ * the diff model
+ * @return the diff model
+ */
+ protected DiffModel papyrusPostProcess(DiffModel diffModel) {
+ final Iterator<EObject> it = diffModel.eAllContents();
+ while(it.hasNext()) {
+ DiffElement diffElement = (DiffElement)it.next();
+ visitElement(diffModel, diffElement);
+ }
+ return diffModel;
+ }
+
+ /**
+ * Visit element.
+ *
+ * @param root
+ * the root
+ * @param diffElement
+ * the diff element
+ */
+ protected void visitElement(DiffModel root, DiffElement diffElement) {
+ AbstractDiffExtension newElement = null;
+ if(diffElement instanceof MoveModelElement) {
+ newElement = (AbstractDiffExtension)extensionBuilder.doSwitch(diffElement);
+ } else if(diffElement instanceof UpdateReference) {
+ newElement = (AbstractDiffExtension)extensionBuilder.doSwitch(diffElement);
+ }
+ if(newElement != null) {
+ replaceElement(diffElement, newElement);
+ }
+ }
+
+ //TODO : currently this method hide the initial element. It should be interesting to destroy it no?
+ private void replaceElement(final DiffElement oldElement, final AbstractDiffExtension newElement) {
+ DiffGroup parent = (DiffGroup)oldElement.eContainer();
+ parent.getSubDiffElements().add((DiffElement)newElement);
+ ((AbstractDiffExtension)newElement).getHideElements().add(oldElement);
+ }
+
+ @Override
+ protected AttributesCheck getAttributesChecker() {
+ if(this.featuresCheck == null) {
+ this.featuresCheck = new FeaturesCheck(getMatchManager(), this.options);
+ }
+ return new PapyrusAttributesCheck(getMatchManager(), this.featuresCheck);
+ }
+
+ @Override
+ protected ReferencesCheck getReferencesChecker() {
+ if(this.featuresCheck == null) {
+ this.featuresCheck = new FeaturesCheck(getMatchManager(), this.options);
+ }
+ return new PapyrusUML2ReferencesCheck(getMatchManager(), this.featuresCheck);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneDiffService.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneDiffService.java new file mode 100644 index 00000000000..dd78ee890cf --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneDiffService.java @@ -0,0 +1,167 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.standalone;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.compare.diff.engine.IDiffEngine;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.MoveModelElement;
+import org.eclipse.emf.compare.diff.service.DiffService;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.papyrus.infra.tools.util.ReflectHelper;
+import org.eclipse.papyrus.uml.compare.diff.Activator;
+
+
+
+public class UMLStandaloneDiffService {
+
+ private static Method fillRequiredDifferencesMethod = null;
+
+ /**
+ * Utility classes don't need to (and shouldn't) be instantiated.
+ */
+ private UMLStandaloneDiffService() {
+ // prevents instantiation
+ }
+
+
+
+ /**
+ * Return a diffmodel created using the match model. This implementation is a generic and simple one.
+ *
+ * @param match
+ * the matching model
+ * @param threeWay
+ * <code>True</code> if we're computing a three way comparison, <code>False</code> otherwise.
+ * @return the corresponding diff model
+ */
+ public static DiffModel doDiff(MatchModel match, boolean threeWay) {
+ return doDiff(match, threeWay, null);
+ }
+
+ /**
+ * Return a diffmodel created using the match model. This implementation is a generic and simple one.
+ *
+ * @param match
+ * the matching model
+ * @param threeWay
+ * <code>True</code> if we're computing a three way comparison, <code>False</code> otherwise.
+ * @param options
+ * the options for the diff
+ * @return the corresponding diff model
+ */
+ public static DiffModel doDiff(MatchModel match, boolean threeWay, final Map<String, Object> options) {
+ // final IDiffEngine engine = getBestDiffEngine(match);
+ final IDiffEngine engine = new UMLStandaloneDiffEngine(options); //TODO verify that it is the correct diff engine for UML
+ final DiffModel diff = engine.doDiff(match, threeWay);
+
+ final Collection<AbstractDiffExtension> extensions = DiffService.getCorrespondingDiffExtensions(match);
+ for(final AbstractDiffExtension ext : extensions) {
+ if(ext != null) {
+ ext.visit(diff);
+ }
+ }
+
+ engine.reset();
+
+ fillRequiredDifferences(diff);
+ //clean the diff
+ cleanDiff(diff);
+
+ return diff;
+ }
+
+ private static void cleanDiff(final DiffModel diffModel) {
+ EList<DiffElement> differences = diffModel.getDifferences();
+
+ final List<DiffElement> toRemove = new ArrayList<DiffElement>();
+ for(DiffElement current : differences) {
+ if(current instanceof MoveModelElement) {//appears when we do a comparison between 2 elements of the same model (name change for example)
+ EObject leftTarget = ((MoveModelElement)current).getLeftTarget();
+ EObject rightTarget = ((MoveModelElement)current).getRightTarget();
+ if(leftTarget == null && rightTarget == null) {
+ toRemove.add(current);
+ }
+ }
+ }
+ for(DiffElement current : toRemove) {
+ EcoreUtil.remove(current);
+ }
+
+ differences = diffModel.getOwnedElements();
+ if(differences.size() == 1 && differences.get(0) instanceof DiffGroup) {
+ DiffGroup group = (DiffGroup)differences.get(0);
+ if(group.getSubDiffElements().size() == 1 && group.getSubDiffElements().get(0) instanceof DiffGroup) {
+ DiffGroup group2 = (DiffGroup)group.getSubDiffElements().get(0);
+ if(!group2.isConflicting() && group2.getSubDiffElements().size() == 1) {
+ DiffGroup group3 = (DiffGroup)group.getSubDiffElements().get(0);
+ if(!group2.isConflicting() && group2.getSubDiffElements().size() == 1) {
+ //we should remove its parent!
+ // diffModel.getOwnedElements().add(group2);
+ // EcoreUtil.remove(group);
+ }
+ }
+ }
+ }
+ // EList<DiffElement> differences2 = diffModel.getDifferences();
+ // if(differences2.size() == 1) {
+ // DiffElement el = differences2.get(0);
+ // if(el instanceof DiffGroup) {
+ // DiffGroup group = (DiffGroup)el;
+ // if(group.getSubDiffElements().size() == 1 && group.getSubDiffElements().get(0) instanceof DiffGroup) {
+ // group = (DiffGroup)group.getSubDiffElements().get(0);
+ // int i = 0;
+ // i++;
+ //
+ // }
+ // }
+ // }
+ }
+
+ //TODO write a JUnit test to be sue that the method called reflexively is always available
+ private static void fillRequiredDifferences(final DiffModel diff) {
+ if(fillRequiredDifferencesMethod == null) {
+ try {
+ fillRequiredDifferencesMethod = ReflectHelper.getMethod(DiffService.class, "fillRequiredDifferences", new Class<?>[]{ EObject.class });
+ } catch (SecurityException e) {
+ Activator.log.error(e);
+ } catch (NoSuchMethodException e) {
+ Activator.log.error(e);
+ }
+ }
+ final Object[] parameters = new Object[1];
+ parameters[0] = diff;
+ try {
+ fillRequiredDifferencesMethod.invoke(null, parameters);
+ } catch (IllegalArgumentException e) {
+ Activator.log.error(e);
+ } catch (IllegalAccessException e) {
+ Activator.log.error(e);
+ } catch (InvocationTargetException e) {
+ Activator.log.error(e);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneMatchEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneMatchEngine.java new file mode 100644 index 00000000000..47dc6f72308 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.diff/src/org/eclipse/papyrus/uml/compare/diff/services/standalone/UMLStandaloneMatchEngine.java @@ -0,0 +1,21 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ * Adapted code from EMF-Compare
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.diff.services.standalone;
+
+import org.eclipse.emf.compare.uml2.match.UML2MatchEngine;
+
+
+public class UMLStandaloneMatchEngine extends UML2MatchEngine {
+ //nothing to do for the moment
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.classpath new file mode 100644 index 00000000000..2d1a4302f04 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.project new file mode 100644 index 00000000000..1a1ca440bd8 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.compare.file</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/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.settings/org.eclipse.jdt.core.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.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/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..63c4bf73f20 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/META-INF/MANIFEST.MF @@ -0,0 +1,41 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.uml.compare;bundle-version="0.10.0",
+ org.eclipse.emf.compare;bundle-version="1.3.1",
+ org.eclipse.compare;bundle-version="3.5.300",
+ org.eclipse.emf.compare.diff;bundle-version="1.3.1",
+ org.eclipse.emf.compare.ui;bundle-version="1.3.1",
+ org.eclipse.papyrus.infra.emf.compare.ui;bundle-version="0.10.0",
+ org.eclipse.emf.ecore,
+ org.eclipse.core.resources;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf.compare.instance;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf.compare.common;bundle-version="0.10.0",
+ org.eclipse.emf.transaction,
+ org.eclipse.emf.workspace;bundle-version="1.4.0",
+ org.eclipse.emf.workspace.ui,
+ org.eclipse.emf.compare.match;bundle-version="1.3.1",
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.uml.compare.diff;bundle-version="0.10.0",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.uml2.uml.resources;bundle-version="4.0.0",
+ org.eclipse.emf.compare.diff,
+ org.eclipse.papyrus.infra.emf.compare.diff;bundle-version="0.10.0",
+ org.eclipse.emf.compare.uml2,
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0"
+Export-Package: org.eclipse.papyrus.uml.compare.file.editor,
+ org.eclipse.papyrus.uml.compare.file.editor.utils,
+ org.eclipse.papyrus.uml.compare.file.handler
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.compare.file.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.uml.compare.file;singleton:=t
+ rue
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/build.properties new file mode 100644 index 00000000000..db81aec8091 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/build.properties @@ -0,0 +1,10 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ plugin.pdoc,\
+ icons/,\
+ plugin.properties
+src.includes = about.html
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/UMLModelFile.gif b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/UMLModelFile.gif Binary files differnew file mode 100644 index 00000000000..4eb1fb5a8dd --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/UMLModelFile.gif diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_16x16.png b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_16x16.png Binary files differnew file mode 100644 index 00000000000..4e38b20444a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_16x16.png diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_32x32.png b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_32x32.png Binary files differnew file mode 100644 index 00000000000..af0c3a85b54 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_32x32.png diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_editor.gif b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_editor.gif Binary files differnew file mode 100644 index 00000000000..e817df6ff0c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/icons/papyrus_compare_editor.gif diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.pdoc b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.pdoc new file mode 100644 index 00000000000..a24b43ccd76 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.pdoc @@ -0,0 +1,4 @@ +<?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 allows to compare uml file using EMF Facet customization. The merge action is done in a command stack">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.properties new file mode 100644 index 00000000000..c108039a0bc --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.papyrus.uml.compare.file
+providerName = Eclipse Modeling Project
+pluginName = Papyrus Compare UML File (Incubation)
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.xml b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.xml new file mode 100644 index 00000000000..45c5fb6f9ef --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/plugin.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ description="Open the Papyrus Model Compare Editor"
+ id="org.eclipse.papyrus.uml.compare.file.command"
+ name="Papyrus Model Compare Editor">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.uml.compare.file.handler.CompareUMLFileHandler"
+ commandId="org.eclipse.papyrus.uml.compare.file.command">
+ <activeWhen>
+ <and>
+ <with
+ variable="selection">
+ <count
+ value="2">
+ </count>
+ </with>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.uml.compare.file.tester.isSelectionForUMLCompareFile"
+ value="true">
+ </test>
+ </and>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="popup:org.eclipse.ui.popup.any">
+ <command
+ commandId="org.eclipse.papyrus.uml.compare.file.command"
+ icon="icons/papyrus_compare_16x16.png"
+ style="push"
+ tooltip="Compare Models synchronizing models and views">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.papyrus.uml.compare.file.editor.CompareUMLFileEditor"
+ contributorClass="org.eclipse.papyrus.uml.compare.file.editor.PapyrusActionBar"
+ default="false"
+ icon="icons/papyrus_compare_16x16.png"
+ id="org.eclipse.papyrus.uml.compare.file.editor"
+ name="Papyrus Model Compare Editor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.eclipse.papyrus.uml.compare.uml.file"
+ objectClass="org.eclipse.core.resources.IResource">
+ <action
+ class="org.eclipse.papyrus.uml.compare.file.handler.CompareUMLFileHandler"
+ definitionId="org.eclipse.papyrus.uml.compare.file.command"
+ enablesFor="2"
+ icon="icons/papyrus_compare_16x16.png"
+ id="org.eclipse.papyrus.uml.compare.file"
+ label="Model Each Other"
+ menubarPath="compareWithMenu/compareWithGroup"
+ tooltip="Open the Papyrus Model Compare Editor">
+ <enablement>
+ <and>
+ <objectClass
+ name="org.eclipse.core.resources.IFile">
+ </objectClass>
+ </and></enablement>
+ </action>
+ </objectContribution>
+ </extension>
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.papyrus.uml.compare.file.tester.CompareUMLFileTester"
+ id="org.eclipse.papyrus.uml.compare.file.tester"
+ namespace="org.eclipse.papyrus.uml.compare.file.tester"
+ properties="isSelectionForUMLCompareFile"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
+ </extension>
+
+</plugin>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/Activator.java new file mode 100644 index 00000000000..75b57a74f8c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/Activator.java @@ -0,0 +1,69 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.file;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.compare.file"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * 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;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (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;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/CompareUMLFileEditor.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/CompareUMLFileEditor.java new file mode 100644 index 00000000000..6bec7308fd5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/CompareUMLFileEditor.java @@ -0,0 +1,370 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.file.editor;
+
+import static org.eclipse.papyrus.infra.core.Activator.log;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.compare.CompareConfiguration;
+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.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.CommandStack;
+import org.eclipse.emf.common.util.URI;
+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.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.match.engine.IMatchEngine;
+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.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.IWorkspaceCommandStack;
+import org.eclipse.emf.workspace.ResourceUndoContext;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.papyrus.infra.core.resource.ModelMultiException;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServiceMultiException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.compare.common.editor.AbstractPapyrusCompareEditor;
+import org.eclipse.papyrus.infra.emf.compare.common.utils.PapyrusModelCompareEditorInput;
+import org.eclipse.papyrus.infra.emf.compare.diff.utils.PapyrusCompareOptions;
+import org.eclipse.papyrus.uml.compare.diff.services.UMLDiffService;
+import org.eclipse.papyrus.uml.compare.diff.services.standalone.StandaloneMergeUtils;
+import org.eclipse.papyrus.uml.compare.diff.services.standalone.UMLStandaloneMatchEngine;
+import org.eclipse.papyrus.uml.compare.file.Activator;
+import org.eclipse.papyrus.uml.compare.file.editor.utils.ServicesRegistryUtils;
+import org.eclipse.papyrus.uml.compare.file.handler.CompareUMLFileInput;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.uml2.common.util.UML2Util;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.UMLPackage;
+
+//import org.eclipse.uml2.uml.utils.UMLUtil;
+
+public class CompareUMLFileEditor extends /* EMFCompareEditor */AbstractPapyrusCompareEditor {//extends CompareEditor{
+
+ /** the id of this editor (declared in the plugin.xml */
+ public static final String COMPARE_UML_FILE_EDITOR_ID = "org.eclipse.papyrus.uml.compare.file.editor"; //$NON-NLS-1$
+
+ private final TransactionalEditingDomain editingDomain;
+
+ private ModelSet set;
+
+ private final ObjectUndoContext undoContext;
+
+ private final IOperationHistoryListener historyListener;
+
+ /** the compared root object */
+ private EObject roots[];
+
+
+ //always null, maybe, excepted when we are in the init method
+ private CompareUMLFileInput tmpInput;
+
+ private ServicesRegistry servicesRegistry;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CompareUMLFileEditor() {
+ super();
+ roots = new EObject[2];
+ this.servicesRegistry = getServicesRegistry();
+ try {
+ set = servicesRegistry.getService(ModelSet.class);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+
+ this.editingDomain = set.getTransactionalEditingDomain();
+ undoContext = new ObjectUndoContext(this, "PayrusUMLFileCompareUndoContext"); //$NON-NLS-1$
+ historyListener = new IOperationHistoryListener() {
+
+ public void historyNotification(final OperationHistoryEvent event) {
+ if(event.getEventType() == OperationHistoryEvent.DONE) {
+ Set<Resource> affectedResources = ResourceUndoContext.getAffectedResources(event.getOperation());
+ if(isConcerned(Collections.unmodifiableSet(affectedResources))) {
+ final IUndoableOperation operation = event.getOperation();
+
+ // remove the default undo context so that we can have
+ // independent undo/redo of independent resource changes
+ operation.removeContext(((IWorkspaceCommandStack)getEditingDomain().getCommandStack()).getDefaultUndoContext());
+
+ // add our undo context to populate our undo menu
+ operation.addContext(undoContext);
+
+ getSite().getShell().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ // dirty = true;
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ // TODO?
+ // Try to select the affected objects.
+ //
+ // if (operation instanceof EMFCommandOperation) {
+ // Command command = ((EMFCommandOperation) operation).getCommand();
+ //
+ // if (command != null) {
+ // setSelectionToViewer(command
+ // .getAffectedObjects());
+ // }
+ // }
+ //
+ // if (propertySheetPage != null) {
+ // propertySheetPage.refresh();
+ // }
+ }
+ });
+ }
+ }
+ }
+ };
+ getOperationHistory().addOperationHistoryListener(historyListener);
+ addUndoRedoListeners();
+ }
+
+
+
+ @Override
+ public void doSave(final IProgressMonitor progressMonitor) {
+ super.doSave(progressMonitor);
+ }
+
+ private boolean isConcerned(final Set affectedResources) {
+ Iterator<?> iter = affectedResources.iterator();
+ while(iter.hasNext()) {
+ if(this.set.getResources().contains(iter.next())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private IOperationHistory getOperationHistory() {
+ if(editingDomain != null) {
+ CommandStack commandStack = editingDomain.getCommandStack();
+ if(commandStack instanceof IWorkspaceCommandStack) {
+ return ((IWorkspaceCommandStack)commandStack).getOperationHistory();
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
+
+ if(input instanceof CompareUMLFileInput) {
+ this.tmpInput = (CompareUMLFileInput)input;
+ final List<IFile> files = ((CompareUMLFileInput)input).getComparedFiles();
+ for(int i = 0; i < files.size(); i++) {
+ final IFile current = files.get(i);
+ try {
+ set.loadModels(current);
+ final String filePath = current.getFullPath().toString();
+ URI uri = URI.createPlatformResourceURI(filePath, false);
+ Package root = UML2Util.load(set, uri, UMLPackage.Literals.PACKAGE);
+ Assert.isNotNull(root, "The root of the model is null");
+ roots[i] = root;
+ } catch (ModelMultiException e1) {
+ Activator.log.error(NLS.bind("Problem for loading the file {0}", current), e1);
+ }
+ }
+
+ ModelCompareEditorInput newInput = getCompareInput(roots[0], roots[1]);
+ this.tmpInput = null;
+ super.init(site, newInput);
+ } else {
+ super.init(site, input);
+ }
+ }
+
+ @Override
+ protected ModelCompareEditorInput createModelCompareEditorInput(final ComparisonSnapshot snapshot) {
+ return new PapyrusModelCompareEditorInput(snapshot, this) {
+
+ @Override
+ public Image getTitleImage() {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/papyrus_compare_editor.gif").createImage();
+ }
+
+ protected ModelCompareInput createModelCompareInput(final ComparisonSnapshot snap) {
+ if(snap instanceof ComparisonResourceSetSnapshot) {
+ return new PapyrusModelCompareInput(((ComparisonResourceSetSnapshot)snap).getMatchResourceSet(), ((ComparisonResourceSetSnapshot)snap).getDiffResourceSet(), editingDomain);
+ }
+ return new PapyrusModelCompareInput(((ComparisonResourceSnapshot)snap).getMatch(), ((ComparisonResourceSnapshot)snap).getDiff(), editingDomain);
+ }
+ };
+ }
+
+ @Override
+ protected void configureInput(final PapyrusModelCompareEditorInput input) {
+ if(this.tmpInput != null) {//null, when are in the Undo/Redo
+ String leftLabel = this.tmpInput.getComparedFiles().get(0).getFullPath().makeRelative().toString();;
+ String rightLabel = this.tmpInput.getComparedFiles().get(1).getFullPath().makeRelative().toString();;
+ Image im = AbstractUIPlugin.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/UMLModelFile.gif").createImage();
+ input.initLabels(leftLabel, im, rightLabel, im);
+ }
+
+
+ final CompareConfiguration cc = input.getCompareConfiguration();
+
+ //configure with the options
+ final Map<String, Object> options = getCompareOptions(null, null, null);//we are looking for the merge options
+ final Boolean leftToRight = (Boolean)options.get(PapyrusCompareOptions.KEY_ALLOW_MERGE_LEFT_TO_RIGHT);
+ final Boolean rightToLeft = (Boolean)options.get(PapyrusCompareOptions.KEY_ALLOW_MERGE_RIGHT_TO_LEFT);
+ if(rightToLeft != null) {
+ cc.setLeftEditable(rightToLeft);
+ }
+ if(leftToRight != null) {
+ cc.setRightEditable(leftToRight);
+ }
+ }
+
+ @Override
+ public Object getAdapter(final Class adapter) {
+ if(adapter.equals(IUndoContext.class)) {
+ // used by undo/redo actions to get their undo context
+ return undoContext;
+ } else if(adapter.equals(TransactionalEditingDomain.class)) {
+ try {
+ this.servicesRegistry.getService(adapter);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+ }
+ return super.getAdapter(adapter);
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.emf.edit.domain.IEditingDomainProvider#getEditingDomain()
+ *
+ * @return
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ return this.editingDomain;
+ }
+
+ @Override
+ public void dispose() {
+ getOperationHistory().removeOperationHistoryListener(historyListener);
+ removeUndoRedoListener();
+ if(this.servicesRegistry != null) {
+ try {
+ this.servicesRegistry.disposeRegistry();
+ } catch (ServiceMultiException e) {
+ log.error(e);
+ }
+ }
+
+ super.dispose();
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.common.editor.AbstractPapyrusCompareEditor#getIOperationHistory()
+ *
+ * @return
+ */
+ @Override
+ protected IOperationHistory getIOperationHistory() {
+ return getOperationHistory();
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.common.editor.AbstractPapyrusCompareEditor#resetInput()
+ *
+ */
+ @Override
+ protected void resetInput() {
+ IEditorInput input = getEditorInput();
+ assert (input instanceof PapyrusModelCompareEditorInput);
+ final TreeViewer viewer = ((PapyrusModelCompareEditorInput)input).getStructureMergeViewer();
+ final PapyrusModelCompareEditorInput newInput = (PapyrusModelCompareEditorInput)getCompareInput(roots[0], roots[1]);
+ final ModelCompareInput input2 = newInput.getpreparedModelCompareInput();
+ viewer.setInput(input2);
+ }
+
+ /**
+ * Returns the service registry associated to the editor.
+ *
+ * @return the servicesRegistry The registry.
+ */
+ public ServicesRegistry getServicesRegistry() {
+ if(servicesRegistry == null) {
+ servicesRegistry = ServicesRegistryUtils.createAndInitServiceRegistryForUMLCompareFile();
+ }
+ return servicesRegistry;
+ }
+
+ @Override
+ protected DiffModel doDiff(final MatchModel match, final Map<String, Object> options) {
+ return UMLDiffService.doDiff(match, false, options);
+ }
+
+ /**
+ *
+ * @param left
+ * @param right
+ * @param options
+ * @see org.eclipse.papyrus.infra.emf.compare.common.editor.AbstractPapyrusCompareEditor#doMatch(IProgressMonitor, org.eclipse.emf.ecore.EObject,
+ * org.eclipse.emf.ecore.EObject, java.util.Map)
+ *
+ * @return
+ * @throws InterruptedException
+ */
+ @Override
+ protected MatchModel doMatch(IProgressMonitor monitor, EObject left, EObject right, Map<String, Object> options) throws InterruptedException {
+ //TODO create your own MatchService
+ // return MatchService.doResourceMatch(left.eResource(), right.eResource(), options);
+ IMatchEngine engine = (IMatchEngine)new UMLStandaloneMatchEngine();
+ // return engine.contentMatch(left, right, StandaloneMergeUtils.getMergeOptions(monitor, left, right));
+ return engine.resourceMatch(left.eResource(), right.eResource(), options);
+ }
+
+ @Override
+ protected Map<String, Object> getCompareOptions(final IProgressMonitor monitor, final EObject left, final EObject right) {
+ return StandaloneMergeUtils.getMergeOptions(monitor, left, right);
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/PapyrusActionBar.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/PapyrusActionBar.java new file mode 100644 index 00000000000..2a4dd3be837 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/PapyrusActionBar.java @@ -0,0 +1,40 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.file.editor;
+
+import org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor;
+import org.eclipse.emf.workspace.ui.actions.RedoActionWrapper;
+import org.eclipse.emf.workspace.ui.actions.UndoActionWrapper;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+
+public class PapyrusActionBar extends EditingDomainActionBarContributor {
+
+ public void init(IActionBars actionBars) {
+ super.init(actionBars);
+
+ ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
+
+ // override the superclass implementation of these actions
+ undoAction = new UndoActionWrapper();
+ undoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO));
+ actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
+
+ redoAction = new RedoActionWrapper();
+ redoAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
+ actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/PapyrusModelCompareInput.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/PapyrusModelCompareInput.java new file mode 100644 index 00000000000..280d64f3ff3 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/PapyrusModelCompareInput.java @@ -0,0 +1,87 @@ +package org.eclipse.papyrus.uml.compare.file.editor;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSetSnapshot;
+import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSnapshot;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.DiffResourceSet;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.compare.match.metamodel.MatchResourceSet;
+import org.eclipse.emf.compare.ui.ICompareInputDetailsProvider;
+import org.eclipse.emf.compare.ui.ModelCompareInput;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeService;
+
+/**
+ *
+ * This input allows to use the Papyrus TransactionalMergeService
+ *
+ */
+public class PapyrusModelCompareInput extends ModelCompareInput {
+
+ private final TransactionalEditingDomain domain;
+
+ public PapyrusModelCompareInput(MatchResourceSet matchResourceSet, DiffResourceSet diffResourceSet, TransactionalEditingDomain domain) {
+ super(matchResourceSet, diffResourceSet);
+ this.domain = domain;
+ }
+
+ public PapyrusModelCompareInput(ComparisonResourceSetSnapshot snapshot, TransactionalEditingDomain domain) {
+ super(snapshot);
+ this.domain = domain;
+ }
+
+ public PapyrusModelCompareInput(ComparisonResourceSnapshot snapshot, TransactionalEditingDomain domain) {
+ super(snapshot);
+ this.domain = domain;
+ }
+
+ public PapyrusModelCompareInput(MatchModel matchModel, DiffModel diffModel, ICompareInputDetailsProvider provider, TransactionalEditingDomain domain) {
+ super(matchModel, diffModel, provider);
+ this.domain = domain;
+ }
+
+ public PapyrusModelCompareInput(MatchResourceSet matchResourceset, DiffResourceSet diffResourceSet, ICompareInputDetailsProvider provider, TransactionalEditingDomain domain) {
+ super(matchResourceset, diffResourceSet, provider);
+ this.domain = domain;
+ }
+
+ public PapyrusModelCompareInput(MatchModel match, DiffModel diff, TransactionalEditingDomain domain) {
+ super(match, diff);
+ this.domain = domain;
+ }
+
+ /**
+ * Applies the changes implied by a given {@link DiffElement} in the
+ * direction specified by <code>leftToRight</code>.
+ *
+ * @param element
+ * {@link DiffElement} containing the copy information.
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left
+ * to the right model, <code>False</code> otherwise.
+ */
+ protected void doCopy(DiffElement element, boolean leftToRight) {
+ Command cmd = TransactionalMergeService.getMergeCommand(domain, element, leftToRight);
+ domain.getCommandStack().execute(cmd);
+ }
+
+ /**
+ * Applies the changes implied by a list of {@link DiffElement} in the
+ * direction specified by <code>leftToRight</code>.
+ *
+ * @param elements
+ * {@link DiffElement}s containing the copy information.
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left
+ * to the right model, <code>False</code> otherwise.
+ */
+ protected void doCopy(List<DiffElement> elements, boolean leftToRight) {
+ Command cmd = TransactionalMergeService.getMergeCommand(domain, elements, leftToRight);
+ domain.getCommandStack().execute(cmd);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/utils/ServicesRegistryUtils.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/utils/ServicesRegistryUtils.java new file mode 100644 index 00000000000..66240785aaf --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/editor/utils/ServicesRegistryUtils.java @@ -0,0 +1,37 @@ +package org.eclipse.papyrus.uml.compare.file.editor.utils;
+
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.uml.compare.file.Activator;
+
+
+public class ServicesRegistryUtils {
+
+
+ private ServicesRegistryUtils() {
+ //to prevent instanciation
+ }
+
+ public static ServicesRegistry createAndInitServiceRegistryForUMLCompareFile() {
+ ServicesRegistry servicesRegistry = null;
+ // Create Services Registry
+ try {
+ servicesRegistry = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
+ // Start the ModelSet first, and load if from the specified File
+ List<Class<?>> servicesToStart = new ArrayList<Class<?>>(1);
+ servicesToStart.add(ModelSet.class);
+ servicesRegistry.startServicesByClassKeys(servicesToStart);
+ } catch (ServiceException e) {
+ // Show log and error
+ Activator.log.error(e.getMessage(), e);
+ }
+ return servicesRegistry;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/CompareUMLFileHandler.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/CompareUMLFileHandler.java new file mode 100644 index 00000000000..27292f50610 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/CompareUMLFileHandler.java @@ -0,0 +1,143 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.file.handler;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.uml.compare.file.Activator;
+import org.eclipse.papyrus.uml.compare.file.editor.CompareUMLFileEditor;
+import org.eclipse.papyrus.uml.compare.file.messages.Messages;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ *
+ * The handler which allows to open the PapyrusUMLFileCompareEditor
+ *
+ */
+public class CompareUMLFileHandler extends AbstractHandler implements IObjectActionDelegate {
+
+ /** The uml file extension */
+ public static final String UML_EXTENSION = "uml"; //$NON-NLS-1$
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ List<IFile> selectedFiles = getSelection();
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorInput input = new CompareUMLFileInput(selectedFiles);//.get(0), selectedFiles.get(1));
+ try {
+ //we open the compare editor
+ page.openEditor(input, CompareUMLFileEditor.COMPARE_UML_FILE_EDITOR_ID, true);
+ } catch (PartInitException e) {
+ Activator.log.error(Messages.CompareUMLFileHandler_ICantOpenThePapyrusCompareEdito, e);
+ }
+ return null;
+ }
+
+
+ /**
+ *
+ * @return
+ * a list owning the selected files
+ */
+ protected List<IFile> getSelection() {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ List<IFile> currentSelection = new ArrayList<IFile>();
+ Iterator<?> iter = ((IStructuredSelection)selection).iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IAdaptable) {
+ IFile file = (IFile)((IAdaptable)current).getAdapter(IFile.class);
+ if(file != null) {
+ currentSelection.add(file);
+ }
+ }
+ }
+ return currentSelection;
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
+ *
+ * @return
+ */
+ @Override
+ public boolean isEnabled() {
+ List<?> selectedElement = getSelection();
+ if(selectedElement.size() != 2) {
+ return false;
+ }
+ Iterator<?> iter = selectedElement.iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IFile) {
+ String extension = ((IFile)current).getFileExtension();
+ if(!extension.equals(UML_EXTENSION)) {
+ return false;
+ }
+ }
+ }
+ return super.isEnabled();
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ *
+ * @param action
+ */
+ public void run(IAction action) {
+ if(isEnabled()) {
+ try {
+ execute(new ExecutionEvent());
+ } catch (ExecutionException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ //nothing to do
+
+ }
+
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ //nothing to do
+ }
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/CompareUMLFileInput.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/CompareUMLFileInput.java new file mode 100644 index 00000000000..3ac32dd5bd5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/CompareUMLFileInput.java @@ -0,0 +1,121 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.file.handler;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.papyrus.uml.compare.file.messages.Messages;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ *
+ * This input is used for the Papyrus CompareUMLFileEditor
+ *
+ */
+public class CompareUMLFileInput implements ICompareUMLFileInput {
+
+ /**
+ * The files to compare
+ */
+ private final List<IFile> files;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param files
+ * the files to compare
+ */
+ public CompareUMLFileInput(final List<IFile> files) {
+ this.files = files;
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IEditorInput#exists()
+ *
+ * @return
+ */
+ public boolean exists() {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IEditorInput#getImageDescriptor()
+ *
+ * @return
+ */
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IEditorInput#getName()
+ *
+ * @return
+ */
+ public String getName() {
+ return Messages.CompareUMLFileInput_PapyrusCompareUMLFileEditorInput;
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IEditorInput#getPersistable()
+ *
+ * @return
+ */
+ public IPersistableElement getPersistable() {
+ //throw new UnsupportedOperationException();
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.ui.IEditorInput#getToolTipText()
+ *
+ * @return
+ */
+ public String getToolTipText() {
+ return getName();
+ }
+
+ /**
+ *
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ *
+ * @param adapter
+ * @return
+ */
+ public Object getAdapter(Class adapter) {
+ return null;
+// throw new UnsupportedOperationException();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.uml.compare.file.handler.ICompareUMLFileInput#getComparedFiles()
+ *
+ * @return
+ */
+ public List<IFile> getComparedFiles() {
+ return this.files;
+ }
+
+
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/ICompareUMLFileInput.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/ICompareUMLFileInput.java new file mode 100644 index 00000000000..7e780912de8 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/handler/ICompareUMLFileInput.java @@ -0,0 +1,26 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.file.handler;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IEditorInput;
+
+
+public interface ICompareUMLFileInput extends IEditorInput {
+
+ public List<IFile> getComparedFiles();
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/messages/Messages.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/messages/Messages.java new file mode 100644 index 00000000000..0f64a0547be --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/messages/Messages.java @@ -0,0 +1,34 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.file.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.compare.file.editor.messages.messages"; //$NON-NLS-1$
+
+ public static String CompareUMLFileEditor_ICantLoadTheModel;
+
+ public static String CompareUMLFileHandler_ICantOpenThePapyrusCompareEdito;
+
+ public static String CompareUMLFileInput_PapyrusCompareUMLFileEditorInput;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/messages/messages.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/messages/messages.properties new file mode 100644 index 00000000000..6108b2edbe7 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/messages/messages.properties @@ -0,0 +1,3 @@ +CompareUMLFileEditor_ICantLoadTheModel=I can't load the model {0}
+CompareUMLFileHandler_ICantOpenThePapyrusCompareEdito=I can't open the Papyrus Compare Editor
+CompareUMLFileInput_PapyrusCompareUMLFileEditorInput=Papyrus Compare UML File Editor Input
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/tester/CompareUMLFileTester.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/tester/CompareUMLFileTester.java new file mode 100644 index 00000000000..a2b0dfe1417 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare.file/src/org/eclipse/papyrus/uml/compare/file/tester/CompareUMLFileTester.java @@ -0,0 +1,65 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.file.tester;
+
+import java.util.Iterator;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+/**
+ *
+ * A property tester for UMLCompareFile
+ *
+ */
+public class CompareUMLFileTester extends PropertyTester {
+
+ /** property to test if the selected element are uml files */
+ public static final String IS_SELECTION_FOR_UML_COMPARE_FILE = "isSelectionForUMLCompareFile"; //$NON-NLS-1$
+
+ /**
+ *
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ *
+ * @param receiver
+ * @param property
+ * @param args
+ * @param expectedValue
+ * @return
+ */
+ public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
+ boolean returnValue = true;
+ if(IS_SELECTION_FOR_UML_COMPARE_FILE.equals(property) && receiver instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection)receiver;
+ if(selection.size() == 2) {
+ Iterator<?> iter = selection.iterator();
+ while(iter.hasNext() && returnValue) {
+ Object current = iter.next();
+ if(!(current instanceof IFile)) {
+ returnValue = false;
+ } else {
+ final IFile file = (IFile)current;
+ returnValue = file.getFileExtension().equals("uml");
+ }
+ }
+ } else {
+ returnValue = false;
+ }
+ } else {
+ returnValue = false;
+ }
+ return returnValue;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.classpath b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.classpath new file mode 100644 index 00000000000..6b1d83e2207 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry excluding="org/eclipse/papyrus/uml/compare/tatiana/PapyrusDiffEngine.java|org/eclipse/papyrus/uml/compare/tatiana/PapyrusMatchEngine.java|org/eclipse/papyrus/uml/compare/tatiana/ElementContentDiffEngine.java|org/eclipse/papyrus/uml/compare/tatiana/ElementContentMatchEngine.java" kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.project b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.project new file mode 100644 index 00000000000..ef210cd5556 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.uml.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/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.settings/org.eclipse.jdt.core.prefs b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..44217f8c068 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.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/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/META-INF/MANIFEST.MF b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..0f1411df304 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/META-INF/MANIFEST.MF @@ -0,0 +1,37 @@ +Manifest-Version: 1.0
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf.compare.common;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf.compare.instance;bundle-version="0.10.0",
+ org.eclipse.uml2.uml;bundle-version="4.0.0",
+ org.eclipse.compare;bundle-version="3.5.300",
+ org.eclipse.emf.compare.diff;bundle-version="1.3.1",
+ org.eclipse.papyrus.infra.emf.compare.ui;bundle-version="0.10.0",
+ org.eclipse.emf.compare.ui;bundle-version="1.3.1",
+ org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.2.0",
+ org.eclipse.emf.compare;bundle-version="1.3.1",
+ org.eclipse.emf.compare.match;bundle-version="1.3.1",
+ org.eclipse.papyrus.infra.tools;bundle-version="0.10.0",
+ org.eclipse.emf.transaction,
+ org.eclipse.papyrus.uml.compare.diff;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf.compare.diff;bundle-version="0.10.0",
+ org.eclipse.core.expressions,
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.0",
+ org.eclipse.emf.edit.ui;bundle-version="2.8.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0"
+Export-Package: org.eclipse.papyrus.uml.compare.editor,
+ org.eclipse.papyrus.uml.compare.internal.handler
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.10.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.uml.compare.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.uml.compare;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/about.html b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/about.html new file mode 100644 index 00000000000..82d49bf5f81 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). 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, "Program" 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 ("Redistributor") 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/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/build.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/build.properties new file mode 100644 index 00000000000..75d692705a5 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/build.properties @@ -0,0 +1,11 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.pdoc,\
+ icons/,\
+ build.properties,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_16x16.png b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_16x16.png Binary files differnew file mode 100644 index 00000000000..4e38b20444a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_16x16.png diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_32x32.png b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_32x32.png Binary files differnew file mode 100644 index 00000000000..af0c3a85b54 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_32x32.png diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_editor.gif b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_editor.gif Binary files differnew file mode 100644 index 00000000000..e817df6ff0c --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/icons/papyrus_compare_editor.gif diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.pdoc b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.pdoc new file mode 100644 index 00000000000..5c9b957330e --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.pdoc @@ -0,0 +1,4 @@ +<?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 a UML Compare Editor for Papyrus. This CompareEditor is done
to be opened in the sasheditor as the others papyrus editors (diagram and table)
This editor is "partially volatile", that is to say, we lose all its information when we close it, 
but we don't lose it when we close Papyrus or Eclipse (see bug 371606)
">
+ <referent firstName="vincent" lastName="lorenzo" eMail="vincent.lorenzo@cea.fr" currentCompany="CEA-LIST"/>
+</doc:Documentation>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.properties b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.properties new file mode 100644 index 00000000000..a1f9b656864 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.properties @@ -0,0 +1,3 @@ +#Properties file for org.eclipse.papyrus.uml.compare
+providerName = Eclipse Modeling Project
+pluginName = Papyrus UML Compare Editor (Incubation)
\ No newline at end of file diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.xml b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.xml new file mode 100644 index 00000000000..a93fcd6f6de --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/plugin.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.core.papyrusDiagram">
+ <editorDiagram
+ factoryClass="org.eclipse.papyrus.uml.compare.factory.UMLCompareEditorFactory"
+ icon="icons/papyrus_compare_16x16.png">
+ </editorDiagram>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.papyrus.editor.category"
+ description="Create a UML Compare Editor"
+ id="org.eclipse.papyrus.uml.compare.command"
+ name="UML Compare Editor">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.papyrus.uml.compare.internal.handler.UMLCompareEditorHandler"
+ commandId="org.eclipse.papyrus.uml.compare.command">
+ <activeWhen>
+ <and>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </and>
+ </activeWhen>
+ </handler>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.eclipse.ui.popup.any">
+ <command
+ commandId="org.eclipse.papyrus.uml.compare.command"
+ icon="icons/papyrus_compare_16x16.png"
+ label="Compare 2 UML Elements"
+ style="push"
+ tooltip="Compare 2 UML Elements">
+ <visibleWhen
+ checkEnabled="true">
+ <or>
+ <and>
+ <with
+ variable="selection">
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <adapt
+ type="org.eclipse.emf.ecore.EObject">
+ </adapt>
+ </iterate>
+ </with>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </and>
+ </or>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ </extension>
+
+</plugin>
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/Activator.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/Activator.java new file mode 100644 index 00000000000..133ba809d72 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/Activator.java @@ -0,0 +1,69 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.compare"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** the Papyrus log helper */
+ public static LogHelper log;
+
+ /**
+ * 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;
+ }
+
+ /*
+ * (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;
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLModelContentMergeDiffTab.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLModelContentMergeDiffTab.java new file mode 100644 index 00000000000..d2f83ef8be0 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLModelContentMergeDiffTab.java @@ -0,0 +1,26 @@ +package org.eclipse.papyrus.uml.compare.content.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.papyrus.uml.compare.utils.RootObject;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class UMLModelContentMergeDiffTab extends ModelContentMergeDiffTab {
+
+ public UMLModelContentMergeDiffTab(final Composite parentComposite, final int side, final ModelContentMergeTabFolder parentFolder) {
+ super(parentComposite, side, parentFolder);
+ }
+
+ @Override
+ public void setReflectiveInput(final Object object) {
+ if(object instanceof RootObject) {
+ clearCaches();
+ setInput(object);
+ setupCaches();
+ needsRedraw = true;
+ } else {
+ super.setReflectiveInput(object);
+ }
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLModelContentMergeTabFolder.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLModelContentMergeTabFolder.java new file mode 100644 index 00000000000..07d1b381e25 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLModelContentMergeTabFolder.java @@ -0,0 +1,52 @@ +package org.eclipse.papyrus.uml.compare.content.viewer;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
+import org.eclipse.emf.compare.ui.viewer.content.part.IModelContentMergeViewerTab;
+import org.eclipse.emf.compare.util.AdapterUtils;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.papyrus.infra.emf.compare.ui.content.viewer.PapyrusModelContentMergeTabFolder;
+import org.eclipse.papyrus.uml.compare.utils.RootObject;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class UMLModelContentMergeTabFolder extends PapyrusModelContentMergeTabFolder {
+
+ public UMLModelContentMergeTabFolder(ModelContentMergeViewer viewer, Composite composite, int side) {
+ super(viewer, composite, side);
+ }
+
+ /**
+ *
+ * @returnZ
+ */
+ protected IContentProvider createDiffTabContentProvider() {
+ return new UMLModelContentMergeDiffTabContentProvider(AdapterUtils.getAdapterFactory());
+ }
+
+
+ @Override
+ protected IModelContentMergeViewerTab createModelContentMergeDiffTab(Composite parent) {
+ diffTab = new UMLModelContentMergeDiffTab(parent, partSide, this);
+ diffTab.setContentProvider(createDiffTabContentProvider());
+ return diffTab;
+ }
+
+ public class UMLModelContentMergeDiffTabContentProvider extends ModelContentMergeDiffTabContentProvider {
+
+ public UMLModelContentMergeDiffTabContentProvider(AdapterFactory factory) {
+ super(factory);
+ }
+
+ @Override
+ public Object[] getElements(Object object) {
+ if(object instanceof RootObject) {
+ Object[] result = new Object[1];
+ result[0] = ((RootObject)object).getRepresentedObject();
+ return result;
+ }
+ return super.getElements(object);
+ }
+
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLTransactionalModelContentMergeViewer.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLTransactionalModelContentMergeViewer.java new file mode 100644 index 00000000000..e9a087b2d8a --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/content/viewer/UMLTransactionalModelContentMergeViewer.java @@ -0,0 +1,58 @@ +package org.eclipse.papyrus.uml.compare.content.viewer;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider;
+import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeContentProvider;
+import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder;
+import org.eclipse.papyrus.infra.emf.compare.ui.content.transactional.viewer.PapyrusTransactionalModelContentMergeViewer;
+import org.eclipse.papyrus.uml.compare.utils.RootObject;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorPart;
+
+
+public class UMLTransactionalModelContentMergeViewer extends PapyrusTransactionalModelContentMergeViewer {
+
+
+ public UMLTransactionalModelContentMergeViewer(final Composite parent, final CompareConfiguration config, final IEditorPart editor) {
+ super(parent, config, editor);
+ }
+
+
+
+ @Override
+ protected IMergeViewerContentProvider createMergeViewerContentProvider() {
+ return new ModelContentMergeContentProvider(configuration) {
+
+ @Override
+ public Object getLeftContent(final Object element) {
+ if(element != null) {
+ return new RootObject(configuration.getProperty(RootObject.LEFT_OBJECT_KEY));
+ }
+ return null;
+ }
+
+ @Override
+ public Object getRightContent(final Object element) {
+ if(element != null) {
+ return new RootObject(configuration.getProperty(RootObject.RIGHT_OBJECT_KEY));
+ }
+ return null;
+ }
+ };
+
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ *
+ * @param composite
+ * @param side
+ * @return
+ */
+ @Override
+ protected ModelContentMergeTabFolder createModelContentMergeTabFolder(final Composite composite, final int side) {
+ return new UMLModelContentMergeTabFolder(this, composite, side);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/editor/UMLCompareEditor.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/editor/UMLCompareEditor.java new file mode 100644 index 00000000000..4f77debcd2f --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/editor/UMLCompareEditor.java @@ -0,0 +1,126 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.editor;
+
+import java.util.Map;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.emf.compare.common.editor.EMFCompareEditor;
+import org.eclipse.papyrus.infra.emf.compare.common.utils.PapyrusModelCompareEditorInput;
+import org.eclipse.papyrus.infra.emf.compare.diff.utils.PapyrusCompareOptions;
+import org.eclipse.papyrus.infra.emf.compare.instance.papyrusemfcompareinstance.PapyrusEMFCompareInstance;
+import org.eclipse.papyrus.uml.compare.diff.services.UMLDiffService;
+import org.eclipse.papyrus.uml.compare.diff.services.nested.NestedMatchService;
+import org.eclipse.papyrus.uml.compare.diff.services.nested.NestedMergeUtils;
+import org.eclipse.papyrus.uml.compare.utils.RootObject;
+import org.eclipse.papyrus.uml.compare.utils.UMLModelCompareEditorInput;
+import org.eclipse.uml2.uml.NamedElement;
+
+
+
+public class UMLCompareEditor extends EMFCompareEditor {
+
+ /** the type of the editor */
+ public static final String EDITOR_TYPE = "PapyrusUMLCompare"; //$NON-NLS-1$
+
+ /**
+ * @param servicesRegistry
+ * @param rawModel
+ *
+ */
+ public UMLCompareEditor(final ServicesRegistry servicesRegistry, final PapyrusEMFCompareInstance rawModel) {
+ super(servicesRegistry, rawModel);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.common.editor.AbstractPapyrusCompareEditor#getCompareOptions(org.eclipse.core.runtime.IProgressMonitor,
+ * org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)
+ *
+ * @param monitor
+ * @param leftObject
+ * @param rightObject
+ * @return
+ */
+ @Override
+ protected Map<String, Object> getCompareOptions(final IProgressMonitor monitor, final EObject leftObject, final EObject rightObject) {
+ return NestedMergeUtils.getMergeOptions(monitor, leftObject, rightObject);
+ }
+
+ @Override
+ protected MatchModel doMatch(IProgressMonitor monitor, final EObject left, final EObject right, final Map<String, Object> options) throws InterruptedException {
+ return NestedMatchService.doContentMatch(left, right, options);
+ }
+
+ /**
+ * A part of this method is duplicated from DiffService#doDiff
+ *
+ * @param match
+ * @return
+ */
+ @Override
+ protected DiffModel doDiff(final MatchModel match, final Map<String, Object> options) {
+ return UMLDiffService.doDiff(match, false, options);
+ }
+
+
+ @Override
+ protected ModelCompareEditorInput createModelCompareEditorInput(final ComparisonSnapshot snapshot) {
+ return new UMLModelCompareEditorInput(snapshot, this);
+ }
+
+ @Override
+ protected void configureInput(final PapyrusModelCompareEditorInput input) {
+
+ //TODO : warning if we use a label provider, warning to the stereotype use
+ CompareConfiguration cc = input.getCompareConfiguration();
+ ILabelProvider prov = getLabelProvider();
+ String leftQName = null;
+ String rightQName = null;
+ final EObject left = this.rawModel.getLeft();
+ if(left instanceof NamedElement) {
+ leftQName = ((NamedElement)left).getQualifiedName();
+ }
+ final EObject right = this.rawModel.getRight();
+ if(right instanceof NamedElement) {
+ rightQName = ((NamedElement)right).getQualifiedName();
+ }
+
+ cc.setLeftLabel(leftQName);
+ cc.setRightLabel(rightQName);
+ cc.setLeftImage(prov.getImage(left));
+ cc.setRightImage(prov.getImage(right));
+ cc.setProperty(RootObject.LEFT_OBJECT_KEY, rawModel.getLeft());
+ cc.setProperty(RootObject.RIGHT_OBJECT_KEY, rawModel.getRight());
+
+ //configure the merge options
+ final Map<String, Object> options = getCompareOptions(null, left, right);//we are looking for the merge options
+ final Boolean leftToRight = (Boolean)options.get(PapyrusCompareOptions.KEY_ALLOW_MERGE_LEFT_TO_RIGHT);
+ final Boolean rightToLeft = (Boolean)options.get(PapyrusCompareOptions.KEY_ALLOW_MERGE_RIGHT_TO_LEFT);
+ if(rightToLeft != null) {
+ cc.setLeftEditable(rightToLeft);
+ }
+ if(leftToRight != null) {
+ cc.setRightEditable(leftToRight);
+ }
+ };
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/factory/UMLCompareEditorFactory.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/factory/UMLCompareEditorFactory.java new file mode 100644 index 00000000000..62073e895f1 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/factory/UMLCompareEditorFactory.java @@ -0,0 +1,31 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.factory;
+
+import org.eclipse.papyrus.infra.emf.compare.common.factory.AbstractEMFCompareEditorFactory;
+import org.eclipse.papyrus.uml.compare.editor.UMLCompareEditor;
+
+
+public class UMLCompareEditorFactory extends AbstractEMFCompareEditorFactory {
+
+ /**
+ * Constructor.
+ *
+ * @param diagramClass
+ * @param expectedType
+ */
+ public UMLCompareEditorFactory() {
+ super(UMLCompareEditor.class, UMLCompareEditor.EDITOR_TYPE);
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/internal/handler/UMLCompareEditorHandler.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/internal/handler/UMLCompareEditorHandler.java new file mode 100644 index 00000000000..5ee57a5eee0 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/internal/handler/UMLCompareEditorHandler.java @@ -0,0 +1,60 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.internal.handler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.emf.compare.common.handler.AbstractEMFCompareEditorHandler;
+import org.eclipse.papyrus.uml.compare.editor.UMLCompareEditor;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * The handler for the UML Compare Editor
+ */
+public class UMLCompareEditorHandler extends AbstractEMFCompareEditorHandler {
+
+ public UMLCompareEditorHandler() {
+ super(UMLCompareEditor.EDITOR_TYPE);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.common.handler.AbstractEMFCompareEditorHandler#getSelection()
+ *
+ * @return
+ */
+ @Override
+ protected List<EObject> getSelection() {
+ List<EObject> umlSelection = new ArrayList<EObject>();
+ for(EObject current : super.getSelection()) {
+ if(current instanceof Element) {
+ umlSelection.add(current);
+ }
+ }
+ return umlSelection;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ boolean enabled = super.isEnabled();
+ if(enabled) {
+ EObject left = getSelection().get(0);
+ EObject right = getSelection().get(1);
+ return left.getClass() == right.getClass();
+ }
+ return false;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/ElementContentDiffEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/ElementContentDiffEngine.java new file mode 100644 index 00000000000..385ae1e7cfd --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/ElementContentDiffEngine.java @@ -0,0 +1,99 @@ +/***************************************************************************** + * 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.tatiana; + +import org.eclipse.emf.compare.diff.engine.GenericDiffEngine; +import org.eclipse.emf.compare.diff.metamodel.DiffElement; +import org.eclipse.emf.compare.diff.metamodel.DiffGroup; +import org.eclipse.emf.compare.diff.metamodel.DiffModel; +import org.eclipse.emf.compare.diff.metamodel.MoveModelElement; +import org.eclipse.emf.ecore.EObject; + + +/** + /** + * The implementation of DiffEngine to compare two arbitrary elements, not nesseserily diagrams + */ +public class ElementContentDiffEngine extends GenericDiffEngine/*PapyrusDiffEngine*/ { + + /** The my left. */ + private final EObject myLeft; + + /** The my right. */ + private final EObject myRight; + + /** + * Instantiates a new element content diff engine. + * + * @param left the left + * @param right the right + */ + public ElementContentDiffEngine(EObject left, EObject right) { + this.myLeft = left; + this.myRight = right; + } + + /* (non-Javadoc) + * @see org.eclipse.emf.compare.diff.engine.GenericDiffEngine#addInContainerPackage(org.eclipse.emf.compare.diff.metamodel.DiffGroup, org.eclipse.emf.compare.diff.metamodel.DiffElement, org.eclipse.emf.ecore.EObject) + */ + @Override + protected void addInContainerPackage(DiffGroup root, DiffElement operation, EObject targetParent) { +// if(targetParent == myLeft || targetParent == myRight) { +// root.getSubDiffElements().add(operation); +// return; +// } + super.addInContainerPackage(root, operation, targetParent); + } + +// /* (non-Javadoc) +// * @see org.eclipse.papyrus.uml.compare.diff.PapyrusDiffEngine#postProcess(org.eclipse.emf.compare.diff.metamodel.DiffModel) +// */ +// @Override +// protected DiffModel postProcess(DiffModel diffModel) { +// super.postProcess(diffModel); +// //#336361 - [UML Compare] Compare two elements: show right element as root +// DiffElement newRoot = findDiffElementFor(diffModel, myRight); +// CompareTwoElementsDiffModel newRootExt = buildCompareTwoElementsDiff(diffModel, newRoot); +// return newRootExt; +// } + + /** + * Builds the compare two elements diff. + * + * @param object the object + * @param newRott the new rott + * @return the compare two elements diff model + */ +// private CompareTwoElementsDiffModel buildCompareTwoElementsDiff(DiffModel object, DiffElement newRott) { +// CompareTwoElementsDiffModel newElement = UMLDiffFactory.eINSTANCE.createCompareTwoElementsDiffModel(); +// newElement.getLeftRoots().add(myLeft); +// newElement.getRightRoots().add(myRight); +//// newElement.getAncestorRoots().addAll(object.getAncestorRoots()); +// newElement.getOwnedElements().add(newRott); +// return newElement; +// } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.uml.compare.diff.PapyrusDiffEngine#visitElement(org.eclipse.emf.compare.diff.metamodel.DiffModel, org.eclipse.emf.compare.diff.metamodel.DiffElement) + */ +// @Override +// protected void visitElement(DiffModel root, DiffElement diffElement) { +// super.visitElement(root, diffElement); +// if (diffElement instanceof MoveModelElement) { +// // don't show 'element moved for the root elements' +// hideElement(diffElement, null); +// } +// } + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/ElementContentMatchEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/ElementContentMatchEngine.java new file mode 100644 index 00000000000..63ef73a4fc1 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/ElementContentMatchEngine.java @@ -0,0 +1,110 @@ +/***************************************************************************** + * 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.tatiana; + +import org.eclipse.emf.compare.FactoryException; +import org.eclipse.emf.compare.match.engine.AbstractSimilarityChecker; +import org.eclipse.emf.compare.match.engine.GenericMatchEngine; +import org.eclipse.emf.compare.match.statistic.MetamodelFilter; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; + +/** + * The implementation of MatchEngine to compare two arbitrary elements, not nesseserily diagrams + */ +public class ElementContentMatchEngine extends GenericMatchEngine{ //PapyrusMatchEngine { + + /** The my left. */ + private final EObject myLeft; + + /** The my right. */ + private final EObject myRight; + + /** + * Instantiates a new element content match engine. + * + * @param left the left + * @param right the right + */ + public ElementContentMatchEngine(EObject left, EObject right) { + this.myLeft = left; + this.myRight = right; + } + + /* (non-Javadoc) + * @see org.eclipse.papyrus.uml.compare.match.PapyrusMatchEngine#prepareChecker() + */ + @Override + protected AbstractSimilarityChecker prepareChecker() { + return new AlwaysSimilarChecker(filter, super.prepareChecker()); + } + + /** + * The Class AlwaysSimilarChecker. + */ + private class AlwaysSimilarChecker extends AbstractSimilarityChecker { + + /** The delegate. */ + private AbstractSimilarityChecker delegate; + + /** + * Instantiates a new always similar checker. + * + * @param filter the filter + * @param fallback the fallback + */ + public AlwaysSimilarChecker(MetamodelFilter filter, AbstractSimilarityChecker fallback) { + super(filter); + this.delegate = fallback; + } + + /* (non-Javadoc) + * @see org.eclipse.emf.compare.match.engine.AbstractSimilarityChecker#isSimilar(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject) + */ + /** + * The standard AbstractSimilarityChecker checks the parent of the elements, + * thus, compared elements won't be considered similar. + * To avoid this problem this method always returns true + **/ + @Override + public boolean isSimilar(EObject obj1, EObject obj2) throws FactoryException { + return true; + } + + /* (non-Javadoc) + * @see org.eclipse.emf.compare.match.engine.AbstractSimilarityChecker#init(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject) + */ + @Override + public void init(EObject leftObject, EObject rightObject) throws FactoryException { + delegate.init(leftObject, rightObject); + } + + /* (non-Javadoc) + * @see org.eclipse.emf.compare.match.engine.AbstractSimilarityChecker#init(org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.resource.Resource) + */ + @Override + public void init(Resource leftResource, Resource rightResource) throws FactoryException { + delegate.init(leftResource, rightResource); + } + + /* (non-Javadoc) + * @see org.eclipse.emf.compare.match.engine.AbstractSimilarityChecker#absoluteMetric(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject) + */ + @Override + public double absoluteMetric(EObject obj1, EObject obj2) throws FactoryException { + return delegate.absoluteMetric(obj1, obj2); + } + } + +} diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/PapyrusDiffEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/PapyrusDiffEngine.java new file mode 100644 index 00000000000..e7bc3bed97f --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/PapyrusDiffEngine.java @@ -0,0 +1,210 @@ +/*****************************************************************************
+ * 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.tatiana;
+
+
+import java.util.Iterator;
+
+import org.eclipse.emf.compare.diff.engine.GenericDiffEngine;
+import org.eclipse.emf.compare.diff.engine.check.ReferencesCheck;
+import org.eclipse.emf.compare.diff.metamodel.AbstractDiffExtension;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffFactory;
+import org.eclipse.emf.compare.diff.metamodel.DiffGroup;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.util.DiffSwitch;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.uml.compare.UMLCompareUtils;
+import org.eclipse.papyrus.uml.compare.diff.extension.DiffElementExtensionBuilder;
+import org.eclipse.papyrus.uml.compare.diff.metamodel.uml_diff_extension.UMLDiffFactory;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.util.UMLUtil;
+
+
+/**
+ * Implementation of DiffEngine for UML Diagrams:
+ * <li>Properly processes changes stereotypes and tagged values,</li>
+ * <li>doesn't show numerous bulk changes as described in Bug 316819#c1</li>
+ */
+public class PapyrusDiffEngine extends GenericDiffEngine {
+
+ /** The my diff element builder. */
+ private DiffSwitch<AbstractDiffExtension> myDiffElementBuilder = new DiffElementExtensionBuilder();
+
+ /** The my get model element switch. */
+ private DiffSwitch<EObject> myGetModelElementSwitch = new ModelElementSwitch();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.compare.diff.engine.GenericDiffEngine#getReferencesChecker()
+ */
+ @Override
+ protected ReferencesCheck getReferencesChecker() {
+ return new UMLReferenceCheck(matchCrossReferencer);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.compare.diff.engine.GenericDiffEngine#doDiff(org.eclipse.emf.compare.match.metamodel.MatchModel, boolean)
+ */
+ @Override
+ public DiffModel doDiff(MatchModel match, boolean threeWay) {
+ DiffModel result = super.doDiff(match, threeWay);
+ return postProcess(result);
+ }
+
+
+ /**
+ * Post process default result of Diff.
+ * Processes changes stereotypes and tagged values
+ *
+ * @param diffModel the diff model
+ * @return the diff model
+ */
+ protected DiffModel postProcess(DiffModel diffModel) {
+ final Iterator<EObject> it = diffModel.eAllContents();
+ while(it.hasNext()) {
+ DiffElement diffElement = (DiffElement)it.next();
+ visitElement(diffModel, diffElement);
+ }
+ return diffModel;
+ }
+
+ /**
+ * Visit element.
+ *
+ * @param root the root
+ * @param diffElement the diff element
+ */
+ protected void visitElement(DiffModel root, DiffElement diffElement) {
+ if(diffElement instanceof DiffGroup) {
+ return;
+ }
+ EObject stereotypeApplication = getModelElementFor(diffElement);
+ if(UMLCompareUtils.isStereotypeApplication(stereotypeApplication)) {
+
+ Element newVisualParent = UMLUtil.getBaseElement(stereotypeApplication);
+ DiffElement newDiffParent = findOrCreateDiffElementFor(root, newVisualParent);
+ AbstractDiffExtension taggedValueDiff = createDiffExtentionElementFor(diffElement);
+
+ newDiffParent.getSubDiffElements().add((DiffElement)taggedValueDiff);
+ hideElement(diffElement, taggedValueDiff);
+ }
+ }
+
+ /**
+ * Hide element.
+ *
+ * @param diffElement the diff element
+ * @param diffExtension the diff extension
+ */
+ protected void hideElement(DiffElement diffElement, AbstractDiffExtension diffExtension) {
+ if(diffExtension == null) {
+ diffExtension = UMLDiffFactory.eINSTANCE.createAddStereotypeApplication();
+ }
+ diffExtension.getHideElements().add(diffElement);
+ }
+
+ /**
+ * Find or create diff element for.
+ *
+ * @param root the root
+ * @param object the object
+ * @return the diff element
+ */
+ private DiffElement findOrCreateDiffElementFor(DiffModel root, EObject object) {
+ if(object == null) {
+ if(!root.getOwnedElements().isEmpty()) {
+ return root.getOwnedElements().get(0);
+ }
+ DiffGroup diffRoot = DiffFactory.eINSTANCE.createDiffGroup();
+ root.getOwnedElements().add(diffRoot);
+ return diffRoot;
+ }
+ DiffElement element = findDiffElementFor(root, object);
+ if(element != null) {
+ return element;
+ }
+
+ DiffElement diffParent = findOrCreateDiffElementFor(root, getParent(object));
+ DiffGroup diffElementForObject = DiffFactory.eINSTANCE.createDiffGroup();
+ diffElementForObject.setRightParent(object);
+
+ diffParent.getSubDiffElements().add(diffElementForObject);
+ return diffElementForObject;
+ }
+
+ /**
+ * Gets the parent.
+ *
+ * @param modelElement the model element
+ * @return the parent
+ */
+ private EObject getParent(EObject modelElement) {
+ return modelElement.eContainer();
+ }
+
+ /**
+ * Find diff element for.
+ *
+ * @param root the root
+ * @param modelElement the model element
+ * @return the diff element
+ */
+ protected final DiffElement findDiffElementFor(DiffModel root, EObject modelElement) {
+ if(modelElement == null) {
+ return null;
+ }
+ final Iterator<EObject> it = root.eAllContents();
+ while(it.hasNext()) {
+ final DiffElement element = (DiffElement)it.next();
+ if(isPertinentDiff(element, modelElement)) {
+ return element;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Checks if is pertinent diff.
+ *
+ * @param diff the diff
+ * @param modelElement the model element
+ * @return true, if is pertinent diff
+ */
+ private boolean isPertinentDiff(DiffElement diff, EObject modelElement) {
+ EObject domainElement = getModelElementFor(diff);
+ return modelElement.equals(domainElement) || modelElement.equals(getMatchedEObject(domainElement));
+ }
+
+ /**
+ * Gets the model element for.
+ *
+ * @param diff the diff
+ * @return the model element for
+ */
+ protected EObject getModelElementFor(DiffElement diff) {
+ return myGetModelElementSwitch.doSwitch(diff);
+ }
+
+ /**
+ * Creates the diff extention element for.
+ *
+ * @param diffElement the diff element
+ * @return the abstract diff extension
+ */
+ protected AbstractDiffExtension createDiffExtentionElementFor(DiffElement diffElement) {
+ return myDiffElementBuilder.doSwitch(diffElement);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/PapyrusMatchEngine.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/PapyrusMatchEngine.java new file mode 100644 index 00000000000..329d13a1709 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/tatiana/PapyrusMatchEngine.java @@ -0,0 +1,69 @@ +/*****************************************************************************
+ * 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.tatiana;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.compare.match.MatchOptions;
+import org.eclipse.emf.compare.match.engine.GenericMatchEngine;
+import org.eclipse.emf.compare.match.engine.IMatchScope;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.uml2.uml.Element;
+
+
+/**
+ * Implementation of MatchEngine for UML Diagrams:
+ * <li>Processes changes in stereotypes and tagged values as children of the base element, not of resource</li>
+ */
+public class PapyrusMatchEngine extends GenericMatchEngine {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.compare.match.engine.GenericMatchEngine#resourceMatch(org.eclipse.emf.ecore.resource.Resource, org.eclipse.emf.ecore.resource.Resource, java.util.Map)
+ */
+ @Override
+ public MatchModel resourceMatch(Resource leftResource, Resource rightResource, Map<String, Object> optionMap) throws InterruptedException {
+ optionMap.put(MatchOptions.OPTION_MATCH_SCOPE_PROVIDER, new PapyrusMatchScopeProvider(leftResource, rightResource));
+ return super.resourceMatch(leftResource, rightResource, optionMap);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.compare.match.engine.GenericMatchEngine#getScopeInternalContents(org.eclipse.emf.ecore.EObject, org.eclipse.emf.compare.match.engine.IMatchScope)
+ */
+ @Override
+ protected List<EObject> getScopeInternalContents(EObject eObject, IMatchScope scope) {
+ ArrayList<EObject> result = new ArrayList<EObject>(super.getScopeInternalContents(eObject, scope));
+ result.addAll(getStereotypeApplications(eObject));
+ return result;
+ }
+
+ /**
+ * Gets the stereotype applications.
+ *
+ * @param eObject the e object
+ * @return the stereotype applications
+ */
+ private List<EObject> getStereotypeApplications(EObject eObject) {
+ if(eObject instanceof Element) {
+ return ((Element)eObject).getStereotypeApplications();
+ } else {
+ return Collections.emptyList();
+ }
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/PapyrusModelCompareInput.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/PapyrusModelCompareInput.java new file mode 100644 index 00000000000..0eecf0f29b2 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/PapyrusModelCompareInput.java @@ -0,0 +1,148 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.utils;
+
+import java.util.List;
+
+import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSetSnapshot;
+import org.eclipse.emf.compare.diff.metamodel.ComparisonResourceSnapshot;
+import org.eclipse.emf.compare.diff.metamodel.DiffElement;
+import org.eclipse.emf.compare.diff.metamodel.DiffModel;
+import org.eclipse.emf.compare.diff.metamodel.DiffResourceSet;
+import org.eclipse.emf.compare.match.metamodel.MatchModel;
+import org.eclipse.emf.compare.match.metamodel.MatchResourceSet;
+import org.eclipse.emf.compare.ui.ICompareInputDetailsProvider;
+import org.eclipse.emf.compare.ui.ModelCompareInput;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.compare.diff.service.TransactionalMergeService;
+
+/**
+ *
+ * This input allows to use the Papyrus TransactionalMergeService
+ *
+ */
+public class PapyrusModelCompareInput extends ModelCompareInput {
+
+ /**
+ * The editing domain used to do the merge
+ */
+ final private TransactionalEditingDomain domain;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * @param matchResourceSet
+ * @param diffResourceSet
+ */
+ public PapyrusModelCompareInput(final TransactionalEditingDomain domain, MatchResourceSet matchResourceSet, DiffResourceSet diffResourceSet) {
+ super(matchResourceSet, diffResourceSet);
+ this.domain = domain;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * @param snapshot
+ */
+ public PapyrusModelCompareInput(final TransactionalEditingDomain domain, ComparisonResourceSetSnapshot snapshot) {
+ super(snapshot);
+ this.domain = domain;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * @param snapshot
+ */
+ public PapyrusModelCompareInput(final TransactionalEditingDomain domain, ComparisonResourceSnapshot snapshot) {
+ super(snapshot);
+ this.domain = domain;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * @param matchModel
+ * @param diffModel
+ * @param provider
+ */
+ public PapyrusModelCompareInput(final TransactionalEditingDomain domain, MatchModel matchModel, DiffModel diffModel, ICompareInputDetailsProvider provider) {
+ super(matchModel, diffModel, provider);
+ this.domain = domain;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * @param matchResourceset
+ * @param diffResourceSet
+ * @param provider
+ */
+ public PapyrusModelCompareInput(final TransactionalEditingDomain domain, MatchResourceSet matchResourceset, DiffResourceSet diffResourceSet, ICompareInputDetailsProvider provider) {
+ super(matchResourceset, diffResourceSet, provider);
+ this.domain = domain;
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param domain
+ * @param match
+ * @param diff
+ */
+ public PapyrusModelCompareInput(final TransactionalEditingDomain domain, MatchModel match, DiffModel diff) {
+ super(match, diff);
+ this.domain = domain;
+ }
+
+ /**
+ * Applies the changes implied by a given {@link DiffElement} in the
+ * direction specified by <code>leftToRight</code>.
+ *
+ * @param element
+ * {@link DiffElement} containing the copy information.
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left
+ * to the right model, <code>False</code> otherwise.
+ */
+ protected void doCopy(DiffElement element, boolean leftToRight) {
+ TransactionalMergeService.merge(domain, element, leftToRight);
+ }
+
+ /**
+ * Applies the changes implied by a list of {@link DiffElement} in the
+ * direction specified by <code>leftToRight</code>.
+ *
+ * @param elements
+ * {@link DiffElement}s containing the copy information.
+ * @param leftToRight
+ * <code>True</code> if the changes must be applied from the left
+ * to the right model, <code>False</code> otherwise.
+ */
+ protected void doCopy(List<DiffElement> elements, boolean leftToRight) {
+ TransactionalMergeService.merge(domain, elements, leftToRight);
+ }
+
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/RootObject.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/RootObject.java new file mode 100644 index 00000000000..09e6bca0d34 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/RootObject.java @@ -0,0 +1,57 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.utils;
+
+
+
+/**
+ *
+ * This class allows to recognize easily the root object in the viewer.
+ * This class was introduced for comparison from the ModelExplorer
+ *
+ */
+public class RootObject {
+
+ /**
+ * the key for the left root object
+ */
+ public static final String LEFT_OBJECT_KEY = "leftObject";
+
+ /**
+ * the key for the right root object
+ */
+ public static final String RIGHT_OBJECT_KEY = "rightObject"; //TODO useful
+
+ /** The represented object. */
+ private Object representedObject = null;
+
+ /**
+ * Instantiates a new root object.
+ *
+ * @param object
+ * the object
+ */
+ public RootObject(final Object object) {
+ this.representedObject = object;
+ }
+
+ /**
+ * Gets the represented object.
+ *
+ * @return the represented object
+ */
+ public Object getRepresentedObject() {
+ return this.representedObject;
+ }
+}
diff --git a/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/UMLModelCompareEditorInput.java b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/UMLModelCompareEditorInput.java new file mode 100644 index 00000000000..b5fb8a42e50 --- /dev/null +++ b/deprecated/uml-compare-1.X/org.eclipse.papyrus.uml.compare/src/org/eclipse/papyrus/uml/compare/utils/UMLModelCompareEditorInput.java @@ -0,0 +1,77 @@ +/*****************************************************************************
+ * Copyright (c) 2012 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) Vincent.Lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.compare.utils;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareViewerPane;
+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.ui.ModelCompareInput;
+import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.emf.compare.common.utils.PapyrusModelCompareEditorInput;
+import org.eclipse.papyrus.uml.compare.content.viewer.UMLTransactionalModelContentMergeViewer;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ *
+ * The Input for the nested UMLCompareEditor
+ *
+ */
+public class UMLModelCompareEditorInput extends PapyrusModelCompareEditorInput {
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param snapshot
+ * the comparison snapshot
+ * @param editor
+ * the editor
+ */
+ public UMLModelCompareEditorInput(final ComparisonSnapshot snapshot, final IEditorPart editor) {
+ super(snapshot, editor);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.compare.common.utils.PapyrusModelCompareEditorInput#createMergeViewer(org.eclipse.compare.CompareViewerPane,
+ * org.eclipse.compare.CompareConfiguration)
+ *
+ * @param pane
+ * @param config
+ * @return
+ */
+ @Override
+ protected ModelContentMergeViewer createMergeViewer(final CompareViewerPane pane, final CompareConfiguration config) {
+ return new UMLTransactionalModelContentMergeViewer(pane, config, this.editor);
+ }
+
+ /**
+ *
+ * @see org.eclipse.emf.compare.ui.editor.ModelCompareEditorInput#createModelCompareInput(org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot)
+ *
+ * @param snap
+ * @return
+ */
+ @Override
+ protected ModelCompareInput createModelCompareInput(final ComparisonSnapshot snap) {
+ final TransactionalEditingDomain domain = getEditingDomain();
+ if(snap instanceof ComparisonResourceSetSnapshot) {
+ return new PapyrusModelCompareInput(domain, ((ComparisonResourceSetSnapshot)snap).getMatchResourceSet(), ((ComparisonResourceSetSnapshot)snap).getDiffResourceSet());
+ }
+ return new PapyrusModelCompareInput(domain, ((ComparisonResourceSnapshot)snap).getMatch(), ((ComparisonResourceSnapshot)snap).getDiff());
+ }
+}
|