From 1cb8e9b4386184fe7526fd62d3aad9fe2dd88e2f Mon Sep 17 00:00:00 2001 From: Laurent Wouters Date: Fri, 4 Apr 2014 16:14:06 +0200 Subject: [clean] Retiring org.eclipse.papyrus.uml.compare.ui Signed-off-by: Laurent Wouters --- .../org.eclipse.papyrus.uml.compare.ui/.classpath | 7 - .../org.eclipse.papyrus.uml.compare.ui/.project | 28 --- .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 23 -- .../org.eclipse.papyrus.uml.compare.ui/about.html | 28 --- .../build.properties | 12 - .../messages.properties | 4 - .../plugin.properties | 3 - .../org.eclipse.papyrus.uml.compare.ui/plugin.xml | 35 --- .../eclipse/papyrus/uml/compare/ui/Activator.java | 89 ------- .../eclipse/papyrus/uml/compare/ui/Messages.java | 34 --- .../ui/action/CompareTwoElementsAction.java | 222 ------------------ .../ElementContentMergeContentProvider.java | 88 ------- .../uml/compare/ui/viewer/content/Messages.java | 28 --- .../viewer/content/UMLModelContentMergeViewer.java | 189 --------------- .../content/UMLModelContentMergeViewerCreator.java | 39 ---- .../compare/ui/viewer/content/messages.properties | 2 - .../ui/viewer/content/part/UMLAdapterFactory.java | 48 ---- .../part/UMLModelContentMergeTabFolder.java | 128 ----------- .../ModelContentMergeDiffTabContentProvider.java | 152 ------------ .../part/diff/UMLModelContentMergeDiffTab.java | 86 ------- .../part/property/Match2ElementsWithDiff.java | 256 --------------------- .../part/property/UMLPropertyContentProvider.java | 130 ----------- 23 files changed, 1639 deletions(-) delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/.classpath delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/.project delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/.settings/org.eclipse.jdt.core.prefs delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/META-INF/MANIFEST.MF delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/about.html delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/build.properties delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/messages.properties delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.properties delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.xml delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Activator.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Messages.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/action/CompareTwoElementsAction.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/ElementContentMergeContentProvider.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/Messages.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/UMLModelContentMergeViewer.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/UMLModelContentMergeViewerCreator.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/messages.properties delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/UMLAdapterFactory.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/UMLModelContentMergeTabFolder.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTabContentProvider.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/diff/UMLModelContentMergeDiffTab.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/property/Match2ElementsWithDiff.java delete mode 100644 deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/property/UMLPropertyContentProvider.java (limited to 'deprecated/org.eclipse.papyrus.uml.compare.ui') diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/.classpath b/deprecated/org.eclipse.papyrus.uml.compare.ui/.classpath deleted file mode 100644 index 64c5e31b7a2..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/.project b/deprecated/org.eclipse.papyrus.uml.compare.ui/.project deleted file mode 100644 index 754f5c7db6a..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.papyrus.uml.compare.ui - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/.settings/org.eclipse.jdt.core.prefs b/deprecated/org.eclipse.papyrus.uml.compare.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 4049fe65088..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Mar 08 16:02:45 GMT+01:00 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.uml.compare.ui/META-INF/MANIFEST.MF deleted file mode 100644 index 836a3ed26f8..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,23 +0,0 @@ -Manifest-Version: 1.0 -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.compare;bundle-version="3.5.200", - org.eclipse.papyrus.uml.compare;bundle-version="0.9.0", - org.eclipse.emf.compare.diff;bundle-version="1.1.1", - org.eclipse.emf.compare;bundle-version="1.1.1", - org.eclipse.emf.compare.ui;bundle-version="1.1.1", - org.eclipse.emf.compare.match;bundle-version="1.1.1", - org.eclipse.emf.facet.infra.browser.custom;bundle-version="0.1.0", - org.eclipse.emf.facet.infra.browser.custom.core;bundle-version="0.1.0", - org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.1.0", - org.eclipse.team.ui;bundle-version="3.5.200", - org.eclipse.uml2.uml.edit;bundle-version="3.1.100", - org.eclipse.emf.edit.ui;bundle-version="2.6.0" -Bundle-Vendor: %Bundle-Vendor -Bundle-ActivationPolicy: lazy -Bundle-Version: 0.9.0.qualifier -Bundle-Name: %Bundle-Name -Bundle-Activator: org.eclipse.papyrus.uml.compare.ui.Activator -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.eclipse.papyrus.uml.compare.ui;singleton:=true -Bundle-RequiredExecutionEnvironment: J2SE-1.5 - diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/about.html b/deprecated/org.eclipse.papyrus.uml.compare.ui/about.html deleted file mode 100644 index 82d49bf5f81..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/about.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - -About - - -

About This Content

- -

June 5, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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 http://www.eclipse.org.

- - - diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/build.properties b/deprecated/org.eclipse.papyrus.uml.compare.ui/build.properties deleted file mode 100644 index b3545bf4896..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -# -#Mon Sep 12 09:29:35 CEST 2011 -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - messages.properties,\ - about.html,\ - OSGI-INF/l10n/bundle.properties -output..=bin/ -src.includes=META-INF/,.,plugin.xml,messages.properties,about.html -source..=src/ -bin..=bin/ diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/messages.properties b/deprecated/org.eclipse.papyrus.uml.compare.ui/messages.properties deleted file mode 100644 index 9693117feca..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/messages.properties +++ /dev/null @@ -1,4 +0,0 @@ -Activator_log_error_message=Unexpected error: -CompareTwoElementsAction_left_element_is_null=Cannot compare elements: left element is null -CompareTwoElementsAction_only_only_element_is_selected=Cannot compare elements: 2 elements should be selected, but only {0} is selected -CompareTwoElementsAction_right_element_is_null=Cannot compare elements: right element is null diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.properties b/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.properties deleted file mode 100644 index f86c0caaac7..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.properties +++ /dev/null @@ -1,3 +0,0 @@ -#Properties file for org.eclipse.papyrus.uml.compare.ui -Bundle-Vendor = Eclipse Modeling Project -Bundle-Name = UML Compare UI \ No newline at end of file diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.xml b/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.xml deleted file mode 100644 index 052599166ac..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/plugin.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Activator.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Activator.java deleted file mode 100644 index 64518b7d60e..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Activator.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.eclipse.papyrus.uml.compare.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -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 - /** The Constant PLUGIN_ID. */ - public static final String PLUGIN_ID = "org.eclipse.papyrus.uml.compare.ui"; //$NON-NLS-1$ - - // The shared instance - /** The plugin. */ - private static Activator plugin; - - /** - * The constructor. - */ - public Activator() { - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - 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) - */ - @Override - 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; - } - - /** - * Log error. - * - * @param e the e - */ - public static void logError(Throwable e) { - logError(Messages.Activator_log_error_message, e); - } - - /** - * Log error. - * - * @param message the message - * @param e the e - */ - public static void logError(String message, Throwable e) { - IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, message, e); - getDefault().getLog().log(status); - } - - /** - * Log info. - * - * @param message the message - */ - public static void logInfo(String message) { - IStatus status = new Status(IStatus.INFO, PLUGIN_ID, message); - getDefault().getLog().log(status); - } - - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Messages.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Messages.java deleted file mode 100644 index 545dd7df6b9..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/Messages.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.eclipse.papyrus.uml.compare.ui; - -import org.eclipse.osgi.util.NLS; - -/** - * The NLS Messages. - */ -public class Messages extends NLS { - - /** The Constant BUNDLE_NAME. */ - private static final String BUNDLE_NAME = "messages"; //$NON-NLS-1$ - - /** The Activator_log_error_message. */ - public static String Activator_log_error_message; - - /** The Compare two elements action_left_element_is_null. */ - public static String CompareTwoElementsAction_left_element_is_null; - - /** The Compare two elements action_only_only_element_is_selected. */ - public static String CompareTwoElementsAction_only_only_element_is_selected; - - /** The Compare two elements action_right_element_is_null. */ - public static String CompareTwoElementsAction_right_element_is_null; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - /** - * Instantiates a new messages. - */ - private Messages() { - } -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/action/CompareTwoElementsAction.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/action/CompareTwoElementsAction.java deleted file mode 100644 index 4186499ad15..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/action/CompareTwoElementsAction.java +++ /dev/null @@ -1,222 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.action; - -import java.lang.reflect.InvocationTargetException; -import java.util.Collection; -import java.util.Map; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.CompareUI; -import org.eclipse.compare.CompareViewerPane; -import org.eclipse.compare.contentmergeviewer.IMergeViewerContentProvider; -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.AbstractDiffExtension; -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.engine.IMatchEngine; -import org.eclipse.emf.compare.match.metamodel.MatchModel; -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.papyrus.uml.compare.diff.extension.UMLStyledStructureLabelProvider; -import org.eclipse.papyrus.uml.compare.element.ElementContentDiffEngine; -import org.eclipse.papyrus.uml.compare.element.ElementContentMatchEngine; -import org.eclipse.papyrus.uml.compare.ui.Activator; -import org.eclipse.papyrus.uml.compare.ui.Messages; -import org.eclipse.papyrus.uml.compare.ui.PapyrusLabelProvider; -import org.eclipse.papyrus.uml.compare.ui.viewer.content.ElementContentMergeContentProvider; -import org.eclipse.papyrus.uml.compare.ui.viewer.content.UMLModelContentMergeViewer; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.team.internal.ui.actions.TeamAction; -import org.eclipse.ui.PlatformUI; - -/** - * Action to compare two arbitrary elements. - * Availbale in the context menu of the model explorer. - */ -public class CompareTwoElementsAction extends TeamAction { - - /* (non-Javadoc) - * @see org.eclipse.team.internal.ui.actions.TeamAction#execute(org.eclipse.jface.action.IAction) - */ - protected void execute(IAction action) throws InvocationTargetException, InterruptedException { - - Object[] selectedElements = getSelection().toArray(); - if(selectedElements.length != 2) { - Activator.logInfo(Messages.bind(Messages.CompareTwoElementsAction_only_only_element_is_selected, selectedElements.length)); - return; - } - - EObject left = getElementFor(selectedElements[0]); - EObject right = getElementFor(selectedElements[1]); - if(left == null) { - Activator.logInfo(Messages.CompareTwoElementsAction_left_element_is_null); - return; - } - - if(right == null) { - Activator.logInfo(Messages.CompareTwoElementsAction_right_element_is_null); - return; - } - - ComparisonResourceSnapshot snapshot = doContentCompare(left, right); - openInCompare(snapshot); - } - - /* (non-Javadoc) - * @see org.eclipse.core.commands.AbstractHandler#isEnabled() - */ - public boolean isEnabled() { - Object[] selectedElements = getSelection().toArray(); - if(selectedElements.length != 2) { - return false; - } - EObject left = getElementFor(selectedElements[0]); - EObject right = getElementFor(selectedElements[1]); - return left != null && right != null; - } - - /** - * Open in compare. - * - * @param snapshot the snapshot - */ - private void openInCompare(ComparisonSnapshot snapshot) { - CompareUI.openCompareEditor(new ModelCompareEditorInput(snapshot) { - - @Override - protected ModelContentMergeViewer createMergeViewer(CompareViewerPane pane, CompareConfiguration config) { - return new UMLModelContentMergeViewer(pane, config) { - @Override - protected IMergeViewerContentProvider createMergeViewerContentProvider() { - return new ElementContentMergeContentProvider(configuration); - } - }; - } - - @Override - public Control createOutlineContents(Composite parent, int direction) { - Control result = super.createOutlineContents(parent, direction); - structureMergeViewer.setLabelProvider(new UMLStyledStructureLabelProvider(new PapyrusLabelProvider())); - return result; - } - - }); - } - - /** - * Do content compare. - * - * @param left the left - * @param right the right - * @return the comparison resource snapshot - */ - protected ComparisonResourceSnapshot doContentCompare(final EObject left, final EObject right) { - final ComparisonResourceSnapshot snapshot = DiffFactory.eINSTANCE.createComparisonResourceSnapshot(); - - try { - PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { - - public void run(IProgressMonitor monitor) throws InterruptedException { - final MatchModel match = contentMatch(left, right, monitor); - final DiffModel diff = contentDiff(left, right, match); - - snapshot.setDiff(diff); - snapshot.setMatch(match); - } - - }); - } catch (final InterruptedException e) { - Activator.logError(e); - } catch (final EMFCompareException e) { - Activator.logError(e); - } catch (final InvocationTargetException e) { - Activator.logError(e); - } - return snapshot; - } - - /** - * Content diff. - * - * @param left the left - * @param right the right - * @param match the match - * @return the diff model - */ - protected DiffModel contentDiff(final EObject left, final EObject right, final MatchModel match) { - ElementContentDiffEngine engine = new ElementContentDiffEngine(left, right); - final DiffModel diff = engine.doDiff(match); - final Collection extensions = DiffService.getCorrespondingDiffExtensions(match); - for(final AbstractDiffExtension ext : extensions) { - if(ext != null) { - ext.visit(diff); - } - } - - engine.reset(); - return diff; - } - - /** - * Content match. - * - * @param left the left - * @param right the right - * @param monitor the monitor - * @return the match model - * @throws InterruptedException the interrupted exception - */ - protected MatchModel contentMatch(final EObject left, final EObject right, IProgressMonitor monitor) throws InterruptedException { - final Map options = new EMFCompareMap(); - options.put(MatchOptions.OPTION_PROGRESS_MONITOR, monitor); - options.put(MatchOptions.OPTION_MATCH_SCOPE_PROVIDER, new GenericMatchScopeProvider(left.eResource(), right.eResource())); - options.put(MatchOptions.OPTION_IGNORE_ID, Boolean.TRUE); - options.put(MatchOptions.OPTION_IGNORE_XMI_ID, Boolean.TRUE); - - final IMatchEngine matchEngine = new ElementContentMatchEngine(left, right); - final MatchModel match = matchEngine.contentMatch(left, right, options); - return match; - } - - /** - * Gets the element for. - * - * @param object the object - * @return the element for - */ - protected EObject getElementFor(Object object) { - if(object instanceof IAdaptable) { - return (EObject)((IAdaptable)object).getAdapter(EObject.class); - } - - if(object instanceof EObject) { - return (EObject)object; - } - return null; - } - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/ElementContentMergeContentProvider.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/ElementContentMergeContentProvider.java deleted file mode 100644 index d57899f1bf4..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/ElementContentMergeContentProvider.java +++ /dev/null @@ -1,88 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content; - -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.uml.compare.diff.metamodel.uml_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) { - 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 - 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/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/Messages.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/Messages.java deleted file mode 100644 index 5e3bd676624..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/Messages.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.eclipse.papyrus.uml.compare.ui.viewer.content; - -import org.eclipse.osgi.util.NLS; - -/** - * The NLS Messages. - */ -public class Messages extends NLS { - - /** The Constant BUNDLE_NAME. */ - private static final String BUNDLE_NAME = "org.eclipse.papyrus.uml.compare.ui.viewer.content.messages"; //$NON-NLS-1$ - - /** The UML model content merge viewer_action_show_all_properties_text. */ - public static String UMLModelContentMergeViewer_action_show_all_properties_text; - - /** The UML model content merge viewer_action_show_all_properties_tooltip. */ - public static String UMLModelContentMergeViewer_action_show_all_properties_tooltip; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - /** - * Instantiates a new messages. - */ - private Messages() { - } -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/UMLModelContentMergeViewer.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/UMLModelContentMergeViewer.java deleted file mode 100644 index 09266bc31ba..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/UMLModelContentMergeViewer.java +++ /dev/null @@ -1,189 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.emf.compare.diff.metamodel.DiffElement; -import org.eclipse.emf.compare.ui.ICompareEditorPartListener; -import org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer; -import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder; -import org.eclipse.jface.action.Action; -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.resource.ImageDescriptor; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.papyrus.uml.compare.Activator; -import org.eclipse.papyrus.uml.compare.ui.viewer.content.part.UMLModelContentMergeTabFolder; -import org.eclipse.swt.widgets.Composite; - - -/** - * The Class UMLModelContentMergeViewer. - */ -public class UMLModelContentMergeViewer extends ModelContentMergeViewer { - - /** The Constant VIEWER_SETTINGS_GROUP. */ - private static final String VIEWER_SETTINGS_GROUP = "viewer";//$NON-NLS-1$ - - /** The Constant SHOW_ALL_PRORPERTIES_IMAGE_PATH. */ - private static final String SHOW_ALL_PRORPERTIES_IMAGE_PATH = "/icons/show_all_properties.gif"; //$NON-NLS-1$ - - /** The my show all properties. */ - private IAction myShowAllProperties; - - /** The my property tab selection listener. */ - private ICompareEditorPartListener myPropertyTabSelectionListener; - - /** The my left part. */ - private UMLModelContentMergeTabFolder myLeftPart; - - /** - * Instantiates a new uML model content merge viewer. - * - * @param parent the parent - * @param config the config - */ - public UMLModelContentMergeViewer(Composite parent, CompareConfiguration config) { - super(parent, config); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer#createModelContentMergeTabFolder(org.eclipse.swt.widgets.Composite, int) - */ - @Override - protected ModelContentMergeTabFolder createModelContentMergeTabFolder(Composite composite, int side) { - return new UMLModelContentMergeTabFolder(this, composite, side); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer#createControls(org.eclipse.swt.widgets.Composite) - */ - @Override - protected void createControls(Composite composite) { - super.createControls(composite); - myPropertyTabSelectionListener = new PropertyTabSelectionListener(); - leftPart.addCompareEditorPartListener(myPropertyTabSelectionListener); - rightPart.addCompareEditorPartListener(myPropertyTabSelectionListener); - ancestorPart.addCompareEditorPartListener(myPropertyTabSelectionListener); - myLeftPart = (UMLModelContentMergeTabFolder)leftPart; - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.viewer.content.ModelContentMergeViewer#createToolItems(org.eclipse.jface.action.ToolBarManager) - */ - @Override - protected void createToolItems(ToolBarManager tbm) { - super.createToolItems(tbm); - tbm.add(new Separator(VIEWER_SETTINGS_GROUP)); - myShowAllProperties = new Action(Messages.UMLModelContentMergeViewer_action_show_all_properties_text, IAction.AS_CHECK_BOX) { - - @Override - public void run() { - showAllProperties(); - } - }; - boolean isEnabled = isPropertyTab(myLeftPart.getSelectedTab()); - myShowAllProperties.setEnabled(isEnabled); - myShowAllProperties.setEnabled(false); - myShowAllProperties.setToolTipText(Messages.UMLModelContentMergeViewer_action_show_all_properties_tooltip); - myShowAllProperties.setImageDescriptor(ImageDescriptor.createFromImage(Activator.getImage(SHOW_ALL_PRORPERTIES_IMAGE_PATH))); - - final ActionContributionItem showAllPropertiesContribution = new ActionContributionItem(myShowAllProperties); - showAllPropertiesContribution.setVisible(true); - tbm.appendToGroup(VIEWER_SETTINGS_GROUP, showAllPropertiesContribution); - } - - /** - * Show all properties. - */ - protected void showAllProperties() { - setSelection(new ArrayList(currentSelection)); - } - - /** - * Property tab selected. - * - * @param isActive the is active - */ - protected void propertyTabSelected(boolean isActive) { - if(isActive) { - myShowAllProperties.setEnabled(true); - } else { - myShowAllProperties.setEnabled(false); - } - } - - /** - * Checks if is property tab. - * - * @param index the index - * @return true, if is property tab - */ - private boolean isPropertyTab(int index) { - return myLeftPart.isPropertyTab(index); - } - - /** - * Checks if is show all properties. - * - * @return true, if is show all properties - */ - public boolean isShowAllProperties() { - return myShowAllProperties.isChecked(); - } - - /** - * Gets the current selection. - * - * @return the current selection - */ - public List getCurrentSelection() { - return currentSelection; - } - - /** - * Bug 338414 - [UML Compare] Filter only changes properties in the Merge Property Viewer. - * - * @see PropertyTabSelectionEvent - */ - private class PropertyTabSelectionListener implements ICompareEditorPartListener { - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.ICompareEditorPartListener#selectedTabChanged(int) - */ - public void selectedTabChanged(int newIndex) { - UMLModelContentMergeViewer.this.propertyTabSelected(isPropertyTab(newIndex)); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.ICompareEditorPartListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) - */ - public void selectionChanged(SelectionChangedEvent event) { - // do nothing - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.ICompareEditorPartListener#updateCenter() - */ - public void updateCenter() { - // do nothing - } - } - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/UMLModelContentMergeViewerCreator.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/UMLModelContentMergeViewerCreator.java deleted file mode 100644 index a178bd423f0..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/UMLModelContentMergeViewerCreator.java +++ /dev/null @@ -1,39 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content; - -import org.eclipse.compare.CompareConfiguration; -import org.eclipse.compare.IViewerCreator; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.widgets.Composite; - - -/** - * The Class UMLModelContentMergeViewerCreator. - */ -public class UMLModelContentMergeViewerCreator implements IViewerCreator { - - /** - * Creates the viewer. - * - * @param parent the parent - * @param config the config - * @return the viewer - * {@inheritDoc} - */ - public Viewer createViewer(Composite parent, CompareConfiguration config) { - return new UMLModelContentMergeViewer(parent, config); - } - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/messages.properties b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/messages.properties deleted file mode 100644 index a0363133867..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/messages.properties +++ /dev/null @@ -1,2 +0,0 @@ -UMLModelContentMergeViewer_action_show_all_properties_text=Show All Properties -UMLModelContentMergeViewer_action_show_all_properties_tooltip=Show All Properties of the Element diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/UMLAdapterFactory.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/UMLAdapterFactory.java deleted file mode 100644 index bb4f8900282..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/UMLAdapterFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content.part; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory; -import org.eclipse.uml2.uml.edit.providers.UMLReflectiveItemProviderAdapterFactory; -import org.eclipse.uml2.uml.edit.providers.UMLResourceItemProviderAdapterFactory; - - -/** - * A factory for creating UMLAdapter objects. - */ -public class UMLAdapterFactory extends ComposedAdapterFactory { - - /** The Constant factories. */ - private final static List factories = new ArrayList(); - static { - factories.add(new UMLResourceItemProviderAdapterFactory()); - factories.add(new UMLItemProviderAdapterFactory()); - factories.add(new EcoreItemProviderAdapterFactory()); - factories.add(new UMLReflectiveItemProviderAdapterFactory()); - } - - /** - * Instantiates a new uML adapter factory. - */ - public UMLAdapterFactory() { - super(factories); - } - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/UMLModelContentMergeTabFolder.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/UMLModelContentMergeTabFolder.java deleted file mode 100644 index 0ee17a0a5b8..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/UMLModelContentMergeTabFolder.java +++ /dev/null @@ -1,128 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content.part; - -import org.eclipse.emf.compare.match.metamodel.Match2Elements; -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.property.ModelContentMergePropertyTab; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.papyrus.uml.compare.ui.PapyrusLabelProvider; -import org.eclipse.papyrus.uml.compare.ui.viewer.content.UMLModelContentMergeViewer; -import org.eclipse.papyrus.uml.compare.ui.viewer.content.ElementContentMergeContentProvider.RootObject; -import org.eclipse.papyrus.uml.compare.ui.viewer.content.part.diff.UMLModelContentMergeDiffTab; -import org.eclipse.papyrus.uml.compare.ui.viewer.content.part.property.Match2ElementsWithDiff; -import org.eclipse.papyrus.uml.compare.ui.viewer.content.part.property.UMLPropertyContentProvider; -import org.eclipse.swt.widgets.Composite; - - -/** - * The Class UMLModelContentMergeTabFolder. - */ -public class UMLModelContentMergeTabFolder extends ModelContentMergeTabFolder { - - /** The my uml viewer. */ - protected final UMLModelContentMergeViewer myUMLViewer; - - /** - * Instantiates a new uML model content merge tab folder. - * - * @param viewer the viewer - * @param composite the composite - * @param side the side - */ - public UMLModelContentMergeTabFolder(ModelContentMergeViewer viewer, Composite composite, int side) { - super(viewer, composite, side); - myUMLViewer = (UMLModelContentMergeViewer)viewer; - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder#createModelContentMergeDiffTab(org.eclipse.swt.widgets.Composite) - */ - @Override - protected IModelContentMergeViewerTab createModelContentMergeDiffTab(Composite parent) { - UMLModelContentMergeDiffTab diffTab = new UMLModelContentMergeDiffTab(parent, partSide, this); - diffTab.setContentProvider(createDiffTabContentProvider()); - diffTab.setLabelProvider(new PapyrusLabelProvider()); - return diffTab; - - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder#createModelContentMergeViewerTab(org.eclipse.swt.widgets.Composite) - */ - @Override - protected IModelContentMergeViewerTab createModelContentMergeViewerTab(Composite parent) { - ModelContentMergePropertyTab propertyTab = new ModelContentMergePropertyTab(parent, partSide, this); - propertyTab.setContentProvider(new UMLPropertyContentProvider()); - return propertyTab; - } - - /** - * Creates the diff tab content provider. - * - * @return the i content provider - */ - protected IContentProvider createDiffTabContentProvider() { - ComposedAdapterFactory adapterFactory = new UMLAdapterFactory(); - AdapterFactoryContentProvider result = new AdapterFactoryContentProvider(adapterFactory) { - - @Override - public Object[] getElements(Object object) { - if(object instanceof RootObject) { - return new Object[]{ ((RootObject)object).object }; - } - return super.getElements(object); - } - }; - - return result; - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder#findMatchFromElement(org.eclipse.emf.ecore.EObject) - */ - protected EObject findMatchFromElement(EObject element) { - EObject matchElement = super.findMatchFromElement(element); - if(!myUMLViewer.isShowAllProperties() && matchElement instanceof Match2Elements) { - return new Match2ElementsWithDiff((Match2Elements)matchElement, myUMLViewer.getCurrentSelection().get(0)); - } - return matchElement; - } - - /** - * Gets the selected tab. - * - * @return the selected tab - */ - public int getSelectedTab() { - return tabFolder.getSelectionIndex(); - } - - /** - * Checks if is property tab. - * - * @param index the index - * @return true, if is property tab - */ - public boolean isPropertyTab(int index) { - final IModelContentMergeViewerTab currentTab = tabs.get(index); - return (currentTab == getPropertyPart()); - } - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTabContentProvider.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTabContentProvider.java deleted file mode 100644 index f0c7a71bdbb..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/diff/ModelContentMergeDiffTabContentProvider.java +++ /dev/null @@ -1,152 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content.part.diff; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.compare.diff.metamodel.ComparisonSnapshot; -import org.eclipse.emf.compare.ui.TypedElementWrapper; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; -import org.eclipse.papyrus.uml.compare.UMLCompareUtils; -import org.eclipse.uml2.uml.Element; - - -/** - * ContentProvider for the Structure Tab of the Merge Viewer. - */ -public class ModelContentMergeDiffTabContentProvider extends AdapterFactoryContentProvider { - - - /** - * Default constructor. Delegates to the super implementation. - * - * @param factory - * Factory to get labels and icons from. - */ - public ModelContentMergeDiffTabContentProvider(AdapterFactory factory) { - super(factory); - } - - /** - * Gets the elements. - * - * @param object the object - * @return the elements - * {@inheritDoc} - * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#getElements(java.lang.Object) - */ - @SuppressWarnings("unchecked") - @Override - public Object[] getElements(Object object) { - // overwritten to ensure contents of ResourceSets, List, and Resource are correclty - // returned. - Object[] result = null; - if(object instanceof ResourceSet) { - final List resources = ((ResourceSet)object).getResources(); - final List elements = new ArrayList(resources.size()); - for(final Resource resource : resources) { - if(resource.getContents().isEmpty() || !(resource.getContents().get(0) instanceof ComparisonSnapshot)) { - elements.add(resource); - } - } - result = elements.toArray(); - } else if(object instanceof TypedElementWrapper) { - result = new Object[]{ ((EObject)object).eResource(), }; - } else if(object instanceof List) { - // we may also display a list of resources - result = ((List)object).toArray(); - } else if(object instanceof Resource) { - // return contents of resource - return filterStereotypeApplications((Resource)object); - } else { - result = super.getElements(object); - } - return result; - } - - /** - * Filter stereotype applications. - * - * @param object the object - * @return the object[] - */ - private Object[] filterStereotypeApplications(Resource object) { - EList contents = object.getContents(); - List result = new ArrayList(); - for(int i = 0; i < contents.size(); i++) { - EObject next = contents.get(i); - if(!UMLCompareUtils.isStereotypeApplication(next)) { - result.add(next); - } - } - return result.toArray(new Object[result.size()]); - } - - /** - * Gets the children. - * - * @param object the object - * @return the children - * {@inheritDoc} - * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#getChildren(java.lang.Object) - */ - @Override - public Object[] getChildren(Object object) { - if(object instanceof Resource) { - // return ((Resource)object).getContents().toArray(); - return new Object[]{ ((Resource)object).getContents().get(0) }; - } - ArrayList result = new ArrayList(); - result.addAll(Arrays.asList(super.getChildren(object))); - result.addAll(getStereotypeApplications(object)); - return result.toArray(new Object[result.size()]); - } - - /** - * Gets the stereotype applications. - * - * @param eObject the e object - * @return the stereotype applications - */ - private List getStereotypeApplications(Object eObject) { - if(eObject instanceof Element) { - return ((Element)eObject).getStereotypeApplications(); - } - return Collections.emptyList(); - } - - - /** - * Checks for children. - * - * @param object the object - * @return true, if successful - * {@inheritDoc} - * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#hasChildren(java.lang.Object) - */ - @Override - public boolean hasChildren(Object object) { - return getChildren(object).length > 0; - } - - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/diff/UMLModelContentMergeDiffTab.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/diff/UMLModelContentMergeDiffTab.java deleted file mode 100644 index 9cb437482fd..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/diff/UMLModelContentMergeDiffTab.java +++ /dev/null @@ -1,86 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content.part.diff; - -import java.util.ArrayList; -import java.util.List; - -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.ecore.EObject; -import org.eclipse.papyrus.uml.compare.UMLCompareUtils; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.uml2.uml.util.UMLUtil; - - -/** - * The Structure Tab in the Merge Viewer. - */ -public class UMLModelContentMergeDiffTab extends ModelContentMergeDiffTab { - - - /** - * Instantiates a new uML model content merge diff tab. - * - * @param parentComposite - * the parent composite - * @param side - * the side - * @param parentFolder - * the parent folder - */ - public UMLModelContentMergeDiffTab(Composite parentComposite, int side, ModelContentMergeTabFolder parentFolder) { - super(parentComposite, side, parentFolder); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab#setSelectionToWidget(java.util.List, boolean) - */ - @Override - protected void setSelectionToWidget(List l, boolean reveal) { - // tfesenko filter stereotype applications - List result = new ArrayList(); - for(Object next : l) { - if(next instanceof EObject && UMLCompareUtils.isStereotypeApplication((EObject)next)) { - EObject stereotypeApplication = (EObject)next; - result.add(UMLUtil.getBaseElement(stereotypeApplication)); - } else { - result.add(next); - } - } - super.setSelectionToWidget(result, reveal); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.emf.compare.ui.viewer.content.part.diff.ModelContentMergeDiffTab#setReflectiveInput(java.lang.Object) - */ - @Override - public void setReflectiveInput(Object object) { - // tfesenko 336361 - [UML Compare] Compare two elements: show right element as root - if(object instanceof EObject) { - clearCaches(); - // tfesenko default implementation sets object.eResource here - setInput(object); - setupCaches(); - needsRedraw = true; - } - super.setReflectiveInput(object); - } - - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/property/Match2ElementsWithDiff.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/property/Match2ElementsWithDiff.java deleted file mode 100644 index 5fbeefc7f70..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/property/Match2ElementsWithDiff.java +++ /dev/null @@ -1,256 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content.part.property; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.TreeIterator; -import org.eclipse.emf.compare.diff.metamodel.DiffElement; -import org.eclipse.emf.compare.match.metamodel.Match2Elements; -import org.eclipse.emf.compare.match.metamodel.MatchElement; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EOperation; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; - - -/** - * The Class Match2Elements implementation that also contains corresponding DiffElement. - Used to filter only changes properties in the Merge Property Viewer (Bug 338414) - */ - -public class Match2ElementsWithDiff implements Match2Elements { - - /** The my delegate. */ - private Match2Elements myDelegate; - - /** The my diff element. */ - private DiffElement myDiffElement; - - /** - * Instantiates a new match2 elements with diff. - * - * @param delegate the delegate - * @param diffElement the diff element - */ - public Match2ElementsWithDiff(Match2Elements delegate, DiffElement diffElement) { - myDelegate = delegate; - myDiffElement = diffElement; - } - - /** - * Gets the diff element. - * - * @return the diff element - */ - public DiffElement getDiffElement() { - return myDiffElement; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return myDelegate.toString() + " " + (myDiffElement == null ? "" : myDiffElement.toString()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.match.metamodel.MatchElement#getSimilarity() - */ - public double getSimilarity() { - return myDelegate.getSimilarity(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.match.metamodel.MatchElement#getSubMatchElements() - */ - public EList getSubMatchElements() { - return myDelegate.getSubMatchElements(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.match.metamodel.MatchElement#setSimilarity(double) - */ - public void setSimilarity(double value) { - myDelegate.setSimilarity(value); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eClass() - */ - public EClass eClass() { - return myDelegate.eClass(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eResource() - */ - public Resource eResource() { - return myDelegate.eResource(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eContainer() - */ - public EObject eContainer() { - return myDelegate; - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eContainingFeature() - */ - public EStructuralFeature eContainingFeature() { - return myDelegate.eContainingFeature(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eContainmentFeature() - */ - public EReference eContainmentFeature() { - return myDelegate.eContainmentFeature(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eContents() - */ - public EList eContents() { - return myDelegate.eContents(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eAllContents() - */ - public TreeIterator eAllContents() { - return myDelegate.eAllContents(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eIsProxy() - */ - public boolean eIsProxy() { - return myDelegate.eIsProxy(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eCrossReferences() - */ - public EList eCrossReferences() { - return myDelegate.eCrossReferences(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eGet(org.eclipse.emf.ecore.EStructuralFeature) - */ - public Object eGet(EStructuralFeature feature) { - return myDelegate.eGet(feature); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eGet(org.eclipse.emf.ecore.EStructuralFeature, boolean) - */ - public Object eGet(EStructuralFeature feature, boolean resolve) { - return myDelegate.eGet(feature, resolve); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eSet(org.eclipse.emf.ecore.EStructuralFeature, java.lang.Object) - */ - public void eSet(EStructuralFeature feature, Object newValue) { - myDelegate.eSet(feature, newValue); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eIsSet(org.eclipse.emf.ecore.EStructuralFeature) - */ - public boolean eIsSet(EStructuralFeature feature) { - return myDelegate.eIsSet(feature); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eUnset(org.eclipse.emf.ecore.EStructuralFeature) - */ - public void eUnset(EStructuralFeature feature) { - myDelegate.eUnset(feature); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.ecore.EObject#eInvoke(org.eclipse.emf.ecore.EOperation, org.eclipse.emf.common.util.EList) - */ - public Object eInvoke(EOperation operation, EList arguments) throws InvocationTargetException { - return myDelegate.eInvoke(operation, arguments); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.common.notify.Notifier#eAdapters() - */ - public EList eAdapters() { - return myDelegate.eAdapters(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.common.notify.Notifier#eDeliver() - */ - public boolean eDeliver() { - return myDelegate.eDeliver(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.common.notify.Notifier#eSetDeliver(boolean) - */ - public void eSetDeliver(boolean deliver) { - myDelegate.eSetDeliver(deliver); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.common.notify.Notifier#eNotify(org.eclipse.emf.common.notify.Notification) - */ - public void eNotify(Notification notification) { - myDelegate.eNotify(notification); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.match.metamodel.Match2Elements#getLeftElement() - */ - public EObject getLeftElement() { - return myDelegate.getLeftElement(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.match.metamodel.Match2Elements#getRightElement() - */ - public EObject getRightElement() { - return myDelegate.getRightElement(); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.match.metamodel.Match2Elements#setLeftElement(org.eclipse.emf.ecore.EObject) - */ - public void setLeftElement(EObject value) { - myDelegate.setLeftElement(value); - } - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.match.metamodel.Match2Elements#setRightElement(org.eclipse.emf.ecore.EObject) - */ - public void setRightElement(EObject value) { - myDelegate.setRightElement(value); - } - -} diff --git a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/property/UMLPropertyContentProvider.java b/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/property/UMLPropertyContentProvider.java deleted file mode 100644 index 4ca46ebadd6..00000000000 --- a/deprecated/org.eclipse.papyrus.uml.compare.ui/src/org/eclipse/papyrus/uml/compare/ui/viewer/content/part/property/UMLPropertyContentProvider.java +++ /dev/null @@ -1,130 +0,0 @@ -/***************************************************************************** - * Copyright (c) 2010 CEA LIST. - * - * - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Tatiana Fesenko (CEA LIST) - Initial API and implementation - * - *****************************************************************************/ -package org.eclipse.papyrus.uml.compare.ui.viewer.content.part.property; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.compare.diff.metamodel.AttributeChange; -import org.eclipse.emf.compare.diff.metamodel.DiffElement; -import org.eclipse.emf.compare.diff.metamodel.DiffGroup; -import org.eclipse.emf.compare.diff.metamodel.ReferenceChange; -import org.eclipse.emf.compare.ui.viewer.content.part.property.PropertyContentProvider; -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * ContentProvider for the Property Tab of the Merge Viewer. - * Used to filter only changes properties in the Merge Property Viewer (Bug 338414) - */ -public class UMLPropertyContentProvider extends PropertyContentProvider { - - /* (non-Javadoc) - * @see org.eclipse.emf.compare.ui.viewer.content.part.property.PropertyContentProvider#getElements(java.lang.Object) - */ - @Override - public Object[] getElements(Object inputElement) { - Object[] elements = super.getElements(inputElement); - if(inputElement instanceof Match2ElementsWithDiff) { - DiffElement diffElement = ((Match2ElementsWithDiff)inputElement).getDiffElement(); - return findRowsForFeatures(elements, getChangedFeatures(diffElement)); - } - return elements; - } - - /** - * Find rows for features. - * - * @param propertyRows the property rows - * @param features the features - * @return the object[] - */ - protected Object[] findRowsForFeatures(Object[] propertyRows, EStructuralFeature[] features) { - List result = new ArrayList(); - for (EStructuralFeature feature : features) { - Object row = findPropertyRowFor(propertyRows, feature); - if(row != null) { - result.add(row); - } - } - return result.toArray(new Object[result.size()]); - } - - /** - * Gets the changed features. - * - * @param diffElement the diff element - * @return the changed features - */ - private EStructuralFeature[] getChangedFeatures(DiffElement diffElement) { - if(diffElement instanceof AttributeChange) { - EStructuralFeature feature = ((AttributeChange)diffElement).getAttribute(); - return new EStructuralFeature[]{feature}; - } - if(diffElement instanceof ReferenceChange) { - EStructuralFeature feature = ((ReferenceChange)diffElement).getReference(); - return new EStructuralFeature[]{feature}; - } - if(diffElement instanceof DiffGroup) { - EList children = ((DiffGroup)diffElement).getSubDiffElements(); - List result = new ArrayList(); - for (DiffElement child: children) { - result.addAll(Arrays.asList(getChangedFeatures(child))); - } - return result.toArray(new EStructuralFeature[result.size()]); - } - return new EStructuralFeature[0]; - } - - - /** - * Find property row for. - * - * @param propertyRows the property rows - * @param feature the feature - * @return the object - */ - private Object findPropertyRowFor(Object[] propertyRows, EStructuralFeature feature) { - for(Object nextRow : propertyRows) { - if(isTheSameFeature(feature, getFeatureFromPropertyRow(nextRow))) { - return nextRow; - } - } - return null; - } - - /** - * Gets the feature from property row. - * - * @param propertyRow the property row - * @return the feature from property row - */ - private EStructuralFeature getFeatureFromPropertyRow(Object propertyRow) { - List row = (List)propertyRow; - return (EStructuralFeature)row.get(0); - } - - /** - * Checks if is the same feature. - * - * @param feature1 the feature1 - * @param feature2 the feature2 - * @return true, if is the same feature - */ - private boolean isTheSameFeature(EStructuralFeature feature1, EStructuralFeature feature2) { - return feature1.getFeatureID() == feature2.getFeatureID() && feature1.getName().equals(feature2.getName()); - } - -} -- cgit v1.2.3