@Override public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { return profile.query(query, monitor); } }
private Map<IInstallableUnit, IInstallableUnit> getProfileIUs() { IQueryResult<IInstallableUnit> profileQueryResult = profile.query(QueryUtil.createIUAnyQuery(), null); Map<IInstallableUnit, IInstallableUnit> result = new HashMap<IInstallableUnit, IInstallableUnit>(); for (Iterator<IInstallableUnit> it = profileQueryResult.iterator(); it.hasNext();) { IInstallableUnit iu = it.next(); result.put(iu, iu); } return result; }
private void addArtifactKeys(IProfile aProfile) { Iterator<IInstallableUnit> installableUnits = aProfile.query(QueryUtil.createIUAnyQuery(), null).iterator(); while (installableUnits.hasNext()) { Collection<IArtifactKey> keys = installableUnits.next().getArtifacts(); if (keys == null) continue; artifactKeyList.addAll(keys); } }
private Set<IInstallableUnit> getUserRoots(IProfile previousProfile) { IQueryResult<IInstallableUnit> allRoots = previousProfile.query(new UserVisibleRootQuery(), null); Set<IInstallableUnit> rootsFromTheBase = previousProfile.query(new IUProfilePropertyQuery("org.eclipse.equinox.p2.base", "true"), null).toUnmodifiableSet(); Set<IInstallableUnit> userRoots = allRoots.toSet(); userRoots.removeAll(rootsFromTheBase); return userRoots; }
private Set<IInstallableUnit> getRoots() { Set<IInstallableUnit> allRoots = profile.query(new IUProfilePropertyQuery(INCLUSION_RULES, IUProfilePropertyQuery.ANY), null).toSet(); if (!honorSharedSettings) return allRoots; IQueryResult<IInstallableUnit> baseRoots = profile.query(new IUProfilePropertyQuery("org.eclipse.equinox.p2.base", Boolean.TRUE.toString()), null); allRoots.removeAll(baseRoots.toUnmodifiableSet()); return allRoots; }
@Override public IQueryResult<IInstallableUnit> queryProfile(IProfile profile, IQuery<IInstallableUnit> query, IProgressMonitor monitor) { IProfile sharedProfile = getSharedProfile(profile.getProfileId()); if (sharedProfile == null) return profile.query(query, monitor); // TODO: Should consider using a sequenced iterator here instead of collecting Collector<IInstallableUnit> result = new Collector<>(); result.addAll(sharedProfile.query(query, monitor)); result.addAll(profile.query(query, monitor)); return result; } }
public IQueryResult<IInstallableUnit> queryProfile(IProfile profile, IQuery<IInstallableUnit> query, IProgressMonitor monitor) { IProfile sharedProfile = getSharedProfile(profile.getProfileId()); if (sharedProfile == null) return profile.query(query, monitor); // TODO: Should consider using a sequenced iterator here instead of collecting Collector<IInstallableUnit> result = new Collector<IInstallableUnit>(); result.addAll(sharedProfile.query(query, monitor)); result.addAll(profile.query(query, monitor)); return result; } }
private Set<IInstallableUnit> getRoots() { Set<IInstallableUnit> allRoots = profile.query(new IUProfilePropertyQuery(INCLUSION_RULES, IUProfilePropertyQuery.ANY), null).toSet(); if (!honorSharedSettings) return allRoots; IQueryResult<IInstallableUnit> baseRoots = profile.query(new IUProfilePropertyQuery("org.eclipse.equinox.p2.base", Boolean.TRUE.toString()), null); allRoots.removeAll(baseRoots.toUnmodifiableSet()); return allRoots; }
private void addArtifactKeys(IProfile aProfile) { Iterator<IInstallableUnit> installableUnits = aProfile.query(QueryUtil.createIUAnyQuery(), null).iterator(); while (installableUnits.hasNext()) { Collection<IArtifactKey> keys = installableUnits.next().getArtifacts(); if (keys == null) continue; artifactKeyList.addAll(keys); } }
/** * Return the {@link IInstallableUnit} that are installed in the running instance of eclipse. * @param rootsOnly set to true to return only the elements that have been explicitly installed (aka roots). * @param monitor the progress monitor * @return the installable units installed */ public IQueryResult<IInstallableUnit> listInstalledElements(boolean rootsOnly, IProgressMonitor monitor) { IProfileRegistry registry = (IProfileRegistry) getAgent().getService(IProfileRegistry.SERVICE_NAME); IProfile profile = registry.getProfile(IProfileRegistry.SELF); if (rootsOnly) return profile.query(new UserVisibleRootQuery(), monitor); return profile.query(QueryUtil.ALL_UNITS, monitor); }
/** * Return the {@link IInstallableUnit} that are installed in the running instance of eclipse. * @param rootsOnly set to true to return only the elements that have been explicitly installed (aka roots). * @param monitor the progress monitor * @return the installable units installed */ public IQueryResult<IInstallableUnit> listInstalledElements(boolean rootsOnly, IProgressMonitor monitor) { IProfileRegistry registry = (IProfileRegistry) getAgent().getService(IProfileRegistry.SERVICE_NAME); IProfile profile = registry.getProfile(IProfileRegistry.SELF); if (rootsOnly) return profile.query(new UserVisibleRootQuery(), monitor); return profile.query(QueryUtil.ALL_UNITS, monitor); }
private IInstallableUnit getPreviousIUForMetaRequirements(IProfile profile, String iuId, IProgressMonitor monitor) { IQueryResult<IInstallableUnit> c = profile.query(QueryUtil.createIUQuery(iuId), monitor); if (c.isEmpty()) return null; return c.iterator().next(); }
private Collection<IInstallableUnit> getInstalledIUs() { IProfile profile = session.getProfileRegistry().getProfile(profileId); if (profile == null) return Collections.<IInstallableUnit> emptyList(); IQuery<IInstallableUnit> query = new UserVisibleRootQuery(); IQueryResult<IInstallableUnit> queryResult = profile.query(query, null); return queryResult.toUnmodifiableSet(); }
private ProvisioningContext createNoRepoContext(ProfileChangeRequest request) { ProvisioningContext noRepoContext = new ProvisioningContext(agent); noRepoContext.setMetadataRepositories(new URI[0]); noRepoContext.setArtifactRepositories(new URI[0]); noRepoContext.setProperty(INCLUDE_PROFILE_IUS, Boolean.FALSE.toString()); noRepoContext.setExtraInstallableUnits(new ArrayList<>(request.getProfile() .query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()).toUnmodifiableSet())); return noRepoContext; }
public boolean isChecked(Object element) { if (profile != null) { IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class); IQueryResult<IInstallableUnit> collector = profile.query(QueryUtil.createIUQuery(iu.getId(), new VersionRange(iu.getVersion(), true, null, false)), new NullProgressMonitor()); if (collector.isEmpty()) { return true; } } return false; } };
private Collection<IInstallableUnit> getInstalledIUs() { IProfile profile = session.getProfileRegistry().getProfile(profileId); if (profile == null) return CollectionUtils.emptyList(); IQuery<IInstallableUnit> query = new UserVisibleRootQuery(); IQueryResult<IInstallableUnit> queryResult = profile.query(query, null); return queryResult.toUnmodifiableSet(); }
public Collection<IInstallableUnit> getInstalledIUs() { IProfile profile = getProfileRegistry().getProfile(profileId); if (profile == null) return CollectionUtils.emptyList(); IQuery<IInstallableUnit> query = new UserVisibleRootQuery(); IQueryResult<IInstallableUnit> queryResult = profile.query(query, null); return queryResult.toUnmodifiableSet(); }
private Collection<IRequirement> areMetaRequirementsSatisfied(IProfile oldProfile, Collection<IInstallableUnit> newProfile, IProvisioningPlan initialPlan) { Collection<IRequirement> allMetaRequirements = extractMetaRequirements(newProfile, initialPlan); for (IRequirement requirement : allMetaRequirements) { if (oldProfile .query(QueryUtil.createLimitQuery(QueryUtil.createMatchQuery(requirement.getMatches()), 1), null) .isEmpty()) return allMetaRequirements; } return null; }
public boolean hasInstalled(IInstallableUnit iu) { IQueryResult<IInstallableUnit> results = profile.query(QueryUtil.createIUQuery(iu.getId(), new VersionRange(iu.getVersion(), true, null, false)), null); return !results.isEmpty(); }
private boolean isSelectable(IInstallableUnit iu, IProfile profile) { int lock = getLock(profile, iu); if ((lock & getLockConstant()) == getLockConstant()) return false; return !profile.query(QueryUtil.createPipeQuery(QueryUtil.createIUQuery(iu), getPolicy().getVisibleInstalledIUQuery()), null).isEmpty(); }