Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-05-06 18:58:51 +0000
committerChristian W. Damus2014-05-06 19:02:47 +0000
commit8077baaf79abf20c82af03b94edb68cb367e066b (patch)
tree2097444c19964007583a73c306783030e944a90b /extraplugins
parentbe9d3223460cee9662a07961a9500f76130879a4 (diff)
downloadorg.eclipse.papyrus-8077baaf79abf20c82af03b94edb68cb367e066b.tar.gz
org.eclipse.papyrus-8077baaf79abf20c82af03b94edb68cb367e066b.tar.xz
org.eclipse.papyrus-8077baaf79abf20c82af03b94edb68cb367e066b.zip
432813: [Performance] Papyrus performs poorly (grey screen) or crashes when working on large profiles
https://bugs.eclipse.org/bugs/show_bug.cgi?id=432813 Fix leak of models on the operation history when CDO integration layer is installed.
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java12
-rw-r--r--extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java28
2 files changed, 38 insertions, 2 deletions
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java
index a94616e64a5..188581b1c41 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOAwareCommandStack.java
@@ -9,6 +9,8 @@
* Contributors:
* CEA LIST - Initial API and implementation
* Christian W. Damus (CEA) - bug 402525
+ * Christian W. Damus (CEA) - bug 432813
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.resource;
@@ -40,6 +42,16 @@ public class CDOAwareCommandStack extends NestingNotifyingWorkspaceCommandStack
}
@Override
+ public void dispose() {
+ IOperationHistory history = getOperationHistory();
+ if(history != null) {
+ CDOUndoContext.flushAll(history);
+ }
+
+ super.dispose();
+ }
+
+ @Override
protected NestingNotifyingWorkspaceCommandStack createNestedCommandStack(IOperationHistory history) {
return new CDOAwareCommandStack(true, history);
}
diff --git a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java
index cde8bb156b8..840428a31c2 100644
--- a/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java
+++ b/extraplugins/cdo/org.eclipse.papyrus.cdo.core/src/org/eclipse/papyrus/cdo/core/resource/CDOUndoContext.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2013 CEA LIST.
+ * Copyright (c) 2013, 2014 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,11 +8,15 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 432813
+ *
*****************************************************************************/
package org.eclipse.papyrus.cdo.core.resource;
+import java.util.Collections;
import java.util.Set;
+import org.eclipse.core.commands.operations.IOperationHistory;
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.osgi.util.NLS;
@@ -29,6 +33,8 @@ import com.google.common.collect.Sets;
*/
public final class CDOUndoContext implements IUndoContext {
+ private static CDOUndoContext ALL_CDO = new CDOUndoContext();
+
private final Set<EObject> affectedObjects;
private String cachedLabel;
@@ -52,6 +58,22 @@ public final class CDOUndoContext implements IUndoContext {
this.affectedObjects = ImmutableSet.copyOf(affectedObjects);
}
+ private CDOUndoContext() {
+ super();
+
+ this.affectedObjects = Collections.<EObject> emptySet();
+ }
+
+ /**
+ * Flushes all {@code CDOUndoContext}s from the specified operation {@code history}.
+ *
+ * @param history
+ * a history to flush
+ */
+ public static void flushAll(IOperationHistory history) {
+ history.dispose(ALL_CDO, true, true, true);
+ }
+
/**
* Obtains an immutable set of the objects affected by the operation.
*
@@ -61,10 +83,12 @@ public final class CDOUndoContext implements IUndoContext {
return affectedObjects;
}
+ @Override
public boolean matches(IUndoContext context) {
- return (context instanceof CDOUndoContext) && !Sets.intersection(getAffectedObjects(), ((CDOUndoContext)context).getAffectedObjects()).isEmpty();
+ return (context == ALL_CDO) || (context instanceof CDOUndoContext) && !Sets.intersection(getAffectedObjects(), ((CDOUndoContext)context).getAffectedObjects()).isEmpty();
}
+ @Override
public String getLabel() {
if(cachedLabel == null) {
StringBuilder buf = new StringBuilder();

Back to the top