Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2013-10-17 06:22:28 -0400
committerMikaël Barbero2013-10-18 16:28:18 -0400
commit13f0fdad43d0490b6b4dd2e9bce80d94f2bd8559 (patch)
tree6b367bdab463e07dd04c3d96a05e954ba5448462 /plugins/org.eclipse.emf.compare.ide.ui/src
parent7252fe708b5006cb279ea6844cdf44c5a9309280 (diff)
downloadorg.eclipse.emf.compare-13f0fdad43d0490b6b4dd2e9bce80d94f2bd8559.tar.gz
org.eclipse.emf.compare-13f0fdad43d0490b6b4dd2e9bce80d94f2bd8559.tar.xz
org.eclipse.emf.compare-13f0fdad43d0490b6b4dd2e9bce80d94f2bd8559.zip
Fix regression on undo/redo support.
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/contentmergeviewer/EMFCompareContentMergeViewer.java24
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java37
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java2
3 files changed, 18 insertions, 45 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
index b1a5f3a85..5cf148225 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java
@@ -80,6 +80,7 @@ import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.menus.IMenuService;
import org.eclipse.ui.part.IPage;
import org.eclipse.ui.services.IServiceLocator;
@@ -134,6 +135,9 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
.getAdapterFactory());
}
+ redoAction = new RedoAction(getCompareConfiguration().getEditingDomain());
+ undoAction = new UndoAction(getCompareConfiguration().getEditingDomain());
+
editingDomainChange(null, getCompareConfiguration().getEditingDomain());
getCompareConfiguration().getEventBus().register(this);
}
@@ -174,12 +178,9 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
setLeftDirty(newValue.getCommandStack().isLeftSaveNeeded());
setRightDirty(newValue.getCommandStack().isRightSaveNeeded());
}
- if (undoAction != null) {
- undoAction.setEditingDomain(newValue);
- }
- if (redoAction != null) {
- redoAction.setEditingDomain(newValue);
- }
+
+ undoAction.setEditingDomain(newValue);
+ redoAction.setEditingDomain(newValue);
}
}
@@ -304,6 +305,8 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
*/
@Override
protected void createToolItems(ToolBarManager toolBarManager) {
+ getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
+ getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
// Add extension point contributions to the content merge viewer toolbar
IServiceLocator workbench = PlatformUI.getWorkbench();
@@ -316,12 +319,9 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
}
public void commandStackChanged(EventObject event) {
- if (undoAction != null) {
- undoAction.update();
- }
- if (redoAction != null) {
- redoAction.update();
- }
+ undoAction.update();
+ redoAction.update();
+
if (getCompareConfiguration().getEditingDomain() != null) {
setLeftDirty(getCompareConfiguration().getEditingDomain().getCommandStack().isLeftSaveNeeded());
setRightDirty(getCompareConfiguration().getEditingDomain().getCommandStack().isRightSaveNeeded());
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java
index c10e9f611..e5d7f5977 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java
@@ -317,13 +317,14 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements Comman
protected void attachListeners(final MergeSourceViewer viewer) {
final StyledText textWidget = viewer.getSourceViewer().getTextWidget();
textWidget.addFocusListener(new FocusListener() {
-
public void focusLost(FocusEvent e) {
- setActiveViewer(viewer, false);
+ getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(), null);
+ getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(), null);
}
public void focusGained(FocusEvent e) {
- setActiveViewer(viewer, true);
+ getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(), fUndoAction);
+ getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(), fRedoAction);
}
});
@@ -350,36 +351,6 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer implements Comman
}
}
});
-
- }
-
- private void setActiveViewer(MergeSourceViewer viewer, boolean activate) {
- // connectContributedActions(viewer, activate);
- if (activate) {
- // fFocusPart = viewer;
- connectGlobalActions(viewer);
- } else {
- connectGlobalActions(null);
- }
- }
-
- private void connectGlobalActions(final MergeSourceViewer part) {
- if (getHandlerService() != null) {
- if (part != null) {
- part.updateActions();
- }
- getHandlerService().updatePaneActionHandlers(new Runnable() {
- public void run() {
- if (part == null) {
- getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(), null);
- getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(), null);
- } else {
- getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(), fUndoAction);
- getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(), fRedoAction);
- }
- }
- });
- }
}
/**
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
index 46281ffbf..d61d6836a 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java
@@ -252,6 +252,8 @@ public class EMFCompareStructureMergeViewer extends AbstractStructuredViewerWrap
undoAction = new UndoAction(getCompareConfiguration().getEditingDomain());
redoAction = new RedoAction(getCompareConfiguration().getEditingDomain());
+ editingDomainChange(null, getCompareConfiguration().getEditingDomain());
+
inputChangedTask.setPriority(Job.LONG);
config.getEventBus().register(this);

Back to the top