Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-27 19:12:00 -0400
committerChristian W. Damus2014-03-27 19:12:00 -0400
commit93eb49aff9fd7724c7312fc5ffb7418d1981432e (patch)
treeaf7a2e3a0683e767c6c2997546cde973e6691ed5 /plugins
parent906d12034232809cf6980f2d505c8d5edd1ae988 (diff)
downloadorg.eclipse.papyrus-93eb49aff9fd7724c7312fc5ffb7418d1981432e.tar.gz
org.eclipse.papyrus-93eb49aff9fd7724c7312fc5ffb7418d1981432e.tar.xz
org.eclipse.papyrus-93eb49aff9fd7724c7312fc5ffb7418d1981432e.zip
410346: Sudden performance degradation e.g. of the Outline View update.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=410346 More fixes for undisposed ComposedAdapterFactory instances. Also don't need extra UMLItemProviderAdapterFactory for getting UML labels because it is already in the composed adapter factory.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/ui/GroupNotifierLabelProvider.java18
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/utils/Utils.java25
2 files changed, 20 insertions, 23 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/ui/GroupNotifierLabelProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/ui/GroupNotifierLabelProvider.java
index 9f11cf849f6..04eacfd72b9 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/ui/GroupNotifierLabelProvider.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/ui/GroupNotifierLabelProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 Atos.
+ * Copyright (c) 2011, 2014 Atos, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Arthur Daussy (Atos) - Initial API and implementation
* Arthur Daussy - 371712 : 372745: [ActivityDiagram] Major refactoring group framework
+ * Christian W. Damus (CEA) - bug 410346
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.activity.activitygroup.ui;
@@ -25,13 +26,14 @@ import org.eclipse.swt.graphics.Image;
*/
public class GroupNotifierLabelProvider extends LabelProvider {
- static AdapterFactoryLabelProvider factory = new AdapterFactoryLabelProvider(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
+ private ComposedAdapterFactory factory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ private AdapterFactoryLabelProvider delegate = new AdapterFactoryLabelProvider(factory);
@Override
public String getText(Object element) {
if(element instanceof IGroupNotifier) {
IGroupNotifier notifier = (IGroupNotifier)element;
- return factory.getText(notifier.getEObject());
+ return delegate.getText(notifier.getEObject());
}
return super.getText(element);
}
@@ -40,8 +42,16 @@ public class GroupNotifierLabelProvider extends LabelProvider {
public Image getImage(Object element) {
if(element instanceof IGroupNotifier) {
IGroupNotifier notifier = (IGroupNotifier)element;
- return factory.getImage(notifier.getEObject());
+ return delegate.getImage(notifier.getEObject());
}
return super.getImage(element);
}
+
+ @Override
+ public void dispose() {
+ delegate.dispose();
+ factory.dispose();
+
+ super.dispose();
+ }
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/utils/Utils.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/utils/Utils.java
index b38517b9826..31c72b85ba8 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/utils/Utils.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/activitygroup/utils/Utils.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 Atos.
+ * Copyright (c) 2011, 2014 Atos, CEA, and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -10,6 +10,7 @@
* Contributors:
* Arthur Daussy (Atos) - Initial API and implementation
* Arthur Daussy - 371712 : 372745: [ActivityDiagram] Major refactoring group framework
+ * Christian W. Damus (CEA) - bug 410346
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.activity.activitygroup.utils;
@@ -25,8 +26,6 @@ import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.requests.ChangeBoundsRequest;
@@ -37,8 +36,7 @@ import org.eclipse.gmf.runtime.notation.LayoutConstraint;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.papyrus.uml.diagram.activity.activitygroup.predicates.DescendantsFilter;
import org.eclipse.papyrus.uml.diagram.activity.activitygroup.request.IGroupRequest;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.edit.providers.UMLItemProviderAdapterFactory;
+import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
@@ -176,27 +174,16 @@ public class Utils {
return Sets.filter(all, new DescendantsFilter(all));
}
- private static UMLItemProviderAdapterFactory adapter = new UMLItemProviderAdapterFactory();
-
- static AdapterFactoryLabelProvider factory = new AdapterFactoryLabelProvider(new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE));
+ static AdapterFactoryLabelProvider factory = new AdapterFactoryLabelProvider(UMLDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
public static String getCorrectLabel(Object object) {
if(object instanceof EObject) {
- if(object instanceof Element) {
- Object provider = adapter.adapt(object, IItemLabelProvider.class);
- if(provider instanceof IItemLabelProvider) {
- IItemLabelProvider labelProvider = (IItemLabelProvider)provider;
- return labelProvider.getText(object);
- }
- } else {
- return factory.getText(object);
- }
+ return factory.getText(object);
} else if(object instanceof EReference) {
return ((EReference)object).getName();
} else {
- return object.toString();
+ return String.valueOf(object); // null safe
}
- return "Error in getting name";////$NON-NLS-1$
}
public static String getCorrectLabel(IAdaptable object) {

Back to the top