Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2013-10-01 10:27:09 -0400
committerGerrit Code Review @ Eclipse.org2013-10-02 10:47:07 -0400
commit121830947f4ef4e39031fa82b71a444b58b62b7c (patch)
tree199ec7b18442021cf542dd340ad339f7727d8506 /plugins/org.eclipse.emf.compare.ide.ui/src
parent1e1453a29d3df6d5bc70d6d5368397485279e884 (diff)
downloadorg.eclipse.emf.compare-121830947f4ef4e39031fa82b71a444b58b62b7c.tar.gz
org.eclipse.emf.compare-121830947f4ef4e39031fa82b71a444b58b62b7c.tar.xz
org.eclipse.emf.compare-121830947f4ef4e39031fa82b71a444b58b62b7c.zip
Give up handlers/commands - Back to actions
Limitations of handlers/commands don't allow us to do what we want. Actions do. Change-Id: I343122dd947b65f0d6130c0ba90df04890b7ec19
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/ide_ui_messages.properties19
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareDiffTreeViewer.java125
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractAcceptRejectChange.java)73
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAllAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractAcceptRejectAllChanges.java)51
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractMergeHandler.java)75
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAllAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractMergeAllHandler.java)41
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptAllChangesAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AcceptChange.java)26
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/RejectAllChanges.java)30
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/CollapseAllModelAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/actions/collapse/CollapseAllModelAction.java)82
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java54
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java190
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java54
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java157
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java54
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java54
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/ExpandAllModelAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/actions/expand/ExpandAllModelAction.java)86
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java50
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java50
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java52
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java52
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectAllChangesAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AcceptAllChanges.java)31
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/RejectChange.java)25
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SaveComparisonModel.java)259
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectNextDiffAction.java54
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectPreviousDiffAction.java54
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java (renamed from plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/util/EMFCompareUIHandlerUtil.java)24
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectHandler.java141
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectLeftToRight.java52
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectRightToLeft.java51
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownHandler.java109
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownLeftToRight.java53
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownRightToLeft.java51
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeAllToLeftHandler.java28
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeAllToRightHandler.java28
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeToLeftHandler.java29
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeToRightHandler.java30
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SelectNextDiff.java44
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SelectPreviousDiff.java44
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/AcceptRejectChangePropertyTester.java50
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/DiffSelectedPropertyTester.java68
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/MergedToPropertyTester.java48
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/ModelSaveablePropertyTester.java50
42 files changed, 1402 insertions, 1296 deletions
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 656dc96b8..d2acdf6ca 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
@@ -18,5 +18,20 @@ ModelResolverRegistry.invalidRanking = Ranking of resolver ''{0}'' was not a val
ModelResolver.coherenceWarning = Some models were accessible from multiple compared files and have been removed from the scope. This could break their references to the compared models as a result of merge operations.
-dropdown.accept.text = Show consequences of accepting change
-dropdown.reject.text = Show consequences of rejecting change \ No newline at end of file
+resource.not.serializable = Resource is not serializable.
+
+save.model.tooltip = Save Comparison Model
+next.diff.tooltip = Next Difference
+previous.diff.tooltip = Previous Difference
+accept.change.tooltip = Accept Change
+accept.all.changes.tooltip = Accept All Non-Conflicting Changes
+reject.change.tooltip = Reject Change
+reject.all.changes.tooltip = Reject All Non-Conflicting Changes
+merged.to.left.tooltip = Copy Current Change From Right To Left
+merged.to.right.tooltip = Copy Current Change From Left To Right
+merged.all.to.left.tooltip = Copy All Non-Conflicting Changes From Right To Left
+merged.all.to.right.tooltip = Copy All Non-Conflicting Changes From Left To Right
+dropdown.left.to.right.tooltip = Show consequences of merging from left to right
+dropdown.right.to.left.tooltip = Show consequences of merging from right to left
+dropdown.accept.tooltip = Show consequences of accepting change
+dropdown.reject.tooltip = Show consequences of rejecting change
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 0d53cd329..8a32c897e 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
@@ -36,7 +36,6 @@ import org.eclipse.compare.CompareViewerSwitchingPane;
import org.eclipse.compare.INavigatable;
import org.eclipse.compare.structuremergeviewer.DiffTreeViewer;
import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notifier;
@@ -45,9 +44,21 @@ import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.Conflict;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceSource;
-import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.ide.ui.internal.actions.collapse.CollapseAllModelAction;
-import org.eclipse.emf.compare.ide.ui.internal.actions.expand.ExpandAllModelAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AcceptAllChangesAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AcceptChangeAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.CollapseAllModelAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.DropDownAcceptRejectMenuAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.DropDownMergeMenuAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.ExpandAllModelAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.MergeAllToLeftAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.MergeAllToRightAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.MergeToLeftAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.MergeToRightAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.RejectAllChangesAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.RejectChangeAction;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.SaveComparisonModelAction;
+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;
@@ -61,7 +72,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.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
@@ -91,12 +101,8 @@ import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.actions.CommandAction;
import org.eclipse.ui.menus.IMenuService;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.ui.services.IServiceLocator;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
/**
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
@@ -677,98 +683,37 @@ public class EMFCompareDiffTreeViewer extends DiffTreeViewer {
"toolbar:org.eclipse.emf.compare.structuremergeviewer.toolbar");
}
- Bundle uiWorkbenchBundle = Platform.getBundle("org.eclipse.ui.workbench"); //$NON-NLS-1$
- Version junoStart = Version.parseVersion("3.103"); //$NON-NLS-1$
-
- // XXX MBA change to 3.105 once bug #366528 is fixed
- Version keplerStart = Version.parseVersion("3.105"); //$NON-NLS-1$
-
- if (uiWorkbenchBundle != null && uiWorkbenchBundle.getVersion().compareTo(junoStart) >= 0
- && uiWorkbenchBundle.getVersion().compareTo(keplerStart) < 0) {
- addActionsForJuno(toolbarManager);
- }
-
groupActionMenu = new GroupActionMenu(getStructureMergeViewerGrouper(), getGroupsMenuManager(),
getDefaultGroupProvider());
filterActionMenu = new FilterActionMenu(getStructureMergeViewerFilter(), getFiltersMenuManager());
+ boolean leftEditable = getCompareConfiguration().isLeftEditable();
+ boolean rightEditable = getCompareConfiguration().isRightEditable();
+
+ if (rightEditable && leftEditable) {
+ toolbarManager.add(new DropDownMergeMenuAction(getCompareConfiguration()));
+ toolbarManager.add(new MergeToRightAction(getCompareConfiguration()));
+ toolbarManager.add(new MergeToLeftAction(getCompareConfiguration()));
+ 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 AcceptAllChangesAction(getCompareConfiguration()));
+ toolbarManager.add(new RejectAllChangesAction(getCompareConfiguration()));
+ }
+ toolbarManager.add(new Separator());
+ toolbarManager.add(new SelectNextDiffAction(getCompareConfiguration()));
+ toolbarManager.add(new SelectPreviousDiffAction(getCompareConfiguration()));
toolbarManager.add(new Separator());
toolbarManager.add(new ExpandAllModelAction(this));
toolbarManager.add(new CollapseAllModelAction(this));
toolbarManager.add(new Separator());
toolbarManager.add(groupActionMenu);
toolbarManager.add(filterActionMenu);
- }
-
- /**
- * Add the compare merge/navigation actions to the structure merge viewer toolbar.
- *
- * @param toolbarManager
- * the given toolbar.
- */
- public void addActionsForJuno(ToolBarManager toolbarManager) {
- boolean bothSidesEditable = getCompareConfiguration().isLeftEditable()
- && getCompareConfiguration().isRightEditable();
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.dropdown", //$NON-NLS-1$
- "Select the way of merge", "icons/full/toolb16/left_to_right.gif", true); //$NON-NLS-2$
- toolbarManager.add(new Separator());
- if (bothSidesEditable) {
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.mergedToRight", //$NON-NLS-1$
- "Copy Current Change From Left To Right", "icons/full/toolb16/merge_to_right.gif", true); //$NON-NLS-2$
- addSMVAction(
- toolbarManager,
- "org.eclipse.emf.compare.ide.ui.mergedAllToRight", //$NON-NLS-1$
- "Copy All Non-Conflicting Changes From Left To Right", "icons/full/toolb16/merge_all_to_right.gif", true); //$NON-NLS-2$
- toolbarManager.add(new Separator());
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.mergedToLeft", //$NON-NLS-1$
- "Copy Current Change From Right To Left", "icons/full/toolb16/merge_to_left.gif", true); //$NON-NLS-2$
- addSMVAction(
- toolbarManager,
- "org.eclipse.emf.compare.ide.ui.mergedAllToLeft", //$NON-NLS-1$
- "Copy All Non-Conflicting Changes From Right To Left", "icons/full/toolb16/merge_all_to_left.gif", true); //$NON-NLS-2$
- } else {
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.acceptChange", //$NON-NLS-1$
- "Accept Change", "icons/full/toolb16/accept_change.gif", true); //$NON-NLS-2$
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.acceptAllChanges", //$NON-NLS-1$
- "Accept All Non-Conflicting Changes", "icons/full/toolb16/accept_all_changes.gif", true); //$NON-NLS-2$
- toolbarManager.add(new Separator());
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.rejectChange", //$NON-NLS-1$
- "Reject Change", "icons/full/toolb16/reject_change.gif", true); //$NON-NLS-2$
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.rejectAllChanges", //$NON-NLS-1$
- "Reject All Non-Conflicting Changes", "icons/full/toolb16/reject_all_changes.gif", true); //$NON-NLS-2$
- }
- toolbarManager.add(new Separator());
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.nextDiff", //$NON-NLS-1$
- "Next Difference", "icons/full/toolb16/next_diff.gif", true); //$NON-NLS-2$
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.previousDiff", //$NON-NLS-1$
- "Previous Difference", "icons/full/toolb16/prev_diff.gif", true); //$NON-NLS-2$
toolbarManager.add(new Separator());
- addSMVAction(toolbarManager, "org.eclipse.emf.compare.ide.ui.saveComparisonModel", //$NON-NLS-1$
- "Save Comparison Model", "icons/full/toolb16/saveas_edit.gif", true); //$NON-NLS-2$
- }
-
- /**
- * Add the given action to the structure merge viewer toolbar.
- *
- * @param tb
- * the given toolbar.
- * @param actionId
- * the id of the action to add.
- * @param tooltip
- * the tooltip of the action to add.
- * @param imagePath
- * the image path of the action to add.
- * @param activated
- * the initial state of the action to add.
- */
- private void addSMVAction(ToolBarManager tb, String actionId, String tooltip, String imagePath,
- boolean activated) {
- IAction action = new CommandAction(PlatformUI.getWorkbench(), actionId);
- action.setToolTipText(tooltip);
- action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- imagePath));
- action.setEnabled(activated);
- tb.add(action);
+ toolbarManager.add(new SaveComparisonModelAction(getCompareConfiguration()));
}
/**
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractAcceptRejectChange.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java
index de3c66ce3..d2173a84f 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractAcceptRejectChange.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAction.java
@@ -8,15 +8,11 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import com.google.common.collect.ImmutableSet;
import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
@@ -24,36 +20,47 @@ import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.command.ICompareCopyCommand;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
-import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
+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.ui.ISources;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
/**
- * Abstract handler that manages the accept and reject actions (when one side of a diff is not editable).
+ * 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 AbstractAcceptRejectChange extends AbstractHandler {
+public abstract class AbstractAcceptRejectAction extends Action {
/** The compare configuration object used to get the compare model. */
private CompareConfiguration configuration;
/**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public AbstractAcceptRejectAction(CompareConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ /**
* {@inheritDoc}
*
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ * @see org.eclipse.jface.action.Action#run()
*/
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- Object diffNode = ((CompareEditorInput)editorInput).getSelectedEdition();
+ @Override
+ public void run() {
+ 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) {
@@ -65,24 +72,46 @@ public abstract class AbstractAcceptRejectChange extends AbstractHandler {
&& !configuration.isRightEditable();
if (leftEditableOnly) {
if (isCopyDiffCase((Diff)data, false)) {
- EMFCompareUIHandlerUtil.copyDiff((Diff)data, false, configuration);
+ EMFCompareUIActionUtil.copyDiff((Diff)data, false, configuration);
} else {
changeStateFromUnresolvedToMerged((Diff)data, true);
}
} else if (rightEditableOnly) {
if (isCopyDiffCase((Diff)data, true)) {
- EMFCompareUIHandlerUtil.copyDiff((Diff)data, true, configuration);
+ EMFCompareUIActionUtil.copyDiff((Diff)data, true, configuration);
} else {
changeStateFromUnresolvedToMerged((Diff)data, false);
}
}
// Select next diff
- EMFCompareUIHandlerUtil.navigate(true, configuration);
+ EMFCompareUIActionUtil.navigate(true, configuration);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * {@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 null;
+ return false;
}
/**
@@ -163,11 +192,11 @@ public abstract class AbstractAcceptRejectChange extends AbstractHandler {
@Override
public void doExecute() {
for (Diff require : DiffUtil.getRequires(difference, leftToRight)) {
- EMFCompareUIHandlerUtil.setMergeDataForDiff(require, leftToRight, configuration
+ EMFCompareUIActionUtil.setMergeDataForDiff(require, leftToRight, configuration
.isLeftEditable(), configuration.isRightEditable());
require.setState(DifferenceState.MERGED);
}
- EMFCompareUIHandlerUtil.setMergeDataForDiff(difference, leftToRight, configuration
+ EMFCompareUIActionUtil.setMergeDataForDiff(difference, leftToRight, configuration
.isLeftEditable(), configuration.isRightEditable());
difference.setState(DifferenceState.MERGED);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractAcceptRejectAllChanges.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAllAction.java
index 6ad6ac943..1d9db230c 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractAcceptRejectAllChanges.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractAcceptRejectAllAction.java
@@ -8,7 +8,7 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static com.google.common.collect.Iterables.filter;
@@ -19,10 +19,6 @@ import com.google.common.collect.Lists;
import java.util.List;
import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.compare.Comparison;
@@ -31,44 +27,49 @@ import org.eclipse.emf.compare.DifferenceSource;
import org.eclipse.emf.compare.DifferenceState;
import org.eclipse.emf.compare.command.ICompareCopyCommand;
import org.eclipse.emf.compare.domain.ICompareEditingDomain;
-import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
+import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
import org.eclipse.emf.compare.utils.EMFComparePredicates;
import org.eclipse.emf.ecore.change.util.ChangeRecorder;
import org.eclipse.emf.edit.command.ChangeCommand;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.jface.action.Action;
/**
- * Abstract handler that manages the accept all and reject all actions (when one side of a diff is not
+ * Abstract action that manages the accept all and reject all actions (when one side of a diff is not
* editable).
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
*/
-public abstract class AbstractAcceptRejectAllChanges extends AbstractHandler {
+public abstract class AbstractAcceptRejectAllAction extends Action {
/** The compare configuration object used to get the compare model. */
protected CompareConfiguration configuration;
/**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public AbstractAcceptRejectAllAction(CompareConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ /**
* {@inheritDoc}
*
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ * @see org.eclipse.jface.action.Action#run()
*/
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
- boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
- if (leftEditableOnly) {
- manageChanges(false);
- } else if (rightEditableOnly) {
- manageChanges(true);
- }
+ @Override
+ public void run() {
+ boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
+ boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
+ if (leftEditableOnly) {
+ manageChanges(false);
+ } else if (rightEditableOnly) {
+ manageChanges(true);
}
- return null;
}
/**
@@ -120,7 +121,7 @@ public abstract class AbstractAcceptRejectAllChanges extends AbstractHandler {
for (Diff diff : differences) {
if (DifferenceState.UNRESOLVED == diff.getState()) {
if (isCopyDiffCase(diff, leftToRight)) {
- EMFCompareUIHandlerUtil.setMergeDataForDiff(diff, leftToRight, configuration
+ EMFCompareUIActionUtil.setMergeDataForDiff(diff, leftToRight, configuration
.isLeftEditable(), configuration.isRightEditable());
compoundCommand.append(editingDomain.createCopyCommand(Lists.newArrayList(diff),
leftToRight, EMFCompareRCPPlugin.getDefault().getMergerRegistry()));
@@ -202,7 +203,7 @@ public abstract class AbstractAcceptRejectAllChanges extends AbstractHandler {
*/
@Override
public void doExecute() {
- EMFCompareUIHandlerUtil.setMergeDataForDiff(difference, leftToRight, configuration
+ EMFCompareUIActionUtil.setMergeDataForDiff(difference, leftToRight, configuration
.isLeftEditable(), configuration.isRightEditable());
difference.setState(DifferenceState.MERGED);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractMergeHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java
index 50286e710..d3697eebf 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractMergeHandler.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAction.java
@@ -8,43 +8,51 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
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.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
+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.ui.ISources;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
/**
- * Abstract Handler that manages a merge of a difference in case of both sides of the comparison are editable.
+ * Abstract Action that manages a merge of a difference in case of both sides of the comparison are editable.
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
* @since 3.0
*/
-public abstract class AbstractMergeHandler extends AbstractHandler {
+public abstract class AbstractMergeAction extends Action {
/** The compare configuration object used to get the compare model. */
private CompareConfiguration configuration;
/**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public AbstractMergeAction(CompareConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ /**
* {@inheritDoc}
*
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ * @see org.eclipse.jface.action.Action#run()
*/
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- setConfiguration(((CompareEditorInput)editorInput).getCompareConfiguration());
- Object diffNode = ((CompareEditorInput)editorInput).getSelectedEdition();
+ @Override
+ public void run() {
+ 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) {
@@ -52,21 +60,35 @@ public abstract class AbstractMergeHandler extends AbstractHandler {
if (data instanceof Diff) {
copyDiff((Diff)data);
// Select next diff
- EMFCompareUIHandlerUtil.navigate(true, configuration);
+ EMFCompareUIActionUtil.navigate(true, configuration);
}
}
}
}
- return null;
}
/**
- * Copy the diff.
+ * {@inheritDoc}
*
- * @param diff
- * the given diff.
+ * @see org.eclipse.jface.action.Action#isEnabled()
*/
- protected abstract void copyDiff(Diff diff);
+ @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.
@@ -86,4 +108,13 @@ public abstract class AbstractMergeHandler extends AbstractHandler {
public void setConfiguration(CompareConfiguration configuration) {
this.configuration = configuration;
}
+
+ /**
+ * Copy the diff.
+ *
+ * @param diff
+ * the given diff.
+ */
+ protected abstract void copyDiff(Diff diff);
+
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractMergeAllHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAllAction.java
index 1c9b059b3..fabec2b16 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AbstractMergeAllHandler.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AbstractMergeAllAction.java
@@ -8,46 +8,42 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.jface.action.Action;
/**
- * Abstract Handler that manages a merge of a all non-conflicting difference in case of both sides of the
+ * Abstract Action that manages a merge of a all non-conflicting difference in case of both sides of the
* comparison are editable.
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
* @since 3.0
*/
-public abstract class AbstractMergeAllHandler extends AbstractHandler {
+public abstract class AbstractMergeAllAction extends Action {
/** The compare configuration object used to get the compare model. */
private CompareConfiguration configuration;
/**
- * {@inheritDoc}
+ * Constructor.
*
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ * @param configuration
+ * The compare configuration object.
*/
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- setConfiguration(((CompareEditorInput)editorInput).getCompareConfiguration());
- copyAllDiffs();
- }
- return null;
+ public AbstractMergeAllAction(CompareConfiguration configuration) {
+ this.configuration = configuration;
}
/**
- * Copy all non-conflicting differences.
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
*/
- protected abstract void copyAllDiffs();
+ @Override
+ public void run() {
+ copyAllDiffs();
+ }
/**
* Get the compare configuration object.
@@ -67,4 +63,9 @@ public abstract class AbstractMergeAllHandler extends AbstractHandler {
public void setConfiguration(CompareConfiguration configuration) {
this.configuration = configuration;
}
+
+ /**
+ * Copy all non-conflicting differences.
+ */
+ protected abstract void copyAllDiffs();
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AcceptChange.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptAllChangesAction.java
index 89967207a..4377cf41c 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AcceptChange.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptAllChangesAction.java
@@ -8,25 +8,43 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
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.ui.plugin.AbstractUIPlugin;
/**
- * Handler that manages a merge of a difference in case of one side of the comparison is not editable.
+ * Action that manages a merge of all non-conflicting differences in case of one side of the comparison is not
+ * editable.
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
* @since 3.0
*/
-public class AcceptChange extends AbstractAcceptRejectChange {
+public class AcceptAllChangesAction extends AbstractAcceptRejectAllAction {
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public AcceptAllChangesAction(CompareConfiguration configuration) {
+ super(configuration);
+ setToolTipText(EMFCompareIDEUIMessages.getString("accept.all.changes.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/accept_all_changes.gif")); //$NON-NLS-1$
+ }
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.handler.AbstractAcceptRejectChange#isCopyDiffCase(org.eclipse.emf.compare.Diff,
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AcceptAllChangesAction#isCopyDiffCase(org.eclipse.emf.compare.Diff,
* boolean)
*/
@Override
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/RejectAllChanges.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java
index 1e9cd62a9..6febad73b 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/RejectAllChanges.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/AcceptChangeAction.java
@@ -8,34 +8,50 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
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.ui.plugin.AbstractUIPlugin;
/**
- * Handler that manages a merge of all non-conflicting differences in case of one side of the comparison is
- * not editable.
+ * Action that manages a merge of a difference in case of one side of the comparison is not editable.
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
* @since 3.0
*/
-public class RejectAllChanges extends AbstractAcceptRejectAllChanges {
+public class AcceptChangeAction extends AbstractAcceptRejectAction {
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public AcceptChangeAction(CompareConfiguration configuration) {
+ super(configuration);
+ setToolTipText(EMFCompareIDEUIMessages.getString("accept.change.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/accept_change.gif")); //$NON-NLS-1$
+ }
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.handler.AbstractAcceptRejectAllChanges#isCopyDiffCase(org.eclipse.emf.compare.Diff,
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.RejectChangeAction#isCopyDiffCase(org.eclipse.emf.compare.Diff,
* boolean)
*/
@Override
protected boolean isCopyDiffCase(Diff diff, boolean leftToRight) {
if (leftToRight) {
- return fromSide(DifferenceSource.RIGHT).apply(diff);
- } else {
return fromSide(DifferenceSource.LEFT).apply(diff);
+ } else {
+ return fromSide(DifferenceSource.RIGHT).apply(diff);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/actions/collapse/CollapseAllModelAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/CollapseAllModelAction.java
index 8bd69cba2..fdbac0d43 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/actions/collapse/CollapseAllModelAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/CollapseAllModelAction.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * 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.actions.collapse;
-
-import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class CollapseAllModelAction extends Action {
-
- private final AbstractTreeViewer treeViewer;
-
- public CollapseAllModelAction(AbstractTreeViewer treeViewer) {
- this.treeViewer = treeViewer;
- setToolTipText("Collapse All"); //$NON-NLS-1$
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/collapse_all.gif")); //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- treeViewer.collapseAll();
- }
-}
+/*******************************************************************************
+ * 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.EMFCompareIDEUIPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class CollapseAllModelAction extends Action {
+
+ private final AbstractTreeViewer treeViewer;
+
+ public CollapseAllModelAction(AbstractTreeViewer treeViewer) {
+ this.treeViewer = treeViewer;
+ setToolTipText("Collapse All"); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/collapse_all.gif")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ treeViewer.collapseAll();
+ }
+}
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
new file mode 100644
index 000000000..4b80e1cb7
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+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 CompareConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public DropDownAcceptAction(CompareConfiguration 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.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(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
new file mode 100644
index 000000000..ee940c5e5
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownAcceptRejectMenuAction.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Action that manages the dropdown menu that allows to show the consequences of an accept or a reject.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ * @since 3.0
+ */
+public class DropDownAcceptRejectMenuAction extends Action implements IMenuCreator {
+
+ /** The compare configuration object used to get the compare model. */
+ private CompareConfiguration configuration;
+
+ /** The menu associated with this action. */
+ private Menu fMenu;
+
+ /** The accept menu item. */
+ private Action acceptItem;
+
+ /** The reject menu item. */
+ private Action rejectItem;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public DropDownAcceptRejectMenuAction(final CompareConfiguration 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) {
+ @Override
+ public void run() {
+ super.run();
+ updateMenu();
+ }
+ };
+
+ rejectItem = new DropDownRejectAction(configuration) {
+ @Override
+ public void run() {
+ super.run();
+ updateMenu();
+ }
+ };
+
+ setMenuCreator(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
+ boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
+ boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
+ if (mergeWay == null || mergeWay.booleanValue()) {
+ configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(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.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(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$
+ }
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.IMenuCreator#dispose()
+ */
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fMenu = new Menu(parent);
+ addActionToMenu(fMenu, acceptItem);
+ addActionToMenu(fMenu, rejectItem);
+
+ return fMenu;
+ }
+
+ /**
+ * Add action to the given menu.
+ *
+ * @param parent
+ * the given menu.
+ * @param action
+ * the given action.
+ */
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ /**
+ * Update the icon and tooltip of the dropdown menu.
+ */
+ protected void updateMenu() {
+ Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
+ boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
+ boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
+ if (mergeWay == null || mergeWay.booleanValue()) {
+ 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$
+ }
+ }
+ }
+}
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
new file mode 100644
index 000000000..1e0ac157a
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownLeftToRightAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+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 CompareConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public DropDownLeftToRightAction(CompareConfiguration 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.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(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
new file mode 100644
index 000000000..47bc3fa19
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownMergeMenuAction.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * Copyright (c) 2012, 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.compare.CompareConfiguration;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ActionContributionItem;
+import org.eclipse.jface.action.IMenuCreator;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Action that manages the click on the dropdown menu of the toolbar of the structure merge viewer.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class DropDownMergeMenuAction extends Action implements IMenuCreator {
+
+ /** The compare configuration object. */
+ private CompareConfiguration configuration;
+
+ /** The menu associated with this action. */
+ private Menu fMenu;
+
+ /** The left to right menu item. */
+ private Action leftToRightItem;
+
+ /** The right to left menu item. */
+ private Action rightToLeftItem;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public DropDownMergeMenuAction(CompareConfiguration configuration) {
+ this.configuration = configuration;
+ setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
+
+ leftToRightItem = new DropDownLeftToRightAction(configuration) {
+ @Override
+ public void run() {
+ super.run();
+ updateMenu();
+ }
+ };
+
+ rightToLeftItem = new DropDownRightToLeftAction(configuration) {
+ @Override
+ public void run() {
+ super.run();
+ updateMenu();
+ }
+ };
+
+ setMenuCreator(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
+ if (mergeWay == null || mergeWay.booleanValue()) {
+ configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/right_to_left.gif")); //$NON-NLS-1$
+ } else {
+ configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.IMenuCreator#dispose()
+ */
+ public void dispose() {
+ if (fMenu != null) {
+ fMenu.dispose();
+ fMenu = null;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu)
+ */
+ public Menu getMenu(Menu parent) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control)
+ */
+ public Menu getMenu(Control parent) {
+ if (fMenu != null) {
+ fMenu.dispose();
+ }
+
+ fMenu = new Menu(parent);
+ addActionToMenu(fMenu, leftToRightItem);
+ addActionToMenu(fMenu, rightToLeftItem);
+
+ return fMenu;
+ }
+
+ /**
+ * Add action to the given menu.
+ *
+ * @param parent
+ * the given menu.
+ * @param action
+ * the given action.
+ */
+ protected void addActionToMenu(Menu parent, Action action) {
+ ActionContributionItem item = new ActionContributionItem(action);
+ item.fill(parent, -1);
+ }
+
+ /**
+ * Update the icon and tooltip of the dropdown menu.
+ */
+ protected void updateMenu() {
+ Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
+ if (mergeWay == null || mergeWay.booleanValue()) {
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
+ } else {
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/right_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/DropDownRejectAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java
new file mode 100644
index 000000000..3bab0879f
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRejectAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+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 CompareConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public DropDownRejectAction(CompareConfiguration 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.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(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
new file mode 100644
index 000000000..34c26d8f0
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/DropDownRightToLeftAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+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 CompareConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public DropDownRightToLeftAction(CompareConfiguration 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.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/actions/expand/ExpandAllModelAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/ExpandAllModelAction.java
index a36941860..309cfc7fa 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/actions/expand/ExpandAllModelAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/ExpandAllModelAction.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * 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.actions.expand;
-
-import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class ExpandAllModelAction extends Action {
-
- private final AbstractTreeViewer treeViewer;
-
- public ExpandAllModelAction(AbstractTreeViewer treeViewer) {
- this.treeViewer = treeViewer;
- setToolTipText("Expand All"); //$NON-NLS-1$
- setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/expand_all.gif")); //$NON-NLS-1$
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- treeViewer.expandToLevel(256);
- // Workaround to force the redraw of the EMFCompareDiffTreeruler
- treeViewer.setSelection(treeViewer.getSelection());
- }
-}
+/*******************************************************************************
+ * 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.EMFCompareIDEUIPlugin;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ */
+public class ExpandAllModelAction extends Action {
+
+ private final AbstractTreeViewer treeViewer;
+
+ public ExpandAllModelAction(AbstractTreeViewer treeViewer) {
+ this.treeViewer = treeViewer;
+ setToolTipText("Expand All"); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/expand_all.gif")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ treeViewer.expandToLevel(256);
+ // Workaround to force the redraw of the EMFCompareDiffTreeruler
+ treeViewer.setSelection(treeViewer.getSelection());
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java
new file mode 100644
index 000000000..c0199d1e0
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToLeftAction.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+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.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Action that manages a merge from left to right of all non-conflicting differences in case of both sides of
+ * the comparison are editable.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ * @since 3.0
+ */
+public class MergeAllToLeftAction extends AbstractMergeAllAction {
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public MergeAllToLeftAction(CompareConfiguration configuration) {
+ super(configuration);
+ setToolTipText(EMFCompareIDEUIMessages.getString("merged.all.to.left.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/merge_all_to_left.gif")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AbstractMergeAllAction#copyAllDiffs()
+ */
+ @Override
+ protected void copyAllDiffs() {
+ EMFCompareUIActionUtil.copyAllDiffs(false, getConfiguration());
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java
new file mode 100644
index 000000000..43f6abc87
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeAllToRightAction.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+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.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Action that manages a merge from right to left of all non-conflicting differences in case of both sides of
+ * the comparison are editable.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ * @since 3.0
+ */
+public class MergeAllToRightAction extends AbstractMergeAllAction {
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public MergeAllToRightAction(CompareConfiguration configuration) {
+ super(configuration);
+ setToolTipText(EMFCompareIDEUIMessages.getString("merged.all.to.right.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/merge_all_to_right.gif")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AbstractMergeAllAction#copyAllDiffs()
+ */
+ @Override
+ protected void copyAllDiffs() {
+ EMFCompareUIActionUtil.copyAllDiffs(true, getConfiguration());
+ }
+}
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
new file mode 100644
index 000000000..88c019882
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToLeftAction.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+import org.eclipse.emf.compare.Diff;
+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.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Action that manages a merge from right to left of a difference in case of both sides of the comparison are
+ * editable.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ * @since 3.0
+ */
+public class MergeToLeftAction extends AbstractMergeAction {
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public MergeToLeftAction(CompareConfiguration configuration) {
+ super(configuration);
+ 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$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AbstractMergeAction#copyDiff(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ protected void copyDiff(Diff diff) {
+ EMFCompareUIActionUtil.copyDiff(diff, false, getConfiguration());
+ }
+
+}
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
new file mode 100644
index 000000000..711bfb81a
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/MergeToRightAction.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+import org.eclipse.emf.compare.Diff;
+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.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Action that manages a merge from left to right of a difference in case of both sides of the comparison are
+ * editable.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ * @since 3.0
+ */
+public class MergeToRightAction extends AbstractMergeAction {
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public MergeToRightAction(CompareConfiguration configuration) {
+ super(configuration);
+ 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$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AbstractMergeAction#copyDiff(org.eclipse.emf.compare.Diff)
+ */
+ @Override
+ protected void copyDiff(Diff diff) {
+ EMFCompareUIActionUtil.copyDiff(diff, true, getConfiguration());
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AcceptAllChanges.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectAllChangesAction.java
index 2929d5702..6ba0f7b09 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/AcceptAllChanges.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectAllChangesAction.java
@@ -8,34 +8,51 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
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.ui.plugin.AbstractUIPlugin;
/**
- * Handler that manages a merge of all non-conflicting differences in case of one side of the comparison is
- * not editable.
+ * Action that manages a merge of all non-conflicting differences in case of one side of the comparison is not
+ * editable.
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
* @since 3.0
*/
-public class AcceptAllChanges extends AbstractAcceptRejectAllChanges {
+public class RejectAllChangesAction extends AbstractAcceptRejectAllAction {
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public RejectAllChangesAction(CompareConfiguration configuration) {
+ super(configuration);
+ setToolTipText(EMFCompareIDEUIMessages.getString("reject.all.changes.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/reject_all_changes.gif")); //$NON-NLS-1$
+ }
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.handler.AbstractAcceptRejectAllChanges#isCopyDiffCase(org.eclipse.emf.compare.Diff,
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.AcceptAllChangesAction#isCopyDiffCase(org.eclipse.emf.compare.Diff,
* boolean)
*/
@Override
protected boolean isCopyDiffCase(Diff diff, boolean leftToRight) {
if (leftToRight) {
- return fromSide(DifferenceSource.LEFT).apply(diff);
- } else {
return fromSide(DifferenceSource.RIGHT).apply(diff);
+ } else {
+ return fromSide(DifferenceSource.LEFT).apply(diff);
}
}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/RejectChange.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java
index 996a129bd..5185caacb 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/RejectChange.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/RejectChangeAction.java
@@ -8,25 +8,42 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions;
import static org.eclipse.emf.compare.utils.EMFComparePredicates.fromSide;
+import org.eclipse.compare.CompareConfiguration;
import org.eclipse.emf.compare.Diff;
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.ui.plugin.AbstractUIPlugin;
/**
- * Handler that manages a reject of a difference in case of one side of the comparison is not editable.
+ * Action that manages a merge of a difference in case of one side of the comparison is not editable.
*
* @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
* @since 3.0
*/
-public class RejectChange extends AbstractAcceptRejectChange {
+public class RejectChangeAction extends AbstractAcceptRejectAction {
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public RejectChangeAction(CompareConfiguration configuration) {
+ super(configuration);
+ setToolTipText(EMFCompareIDEUIMessages.getString("reject.change.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/reject_change.gif")); //$NON-NLS-1$
+ }
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.handler.AbstractAcceptRejectChange#isCopyDiffCase(org.eclipse.emf.compare.Diff,
+ * @see org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.RejectChangeAction#isCopyDiffCase(org.eclipse.emf.compare.Diff,
* boolean)
*/
@Override
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SaveComparisonModel.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java
index 87c4bccb3..732dbf6f7 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SaveComparisonModel.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java
@@ -1,121 +1,138 @@
-/*******************************************************************************
- * Copyright (c) 2012, 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.handler;
-
-import static com.google.common.collect.Maps.newHashMap;
-
-import com.google.common.collect.ImmutableList;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.NotSerializableException;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.compare.Comparison;
-import org.eclipse.emf.compare.rcp.ui.EMFCompareRCPUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareRCPUIMessages;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.statushandlers.StatusAdapter;
-import org.eclipse.ui.statushandlers.StatusManager;
-
-/**
- * Handler that manages the save of the comparison model.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class SaveComparisonModel extends AbstractHandler {
-
- /** The dialog buttons. */
- private static final ImmutableList<String> DIALOG_BUTTON_LABELS = ImmutableList.of("Replace", "Cancel");
-
- /** The compare configuration object used to get the compare model. */
- private CompareConfiguration configuration;
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- Shell parent = configuration.getContainer().getWorkbenchPart().getSite().getShell();
-
- FileDialog fileDialog = new FileDialog(parent, SWT.SAVE);
- String filePath = fileDialog.open();
- if (filePath != null) {
- File file = new File(filePath);
- if (file.exists()) {
- MessageDialog messageDialog = new MessageDialog(parent, "File already exists", null,
- "File \"" + file.toString()
- + "\" already exists. Do you want to replace the existing one?",
- MessageDialog.WARNING, DIALOG_BUTTON_LABELS.toArray(new String[0]), 1);
- int open = messageDialog.open();
- if (open == DIALOG_BUTTON_LABELS.indexOf("Replace")) {
- saveComparison(file);
- } // else do nothing
- } else {
- saveComparison(file);
- }
- }
- }
-
- return null;
- }
-
- /**
- * Save the compare model in the given result {@link File}.
- *
- * @param file
- * the result {@link File}.
- */
- private void saveComparison(File file) {
- Comparison comparison = (Comparison)configuration.getProperty(EMFCompareConstants.COMPARE_RESULT);
- Resource resource = new XMIResourceImpl(URI.createFileURI(file.getAbsolutePath()));
- Copier copier = new Copier(false);
- EObject comparisonCopy = copier.copy(comparison);
- copier.copyReferences();
-
- resource.getContents().add(comparisonCopy);
- try {
- resource.save(newHashMap());
- } catch (RuntimeException e) {
- if (e.getCause() instanceof NotSerializableException) {
- final Status status = new Status(IStatus.ERROR, EMFCompareRCPUIPlugin.PLUGIN_ID,
- EMFCompareRCPUIMessages.getString("resource.not.serializable"), e); //$NON-NLS-1$
- StatusManager.getManager().handle(new StatusAdapter(status), StatusManager.SHOW);
- } else {
- EMFCompareRCPUIPlugin.getDefault().log(e);
- }
- } catch (IOException e) {
- EMFCompareRCPUIPlugin.getDefault().log(e);
- }
- }
-}
+/*******************************************************************************
+ * 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 static com.google.common.collect.Maps.newHashMap;
+
+import com.google.common.collect.ImmutableList;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.NotSerializableException;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.compare.Comparison;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
+import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
+import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.statushandlers.StatusAdapter;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * Action that manages the save of the comparison model.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ * @since 3.0
+ */
+public class SaveComparisonModelAction extends Action {
+
+ /** The dialog buttons. */
+ private static final ImmutableList<String> DIALOG_BUTTON_LABELS = ImmutableList.of("Replace", "Cancel");
+
+ /** The compare configuration object used to get the compare model. */
+ private CompareConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public SaveComparisonModelAction(CompareConfiguration configuration) {
+ this.configuration = configuration;
+ setToolTipText(EMFCompareIDEUIMessages.getString("save.model.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/saveas_edit.gif")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ Shell parent = PlatformUI.getWorkbench().getDisplay().getActiveShell();
+
+ FileDialog fileDialog = new FileDialog(parent, SWT.SAVE);
+ String filePath = fileDialog.open();
+ if (filePath != null) {
+ File file = new File(filePath);
+ if (file.exists()) {
+ MessageDialog messageDialog = new MessageDialog(parent, "File already exists", null,
+ "File \"" + file.toString()
+ + "\" already exists. Do you want to replace the existing one?",
+ MessageDialog.WARNING, DIALOG_BUTTON_LABELS.toArray(new String[0]), 1);
+ int open = messageDialog.open();
+ if (open == DIALOG_BUTTON_LABELS.indexOf("Replace")) {
+ saveComparison(file);
+ } // else do nothing
+ } else {
+ saveComparison(file);
+ }
+ }
+
+ super.run();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#isEnabled()
+ */
+ @Override
+ public boolean isEnabled() {
+ return configuration.isLeftEditable() && configuration.isRightEditable();
+ }
+
+ /**
+ * Save the compare model in the given result {@link File}.
+ *
+ * @param file
+ * the result {@link File}.
+ */
+ private void saveComparison(File file) {
+ Comparison comparison = (Comparison)configuration.getProperty(EMFCompareConstants.COMPARE_RESULT);
+ Resource resource = new XMIResourceImpl(URI.createFileURI(file.getAbsolutePath()));
+ Copier copier = new Copier(false);
+ EObject comparisonCopy = copier.copy(comparison);
+ copier.copyReferences();
+
+ resource.getContents().add(comparisonCopy);
+ try {
+ resource.save(newHashMap());
+ } catch (RuntimeException e) {
+ if (e.getCause() instanceof NotSerializableException) {
+ final Status status = new Status(IStatus.ERROR, EMFCompareIDEUIPlugin.PLUGIN_ID,
+ EMFCompareIDEUIMessages.getString("resource.not.serializable"), e); //$NON-NLS-1$
+ StatusManager.getManager().handle(new StatusAdapter(status), StatusManager.SHOW);
+ } else {
+ EMFCompareIDEUIPlugin.getDefault().log(e);
+ }
+ } catch (IOException e) {
+ EMFCompareIDEUIPlugin.getDefault().log(e);
+ }
+ }
+}
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
new file mode 100644
index 000000000..46dfea92d
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectNextDiffAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+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.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Action that manages the selection of the next difference.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ * @since 3.0
+ */
+public class SelectNextDiffAction extends Action {
+
+ /** The compare configuration object used to get the compare model. */
+ private CompareConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public SelectNextDiffAction(CompareConfiguration configuration) {
+ this.configuration = configuration;
+ setToolTipText(EMFCompareIDEUIMessages.getString("next.diff.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/next_diff.gif")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ // Select next diff
+ EMFCompareUIActionUtil.navigate(true, configuration);
+ }
+}
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
new file mode 100644
index 000000000..d1d7f6654
--- /dev/null
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SelectPreviousDiffAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * 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.compare.CompareConfiguration;
+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.structuremergeviewer.actions.util.EMFCompareUIActionUtil;
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Action that manages the selection of the previous difference.
+ *
+ * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
+ * @since 3.0
+ */
+public class SelectPreviousDiffAction extends Action {
+
+ /** The compare configuration object used to get the compare model. */
+ private CompareConfiguration configuration;
+
+ /**
+ * Constructor.
+ *
+ * @param configuration
+ * The compare configuration object.
+ */
+ public SelectPreviousDiffAction(CompareConfiguration configuration) {
+ this.configuration = configuration;
+ setToolTipText(EMFCompareIDEUIMessages.getString("previous.diff.tooltip")); //$NON-NLS-1$
+ setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
+ "icons/full/toolb16/prev_diff.gif")); //$NON-NLS-1$
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.jface.action.Action#run()
+ */
+ @Override
+ public void run() {
+ // Select prev diff
+ EMFCompareUIActionUtil.navigate(false, configuration);
+ }
+}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/util/EMFCompareUIHandlerUtil.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java
index 168cbc70a..475bc6d6d 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/util/EMFCompareUIHandlerUtil.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/util/EMFCompareUIActionUtil.java
@@ -8,7 +8,7 @@
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
-package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util;
+package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.actions.util;
import static com.google.common.collect.Iterables.addAll;
import static com.google.common.collect.Iterables.filter;
@@ -43,17 +43,17 @@ import org.eclipse.emf.compare.utils.EMFComparePredicates;
import org.eclipse.emf.ecore.util.EcoreUtil;
/**
- * Util class that provides utilities methods for RCP UI handlers.
+ * 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 EMFCompareUIHandlerUtil {
+public final class EMFCompareUIActionUtil {
/**
* Utility classes don't need a default constructor.
*/
- private EMFCompareUIHandlerUtil() {
+ private EMFCompareUIActionUtil() {
// Hides default constructor.
}
@@ -94,17 +94,17 @@ public final class EMFCompareUIHandlerUtil {
diffsToCopy.add(diffToCopy);
// Add merge data for required diffs
for (Diff require : DiffUtil.getRequires(diffToCopy, leftToRight)) {
- EMFCompareUIHandlerUtil.setMergeDataForDiff(require, leftToRight, configuration
+ EMFCompareUIActionUtil.setMergeDataForDiff(require, leftToRight, configuration
.isLeftEditable(), configuration.isRightEditable());
}
- if (EMFCompareUIHandlerUtil.isCascadingDifferencesFilterActive(configuration)) {
+ if (EMFCompareUIActionUtil.isCascadingDifferencesFilterActive(configuration)) {
addAll(diffsToCopy, org.eclipse.emf.compare.utils.DiffUtil.getSubDiffs(leftToRight).apply(
diffToCopy));
}
// Add merge data for subs diffs
for (Diff diff : diffsToCopy) {
- EMFCompareUIHandlerUtil.setMergeDataForDiff(diff, leftToRight,
- configuration.isLeftEditable(), configuration.isRightEditable());
+ EMFCompareUIActionUtil.setMergeDataForDiff(diff, leftToRight, configuration.isLeftEditable(),
+ configuration.isRightEditable());
}
// Add merge data for diffs in conflicts
addMergeDataForConflictedDiffs(diffToCopy, leftToRight, configuration);
@@ -138,8 +138,8 @@ public final class EMFCompareUIHandlerUtil {
&& ((diffToCopy.getSource() == DifferenceSource.LEFT && conflictedDiff
.getSource() == DifferenceSource.RIGHT) || (diffToCopy.getSource() == DifferenceSource.RIGHT && conflictedDiff
.getSource() == DifferenceSource.LEFT))) {
- EMFCompareUIHandlerUtil.setMergeDataForDiff(conflictedDiff, leftToRight,
- configuration.isLeftEditable(), configuration.isRightEditable());
+ EMFCompareUIActionUtil.setMergeDataForDiff(conflictedDiff, leftToRight, configuration
+ .isLeftEditable(), configuration.isRightEditable());
}
}
}
@@ -175,8 +175,8 @@ public final class EMFCompareUIHandlerUtil {
if (differences.size() > 0) {
for (Diff diff : differences) {
- EMFCompareUIHandlerUtil.setMergeDataForDiff(diff, leftToRight,
- configuration.isLeftEditable(), configuration.isRightEditable());
+ EMFCompareUIActionUtil.setMergeDataForDiff(diff, leftToRight, configuration.isLeftEditable(),
+ configuration.isRightEditable());
}
ICompareEditingDomain editingDomain = (ICompareEditingDomain)configuration
.getProperty(EMFCompareConstants.EDITING_DOMAIN);
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectHandler.java
deleted file mode 100644
index 429999f90..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectHandler.java
+++ /dev/null
@@ -1,141 +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.handler;
-
-import java.util.Map;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.internal.CompareEditor;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
-import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.menus.UIElement;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Handler that manages the click on 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>
- */
-public class DropDownAcceptRejectHandler extends AbstractHandler implements IElementUpdater {
-
- /** The compare configuration object. */
- private CompareConfiguration configuration;
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- Object trigger = event.getTrigger();
- if (trigger instanceof Event) {
- Event eventWidget = (Event)event.getTrigger();
- Widget widget = eventWidget.widget;
- if (widget instanceof ToolItem) {
- ToolItem toolItem = (ToolItem)widget;
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
- boolean rightEditableOnly = !configuration.isLeftEditable()
- && configuration.isRightEditable();
- boolean leftEditableOnly = configuration.isLeftEditable()
- && !configuration.isRightEditable();
- if (mergeWay == null || mergeWay.booleanValue()) {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
- if (leftEditableOnly) {
- toolItem.setImage(EMFCompareIDEUIPlugin.getImage("icons/full/toolb16/reject.gif")); //$NON-NLS-1$
- toolItem.setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.reject.text")); //$NON-NLS-1$
- } else if (rightEditableOnly) {
- toolItem.setImage(EMFCompareIDEUIPlugin.getImage("icons/full/toolb16/accept.gif")); //$NON-NLS-1$
- toolItem.setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.text")); //$NON-NLS-1$
- }
- } else {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
- if (leftEditableOnly) {
- toolItem.setImage(EMFCompareIDEUIPlugin.getImage("icons/full/toolb16/accept.gif")); //$NON-NLS-1$
- toolItem.setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.accept.text")); //$NON-NLS-1$
- } else if (rightEditableOnly) {
- toolItem.setImage(EMFCompareIDEUIPlugin.getImage("icons/full/toolb16/reject.gif")); //$NON-NLS-1$
- toolItem.setToolTipText(EMFCompareIDEUIMessages.getString("dropdown.reject.text")); //$NON-NLS-1$
- }
- }
- }
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.ui.commands.IElementUpdater#updateElement(UIElement, Map)
- */
- public void updateElement(UIElement element, Map parameters) {
- if (configuration == null) {
- Object value = parameters.get("org.eclipse.ui.IWorkbenchWindow"); //$NON-NLS-1$
- if (value instanceof IWorkbenchWindow) {
- IWorkbenchPage pa = ((IWorkbenchWindow)value).getActivePage();
- IEditorPart editor = pa.getActiveEditor();
- if (editor instanceof CompareEditor) {
- IEditorInput editorInput = editor.getEditorInput();
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- }
- }
- }
- }
- if (configuration != null) {
- Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
- boolean rightEditableOnly = !configuration.isLeftEditable() && configuration.isRightEditable();
- boolean leftEditableOnly = configuration.isLeftEditable() && !configuration.isRightEditable();
- if (mergeWay == null || mergeWay.booleanValue()) {
- if (leftEditableOnly) {
- element.setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
- element.setTooltip(EMFCompareIDEUIMessages.getString("dropdown.accept.text")); //$NON-NLS-1$
- } else if (rightEditableOnly) {
- element.setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/reject.gif")); //$NON-NLS-1$
- element.setTooltip(EMFCompareIDEUIMessages.getString("dropdown.reject.text")); //$NON-NLS-1$
- }
- } else {
- if (leftEditableOnly) {
- element.setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/reject.gif")); //$NON-NLS-1$
- element.setTooltip(EMFCompareIDEUIMessages.getString("dropdown.reject.text")); //$NON-NLS-1$
- } else if (rightEditableOnly) {
- element.setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(
- EMFCompareIDEUIPlugin.PLUGIN_ID, "icons/full/toolb16/accept.gif")); //$NON-NLS-1$
- element.setTooltip(EMFCompareIDEUIMessages.getString("dropdown.accept.text")); //$NON-NLS-1$
- }
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectLeftToRight.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectLeftToRight.java
deleted file mode 100644
index 561ec47fa..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectLeftToRight.java
+++ /dev/null
@@ -1,52 +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.handler;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Handler that manages the click on the menu item left to right 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>
- */
-public class DropDownAcceptRejectLeftToRight extends AbstractHandler {
-
- /** The compare configuration object. */
- private CompareConfiguration configuration;
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
- }
- ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(
- ICommandService.class);
- commandService.refreshElements("org.eclipse.emf.compare.ide.ui.dropdown.acceptreject", null); //$NON-NLS-1$
-
- return null;
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectRightToLeft.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectRightToLeft.java
deleted file mode 100644
index 72cba91c7..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownAcceptRejectRightToLeft.java
+++ /dev/null
@@ -1,51 +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.handler;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Handler that manages the click on the menu item right to left 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>
- */
-public class DropDownAcceptRejectRightToLeft extends AbstractHandler {
-
- /** The compare configuration object. */
- private CompareConfiguration configuration;
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
- }
- ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(
- ICommandService.class);
- commandService.refreshElements("org.eclipse.emf.compare.ide.ui.dropdown.acceptreject", null); //$NON-NLS-1$
- return null;
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownHandler.java
deleted file mode 100644
index 3d9494106..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownHandler.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 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.handler;
-
-import java.util.Map;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.internal.CompareEditor;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIPlugin;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.commands.IElementUpdater;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.menus.UIElement;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Handler that manages the click on the dropdown menu of the toolbar of the structure merge viewer.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class DropDownHandler extends AbstractHandler implements IElementUpdater {
-
- /** The compare configuration object. */
- private CompareConfiguration configuration;
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
-
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- Object trigger = event.getTrigger();
- if (trigger instanceof Event) {
- Event eventWidget = (Event)event.getTrigger();
- Widget widget = eventWidget.widget;
- if (widget instanceof ToolItem) {
- ToolItem toolItem = (ToolItem)widget;
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
- if (mergeWay == null || mergeWay.booleanValue()) {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
- toolItem.setImage(EMFCompareIDEUIPlugin
- .getImage("icons/full/toolb16/right_to_left.gif")); //$NON-NLS-1$
- } else {
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
- toolItem.setImage(EMFCompareIDEUIPlugin
- .getImage("icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
- }
- }
- }
- }
-
- return null;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.ui.commands.IElementUpdater#updateElement(UIElement, Map)
- */
- public void updateElement(UIElement element, Map parameters) {
- if (configuration == null) {
- Object value = parameters.get("org.eclipse.ui.IWorkbenchWindow"); //$NON-NLS-1$
- if (value instanceof IWorkbenchWindow) {
- IWorkbenchPage pa = ((IWorkbenchWindow)value).getActivePage();
- IEditorPart editor = pa.getActiveEditor();
- if (editor instanceof CompareEditor) {
- IEditorInput editorInput = editor.getEditorInput();
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- }
- }
- }
- }
- if (configuration != null) {
- Boolean mergeWay = (Boolean)configuration.getProperty(EMFCompareConstants.MERGE_WAY);
- if (mergeWay == null || mergeWay.booleanValue()) {
- element.setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/left_to_right.gif")); //$NON-NLS-1$
- } else {
- element.setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(EMFCompareIDEUIPlugin.PLUGIN_ID,
- "icons/full/toolb16/right_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/handler/DropDownLeftToRight.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownLeftToRight.java
deleted file mode 100644
index beeca1c86..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownLeftToRight.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 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.handler;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Handler that manages the click on the menu item left to right in the dropdown menu of the toolbar of the
- * structure merge viewer.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class DropDownLeftToRight extends AbstractHandler {
-
- /** The compare configuration object. */
- private CompareConfiguration configuration;
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(true));
- }
-
- ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(
- ICommandService.class);
- commandService.refreshElements("org.eclipse.emf.compare.ide.ui.dropdown", null); //$NON-NLS-1$
-
- return null;
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownRightToLeft.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownRightToLeft.java
deleted file mode 100644
index 3daff914f..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/DropDownRightToLeft.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012, 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.handler;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.compare.rcp.ui.internal.EMFCompareConstants;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Handler that manages the click on the menu item right to left in the dropdown menu of the toolbar of the
- * structure merge viewer.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class DropDownRightToLeft extends AbstractHandler {
-
- /** The compare configuration object. */
- private CompareConfiguration configuration;
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- configuration.setProperty(EMFCompareConstants.MERGE_WAY, new Boolean(false));
- }
- ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(
- ICommandService.class);
- commandService.refreshElements("org.eclipse.emf.compare.ide.ui.dropdown", null); //$NON-NLS-1$
- return null;
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeAllToLeftHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeAllToLeftHandler.java
deleted file mode 100644
index 2055cdb88..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeAllToLeftHandler.java
+++ /dev/null
@@ -1,28 +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.handler;
-
-import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
-
-/**
- * Handler that manages a merge from left to right of all non-conflicting differences in case of both sides of
- * the comparison are editable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class MergeAllToLeftHandler extends AbstractMergeAllHandler {
-
- @Override
- protected void copyAllDiffs() {
- EMFCompareUIHandlerUtil.copyAllDiffs(false, getConfiguration());
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeAllToRightHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeAllToRightHandler.java
deleted file mode 100644
index b7e83ab97..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeAllToRightHandler.java
+++ /dev/null
@@ -1,28 +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.handler;
-
-import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
-
-/**
- * Handler that manages a merge from left to right of all non-conflicting differences in case of both sides of
- * the comparison are editable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class MergeAllToRightHandler extends AbstractMergeAllHandler {
-
- @Override
- protected void copyAllDiffs() {
- EMFCompareUIHandlerUtil.copyAllDiffs(true, getConfiguration());
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeToLeftHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeToLeftHandler.java
deleted file mode 100644
index d20101008..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeToLeftHandler.java
+++ /dev/null
@@ -1,29 +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.handler;
-
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
-
-/**
- * Handler that manages a merge from right to left of a difference in case of both sides of the comparison are
- * editable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class MergeToLeftHandler extends AbstractMergeHandler {
-
- @Override
- protected void copyDiff(Diff diff) {
- EMFCompareUIHandlerUtil.copyDiff(diff, false, getConfiguration());
- }
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeToRightHandler.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeToRightHandler.java
deleted file mode 100644
index 660c2335d..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/MergeToRightHandler.java
+++ /dev/null
@@ -1,30 +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.handler;
-
-import org.eclipse.emf.compare.Diff;
-import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
-
-/**
- * Handler that manages a merge from left to right of a difference in case of both sides of the comparison are
- * editable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class MergeToRightHandler extends AbstractMergeHandler {
-
- @Override
- protected void copyDiff(Diff diff) {
- EMFCompareUIHandlerUtil.copyDiff(diff, true, getConfiguration());
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SelectNextDiff.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SelectNextDiff.java
deleted file mode 100644
index e2e6bb163..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SelectNextDiff.java
+++ /dev/null
@@ -1,44 +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.handler;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Handler that manages the select next diff button.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class SelectNextDiff extends AbstractHandler {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- CompareConfiguration configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- // Select next diff
- EMFCompareUIHandlerUtil.navigate(true, configuration);
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SelectPreviousDiff.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SelectPreviousDiff.java
deleted file mode 100644
index 5ecd4e10d..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/SelectPreviousDiff.java
+++ /dev/null
@@ -1,44 +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.handler;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.util.EMFCompareUIHandlerUtil;
-import org.eclipse.ui.ISources;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Handler that manages the select previous diff button.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- */
-public class SelectPreviousDiff extends AbstractHandler {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Object editorInput = HandlerUtil.getVariable(event, ISources.ACTIVE_EDITOR_INPUT_NAME);
- if (editorInput instanceof CompareEditorInput) {
- CompareConfiguration configuration = ((CompareEditorInput)editorInput).getCompareConfiguration();
- // Select next diff
- EMFCompareUIHandlerUtil.navigate(false, configuration);
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/AcceptRejectChangePropertyTester.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/AcceptRejectChangePropertyTester.java
deleted file mode 100644
index da011a225..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/AcceptRejectChangePropertyTester.java
+++ /dev/null
@@ -1,50 +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.handler.propertytester;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * A property tester linked with
- * {@link org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.AbstractMergeHandler.AbstractMergedTo}. It returns
- * true when only one model side is editable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class AcceptRejectChangePropertyTester extends PropertyTester {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.expressions.PropertyTester#test(java.lang.Object, java.lang.String,
- * java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof IEditorPart) {
- IEditorInput i = ((IEditorPart)receiver).getEditorInput();
- if (i instanceof CompareEditorInput) {
- CompareConfiguration configuration = ((CompareEditorInput)i).getCompareConfiguration();
- if (configuration.isLeftEditable() && !configuration.isRightEditable()) {
- return true;
- } else if (!configuration.isLeftEditable() && configuration.isRightEditable()) {
- return true;
- }
- }
- }
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/DiffSelectedPropertyTester.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/DiffSelectedPropertyTester.java
deleted file mode 100644
index 609a4bbad..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/DiffSelectedPropertyTester.java
+++ /dev/null
@@ -1,68 +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.handler.propertytester;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.expressions.PropertyTester;
-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.DifferenceState;
-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.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * A property tester that checks if a diff is selected in the compare editor.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class DiffSelectedPropertyTester extends PropertyTester {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.expressions.PropertyTester#test(java.lang.Object, java.lang.String,
- * java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof IEditorPart) {
- IEditorInput i = ((IEditorPart)receiver).getEditorInput();
- if (i instanceof CompareEditorInput) {
- CompareConfiguration configuration = ((CompareEditorInput)i).getCompareConfiguration();
- ISelection selection = (ISelection)configuration
- .getProperty(EMFCompareConstants.SMV_SELECTION);
- if (selection instanceof IStructuredSelection) {
- Object element = ((IStructuredSelection)selection).getFirstElement();
- if (element instanceof Adapter) {
- Notifier target = ((Adapter)element).getTarget();
- if (target instanceof TreeNode) {
- EObject data = ((TreeNode)target).getData();
- if (data instanceof Diff) {
- if (DifferenceState.MERGED != ((Diff)data).getState()) {
- return true;
- }
- }
- }
- }
- }
- }
- }
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/MergedToPropertyTester.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/MergedToPropertyTester.java
deleted file mode 100644
index 3de306ca6..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/MergedToPropertyTester.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.handler.propertytester;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * A property tester linked with
- * {@link org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.AbstractMergeHandler.AbstractMergedTo}. It returns
- * true when both model sides are editable.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class MergedToPropertyTester extends PropertyTester {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.expressions.PropertyTester#test(java.lang.Object, java.lang.String,
- * java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof IEditorPart) {
- IEditorInput i = ((IEditorPart)receiver).getEditorInput();
- if (i instanceof CompareEditorInput) {
- CompareConfiguration configuration = ((CompareEditorInput)i).getCompareConfiguration();
- if (configuration.isLeftEditable() && configuration.isRightEditable()) {
- return true;
- }
- }
- }
- return false;
- }
-
-}
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/ModelSaveablePropertyTester.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/ModelSaveablePropertyTester.java
deleted file mode 100644
index ea6890f04..000000000
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/handler/propertytester/ModelSaveablePropertyTester.java
+++ /dev/null
@@ -1,50 +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.handler.propertytester;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * A property tester linked with
- * {@link org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer.handler.SaveComparisonModel}. It tests
- * the editable property of both model sides.
- *
- * @author <a href="mailto:axel.richard@obeo.fr">Axel Richard</a>
- * @since 3.0
- */
-public class ModelSaveablePropertyTester extends PropertyTester {
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.core.expressions.PropertyTester#test(java.lang.Object, java.lang.String,
- * java.lang.Object[], java.lang.Object)
- */
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- if (receiver instanceof IEditorPart) {
- IEditorInput i = ((IEditorPart)receiver).getEditorInput();
- if (i instanceof CompareEditorInput) {
- CompareConfiguration configuration = ((CompareEditorInput)i).getCompareConfiguration();
- if (!configuration.isLeftEditable() || !configuration.isRightEditable()) {
- return false;
- } else if (((CompareEditorInput)i).isDirty()) {
- return false;
- }
- }
- }
- return true;
- }
-
-}

Back to the top