diff options
author | Pascal Rapicault | 2014-04-04 13:56:50 +0000 |
---|---|---|
committer | Pascal Rapicault | 2014-04-04 13:56:50 +0000 |
commit | faaf1d4d76b2770c003a4c9ba70b0311d433d8b7 (patch) | |
tree | 0f4414d227d2d53e92e2a12686401ae3285e294d | |
parent | d0244d445f8ab6ba8ff5df3958486a5388d8af59 (diff) | |
download | rt.equinox.p2-faaf1d4d76b2770c003a4c9ba70b0311d433d8b7.tar.gz rt.equinox.p2-faaf1d4d76b2770c003a4c9ba70b0311d433d8b7.tar.xz rt.equinox.p2-faaf1d4d76b2770c003a4c9ba70b0311d433d8b7.zip |
Bug 384646 - [ui] 'type filter text' box searches as the user types each
letter and hangs
Signed-off-by: Pascal Rapicault <pascal.rapicault@ericsson.com>
2 files changed, 15 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java index 394a8ddc4..9cfa06562 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java @@ -26,6 +26,7 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement private ArrayList<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(1); private Collection<IRequirement> requirements; + private Object[] cache = null; public CategoryElement(Object parent, IInstallableUnit iu) { super(parent); @@ -119,6 +120,13 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement return requirements; } + @Override + protected Object[] fetchChildren(Object o, IProgressMonitor monitor) { + if (cache == null) + cache = super.fetchChildren(o, monitor); + return cache; + } + /* (non-Javadoc) * @see org.eclipse.equinox.internal.p2.ui.model.IIUElement#shouldShowChildren() */ diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java index 146e4b131..b4e2173bc 100644 --- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java +++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java @@ -37,6 +37,7 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor URI location; boolean isEnabled; String name; + Object[] cache; public MetadataRepositoryElement(Object parent, URI location, boolean isEnabled) { this(parent, null, null, location, isEnabled); @@ -64,6 +65,9 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor } protected Object[] fetchChildren(Object o, IProgressMonitor monitor) { + if (cache != null) + return cache; + SubMonitor sub = SubMonitor.convert(monitor, 200); // Ensure the repository is loaded using the monitor, so we respond to cancelation. // Otherwise, a non-loaded repository could be loaded in the query provider without a monitor. @@ -71,12 +75,13 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor try { getMetadataRepository(sub.newChild(100)); //only invoke super if we successfully loaded the repository - return super.fetchChildren(o, sub.newChild(100)); + cache = super.fetchChildren(o, sub.newChild(100)); } catch (ProvisionException e) { getProvisioningUI().getRepositoryTracker().reportLoadFailure(location, e); // TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=276784 - return new Object[] {new EmptyElementExplanation(this, IStatus.ERROR, e.getLocalizedMessage(), "")}; //$NON-NLS-1$ + cache = new Object[] {new EmptyElementExplanation(this, IStatus.ERROR, e.getLocalizedMessage(), "")}; //$NON-NLS-1$ } + return cache; } protected String getImageId(Object obj) { |