diff options
author | Philip Langer | 2017-09-18 14:15:39 +0000 |
---|---|---|
committer | Laurent Goubet | 2018-12-11 10:23:11 +0000 |
commit | 745ca4b14982b775fa250f66acb886f08d08869d (patch) | |
tree | 61c8023d910fe201f1cb93496c3adef1dc0ea43a /plugins/org.eclipse.emf.compare.rcp.ui/src/org | |
parent | 6cdc8d9966f34103b157687a6a34d09bc9b8acc3 (diff) | |
download | org.eclipse.emf.compare-745ca4b14982b775fa250f66acb886f08d08869d.tar.gz org.eclipse.emf.compare-745ca4b14982b775fa250f66acb886f08d08869d.tar.xz org.eclipse.emf.compare-745ca4b14982b775fa250f66acb886f08d08869d.zip |
[514079] Improve mirroring support
The changes introduced in https://git.eclipse.org/r/#/c/93726/ to
support mirroring are incomplete and lead to a very confusing state. If
the user swapped the sides in the CMV, the SMV tree continues to show
diffs with the same directional overlays. Also the tool bar actions have
the tooltips and operate in the original direction; thus, contradicting
the side shown in the CMV.
With this change, we also adapt the changes in the SMV, if the user
switched the sides in the CMV.
Moreover, this change also simplifies and improves the way how the
mirroring support is implemented by creating a new viewer
when the mirroring state changes instead of switching all the content
and label providers within each implementation class. Thus, this commit
partly reverts the previous change 93726 and replaces it with a more
thorough and straight-forward implementation.
Bug: 514079
Change-Id: Ia91454e421a6916fa8e7d62eded3180f7905b28a
Diffstat (limited to 'plugins/org.eclipse.emf.compare.rcp.ui/src/org')
3 files changed, 23 insertions, 9 deletions
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java index 6beff7ef5..c3c661494 100644 --- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java +++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/configuration/IEMFCompareConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2015 Obeo. + * Copyright (c) 2013, 2018 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 @@ -7,6 +7,7 @@ * * Contributors: * Obeo - initial API and implementation + * Philip Langer - bug 514079 *******************************************************************************/ package org.eclipse.emf.compare.rcp.ui.internal.configuration; @@ -64,4 +65,6 @@ public interface IEMFCompareConfiguration { void setDiffRelationshipComputer(IDiffRelationshipComputer diffRelationshipComputer); boolean getBooleanProperty(String key, boolean dflt); + + boolean isMirrored(); } diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/impl/AbstractMergeViewer.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/impl/AbstractMergeViewer.java index c19571ccb..4639f835b 100644 --- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/impl/AbstractMergeViewer.java +++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/impl/AbstractMergeViewer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Obeo. + * Copyright (c) 2012, 2018 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Obeo - initial API and implementation + * Philip Langer - bug 514079 *******************************************************************************/ package org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.impl; @@ -67,6 +68,20 @@ public abstract class AbstractMergeViewer extends ContentViewer implements IMerg } /** + * Returns the effective side taking into account {@link CompareConfiguration#isMirrored()} to switch left + * and right. + * + * @param side + * @return the effective side with respect to mirroring. + */ + protected MergeViewerSide getEffectiveSide() { + if (getCompareConfiguration().isMirrored()) { + return getSide().opposite(); + } + return getSide(); + } + + /** * Returns the compare configuration object used by this viewer. * * @return the compare configuration object used by this viewer. diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/impl/AbstractTableOrTreeMergeViewer.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/impl/AbstractTableOrTreeMergeViewer.java index efbeb30e2..decd275a5 100644 --- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/impl/AbstractTableOrTreeMergeViewer.java +++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/mergeviewer/impl/AbstractTableOrTreeMergeViewer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2017 Obeo and others. + * Copyright (c) 2012, 2018 Obeo and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,11 +7,7 @@ * * Contributors: * Obeo - initial API and implementation -<<<<<<< master - * Philip Langer - bug 527858 -======= - * Philip Langer - bug 527567 ->>>>>>> dde9ebc [527567] Generalize the table and tree merge viewer framework + * Philip Langer - bug 527858, 514079, 527567 *******************************************************************************/ package org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.impl; @@ -198,7 +194,7 @@ public abstract class AbstractTableOrTreeMergeViewer extends AbstractStructuredM g.setLineStyle(SWT.LINE_SOLID); } - switch (getSide()) { + switch (getEffectiveSide()) { case LEFT: drawLineFromBoxToCenter(itemWrapper, bounds, g); break; |