Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2013-10-08 04:54:59 -0400
committerMikaël Barbero2013-10-11 10:22:30 -0400
commitb09d1f1e084aaa201b87ee9de2b8d5a8c1611b79 (patch)
treee259b046a4950c64ab00438b738d5e9a36dadde2 /plugins/org.eclipse.emf.compare.ide.ui/src
parentc791695c06779333eefdea940f0a24e062b06411 (diff)
downloadorg.eclipse.emf.compare-b09d1f1e084aaa201b87ee9de2b8d5a8c1611b79.tar.gz
org.eclipse.emf.compare-b09d1f1e084aaa201b87ee9de2b8d5a8c1611b79.tar.xz
org.eclipse.emf.compare-b09d1f1e084aaa201b87ee9de2b8d5a8c1611b79.zip
Make merge action listener to selection instead of SMV constants
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/EMFCompareDiffTreeRuler.java1
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java31
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java59
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java71
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java53
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java111
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java53
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java81
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java53
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java53
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java5
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java5
14 files changed, 205 insertions, 381 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
index 0edae5128..22499aa45 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeRuler.java
@@ -34,7 +34,6 @@ import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.ide.ui.internal.configuration.EMFCompareConfiguration;
import org.eclipse.emf.compare.internal.utils.DiffUtil;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.IDifferenceFilter;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeNode;
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java
index 1492cf570..8b5b64058 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java
@@ -23,14 +23,12 @@ import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.compare.CompareViewerPane;
import org.eclipse.compare.CompareViewerSwitchingPane;
import org.eclipse.compare.INavigatable;
@@ -61,7 +59,6 @@ import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.Save
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.SelectNextDiffAction;
import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.SelectPreviousDiffAction;
import org.eclipse.emf.compare.internal.utils.DiffUtil;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.actions.FilterActionMenu;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.actions.GroupActionMenu;
import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.IDifferenceFilter;
@@ -73,7 +70,6 @@ import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl.
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.tree.TreeNode;
-import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.action.ToolBarManager;
@@ -81,11 +77,9 @@ import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
import org.eclipse.jface.viewers.IElementComparer;
import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
@@ -122,8 +116,6 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
private final Color unmergeableDiffColor;
- private final ISelectionChangedListener fSelectionChangedListener;
-
private final CompareViewerSwitchingPane fParent;
private ToolBarManager toolbarManager;
@@ -192,20 +184,6 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
fParent = null;
}
- fSelectionChangedListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- getControl().redraw();
- getCompareConfiguration()
- .setProperty(EMFCompareConstants.SMV_SELECTION, event.getSelection());
- if (toolbarManager != null) {
- for (IContributionItem item : toolbarManager.getItems()) {
- item.update();
- }
- }
- }
- };
- addSelectionChangedListener(fSelectionChangedListener);
-
fEraseItemListener = new Listener() {
public void handleEvent(Event event) {
EMFCompareDiffTreeViewer.this.handleEraseItemEvent(event);
@@ -688,14 +666,14 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
if (rightEditable && leftEditable) {
toolbarManager.add(new DropDownMergeMenuAction(getCompareConfiguration()));
- toolbarManager.add(new MergeToRightAction(getCompareConfiguration()));
- toolbarManager.add(new MergeToLeftAction(getCompareConfiguration()));
+ toolbarManager.add(new MergeToRightAction(getCompareConfiguration(), this));
+ toolbarManager.add(new MergeToLeftAction(getCompareConfiguration(), this));
toolbarManager.add(new MergeAllToRightAction(getCompareConfiguration()));
toolbarManager.add(new MergeAllToLeftAction(getCompareConfiguration()));
} else {
toolbarManager.add(new DropDownAcceptRejectMenuAction(getCompareConfiguration()));
- toolbarManager.add(new AcceptChangeAction(getCompareConfiguration()));
- toolbarManager.add(new RejectChangeAction(getCompareConfiguration()));
+ toolbarManager.add(new AcceptChangeAction(getCompareConfiguration(), this));
+ toolbarManager.add(new RejectChangeAction(getCompareConfiguration(), this));
toolbarManager.add(new AcceptAllChangesAction(getCompareConfiguration()));
toolbarManager.add(new RejectAllChangesAction(getCompareConfiguration()));
}
@@ -827,7 +805,6 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
@Override
protected void handleDispose(DisposeEvent event) {
getControl().removeListener(SWT.EraseItem, fEraseItemListener);
- removeSelectionChangedListener(fSelectionChangedListener);
super.handleDispose(event);
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java
index d64b7e2a9..c76bc6e30 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java
@@ -23,33 +23,40 @@ import org.eclipse.emf.compare.domain.ICompareEditingDomain;
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.emf.compare.internal.utils.DiffUtil;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.change.util.ChangeRecorder;
import org.eclipse.emf.edit.command.ChangeCommand;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
/**
* Abstract action that manages the accept and reject actions (when one side of a diff is not editable).
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
-public abstract class AbstractAcceptRejectAction extends Action {
+public abstract class AbstractAcceptRejectAction extends Action implements ISelectionChangedListener {
/** The compare configuration object used to get the compare model. */
private final EMFCompareConfiguration configuration;
+ private final ISelectionProvider selectionProvider;
+
/**
* Constructor.
*
* @param configuration
* The compare configuration object.
*/
- public AbstractAcceptRejectAction(EMFCompareConfiguration configuration) {
+ public AbstractAcceptRejectAction(EMFCompareConfiguration configuration,
+ ISelectionProvider selectionProvider) {
this.configuration = configuration;
+ this.selectionProvider = selectionProvider;
+ selectionProvider.addSelectionChangedListener(this);
}
/**
@@ -59,7 +66,7 @@ public abstract class AbstractAcceptRejectAction extends Action {
*/
@Override
public void run() {
- ISelection selection = (ISelection)configuration.getProperty(EMFCompareConstants.SMV_SELECTION);
+ ISelection selection = selectionProvider.getSelection();
if (selection instanceof IStructuredSelection) {
Object diffNode = ((IStructuredSelection)selection).getFirstElement();
if (diffNode instanceof Adapter) {
@@ -93,29 +100,6 @@ public abstract class AbstractAcceptRejectAction extends Action {
}
/**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.action.Action#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- ISelection selection = (ISelection)configuration.getProperty(EMFCompareConstants.SMV_SELECTION);
- if (selection instanceof IStructuredSelection) {
- Object diffNode = ((IStructuredSelection)selection).getFirstElement();
- if (diffNode instanceof Adapter) {
- Notifier target = ((Adapter)diffNode).getTarget();
- if (target instanceof TreeNode) {
- EObject data = ((TreeNode)target).getData();
- if (data instanceof Diff) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
* Check if the way of merge of the given diff correspond to a copy or a simple change state (unresolved
* to merged).
*
@@ -147,6 +131,27 @@ public abstract class AbstractAcceptRejectAction extends Action {
}
/**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ boolean ret = false;
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object diffNode = ((IStructuredSelection)selection).getFirstElement();
+ if (diffNode instanceof Adapter) {
+ Notifier target = ((Adapter)diffNode).getTarget();
+ if (target instanceof TreeNode) {
+ EObject data = ((TreeNode)target).getData();
+ ret = data instanceof Diff;
+ }
+ }
+ }
+ setEnabled(ret);
+ }
+
+ /**
* A specific {@link ChangeCommand} that change the state of the given diff and all its required diffs
* from {@link DifferenceState#UNRESOLVED} to {@link DifferenceState#MERGED}.
*
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java
index 75cc3e851..b7e547bf5 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java
@@ -10,18 +10,19 @@
*******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
-import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.compare.Diff;
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.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
/**
* Abstract Action that manages a merge of a difference in case of both sides of the comparison are editable.
@@ -29,10 +30,12 @@ import org.eclipse.jface.viewers.IStructuredSelection;
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
* @since 3.0
*/
-public abstract class AbstractMergeAction extends Action {
+public abstract class AbstractMergeAction extends Action implements ISelectionChangedListener {
/** The compare configuration object used to get the compare model. */
- private EMFCompareConfiguration configuration;
+ private final EMFCompareConfiguration configuration;
+
+ private final ISelectionProvider selectionProvider;
/**
* Constructor.
@@ -40,8 +43,10 @@ public abstract class AbstractMergeAction extends Action {
* @param configuration
* The compare configuration object.
*/
- public AbstractMergeAction(EMFCompareConfiguration configuration) {
+ public AbstractMergeAction(EMFCompareConfiguration configuration, ISelectionProvider selectionProvider) {
this.configuration = configuration;
+ this.selectionProvider = selectionProvider;
+ selectionProvider.addSelectionChangedListener(this);
}
/**
@@ -51,7 +56,7 @@ public abstract class AbstractMergeAction extends Action {
*/
@Override
public void run() {
- ISelection selection = (ISelection)configuration.getProperty(EMFCompareConstants.SMV_SELECTION);
+ ISelection selection = selectionProvider.getSelection();
if (selection instanceof IStructuredSelection) {
Object diffNode = ((IStructuredSelection)selection).getFirstElement();
if (diffNode instanceof Adapter) {
@@ -69,29 +74,6 @@ public abstract class AbstractMergeAction extends Action {
}
/**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.action.Action#isEnabled()
- */
- @Override
- public boolean isEnabled() {
- ISelection selection = (ISelection)configuration.getProperty(EMFCompareConstants.SMV_SELECTION);
- if (selection instanceof IStructuredSelection) {
- Object diffNode = ((IStructuredSelection)selection).getFirstElement();
- if (diffNode instanceof Adapter) {
- Notifier target = ((Adapter)diffNode).getTarget();
- if (target instanceof TreeNode) {
- EObject data = ((TreeNode)target).getData();
- if (data instanceof Diff) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
* Get the compare configuration object.
*
* @return the configuration
@@ -101,16 +83,6 @@ public abstract class AbstractMergeAction extends Action {
}
/**
- * Set the compare configuration object.
- *
- * @param configuration
- * the configuration to set
- */
- public void setConfiguration(EMFCompareConfiguration configuration) {
- this.configuration = configuration;
- }
-
- /**
* Copy the diff.
*
* @param diff
@@ -118,4 +90,25 @@ public abstract class AbstractMergeAction extends Action {
*/
protected abstract void copyDiff(Diff diff);
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ boolean ret = false;
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object diffNode = ((IStructuredSelection)selection).getFirstElement();
+ if (diffNode instanceof Adapter) {
+ Notifier target = ((Adapter)diffNode).getTarget();
+ if (target instanceof TreeNode) {
+ EObject data = ((TreeNode)target).getData();
+ ret = data instanceof Diff;
+ }
+ }
+ }
+ setEnabled(ret);
+ }
+
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java
index a6cfc67e9..701a3317c 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.compare.DifferenceSource;
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.jface.viewers.ISelectionProvider;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -33,8 +34,8 @@ public class AcceptChangeAction extends AbstractAcceptRejectAction {
* @param configuration
* The compare configuration object.
*/
- public AcceptChangeAction(EMFCompareConfiguration configuration) {
- super(configuration);
+ public AcceptChangeAction(EMFCompareConfiguration configuration, ISelectionProvider selectionProvider) {
+ super(configuration, selectionProvider);
setToolTipText(EMFCompareIDEUIMessages.getString("accept.change.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/accept_change.gif")); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java
deleted file mode 100644
index b9cf3dff2..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java
+++ /dev/null
@@ -1,53 +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;
-
-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.jface.action.Action;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Action that manages the click on the menu item "show consequences of accepting change" in the dropdown menu
- * of the toolbar of the structure merge viewer when one side only is readable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class DropDownAcceptAction extends Action {
-
- /** The compare configuration object used to get the compare model. */
- private EMFCompareConfiguration configuration;
-
- /**
- * Constructor.
- *
- * @param configuration
- * The compare configuration object.
- */
- public DropDownAcceptAction(EMFCompareConfiguration configuration) {
- this.configuration = configuration;
- setText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- configuration.setPreviewMergeMode(true);
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java
index 3f757d7b6..5e554a711 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
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.rcp.ui.internal.configuration.EMFCompareConfigurationChangeListener;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
@@ -29,16 +30,18 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreator {
/** The compare configuration object used to get the compare model. */
- private EMFCompareConfiguration configuration;
+ private final EMFCompareConfiguration configuration;
/** The menu associated with this action. */
private Menu fMenu;
/** The accept menu item. */
- private Action acceptItem;
+ private final Action acceptItem;
/** The reject menu item. */
- private Action rejectItem;
+ private final Action rejectItem;
+
+ private final EMFCompareConfigurationChangeListener changeListener;
/**
* Constructor.
@@ -46,27 +49,23 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
* @param configuration
* The compare configuration object.
*/
- public DropDownAcceptRejectMenuAction(final EMFCompareConfiguration configuration) {
+ public DropDownAcceptRejectMenuAction(EMFCompareConfiguration configuration) {
this.configuration = configuration;
setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/accept.gif")); //$NON-NLS-1$
- acceptItem = new DropDownAcceptAction(configuration) {
+ changeListener = new EMFCompareConfigurationChangeListener() {
@Override
- public void run() {
- super.run();
- updateMenu();
+ public void previewMergeModeChange(Boolean oldValue, Boolean newValue) {
+ updateMenu(newValue.booleanValue());
}
};
+ configuration.addChangeListener(changeListener);
- rejectItem = new DropDownRejectAction(configuration) {
- @Override
- public void run() {
- super.run();
- updateMenu();
- }
- };
+ acceptItem = new DropDownAction(configuration, true);
+ rejectItem = new DropDownAction(configuration, false);
+ updateMenu(configuration.getPreviewMergeMode());
setMenuCreator(this);
}
@@ -79,31 +78,7 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
@Override
public void run() {
boolean mergeWay = configuration.getPreviewMergeMode();
- boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
- boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
- if (mergeWay) {
- configuration.setPreviewMergeMode(false);
- if (leftEditableOnly) {
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/reject.gif")); //$NON-NLS-1$
- setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.reject.tooltip")); //$NON-NLS-1$
- } else if (rightEditableOnly) {
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
- setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
- }
- } else {
- configuration.setPreviewMergeMode(true);
- if (leftEditableOnly) {
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
- setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
- } else if (rightEditableOnly) {
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/reject.gif")); //$NON-NLS-1$
- setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.reject.tooltip")); //$NON-NLS-1$
- }
- }
+ configuration.setPreviewMergeMode(!mergeWay);
}
/**
@@ -116,6 +91,7 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
fMenu.dispose();
fMenu = null;
}
+ configuration.removeChangeListener(changeListener);
}
/**
@@ -160,8 +136,7 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
/**
* Update the icon and tooltip of the dropdown menu.
*/
- protected void updateMenu() {
- boolean mergeWay = configuration.getPreviewMergeMode();
+ protected void updateMenu(boolean mergeWay) {
boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
if (mergeWay) {
@@ -186,4 +161,56 @@ public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreat
}
}
}
+
+ private static class DropDownAction extends Action {
+
+ /** The compare configuration object used to get the compare model. */
+ private final EMFCompareConfiguration configuration;
+
+ private final boolean mode;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public DropDownAction(EMFCompareConfiguration configuration, boolean mode) {
+ this.configuration = configuration;
+ this.mode = mode;
+ boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
+ boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
+ if (mode) {
+ if (leftEditableOnly) {
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+ EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
+ setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
+ } else if (rightEditableOnly) {
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+ EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/reject.gif")); //$NON-NLS-1$
+ setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.reject.tooltip")); //$NON-NLS-1$
+ }
+ } else {
+ if (leftEditableOnly) {
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+ EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/reject.gif")); //$NON-NLS-1$
+ setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.reject.tooltip")); //$NON-NLS-1$
+ } else if (rightEditableOnly) {
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+ EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
+ setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.tooltip")); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ configuration.setPreviewMergeMode(mode);
+ }
+ }
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java
deleted file mode 100644
index ab3114ba3..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java
+++ /dev/null
@@ -1,53 +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;
-
-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.jface.action.Action;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Action that manages the click on the menu item "show consequences of merge from left to right" in the
- * dropdown menu of the toolbar of the structure merge viewer when both sides are writeable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class DropDownLeftToRightAction extends Action {
-
- /** The compare configuration object used to get the compare model. */
- private EMFCompareConfiguration configuration;
-
- /**
- * Constructor.
- *
- * @param configuration
- * The compare configuration object.
- */
- public DropDownLeftToRightAction(EMFCompareConfiguration configuration) {
- this.configuration = configuration;
- setText(EMFCompareIDEUIMessages.getString("dropdown.left.to.right.tooltip")); //$NON-NLS-1$
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- configuration.setPreviewMergeMode(true);
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java
index 5d512c732..b853b8465 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java
@@ -13,6 +13,7 @@ package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
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.rcp.ui.internal.configuration.EMFCompareConfigurationChangeListener;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
@@ -28,16 +29,18 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class DropDownMergeMenuAction extends Action implements IMenuCreator {
/** The compare configuration object. */
- private EMFCompareConfiguration configuration;
+ private final EMFCompareConfiguration configuration;
/** The menu associated with this action. */
private Menu fMenu;
/** The left to right menu item. */
- private Action leftToRightItem;
+ private final Action leftToRightItem;
/** The right to left menu item. */
- private Action rightToLeftItem;
+ private final Action rightToLeftItem;
+
+ private final EMFCompareConfigurationChangeListener changeListener;
/**
* Constructor.
@@ -51,21 +54,17 @@ public class DropDownMergeMenuAction extends Action implements IMenuCreator {
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
- leftToRightItem = new DropDownLeftToRightAction(configuration) {
+ changeListener = new EMFCompareConfigurationChangeListener() {
@Override
- public void run() {
- super.run();
- updateMenu();
+ public void previewMergeModeChange(Boolean oldValue, Boolean newValue) {
+ updateMenu(newValue.booleanValue());
}
};
+ configuration.addChangeListener(changeListener);
- rightToLeftItem = new DropDownRightToLeftAction(configuration) {
- @Override
- public void run() {
- super.run();
- updateMenu();
- }
- };
+ leftToRightItem = new DropDownAction(configuration, true);
+ rightToLeftItem = new DropDownAction(configuration, false);
+ updateMenu(configuration.getPreviewMergeMode());
setMenuCreator(this);
}
@@ -78,15 +77,7 @@ public class DropDownMergeMenuAction extends Action implements IMenuCreator {
@Override
public void run() {
boolean mergeWay = configuration.getPreviewMergeMode();
- if (mergeWay) {
- configuration.setPreviewMergeMode(false);
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/right_to_left.gif")); //$NON-NLS-1$
- } else {
- configuration.setPreviewMergeMode(true);
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
- }
+ configuration.setPreviewMergeMode(!mergeWay);
}
/**
@@ -99,6 +90,7 @@ public class DropDownMergeMenuAction extends Action implements IMenuCreator {
fMenu.dispose();
fMenu = null;
}
+ configuration.removeChangeListener(changeListener);
}
/**
@@ -143,14 +135,53 @@ public class DropDownMergeMenuAction extends Action implements IMenuCreator {
/**
* Update the icon and tooltip of the dropdown menu.
*/
- protected void updateMenu() {
- boolean mergeWay = configuration.getPreviewMergeMode();
+ protected void updateMenu(boolean mergeWay) {
if (mergeWay) {
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
+ setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.left.to.right.tooltip")); //$NON-NLS-1$
} else {
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/right_to_left.gif")); //$NON-NLS-1$
+ setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.right.to.left.tooltip")); //$NON-NLS-1$
+ }
+ }
+
+ private static class DropDownAction extends Action {
+
+ /** The compare configuration object used to get the compare model. */
+ private final EMFCompareConfiguration configuration;
+
+ private final boolean mode;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public DropDownAction(EMFCompareConfiguration configuration, boolean mode) {
+ this.configuration = configuration;
+ this.mode = mode;
+ if (mode) {
+ setText(EMFCompareIDEUIMessages.getString("dropdown.left.to.right.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+ EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
+ } else {
+ setText(EMFCompareIDEUIMessages.getString("dropdown.right.to.left.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(
+ EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/right_to_left.gif")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ configuration.setPreviewMergeMode(mode);
}
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java
deleted file mode 100644
index 5125fa74f..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java
+++ /dev/null
@@ -1,53 +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;
-
-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.jface.action.Action;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Action that manages the click on the menu item "show consequences of rejecting change" in the dropdown menu
- * of the toolbar of the structure merge viewer when one side only is readable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class DropDownRejectAction extends Action {
-
- /** The compare configuration object used to get the compare model. */
- private EMFCompareConfiguration configuration;
-
- /**
- * Constructor.
- *
- * @param configuration
- * The compare configuration object.
- */
- public DropDownRejectAction(EMFCompareConfiguration configuration) {
- this.configuration = configuration;
- setText(EMFCompareIDEUIMessages.getString("dropdown.reject.tooltip")); //$NON-NLS-1$
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/reject.gif")); //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- configuration.setPreviewMergeMode(false);
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java
deleted file mode 100644
index 0ea3b7196..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java
+++ /dev/null
@@ -1,53 +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;
-
-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.jface.action.Action;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Action that manages the click on the menu item "show consequences of merge from right to left" in the
- * dropdown menu of the toolbar of the structure merge viewer when both sides are writeable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class DropDownRightToLeftAction extends Action {
-
- /** The compare configuration object used to get the compare model. */
- private EMFCompareConfiguration configuration;
-
- /**
- * Constructor.
- *
- * @param configuration
- * The compare configuration object.
- */
- public DropDownRightToLeftAction(EMFCompareConfiguration configuration) {
- this.configuration = configuration;
- setText(EMFCompareIDEUIMessages.getString("dropdown.right.to.left.tooltip")); //$NON-NLS-1$
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/right_to_left.gif")); //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- configuration.setPreviewMergeMode(false);
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java
index 7bf867d56..e384dfc37 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java
@@ -15,6 +15,7 @@ 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.viewers.ISelectionProvider;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -32,8 +33,8 @@ public class MergeToLeftAction extends AbstractMergeAction {
* @param configuration
* The compare configuration object.
*/
- public MergeToLeftAction(EMFCompareConfiguration configuration) {
- super(configuration);
+ public MergeToLeftAction(EMFCompareConfiguration configuration, ISelectionProvider selectionProvider) {
+ super(configuration, selectionProvider);
setToolTipText(EMFCompareIDEUIMessages.getString("merged.to.left.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/merge_to_left.gif")); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java
index 15c188fd0..d5e5131bb 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java
@@ -15,6 +15,7 @@ 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.viewers.ISelectionProvider;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -32,8 +33,8 @@ public class MergeToRightAction extends AbstractMergeAction {
* @param configuration
* The compare configuration object.
*/
- public MergeToRightAction(EMFCompareConfiguration configuration) {
- super(configuration);
+ public MergeToRightAction(EMFCompareConfiguration configuration, ISelectionProvider selectionProvider) {
+ super(configuration, selectionProvider);
setToolTipText(EMFCompareIDEUIMessages.getString("merged.to.right.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/merge_to_right.gif")); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java
index 5d7259e60..33a4c6a61 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java
@@ -17,6 +17,7 @@ import org.eclipse.emf.compare.DifferenceSource;
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.jface.viewers.ISelectionProvider;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
@@ -33,8 +34,8 @@ public class RejectChangeAction extends AbstractAcceptRejectAction {
* @param configuration
* The compare configuration object.
*/
- public RejectChangeAction(EMFCompareConfiguration configuration) {
- super(configuration);
+ public RejectChangeAction(EMFCompareConfiguration configuration, ISelectionProvider selectionProvider) {
+ super(configuration, selectionProvider);
setToolTipText(EMFCompareIDEUIMessages.getString("reject.change.tooltip")); //$NON-NLS-1$
setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
"icons/full/toolb16/reject_change.gif")); //$NON-NLS-1$

Back to the top