]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.project/src/org/eclipse/equinox/internal/p2/ui/query/RequiredIUsQuery.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.project / src / org / eclipse / equinox / internal / p2 / ui / query / RequiredIUsQuery.java
diff --git a/bundles/org.simantics.project/src/org/eclipse/equinox/internal/p2/ui/query/RequiredIUsQuery.java b/bundles/org.simantics.project/src/org/eclipse/equinox/internal/p2/ui/query/RequiredIUsQuery.java
new file mode 100644 (file)
index 0000000..465732b
--- /dev/null
@@ -0,0 +1,45 @@
+/*******************************************************************************\r
+ *  Copyright (c) 2010 IBM Corporation and others.\r
+ *  All rights reserved. This program and the accompanying materials\r
+ *  are made available under the terms of the Eclipse Public License v1.0\r
+ *  which accompanies this distribution, and is available at\r
+ *  http://www.eclipse.org/legal/epl-v10.html\r
+ * \r
+ *  Contributors:\r
+ *     IBM Corporation - initial API and implementation\r
+ *     Cloudsmith Inc. - converted into expression based query\r
+ *******************************************************************************/\r
+package org.eclipse.equinox.internal.p2.ui.query;\r
+\r
+import org.eclipse.equinox.p2.query.ExpressionMatchQuery;\r
+\r
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;\r
+import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;\r
+import org.eclipse.equinox.p2.metadata.expression.IExpression;\r
+\r
+/**\r
+/**\r
+ * A query matching every {@link IInstallableUnit} that is meets\r
+ * any requirement of the specified IU.  This query is used when\r
+ * drilling down to show the children of an available IU.  For example,\r
+ * when installing an IU, we want to show all the IU's that are in the provisioning\r
+ * plan that are required by this IU.  This is usually used in combination with\r
+ * other queries (such as show all Required IUs which also are visible to\r
+ * the user as available).\r
+ * \r
+ * @since 2.0 \r
+ */\r
+public class RequiredIUsQuery extends ExpressionMatchQuery<IInstallableUnit> {\r
+\r
+       private static final IExpression expression = ExpressionUtil.parse("$0.exists(rc | this ~= rc)"); //$NON-NLS-1$\r
+\r
+       /**\r
+        * Creates a new query that will return any IU that meets any\r
+        * one of the requirements of the specified IU. \r
+        * \r
+        * @param iu The IU whose requirements are to be checked\r
+        */\r
+       public RequiredIUsQuery(IInstallableUnit iu) {\r
+               super(IInstallableUnit.class, expression, iu.getRequirements());\r
+       }\r
+}\r