diff options
| author | Camille Letavernier | 2016-01-06 10:54:55 +0000 |
|---|---|---|
| committer | Camille Letavernier | 2016-01-06 12:00:38 +0000 |
| commit | 53bd3941853109af4fc17d1320c60a3e3bfb12a0 (patch) | |
| tree | e6246d7fad7eecf7160bb71905d9654c54dae530 | |
| parent | 731a29abe997e2175b9982a9fd026e6672ee5be0 (diff) | |
| download | org.eclipse.papyrus-53bd3941853109af4fc17d1320c60a3e3bfb12a0.tar.gz org.eclipse.papyrus-53bd3941853109af4fc17d1320c60a3e3bfb12a0.tar.xz org.eclipse.papyrus-53bd3941853109af4fc17d1320c60a3e3bfb12a0.zip | |
Bug 485259: [Performances - Properties View] Opening a Reference browser
is
slow on big models
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485259
Change-Id: Icb6dbe05b31b342c9c6271ef4f1b4bc1a39a0c40
Signed-off-by: Camille Letavernier <camille.letavernier@cea.fr>
4 files changed, 28 insertions, 5 deletions
diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java index d1c69487e6b..746d71885de 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf/src/org/eclipse/papyrus/infra/emf/providers/EMFLabelProvider.java @@ -86,7 +86,7 @@ public class EMFLabelProvider extends ResolvingCustomizedLabelProvider implement if (selection.size() == 1) {
return getText(selection.getFirstElement());
} else {
- final List<Object> selectionAsList = selection.toList();
+ final List<?> selectionAsList = selection.toList();
String str = "";
for (int i = 0; i < selectionAsList.size(); i++) {
final String txt = getText(selectionAsList.get(i));
diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/IRequestCacheEntries.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/IRequestCacheEntries.java index cd9e4f22df4..91ee99a9c3f 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/IRequestCacheEntries.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/IRequestCacheEntries.java @@ -32,5 +32,8 @@ public interface IRequestCacheEntries { /** Defined in org.eclipse.gmf.runtime.emf.type.core.internal.requests.RequestCacheEntries (internal) */ public static final String Client_Context = "Client_Context";//$NON-NLS-1$ + + /** Defined in org.eclipse.gmf.runtime.emf.type.core.internal.requests.RequestCacheEntries (internal) */ + public static final String Dependent_Elements = "Dependent_Elements";//$NON-NLS-1$ } diff --git a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestCacheEntries.java b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestCacheEntries.java index 3741bc80dd0..9af36e6c6f1 100644 --- a/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestCacheEntries.java +++ b/plugins/infra/services/org.eclipse.papyrus.infra.services.edit/src/org/eclipse/papyrus/infra/services/edit/utils/RequestCacheEntries.java @@ -1,15 +1,15 @@ /***************************************************************************** * Copyright (c) 2015 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 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * + * * CEA LIST- Initial API and implementation - * Inspired from GMF runtime internal class: + * Inspired from GMF runtime internal class: * *****************************************************************************/ package org.eclipse.papyrus.infra.services.edit.utils; diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/EditServiceValidator.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/EditServiceValidator.java index 8df51421cc1..6fbd640e7e8 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/EditServiceValidator.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/providers/EditServiceValidator.java @@ -11,13 +11,20 @@ *****************************************************************************/
package org.eclipse.papyrus.uml.tools.providers;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.infra.services.edit.utils.IRequestCacheEntries;
+import org.eclipse.papyrus.infra.services.edit.utils.RequestCacheEntries;
import org.eclipse.papyrus.uml.tools.Activator;
/**
@@ -36,6 +43,8 @@ public class EditServiceValidator { private IElementEditService editingService;
+ private Map<String, Object> adviceCache;
+
/**
* Constructor
*
@@ -54,6 +63,16 @@ public class EditServiceValidator { // log error service not found...
Activator.log.warn("Could not create service for " + EMFCoreUtil.getQualifiedName(editedEObject, true));
}
+
+ // Bug 485259: Use a cache for the advices, as we will build many SetRequests for the same element type
+ adviceCache = new HashMap<String, Object>();
+ try {
+ RequestCacheEntries.initializeEObjCache(editedEObject, adviceCache);
+ adviceCache.put(IRequestCacheEntries.Dependent_Elements, new HashSet<Object>()); // The set will be populated on the fly
+ adviceCache.put(IRequestCacheEntries.Checked_Elements, new HashSet<Object>()); // The set will be populated on the fly
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
}
/**
@@ -62,7 +81,7 @@ public class EditServiceValidator { *
* @param element
* @return
- * True if the given element is valid
+ * True if the given element is valid
*/
public boolean isValidValue(Object element) {
// Get semantic element
@@ -73,6 +92,7 @@ public class EditServiceValidator { // Test editing command...
SetRequest req = new SetRequest(editedEObject, editedFeature, semanticElement);
+ req.setParameter(RequestCacheEntries.Cache_Maps, adviceCache);
if ((editingService != null) && (editingService.canEdit(req))) {
return true;
}
|
