summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-12-20 05:49:08 (EST)
committerEike Stepper2007-12-20 05:49:08 (EST)
commit084753263bd3a8545257561dac6cde43274fbe09 (patch)
treee8360703dc51699117af609b13a8c70237bfcc76
parent003040d1415fb4c7df9be2b474cbaa36fc8316cd (diff)
downloadcdo-084753263bd3a8545257561dac6cde43274fbe09.zip
cdo-084753263bd3a8545257561dac6cde43274fbe09.tar.gz
cdo-084753263bd3a8545257561dac6cde43274fbe09.tar.bz2
[213420] Speed up handling of ManyReferences in DBStoreAccessor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=213420
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF3
-rw-r--r--plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOItemProviderAdapter.java63
2 files changed, 65 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF
index e105579..9e728f0 100644
--- a/plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.cdo.edit/META-INF/MANIFEST.MF
@@ -13,5 +13,6 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.3.0,4.0.0)",
org.eclipse.emf.ecore;bundle-version="[2.3.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.ecore.edit;bundle-version="[2.3.0,3.0.0)";visibility:=reexport,
org.eclipse.emf.cdo;bundle-version="[0.8.0,0.9.0)";visibility:=reexport
-Export-Package: org.eclipse.emf.cdo.eresource.provider
+Export-Package: org.eclipse.emf.cdo.edit;version="0.8.0",
+ org.eclipse.emf.cdo.eresource.provider;version="0.8.0"
Eclipse-LazyStart: true
diff --git a/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOItemProviderAdapter.java b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOItemProviderAdapter.java
new file mode 100644
index 0000000..c2ed9c7
--- /dev/null
+++ b/plugins/org.eclipse.emf.cdo.edit/src/org/eclipse/emf/cdo/edit/CDOItemProviderAdapter.java
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (c) 2004 - 2007 Eike Stepper, Germany.
+ * 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:
+ * Eike Stepper - initial API and implementation
+ **************************************************************************/
+package org.eclipse.emf.cdo.edit;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.provider.ItemProviderAdapter;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Eike Stepper
+ */
+public class CDOItemProviderAdapter extends ItemProviderAdapter
+{
+ public CDOItemProviderAdapter(AdapterFactory adapterFactory)
+ {
+ super(adapterFactory);
+ }
+
+ @Override
+ @SuppressWarnings("deprecation")
+ public boolean hasChildren(Object object)
+ {
+ Collection<? extends EStructuralFeature> anyChildrenFeatures = getChildrenFeatures(object);
+ if (anyChildrenFeatures.isEmpty())
+ {
+ anyChildrenFeatures = getChildrenReferences(object);
+ }
+
+ EObject eObject = (EObject)object;
+ for (EStructuralFeature feature : anyChildrenFeatures)
+ {
+ if (feature.isMany())
+ {
+ List<?> children = (List<?>)eObject.eGet(feature);
+ if (!children.isEmpty())
+ {
+ return true;
+ }
+ }
+ else
+ {
+ if (eObject.eIsSet(feature))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+}