From a7d597650a2da69670e164f6264d9fef76ec0dc7 Mon Sep 17 00:00:00 2001 From: Cherian Mathew Date: Mon, 23 Nov 2015 16:59:06 +0100 Subject: [PATCH] Correct update operation initialisation --- .../taxeditor/update/UpdateHandler.java | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java index 43c6e15bb..57ea16bf3 100644 --- a/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java +++ b/eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java @@ -20,7 +20,6 @@ import org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard; import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.operations.ProvisioningJob; -import org.eclipse.equinox.p2.operations.RepositoryTracker; import org.eclipse.equinox.p2.operations.UpdateOperation; import org.eclipse.equinox.p2.repository.IRepositoryManager; import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; @@ -47,15 +46,11 @@ public class UpdateHandler extends PreloadingRepositoryHandler { if (hasNoRepos) { return; } - UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null); + UpdateOperation operation = new UpdateOperation(ProvisioningUI.getDefaultUI().getSession()); // check for updates IStatus status = checkForUpdates(operation); - if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) { - MessagingUtils.informationDialog("Checking for updates", status); - return; - } if (status.isOK() && status.getSeverity() != IStatus.ERROR) { @@ -85,6 +80,8 @@ public class UpdateHandler extends PreloadingRepositoryHandler { } } } + } else { + MessagingUtils.informationDialog("Checking for updates", status); } } @@ -124,16 +121,4 @@ public class UpdateHandler extends PreloadingRepositoryHandler { bundleContext.ungetService(reference); } } - - - @Override - protected boolean preloadRepositories() { - hasNoRepos = false; - RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker(); - if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) { - hasNoRepos = true; - return false; - } - return super.preloadRepositories(); - } } -- 2.34.1