summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2012-04-30 15:58:49 (EDT)
committerPascal Rapicault2012-04-30 16:01:00 (EDT)
commitbfb61cce27c4a783924cf196073ebd82129bef8a (patch)
treef062e3c7224eb1c92b4344a016552cc056a37754
parentaca36ad707f94cd48296dba8d68ad1ca4a9ee956 (diff)
downloadrt.equinox.p2-bfb61cce27c4a783924cf196073ebd82129bef8a.zip
rt.equinox.p2-bfb61cce27c4a783924cf196073ebd82129bef8a.tar.gz
rt.equinox.p2-bfb61cce27c4a783924cf196073ebd82129bef8a.tar.bz2
Bug 368064 - [UI] Capability index is not used when expanding categoriesv20120430-2001
in the UI
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java
index 53943c8..c9e2056 100644
--- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java
+++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/index/CapabilityIndex.java
@@ -132,6 +132,7 @@ public class CapabilityIndex extends Index<IInstallableUnit> {
case IExpression.TYPE_ALL :
case IExpression.TYPE_EXISTS :
CollectionFilter cf = (CollectionFilter) expr;
+
if (isIndexedMember(cf.getOperand(), variable, InstallableUnit.MEMBER_PROVIDED_CAPABILITIES)) {
// This is providedCapabilities.exists or providedCapabilites.all
//
@@ -145,6 +146,30 @@ public class CapabilityIndex extends Index<IInstallableUnit> {
queriedKeys = getQueriedIDs(ctx, variable, ProvidedCapability.MEMBER_NAME, booleanExpr, queriedKeys);
}
}
+ if (queriedKeys == null) {
+ // Might be a parameterized query of requirements
+ // If matching class is InstallableUnit && paramter exists && parameter is IRequirement
+ if (cf.getOperand() instanceof Parameter && ctx.getParameter(0) instanceof Collection<?>) {
+ // Check that the parameter really is the requirement array
+ // This only really works for IRequiredCapabilities, not any IRequirements
+ Collection<?> collection = (Collection<?>) ctx.getParameter(0);
+ boolean instance = !collection.isEmpty();
+ for (Object object : collection) {
+ instance &= (object instanceof IRequiredCapability);
+ }
+ if (instance) {
+ Collection<String> result = new ArrayList<String>();
+ for (Object object : collection) {
+ // This instance of check was done above
+ IRequiredCapability capability = (IRequiredCapability) object;
+ result.add(capability.getName());
+ }
+ if (result.size() > 0) {
+ queriedKeys = result;
+ }
+ }
+ }
+ }
break;
case IExpression.TYPE_MATCHES :