Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Borkowski2015-05-13 10:01:57 +0000
committerAxel RICHARD2015-05-22 06:58:25 +0000
commit1b857b4643d1350ca5b26aa0793801b612139d5a (patch)
tree16a73ef299a1ef9b5f489363802e7a5a7b9d4933 /plugins
parentd8b87cecb1a4c85496d780c2b350e0ec938488c2 (diff)
downloadorg.eclipse.emf.compare-1b857b4643d1350ca5b26aa0793801b612139d5a.tar.gz
org.eclipse.emf.compare-1b857b4643d1350ca5b26aa0793801b612139d5a.tar.xz
org.eclipse.emf.compare-1b857b4643d1350ca5b26aa0793801b612139d5a.zip
[467191] Add label for comparing equivalent models
Comparing equivalently changed models means that only pseudo changes are present, which are filtered out by default. A message indicating this specific case allows the user to easier understand that the models are equivalent (instead of just stating that all conflicts have been filtered from the view). Bug: 467191 Change-Id: Ibcf140488cc25e3015d58514f9803a9c6ae26394 Signed-off-by: Michael Borkowski <mborkowski@eclipsesource.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/plugin.xml12
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsCompareInput.java66
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsContentViewer.java33
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsViewerCreator.java35
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java17
6 files changed, 163 insertions, 5 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/plugin.xml b/plugins/org.eclipse.emf.compare.ide.ui/plugin.xml
index 26b6aac42..c12f108df 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.compare.ide.ui/plugin.xml
@@ -10,7 +10,8 @@
Contributors:
Obeo - initial API and implementation
- Stefan Dirix - Bug 456699
+ Stefan Dirix - bug 456699
+ Michael Borkowski - bug 467191
-->
<plugin>
@@ -81,6 +82,12 @@
label="%emf.compare.no.visible.item.viewer">
</viewer>
<viewer
+ class="org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.label.OnlyPseudoConflictsViewerCreator"
+ extensions="org.eclipse.emf.compare.rcp.ui.eOnlyPseudoConflicts"
+ id="org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.OnlyPseudoConflictsViewer"
+ label="%emf.compare.only.pseudo.conflicts.viewer">
+ </viewer>
+ <viewer
class="org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.TextFallbackCompareViewerCreator"
extensions=
"org.eclipse.emf.compare.rcp.ui.fallbackText,
@@ -90,7 +97,8 @@
org.eclipse.emf.compare.rcp.ui.eListDiff,
org.eclipse.emf.compare.rcp.ui.eTextDiff,
org.eclipse.emf.compare.rcp.ui.eNoDiff,
- org.eclipse.emf.compare.rcp.ui.eNoVisibleItem"
+ org.eclipse.emf.compare.rcp.ui.eNoVisibleItem,
+ org.eclipse.emf.compare.rcp.ui.eOnlyPseudoConflicts"
id="org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.TextFallbackCompareViewer"
label="%emf.compare.fallback.textcompare">
</viewer>
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsCompareInput.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsCompareInput.java
new file mode 100644
index 000000000..2ac44b8f5
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsCompareInput.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2015 EclipseSource Muenchen GmbH and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Michael Borkowski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.label;
+
+import org.eclipse.compare.ITypedElement;
+import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.ForwardingCompareInput;
+
+/**
+ * A compare input whose purpose is to support a comparison with only pseudo-conflicts.
+ *
+ * @author Michael Borkowski <mborkowski@eclipsesource.com>
+ */
+public class OnlyPseudoConflictsCompareInput extends ForwardingCompareInput {
+
+ /**
+ * @param compareInput
+ */
+ public OnlyPseudoConflictsCompareInput(ICompareInput compareInput) {
+ super(compareInput);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.ForwardingCompareInput#createForwardingTypedElement(org.eclipse.compare.ITypedElement)
+ */
+ @Override
+ protected ForwardingTypedElement createForwardingTypedElement(ITypedElement typedElement) {
+ return new OnlyPseudoConflictsTypedElement(typedElement);
+ }
+
+ /**
+ * A specific {@link ITypedElement} to use with
+ * {@link org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.label.OnlyPseudoConflictsCompareInput}
+ * .
+ *
+ * @author MB
+ */
+ class OnlyPseudoConflictsTypedElement extends ForwardingTypedElement {
+
+ /**
+ * @param delegate
+ */
+ public OnlyPseudoConflictsTypedElement(ITypedElement delegate) {
+ super(delegate);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getType() {
+ return "org.eclipse.emf.compare.rcp.ui.eOnlyPseudoConflicts"; //$NON-NLS-1$
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsContentViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsContentViewer.java
new file mode 100644
index 000000000..b9db6f77d
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsContentViewer.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2015 EclipseSource Muenchen GmbH and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Michael Borkowski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.label;
+
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * A {@link LabelContentViewer} in case of a comparison with only pseudo-conflicts.
+ *
+ * @author Michael Borkowski <mborkowski@eclipsesource.com>
+ */
+public class OnlyPseudoConflictsContentViewer extends LabelContentViewer {
+
+ /**
+ * Creates a new viewer and its controls.
+ *
+ * @param parent
+ * the parent of the control of this viewer.
+ */
+ public OnlyPseudoConflictsContentViewer(Composite parent) {
+ super(parent, EMFCompareIDEUIMessages.getString("only.pseudo.conflicts.viewer.title"), //$NON-NLS-1$
+ EMFCompareIDEUIMessages.getString("only.pseudo.conflicts.viewer.desc")); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsViewerCreator.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsViewerCreator.java
new file mode 100644
index 000000000..71f1c5374
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/label/OnlyPseudoConflictsViewerCreator.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2015 EclipseSource Muenchen GmbH and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Michael Borkowski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.label;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.IViewerCreator;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Creates an empty viewer with a single centered label which says there are only pseudo-conflicts for the
+ * comparison.
+ *
+ * @author Michael Borkowski <mborkowski@eclipsesource.com>
+ */
+public class OnlyPseudoConflictsViewerCreator implements IViewerCreator {
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.compare.IViewerCreator#createViewer(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.compare.CompareConfiguration)
+ */
+ public Viewer createViewer(final Composite parent, CompareConfiguration config) {
+ return new OnlyPseudoConflictsContentViewer(parent);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties
index b506e6d4f..a1c34851c 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/ide_ui_messages.properties
@@ -8,7 +8,8 @@
# Contributors:
# Obeo - initial API and implementation
# Philip Langer - log entries for model merge
-# Stefan Dirix - Bug 456699
+# Stefan Dirix - bug 456699
+# Michael Borkowski - bug 467191
################################################################################
## ! note ! double the apostrophes if you need one in the printed String
EMFSynchronizationModel.resolving = Creating EMF Synchronization Model
@@ -52,6 +53,8 @@ no.differences.viewer.desc = No differences detected for this comparison.
no.differences.viewer.title = No differences detected.
no.visible.item.viewer.desc = No visible item with this set of filters/group.\nPlease enable/disable filters, or change group to see items.
no.visible.item.viewer.title = No visible item.
+only.pseudo.conflicts.viewer.desc = There are only pseudo-conflicts for this comparison, making the models equivalent.\nTo view the pseudo-conflicts, change the filter settings.
+only.pseudo.conflicts.viewer.title = Only pseudo-conflicts.
no.selected.item.viewer.desc = No selected item in the top panel.
no.selected.item.viewer.title = No selected item.
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
index b68a81bfb..4b72024bd 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013, 2015 Obeo.
+ * Copyright (c) 2013, 2015 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
+ * Michael Borkowski - bug 467191
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;
@@ -20,6 +21,7 @@ import com.google.common.base.Predicate;
import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
+import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.eventbus.Subscribe;
@@ -65,6 +67,7 @@ import org.eclipse.emf.common.util.BasicMonitor;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.ConflictKind;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.EMFCompare;
@@ -80,6 +83,7 @@ import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.label.NoDifferencesCompareInput;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.label.NoVisibleItemCompareInput;
+import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.label.OnlyPseudoConflictsCompareInput;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.EMFCompareColor;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.RedoAction;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.UndoAction;
@@ -116,6 +120,7 @@ import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.filters.IDifferenceFi
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProviderChange;
import org.eclipse.emf.compare.scope.IComparisonScope;
+import org.eclipse.emf.compare.utils.EMFComparePredicates;
import org.eclipse.emf.compare.utils.IDiagnosable;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
@@ -1100,13 +1105,21 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
if (differences.isEmpty()) {
navigatable.fireOpen(new NoDifferencesCompareInput(compareInput));
} else if (!navigatable.hasChange(INavigatable.FIRST_CHANGE)) {
- navigatable.fireOpen(new NoVisibleItemCompareInput(compareInput));
+ if (hasOnlyPseudoConflicts(differences)) {
+ navigatable.fireOpen(new OnlyPseudoConflictsCompareInput(compareInput));
+ } else {
+ navigatable.fireOpen(new NoVisibleItemCompareInput(compareInput));
+ }
} else {
navigatable.selectChange(INavigatable.FIRST_CHANGE);
}
}
}
+ private boolean hasOnlyPseudoConflicts(List<Diff> differences) {
+ return Iterators.all(differences.iterator(), EMFComparePredicates.hasConflict(ConflictKind.PSEUDO));
+ }
+
private void updateLayout(boolean displayProgress, boolean doLayout) {
((GridData)progressInfoItem.getLayoutData()).exclude = !displayProgress;
progressInfoItem.setVisible(displayProgress);

Back to the top