Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2013-10-20 13:26:47 -0400
committerMikaël Barbero2013-10-21 04:45:10 -0400
commitcf5b3021d4a7a9d2ca2f132dac3f4412f0008775 (patch)
tree2de37b1f5ef87d30ba93af837493bb6f5358dc16 /plugins/org.eclipse.emf.compare.ide.ui/src
parent38ec8f53db44c71320ae28500fea5ca8d1a1b09e (diff)
downloadorg.eclipse.emf.compare-cf5b3021d4a7a9d2ca2f132dac3f4412f0008775.tar.gz
org.eclipse.emf.compare-cf5b3021d4a7a9d2ca2f132dac3f4412f0008775.tar.xz
org.eclipse.emf.compare-cf5b3021d4a7a9d2ca2f132dac3f4412f0008775.zip
Use navigatable instead of navigator.
We don't want to call next on content merge viewer when calling next on structure merge viewer. Change-Id: I43b05dd040d43307d1670b34eec68dd33e6cf209
Diffstat (limited to 'plugins/org.eclipse.emf.compare.ide.ui/src')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java13
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java13
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java12
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectNextDiffAction.java12
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectPreviousDiffAction.java13
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java48
6 files changed, 29 insertions, 82 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java
index 434ce7d0f..f5048801c 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/CompareToolBar.java
@@ -19,6 +19,7 @@ import com.google.common.eventbus.Subscribe;
import java.util.EnumSet;
import java.util.List;
+import org.eclipse.compare.INavigatable;
import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.CollapseAllModelAction;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.DropDownMergeMenuAction;
@@ -82,7 +83,7 @@ public class CompareToolBar implements ISelectionChangedListener {
.getDifferenceFilterRegistry());
}
- public final void initToolbar(ToolBarManager toolbarManager, AbstractTreeViewer viewer) {
+ public final void initToolbar(ToolBarManager toolbarManager, AbstractTreeViewer viewer, INavigatable nav) {
compareConfiguration.getEventBus().register(this);
// Add extension point contributions to the structure merge viewer toolbar
@@ -106,15 +107,15 @@ public class CompareToolBar implements ISelectionChangedListener {
toolbarManager.add(new DropDownMergeMenuAction(compareConfiguration, modes));
for (MergeMode mode : modes) {
- toolbarManager.add(createMergeAction(mode, compareConfiguration));
+ toolbarManager.add(createMergeAction(mode, compareConfiguration, nav));
}
for (MergeMode mode : modes) {
toolbarManager.add(createMergeAllNonConflictingAction(mode, compareConfiguration));
}
toolbarManager.add(new Separator());
- toolbarManager.add(new SelectNextDiffAction(compareConfiguration));
- toolbarManager.add(new SelectPreviousDiffAction(compareConfiguration));
+ toolbarManager.add(new SelectNextDiffAction(nav));
+ toolbarManager.add(new SelectPreviousDiffAction(nav));
toolbarManager.add(new Separator());
toolbarManager.add(new ExpandAllModelAction(viewer));
toolbarManager.add(new CollapseAllModelAction(viewer));
@@ -131,10 +132,10 @@ public class CompareToolBar implements ISelectionChangedListener {
toolbarManager.update(true);
}
- private MergeAction createMergeAction(MergeMode mergeMode, EMFCompareConfiguration cc) {
+ private MergeAction createMergeAction(MergeMode mergeMode, EMFCompareConfiguration cc, INavigatable nav) {
IMerger.Registry mergerRegistry = EMFCompareRCPPlugin.getDefault().getMergerRegistry();
MergeAction mergeAction = new MergeAction(cc.getEditingDomain(), mergerRegistry, mergeMode, cc
- .isLeftEditable(), cc.isRightEditable(), cc.getContainer().getNavigator());
+ .isLeftEditable(), cc.isRightEditable(), nav);
mergeActions.add(mergeAction);
return mergeAction;
}
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 2ea8526fb..17e30a969 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
@@ -32,7 +32,6 @@ import java.util.Set;
import org.eclipse.compare.CompareUI;
import org.eclipse.compare.CompareViewerPane;
import org.eclipse.compare.CompareViewerSwitchingPane;
-import org.eclipse.compare.ICompareNavigator;
import org.eclipse.compare.INavigatable;
import org.eclipse.compare.ITypedElement;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
@@ -200,6 +199,8 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
private boolean pseudoConflictsFilterEnabled;
+ private INavigatable navigatable;
+
/**
* Constructor.
*
@@ -227,10 +228,12 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
}
};
+ navigatable = new Navigatable(fAdapterFactory, getViewer());
+
toolBar = new CompareToolBar(structureMergeViewerGrouper, structureMergeViewerFilter,
getCompareConfiguration());
getViewer().addSelectionChangedListener(toolBar);
- toolBar.initToolbar(CompareViewerPane.getToolBarManager(parent), getViewer());
+ toolBar.initToolbar(CompareViewerPane.getToolBarManager(parent), getViewer(), navigatable);
selectionChangeListener = new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
@@ -350,9 +353,6 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
dependencyData = new DependencyData(getCompareConfiguration(), treeViewer);
- INavigatable nav = new Navigatable(fAdapterFactory, treeViewer);
- control.setData(INavigatable.NAVIGATOR_PROPERTY, nav);
-
control.setData(CompareUI.COMPARE_VIEWER_TITLE, "Model differences");
treeRuler = new EMFCompareDiffTreeRuler(control, SWT.NONE, treeViewer, dependencyData);
@@ -603,8 +603,7 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
// refresh caused by the initialization of the viewer filters and the groupe providers.
refreshTitle();
- ICompareNavigator navigator = getCompareConfiguration().getContainer().getNavigator();
- navigator.selectChange(true);
+ navigatable.selectChange(INavigatable.FIRST_CHANGE);
}
});
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java
index df5ce8b25..b0b4eb282 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAction.java
@@ -21,7 +21,7 @@ import com.google.common.base.Preconditions;
import java.util.List;
-import org.eclipse.compare.ICompareNavigator;
+import org.eclipse.compare.INavigatable;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.compare.Diff;
@@ -66,7 +66,7 @@ public class MergeAction extends BaseSelectionListenerAction {
private final List<Diff> selectedDifferences;
- private final ICompareNavigator navigator;
+ private final INavigatable navigatable;
/**
* Constructor.
@@ -75,9 +75,9 @@ public class MergeAction extends BaseSelectionListenerAction {
* The compare configuration object.
*/
public MergeAction(ICompareEditingDomain editingDomain, IMerger.Registry mergerRegistry, MergeMode mode,
- boolean isLeftEditable, boolean isRightEditable, ICompareNavigator navigator) {
+ boolean isLeftEditable, boolean isRightEditable, INavigatable navigatable) {
super(""); //$NON-NLS-1$
- this.navigator = navigator;
+ this.navigatable = navigatable;
Preconditions.checkNotNull(mode);
// at least should be editable
@@ -145,9 +145,9 @@ public class MergeAction extends BaseSelectionListenerAction {
mergerRegistry, mergeRunnable);
editingDomain.getCommandStack().execute(mergeCommand);
- if (navigator != null) {
+ if (navigatable != null) {
// navigator is null in MergeAllNonConflictingAction
- navigator.selectChange(true);
+ navigatable.selectChange(INavigatable.NEXT_CHANGE);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectNextDiffAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectNextDiffAction.java
index 27e8e47b5..491711d28 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectNextDiffAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectNextDiffAction.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
+import org.eclipse.compare.INavigatable;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
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.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -25,8 +24,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
*/
public class SelectNextDiffAction extends Action {
- /** The compare configuration object used to get the compare model. */
- private EMFCompareConfiguration configuration;
+ private final INavigatable navigatable;
/**
* Constructor.
@@ -34,8 +32,8 @@ public class SelectNextDiffAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public SelectNextDiffAction(EMFCompareConfiguration configuration) {
- this.configuration = configuration;
+ public SelectNextDiffAction(INavigatable navigatable) {
+ this.navigatable = navigatable;
setToolTipText(EMFCompareIDEUIMessages.getString("next.diff.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/next_diff.gif")); //$NON-NLS-1$
@@ -49,6 +47,6 @@ public class SelectNextDiffAction extends Action {
@Override
public void run() {
// Select next diff
- EMFCompareUIActionUtil.navigate(true, configuration);
+ navigatable.selectChange(INavigatable.NEXT_CHANGE);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectPreviousDiffAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectPreviousDiffAction.java
index 856b81c99..72e954a7d 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectPreviousDiffAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectPreviousDiffAction.java
@@ -10,10 +10,9 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
+import org.eclipse.compare.INavigatable;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
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.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -25,8 +24,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
*/
public class SelectPreviousDiffAction extends Action {
- /** The compare configuration object used to get the compare model. */
- private EMFCompareConfiguration configuration;
+ private final INavigatable navigatable;
/**
* Constructor.
@@ -34,8 +32,8 @@ public class SelectPreviousDiffAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public SelectPreviousDiffAction(EMFCompareConfiguration configuration) {
- this.configuration = configuration;
+ public SelectPreviousDiffAction(INavigatable navigatable) {
+ this.navigatable = navigatable;
setToolTipText(EMFCompareIDEUIMessages.getString("previous.diff.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/prev_diff.gif")); //$NON-NLS-1$
@@ -48,7 +46,6 @@ public class SelectPreviousDiffAction extends Action {
*/
@Override
public void run() {
- // Select prev diff
- EMFCompareUIActionUtil.navigate(false, configuration);
+ navigatable.selectChange(INavigatable.PREVIOUS_CHANGE);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java
deleted file mode 100644
index 05ff425d7..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013 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.emf.compare.ide.ui.internal.structuremergeviewer.actions.util;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareNavigator;
-import org.eclipse.compare.ICompareNavigator;
-
-/**
- * Util class that provides utilities methods for IDE UI actions.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public final class EMFCompareUIActionUtil {
-
- /**
- * Utility classes don't need a default constructor.
- */
- private EMFCompareUIActionUtil() {
- // Hides default constructor.
- }
-
- /**
- * Called by the framework to navigate to the next (or previous) difference. This will open the content
- * viewer for the next (or previous) diff displayed in the structure viewer.
- *
- * @param next
- * <code>true</code> if we are to open the next structure viewer's diff, <code>false</code> if
- * we should go to the previous instead.
- * @param configuration
- * the compare configuration object.
- */
- public static void navigate(boolean next, CompareConfiguration configuration) {
- final ICompareNavigator navigator = configuration.getContainer().getNavigator();
- if (navigator instanceof CompareNavigator && ((CompareNavigator)navigator).hasChange(next)) {
- navigator.selectChange(next);
- }
- }
-}

Back to the top