diff options
author | Vincent Lorenzo | 2018-03-02 14:12:00 +0000 |
---|---|---|
committer | vincent lorenzo | 2018-03-02 15:42:06 +0000 |
commit | d8bec2889f5f93ea845dca891c53d16ef74330d3 (patch) | |
tree | 67ade52a29282d5852d778be40c89fe4c0d46ad4 /plugins/uml/diagram | |
parent | b923be500734dc0a8162277b2d7ee41992c2e7ac (diff) | |
download | org.eclipse.papyrus-d8bec2889f5f93ea845dca891c53d16ef74330d3.tar.gz org.eclipse.papyrus-d8bec2889f5f93ea845dca891c53d16ef74330d3.tar.xz org.eclipse.papyrus-d8bec2889f5f93ea845dca891c53d16ef74330d3.zip |
Bug 531936: [SequenceDiagram] The operation history listener registered by the GridManagmentEditPolicy is never removed
- fix only the remove of the listener on desactivate()
Change-Id: Ieaf6258c779890d9dfc55cd3b2a8115554c7234f
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins/uml/diagram')
-rw-r--r-- | plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java index a459e048731..26f2e29c8fc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/referencialgrilling/GridManagementEditPolicy.java @@ -9,7 +9,7 @@ * Contributors: * CEA LIST - Initial API and implementation * Mickaƫl ADAM (ALL4TEC) mickael.adam@all4tec.net - Bug 519756 - * + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 531936 *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.sequence.referencialgrilling; @@ -24,7 +24,6 @@ import java.util.List; import org.eclipse.core.commands.operations.OperationHistoryFactory; import org.eclipse.draw2d.geometry.Point; -import org.eclipse.emf.common.command.CommandStackListener; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.edit.command.SetCommand; @@ -98,8 +97,8 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A public boolean CREATION_X_FREE = true; /** if the CREATION_X_FREE == false COLUMN are created at fixed position **/ public int X_SPACING = 100; - private ContentDiagramListener contentDiagramListener; - private CommandStackListener commandStackListener; + // private ContentDiagramListener contentDiagramListener; + // private CommandStackListener commandStackListener; /** * @return the moveAllLinesAtSamePosition @@ -185,11 +184,14 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A public void activate() { super.activate(); getDiagramEventBroker().addNotificationListener(((EObject) getHost().getModel()), this); - contentDiagramListener = new ContentDiagramListener(this); - commandStackListener = new GridCommandStackListener(this); - operationHistoryListener = new RedirectionOperationListener(this); + + // contentDiagramListener = new ContentDiagramListener(this); + // commandStackListener = new GridCommandStackListener(this); + + this.operationHistoryListener = new RedirectionOperationListener(this); + OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(this.operationHistoryListener); // ((EObject) getHost().getModel()).eResource().eAdapters().add(contentDiagramListener); - OperationHistoryFactory.getOperationHistory().addOperationHistoryListener(operationHistoryListener); + // getDiagramEditPart(getHost()).getEditingDomain().getCommandStack().addCommandStackListener(commandStackListener); // PlatformUI.getWorkbench().getDisplay().addFilter(SWT.KeyDown, new KeyToSetMoveLinesListener(this, SWT.SHIFT, false)); // PlatformUI.getWorkbench().getDisplay().addFilter(SWT.KeyUp, new KeyToSetMoveLinesListener(this, SWT.SHIFT, true)); @@ -351,6 +353,9 @@ public class GridManagementEditPolicy extends GraphicalEditPolicyEx implements A @Override public void deactivate() { getDiagramEventBroker().removeNotificationListener(((EObject) getHost().getModel()), this); + if (null != this.operationHistoryListener) { + OperationHistoryFactory.getOperationHistory().removeOperationHistoryListener(this.operationHistoryListener); + } super.deactivate(); } |