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