Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 20ea0d0111a1ebcbc6e937815dcb14afa486133c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*******************************************************************************
 *  Copyright (c) 2009 IBM Corporation and others.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 * 
 *  Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.equinox.p2.engine.query;

import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;


/**
 * A query matching all the {@link IInstallableUnit}s that are marked visible to the user. 
 * @since 2.0
 */
public class UserVisibleRootQuery extends IUProfilePropertyQuery {

	public UserVisibleRootQuery() {
		super(IProfile.PROP_PROFILE_ROOT_IU, Boolean.TRUE.toString());
	}

	/**
	 * Test if the {@link IInstallableUnit}, in the context of a {@link IProfile} is visible to the user 
	 * @param iu the element being tested.
	 * @param profile the context in which the iu is tested
	 * @return <tt>true</tt> if the element is visible to the user.
	 */
	public static boolean isUserVisible(IInstallableUnit iu, IProfile profile) {
		String value = profile.getInstallableUnitProperty(iu, IProfile.PROP_PROFILE_ROOT_IU);
		if (value != null && (value.equals(Boolean.TRUE.toString())))
			return true;
		return false;
	}
}

Back to the top