summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2012-05-14 18:08:25 (EDT)
committerIan Bull2012-05-14 18:08:25 (EDT)
commit8a16090df20423751452e26b96863507dfd20514 (patch)
tree659dc38b793d87e4a5ff829d4bc653c5bec11c53
parentbd4be9c85e4e312c306c8986de4ea89eaff8e611 (diff)
downloadrt.equinox.p2-8a16090df20423751452e26b96863507dfd20514.zip
rt.equinox.p2-8a16090df20423751452e26b96863507dfd20514.tar.gz
rt.equinox.p2-8a16090df20423751452e26b96863507dfd20514.tar.bz2
Bug 349628 - No update proposed when there are repository with errorsv20120514-2208I20120514-2100I20120514-1900
Introduces a Suppress Errors flag on the Repository Load job. If this flag is set, then repository load errors are not shown. We set this flag when check for updates happen.
-rw-r--r--bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java15
2 files changed, 22 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java
index f2ce43a..aaa3e1f 100644
--- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java
+++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/UpdateHandler.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.ui.sdk;
import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.operations.UpdateOperation;
import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
@@ -62,6 +63,12 @@ public class UpdateHandler extends PreloadingRepositoryHandler {
}
@Override
+ protected void setLoadJobProperties(Job loadJob) {
+ super.setLoadJobProperties(loadJob);
+ loadJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_REPOSITORY_ERRORS, Boolean.toString(true));
+ }
+
+ @Override
protected String getProgressTaskName() {
return ProvSDKMessages.UpdateHandler_ProgressTaskName;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
index bae1955..4d21f90 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java
@@ -68,6 +68,15 @@ public class LoadMetadataRepositoryJob extends ProvisioningJob {
*/
public static final QualifiedName ACCUMULATE_LOAD_ERRORS = new QualifiedName(ProvUIActivator.PLUGIN_ID, "ACCUMULATE_LOAD_ERRORS"); //$NON-NLS-1$
+ /**
+ * The key that should be used to set a property on a repository load job to indicate
+ * that load errors should be suppressed. This is useful if repositories
+ * are being loaded in the background as part of a check for update.
+ *
+ * @since 2.2
+ */
+ public static final QualifiedName SUPPRESS_REPOSITORY_ERRORS = new QualifiedName(ProvUIActivator.PLUGIN_ID, "SUPPRESS_REPOSITORY_ERRORS"); //$NON-NLS-1$
+
private List<IMetadataRepository> repoCache = new ArrayList<IMetadataRepository>();
private RepositoryTracker tracker;
private MultiStatus accumulatedStatus;
@@ -125,6 +134,8 @@ public class LoadMetadataRepositoryJob extends ProvisioningJob {
}
private void handleLoadFailure(ProvisionException e, URI location) {
+ if (shouldSuppressErrors()) // If we should suppress errors, just skip this
+ return;
if (shouldAccumulateFailures()) {
// Some ProvisionExceptions include an empty multi status with a message.
// Since empty multi statuses have a severity OK, The platform status handler doesn't handle
@@ -146,6 +157,10 @@ public class LoadMetadataRepositoryJob extends ProvisioningJob {
}
}
+ private boolean shouldSuppressErrors() {
+ return getProperty(LoadMetadataRepositoryJob.SUPPRESS_REPOSITORY_ERRORS) != null;
+ }
+
private boolean shouldAccumulateFailures() {
return getProperty(LoadMetadataRepositoryJob.ACCUMULATE_LOAD_ERRORS) != null;
}