]> gerrit.simantics Code Review - simantics/platform.git/blob - 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
1 /*******************************************************************************\r
2  *  Copyright (c) 2010 IBM Corporation and others.\r
3  *  All rights reserved. This program and the accompanying materials\r
4  *  are made available under the terms of the Eclipse Public License v1.0\r
5  *  which accompanies this distribution, and is available at\r
6  *  http://www.eclipse.org/legal/epl-v10.html\r
7  * \r
8  *  Contributors:\r
9  *     IBM Corporation - initial API and implementation\r
10  *     Cloudsmith Inc. - converted into expression based query\r
11  *******************************************************************************/\r
12 package org.eclipse.equinox.internal.p2.ui.query;\r
13 \r
14 import org.eclipse.equinox.p2.query.ExpressionMatchQuery;\r
15 \r
16 import org.eclipse.equinox.p2.metadata.IInstallableUnit;\r
17 import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;\r
18 import org.eclipse.equinox.p2.metadata.expression.IExpression;\r
19 \r
20 /**\r
21 /**\r
22  * A query matching every {@link IInstallableUnit} that is meets\r
23  * any requirement of the specified IU.  This query is used when\r
24  * drilling down to show the children of an available IU.  For example,\r
25  * when installing an IU, we want to show all the IU's that are in the provisioning\r
26  * plan that are required by this IU.  This is usually used in combination with\r
27  * other queries (such as show all Required IUs which also are visible to\r
28  * the user as available).\r
29  * \r
30  * @since 2.0 \r
31  */\r
32 public class RequiredIUsQuery extends ExpressionMatchQuery<IInstallableUnit> {\r
33 \r
34         private static final IExpression expression = ExpressionUtil.parse("$0.exists(rc | this ~= rc)"); //$NON-NLS-1$\r
35 \r
36         /**\r
37          * Creates a new query that will return any IU that meets any\r
38          * one of the requirements of the specified IU. \r
39          * \r
40          * @param iu The IU whose requirements are to be checked\r
41          */\r
42         public RequiredIUsQuery(IInstallableUnit iu) {\r
43                 super(IInstallableUnit.class, expression, iu.getRequirements());\r
44         }\r
45 }\r