diff options
author | Pascal Rapicault | 2014-04-04 16:47:00 +0000 |
---|---|---|
committer | Pascal Rapicault | 2014-04-04 16:57:49 +0000 |
commit | 8d4de6a6810d18c22353e0cd93d1834719fd0d80 (patch) | |
tree | ddb954272fe7bfa5156dba57c1730196d1bd02ec | |
parent | ce8ec364c1523fc55b666f134a7bbf8fe044c65f (diff) | |
download | rt.equinox.p2-8d4de6a6810d18c22353e0cd93d1834719fd0d80.tar.gz rt.equinox.p2-8d4de6a6810d18c22353e0cd93d1834719fd0d80.tar.xz rt.equinox.p2-8d4de6a6810d18c22353e0cd93d1834719fd0d80.zip |
Bug 384646 - [ui] 'type filter text' box searches hangs
Always force the loading of the repository in the background (even when
it has already obtained from the remote location) which allows to
initialize the category cache while outside of the UI loop.
Signed-off-by: Pascal Rapicault <pascal.rapicault@ericsson.com>
2 files changed, 10 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java index 2ae966587..b0fa3fa91 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java @@ -34,7 +34,8 @@ public abstract class QueriedElement extends ProvElement { // that want to eliminate duplicates from the parent hierarchy. // This cache is *not* used as a general purpose child cache. private Collection<?> cachedChildren; - + private static final Object[] EMPTY= new Object[0]; + protected QueriedElement(Object parent) { super(parent); } @@ -158,6 +159,8 @@ public abstract class QueriedElement extends ProvElement { } public Object[] getCachedChildren() { + if (cachedChildren == null) + return EMPTY; return cachedChildren.toArray(); } diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java index 1e77c1fa6..485e635e8 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java @@ -14,8 +14,7 @@ package org.eclipse.equinox.internal.p2.ui.viewers; import java.util.HashMap; import java.util.HashSet; import org.eclipse.core.runtime.ListenerList; -import org.eclipse.equinox.internal.p2.ui.model.QueriedElement; -import org.eclipse.equinox.internal.p2.ui.model.RemoteQueriedElement; +import org.eclipse.equinox.internal.p2.ui.model.*; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.Viewer; @@ -109,12 +108,13 @@ public class DeferredQueryContentProvider extends ProvElementContentProvider { // We rely on the assumption that the queryable is the most expensive // thing to get vs. the query itself being expensive. // (loading a repo vs. querying a repo afterward) - if (element.hasQueryable()) + if (manager != null && !synchronous && (element instanceof MetadataRepositoryElement || element instanceof MetadataRepositories)) { + if (element.getCachedChildren().length == 0) + return manager.getChildren(element); return element.getChildren(element); - - if (manager != null && !synchronous) { - return manager.getChildren(parent); } + if (element.hasQueryable()) + return element.getChildren(element); } return super.getChildren(parent); } |