Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaël Barbero2013-04-25 14:52:27 +0000
committerMikaël Barbero2013-04-25 14:52:50 +0000
commitc9ee3bc67b43b7bbed8dec45bac0676224ef526f (patch)
treebd86b914e2374789b78d5e0e187497c4b8e58636
parent24c6099a128f2123828c217081af075e9263c76f (diff)
downloadorg.eclipse.emf.compare-c9ee3bc67b43b7bbed8dec45bac0676224ef526f.tar.gz
org.eclipse.emf.compare-c9ee3bc67b43b7bbed8dec45bac0676224ef526f.tar.xz
org.eclipse.emf.compare-c9ee3bc67b43b7bbed8dec45bac0676224ef526f.zip
[406548] Allow to save more than once
- listen to property changes in content merge viewer and react accordingly when it is the editing domain that change - re-create a new CompareEditingDomain for each new Comparison and dispose properly the previous one.
-rw-r--r--plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/contentmergeviewer/diagram/DiagramContentMergeViewer.java82
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/EMFCompareContentMergeViewer.java97
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/contentmergeviewer/text/EMFCompareTextMergeViewer.java55
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/EMFCompareStructureMergeViewer.java16
4 files changed, 114 insertions, 136 deletions
diff --git a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/contentmergeviewer/diagram/DiagramContentMergeViewer.java b/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/contentmergeviewer/diagram/DiagramContentMergeViewer.java
index b54e785be..1ea227c44 100644
--- a/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/contentmergeviewer/diagram/DiagramContentMergeViewer.java
+++ b/plugins/org.eclipse.emf.compare.diagram.ide.ui/src/org/eclipse/emf/compare/diagram/ide/ui/internal/contentmergeviewer/diagram/DiagramContentMergeViewer.java
@@ -40,7 +40,7 @@ import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.CommandStackListener;
+import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.compare.Diff;
import org.eclipse.emf.compare.DifferenceKind;
import org.eclipse.emf.compare.DifferenceState;
@@ -57,20 +57,13 @@ import org.eclipse.emf.compare.diagram.internal.extensions.DiagramDiff;
import org.eclipse.emf.compare.diagram.internal.extensions.Hide;
import org.eclipse.emf.compare.diagram.internal.extensions.Show;
import org.eclipse.emf.compare.diagram.internal.factories.extensions.CoordinatesChangeFactory;
-import org.eclipse.emf.compare.domain.ICompareEditingDomain;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.EMFCompareContentMergeViewer;
import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.tree.TreeContentMergeViewerContentProvider;
-import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.RedoAction;
-import org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.UndoAction;
import org.eclipse.emf.compare.rcp.EMFCompareRCPPlugin;
import org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.IMergeViewer;
import org.eclipse.emf.compare.rcp.ui.internal.mergeviewer.IMergeViewer.MergeViewerSide;
import org.eclipse.emf.compare.utils.DiffUtil;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
-import org.eclipse.emf.transaction.TransactionalCommandStack;
import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.GraphicalEditPart;
@@ -85,7 +78,6 @@ import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Composite;
@@ -1693,12 +1685,6 @@ public class DiagramContentMergeViewer extends EMFCompareContentMergeViewer {
*/
private static final String BUNDLE_NAME = DiagramContentMergeViewer.class.getName();
- /** The editing domain. */
- private ICompareEditingDomain fEditingDomain;
-
- /** Listener to manage the update of the decorators on events about the command stack. */
- private CommandStackListener fDecoratorsCommandStackListener;
-
/** The phantom manager to use in the context of this viewer. */
private final DecoratorsManager fDecoratorsManager = new DecoratorsManager();
@@ -1706,12 +1692,6 @@ public class DiagramContentMergeViewer extends EMFCompareContentMergeViewer {
private Diff fCurrentSelectedDiff;
/**
- * The adapter factory used to create the content and label provider for ancestor, left and right
- * {@link DiagramMergeViewer}.
- */
- private final ComposedAdapterFactory fAdapterFactory;
-
- /**
* Creates a new {@link DiagramContentMergeViewer} by calling the super constructor with the given
* parameters.
* <p>
@@ -1727,25 +1707,8 @@ public class DiagramContentMergeViewer extends EMFCompareContentMergeViewer {
*/
public DiagramContentMergeViewer(Composite parent, CompareConfiguration config) {
super(SWT.NONE, ResourceBundle.getBundle(BUNDLE_NAME), config);
-
- fAdapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
- fAdapterFactory.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
- fAdapterFactory.addAdapterFactory(new ResourceItemProviderAdapterFactory());
-
buildControl(parent);
- setContentProvider(new TreeContentMergeViewerContentProvider(config, getComparison()));
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.eclipse.compare.contentmergeviewer.ContentMergeViewer#handleDispose(org.eclipse.swt.events.DisposeEvent)
- */
- @Override
- protected void handleDispose(DisposeEvent event) {
- fEditingDomain.getCommandStack().removeCommandStackListener(fDecoratorsCommandStackListener);
- fAdapterFactory.dispose();
- super.handleDispose(event);
+ setContentProvider(new TreeContentMergeViewerContentProvider(config));
}
/**
@@ -1852,7 +1815,7 @@ public class DiagramContentMergeViewer extends EMFCompareContentMergeViewer {
*/
@Override
protected void updateContent(Object ancestor, Object left, Object right) {
- initStackListenerAndUpdateContent(ancestor, left, right);
+ super.updateContent(ancestor, left, right);
getLeftMergeViewer().getGraphicalViewer().flush();
getRightMergeViewer().getGraphicalViewer().flush();
@@ -1886,34 +1849,25 @@ public class DiagramContentMergeViewer extends EMFCompareContentMergeViewer {
/**
* {@inheritDoc}
*
- * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.EMFCompareContentMergeViewer#installCommandStackListener(org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.UndoAction,
- * org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.util.RedoAction)
+ * @see org.eclipse.emf.compare.ide.ui.internal.contentmergeviewer.EMFCompareContentMergeViewer#commandStackChanged(java.util.EventObject)
*/
@Override
- protected CommandStackListener installCommandStackListener(UndoAction undoAction, RedoAction redoAction) {
- CommandStackListener cmdStackListener = super.installCommandStackListener(undoAction, redoAction);
- fEditingDomain = getEditingDomain();
- fDecoratorsCommandStackListener = new CommandStackListener() {
-
- public void commandStackChanged(EventObject event) {
- Object source = event.getSource();
- if (source instanceof TransactionalCommandStack) {
- Command command = ((TransactionalCommandStack)source).getMostRecentCommand();
- if (command instanceof CopyCommand) {
- Iterator<DiagramDiff> diffs = Iterators.filter(command.getAffectedObjects()
- .iterator(), DiagramDiff.class);
- while (diffs.hasNext()) {
- DiagramDiff diagramDiff = diffs.next();
- fDecoratorsManager.hideAll();
- fDecoratorsManager.removeAll(); // force the computation for the next
- // decorator reveal.
- }
- }
+ public void commandStackChanged(EventObject event) {
+ super.commandStackChanged(event);
+ Object source = event.getSource();
+ if (source instanceof CommandStack) {
+ Command command = ((CommandStack)source).getMostRecentCommand();
+ if (command instanceof CopyCommand) {
+ Iterator<DiagramDiff> diffs = Iterators.filter(command.getAffectedObjects().iterator(),
+ DiagramDiff.class);
+ while (diffs.hasNext()) {
+ DiagramDiff diagramDiff = diffs.next();
+ fDecoratorsManager.hideAll();
+ fDecoratorsManager.removeAll(); // force the computation for the next
+ // decorator reveal.
}
}
- };
- fEditingDomain.getCommandStack().addCommandStackListener(fDecoratorsCommandStackListener);
- return cmdStackListener;
+ }
}
/**
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 07d2e70b0..2da41fddf 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
@@ -45,6 +45,8 @@ import org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.filters.impl
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -65,7 +67,7 @@ import org.eclipse.ui.services.IServiceLocator;
/**
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
*/
-public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer implements ISelectionChangedListener, ICompareColor.Provider, IAdaptable {
+public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer implements ISelectionChangedListener, ICompareColor.Provider, IAdaptable, IPropertyChangeListener, CommandStackListener {
private static final String HANDLER_SERVICE = "fHandlerService";
@@ -98,8 +100,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
private final DynamicObject fDynamicObject;
- private CommandStackListener fCommandStackListener;
-
private UndoAction undoAction;
private RedoAction redoAction;
@@ -112,6 +112,38 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
protected EMFCompareContentMergeViewer(int style, ResourceBundle bundle, CompareConfiguration cc) {
super(style, bundle, cc);
fDynamicObject = new DynamicObject(this);
+
+ editingDomainChange(null, getEditingDomain());
+ cc.addPropertyChangeListener(this);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if (EMFCompareConstants.EDITING_DOMAIN.equals(event.getProperty())) {
+ editingDomainChange((ICompareEditingDomain)event.getOldValue(), (ICompareEditingDomain)event
+ .getNewValue());
+ }
+ }
+
+ /**
+ * @param oldValue
+ * @param newValue
+ */
+ protected void editingDomainChange(ICompareEditingDomain oldValue, ICompareEditingDomain newValue) {
+ if (oldValue != null) {
+ oldValue.getCommandStack().removeCommandStackListener(this);
+ }
+ if (newValue != oldValue) {
+ if (newValue != null) {
+ newValue.getCommandStack().addCommandStackListener(this);
+ }
+ if (undoAction != null) {
+ undoAction.setEditingDomain(newValue);
+ }
+ if (redoAction != null) {
+ redoAction.setEditingDomain(newValue);
+ }
+
+ }
}
/**
@@ -160,7 +192,10 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
*/
@Override
protected void updateContent(Object ancestor, Object left, Object right) {
- initStackListenerAndUpdateContent(ancestor, left, right);
+ fAncestor.setInput(ancestor);
+ fLeft.setInput(left);
+ fRight.setInput(right);
+
updateSelection(left);
}
@@ -180,19 +215,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
getCenterControl().redraw();
}
- protected void initStackListenerAndUpdateContent(Object ancestor, Object left, Object right) {
- undoAction.setEditingDomain(getEditingDomain());
- redoAction.setEditingDomain(getEditingDomain());
-
- if (getEditingDomain() != null && fCommandStackListener == null) {
- fCommandStackListener = installCommandStackListener(undoAction, redoAction);
- }
-
- fAncestor.setInput(ancestor);
- fLeft.setInput(left);
- fRight.setInput(right);
- }
-
private ISelection createSelectionOrEmpty(final Object o) {
final ISelection selection;
if (o != null) {
@@ -312,28 +334,24 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
undoAction = new UndoAction(getEditingDomain());
redoAction = new RedoAction(getEditingDomain());
- if (getEditingDomain() != null && fCommandStackListener == null) {
- fCommandStackListener = installCommandStackListener(undoAction, redoAction);
- }
-
getHandlerService().setGlobalActionHandler(ActionFactory.UNDO.getId(), undoAction);
getHandlerService().setGlobalActionHandler(ActionFactory.REDO.getId(), redoAction);
}
- protected CommandStackListener installCommandStackListener(final UndoAction undoAction,
- final RedoAction redoAction) {
- CommandStackListener commandStackListener = new CommandStackListener() {
- public void commandStackChanged(EventObject event) {
- undoAction.update();
- redoAction.update();
- setLeftDirty(getEditingDomain().getCommandStack().isLeftSaveNeeded());
- setRightDirty(getEditingDomain().getCommandStack().isRightSaveNeeded());
- refresh();
- }
- };
- getEditingDomain().getCommandStack().addCommandStackListener(commandStackListener);
- return commandStackListener;
+ public void commandStackChanged(EventObject event) {
+ if (undoAction != null) {
+ undoAction.update();
+ }
+ if (redoAction != null) {
+ redoAction.update();
+ }
+ if (getEditingDomain() != null) {
+ setLeftDirty(getEditingDomain().getCommandStack().isLeftSaveNeeded());
+ setRightDirty(getEditingDomain().getCommandStack().isRightSaveNeeded());
+ }
+
+ refresh();
}
/**
@@ -349,12 +367,6 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
leftToRight, EMFCompareRCPPlugin.getDefault().getMergerRegistry());
getEditingDomain().getCommandStack().execute(copyCommand);
-
- // if (leftToRight) {
- // setRightDirty(true);
- // } else {
- // setLeftDirty(true);
- // }
refresh();
}
@@ -570,9 +582,8 @@ public abstract class EMFCompareContentMergeViewer extends ContentMergeViewer im
*/
@Override
protected void handleDispose(DisposeEvent event) {
- if (fCommandStackListener != null && getEditingDomain() != null) {
- getEditingDomain().getCommandStack().removeCommandStackListener(fCommandStackListener);
- }
+ getCompareConfiguration().removePropertyChangeListener(this);
+ editingDomainChange(getEditingDomain(), null);
super.handleDispose(event);
}
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 9d6a7f1dc..023f9221d 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
@@ -52,6 +52,8 @@ import org.eclipse.emf.edit.command.ChangeCommand;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -59,7 +61,7 @@ import org.eclipse.swt.widgets.Control;
/**
* @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
*/
-public class EMFCompareTextMergeViewer extends TextMergeViewer {
+public class EMFCompareTextMergeViewer extends TextMergeViewer implements IPropertyChangeListener, CommandStackListener {
private static final String BUNDLE_NAME = EMFCompareTextMergeViewer.class.getName();
@@ -69,8 +71,6 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer {
private ActionContributionItem fCopyDiffRightToLeftItem;
- private CommandStackListener fCommandStackListener;
-
/**
* @param parent
* @param configuration
@@ -78,27 +78,40 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer {
public EMFCompareTextMergeViewer(Composite parent, CompareConfiguration configuration) {
super(parent, configuration);
setContentProvider(new EMFCompareTextMergeViewerContentProvider(configuration));
+
+ editingDomainChange(null, getEditingDomain());
+ configuration.addPropertyChangeListener(this);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if (EMFCompareConstants.EDITING_DOMAIN.equals(event.getProperty())) {
+ editingDomainChange((ICompareEditingDomain)event.getOldValue(), (ICompareEditingDomain)event
+ .getNewValue());
+ }
}
/**
- * {@inheritDoc}
- *
- * @see org.eclipse.compare.contentmergeviewer.TextMergeViewer#updateContent(java.lang.Object,
- * java.lang.Object, java.lang.Object)
+ * @param oldValue
+ * @param newValue
*/
- @Override
- protected void updateContent(Object ancestor, Object left, Object right) {
- if (getEditingDomain() != null && fCommandStackListener == null) {
- fCommandStackListener = new CommandStackListener() {
- public void commandStackChanged(EventObject event) {
- setLeftDirty(getEditingDomain().getCommandStack().isLeftSaveNeeded());
- setRightDirty(getEditingDomain().getCommandStack().isRightSaveNeeded());
- refresh();
- }
- };
- getEditingDomain().getCommandStack().addCommandStackListener(fCommandStackListener);
+ protected void editingDomainChange(ICompareEditingDomain oldValue, ICompareEditingDomain newValue) {
+ if (oldValue != null) {
+ oldValue.getCommandStack().removeCommandStackListener(this);
+ }
+ if (newValue != oldValue) {
+ if (newValue != null) {
+ newValue.getCommandStack().addCommandStackListener(this);
+ }
+ }
+ }
+
+ public void commandStackChanged(EventObject event) {
+ if (getEditingDomain() != null) {
+ setLeftDirty(getEditingDomain().getCommandStack().isLeftSaveNeeded());
+ setRightDirty(getEditingDomain().getCommandStack().isRightSaveNeeded());
}
- super.updateContent(ancestor, left, right);
+
+ refresh();
}
/**
@@ -344,9 +357,7 @@ public class EMFCompareTextMergeViewer extends TextMergeViewer {
*/
@Override
protected void handleDispose(DisposeEvent event) {
- if (fCommandStackListener != null && getEditingDomain() != null) {
- getEditingDomain().getCommandStack().removeCommandStackListener(fCommandStackListener);
- }
+ editingDomainChange(getEditingDomain(), null);
super.handleDispose(event);
}
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 8285bd62b..8de3506ff 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
@@ -38,6 +38,7 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.util.BasicMonitor;
@@ -338,14 +339,14 @@ public class EMFCompareStructureMergeViewer extends DiffTreeViewer implements Co
final ResourceSet rightResourceSet = (ResourceSet)scope.getRight();
final ResourceSet originResourceSet = (ResourceSet)scope.getOrigin();
- editingDomain = (ICompareEditingDomain)getCompareConfiguration().getProperty(
- EMFCompareConstants.EDITING_DOMAIN);
- if (editingDomain == null) {
- editingDomain = EMFCompareEditingDomain.create(leftResourceSet, rightResourceSet,
- originResourceSet);
- getCompareConfiguration().setProperty(EMFCompareConstants.EDITING_DOMAIN, editingDomain);
+ if (editingDomain != null) {
+ editingDomain.getCommandStack().removeCommandStackListener(this);
+ editingDomain.dispose();
}
+ editingDomain = EMFCompareEditingDomain.create(leftResourceSet, rightResourceSet,
+ originResourceSet);
+ getCompareConfiguration().setProperty(EMFCompareConstants.EDITING_DOMAIN, editingDomain);
editingDomain.getCommandStack().addCommandStackListener(this);
compareInputChanged(scope, compareResult);
@@ -388,6 +389,7 @@ public class EMFCompareStructureMergeViewer extends DiffTreeViewer implements Co
if (editingDomain != null) {
editingDomain.getCommandStack().removeCommandStackListener(this);
getCompareConfiguration().setProperty(EMFCompareConstants.EDITING_DOMAIN, null);
+ editingDomain.dispose();
editingDomain = null;
}
@@ -733,7 +735,7 @@ public class EMFCompareStructureMergeViewer extends DiffTreeViewer implements Co
* @see org.eclipse.emf.common.command.CommandStackListener#commandStackChanged(java.util.EventObject)
*/
public void commandStackChanged(EventObject event) {
- Command mostRecentCommand = editingDomain.getCommandStack().getMostRecentCommand();
+ Command mostRecentCommand = ((CommandStack)event.getSource()).getMostRecentCommand();
if (mostRecentCommand instanceof ICompareCopyCommand) {
Collection<?> affectedObjects = mostRecentCommand.getAffectedObjects();
refresh(true);

Back to the top