Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSusan Franklin2010-12-20 22:38:40 +0000
committerSusan Franklin2010-12-20 22:38:40 +0000
commit9e89ef4b80a63ba00bd27fe1f92e4e863a82a977 (patch)
tree6d9b0871de36f9f321f321767553052a48df4849 /bundles/org.eclipse.equinox.p2.operations
parent26da76d5c5c87f1d9aadb508ff1534773c228bde (diff)
downloadrt.equinox.p2-9e89ef4b80a63ba00bd27fe1f92e4e863a82a977.tar.gz
rt.equinox.p2-9e89ef4b80a63ba00bd27fe1f92e4e863a82a977.tar.xz
rt.equinox.p2-9e89ef4b80a63ba00bd27fe1f92e4e863a82a977.zip
Bug 311633 - [ui] RepositoryTracker duplicate checking should consult the repo managerv20101221-0005
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.operations')
-rw-r--r--bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
index fd2a99abd..152a3d09e 100644
--- a/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
+++ b/bundles/org.eclipse.equinox.p2.operations/src/org/eclipse/equinox/p2/operations/RepositoryTracker.java
@@ -112,15 +112,29 @@ public abstract class RepositoryTracker {
if (!localValidationStatus.isOK())
return localValidationStatus;
- // Syntax was ok, now look for duplicates
+ if (contains(location, session))
+ return new Status(IStatus.ERROR, Activator.ID, IStatusCodes.INVALID_REPOSITORY_LOCATION, Messages.RepositoryTracker_DuplicateLocation, null);
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Return a boolean indicating whether this tracker already contains the specified
+ * repository location.
+ *
+ * @param location the location in question
+ * @param session the provisioning session providing the repository services
+ * @since 2.1
+ */
+ protected boolean contains(URI location, ProvisioningSession session) {
+ // This is a fallback implementation in the absence of a repository manager
+ // that would know what to do.
URI[] knownRepositories = getKnownRepositories(session);
for (int i = 0; i < knownRepositories.length; i++) {
if (URIUtil.sameURI(knownRepositories[i], location)) {
- localValidationStatus = new Status(IStatus.ERROR, Activator.ID, IStatusCodes.INVALID_REPOSITORY_LOCATION, Messages.RepositoryTracker_DuplicateLocation, null);
- break;
+ return true;
}
}
- return localValidationStatus;
+ return false;
}
/**

Back to the top