Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2007-11-19 22:18:39 +0000
committerJohn Arthorne2007-11-19 22:18:39 +0000
commit7905a9bb2ac0dd96cc233ee1554e344e4e7cf193 (patch)
treeebb52c13ed773a9bce806d41c7d402623e4d5975 /bundles/org.eclipse.equinox.p2.console
parent489b8c60490eab0bcfa9840b7e7b9c74c8ca67cb (diff)
downloadrt.equinox.p2-7905a9bb2ac0dd96cc233ee1554e344e4e7cf193.tar.gz
rt.equinox.p2-7905a9bb2ac0dd96cc233ee1554e344e4e7cf193.tar.xz
rt.equinox.p2-7905a9bb2ac0dd96cc233ee1554e344e4e7cf193.zip
Cleaned up using convenience methodv20071119
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.console')
-rw-r--r--bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java25
1 files changed, 8 insertions, 17 deletions
diff --git a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
index a92c65f33..96790d72c 100644
--- a/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
+++ b/bundles/org.eclipse.equinox.p2.console/src/org/eclipse/equinox/internal/p2/console/ProvisioningHelper.java
@@ -24,6 +24,7 @@ import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.director.*;
import org.eclipse.equinox.p2.engine.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
import org.eclipse.equinox.p2.metadata.repository.IMetadataRepository;
import org.eclipse.equinox.p2.metadata.repository.IMetadataRepositoryManager;
import org.eclipse.equinox.p2.query.Collector;
@@ -181,25 +182,14 @@ public class ProvisioningHelper {
* Install the described IU
*/
public static IStatus install(String unitId, String version, Profile profile, IProgressMonitor progress) throws ProvisionException {
- IMetadataRepository[] repos = getMetadataRepositories();
- if (repos == null || profile == null)
+ if (profile == null)
return null;
- // search for a matching IU in the known repositories
- IInstallableUnit toInstall = null;
- Version unitVersion = new Version(version);
- outer: for (int i = 0; i < repos.length; i++) {
- IInstallableUnit[] ius = repos[i].getInstallableUnits(progress);
- for (int j = 0; j < ius.length; j++) {
- if (unitId.equals(ius[j].getId()) && unitVersion.equals(ius[j].getVersion())) {
- toInstall = ius[j];
- break outer;
- }
- }
- }
- if (toInstall == null) {
+ Collector units = getInstallableUnits(null, new InstallableUnitQuery(unitId, new Version(version)), progress);
+ if (units.isEmpty()) {
StringBuffer error = new StringBuffer();
- error.append("Installable unit not found: " + unitId + ' ' + unitVersion + '\n');
+ error.append("Installable unit not found: " + unitId + ' ' + version + '\n');
error.append("Repositories searched:\n");
+ IMetadataRepository[] repos = getMetadataRepositories();
for (int i = 0; i < repos.length; i++)
error.append(repos[i].getLocation() + "\n");
throw new ProvisionException(error.toString());
@@ -212,7 +202,8 @@ public class ProvisioningHelper {
Engine engine = (Engine) ServiceHelper.getService(Activator.getContext(), Engine.class.getName());
if (engine == null)
throw new ProvisionException("No director service found.");
- ProvisioningPlan result = planner.getInstallPlan(new IInstallableUnit[] {toInstall}, profile, progress);
+ IInstallableUnit[] toInstall = (IInstallableUnit[]) units.toArray(IInstallableUnit.class);
+ ProvisioningPlan result = planner.getInstallPlan(toInstall, profile, progress);
if (!result.getStatus().isOK())
return result.getStatus();

Back to the top