Simplify update process
authorCherian Mathew <c.mathew@bgbm.org>
Mon, 23 Nov 2015 16:34:09 +0000 (17:34 +0100)
committerCherian Mathew <c.mathew@bgbm.org>
Mon, 23 Nov 2015 16:34:09 +0000 (17:34 +0100)
eu.etaxonomy.taxeditor.application/src/main/java/eu/etaxonomy/taxeditor/update/UpdateHandler.java

index 57ea16bf3963e577fd31d31bed78c84b1a92ea5f..4497c34fb8a2f31e4b1d9164fa6f848ca8642a50 100644 (file)
@@ -39,49 +39,35 @@ import eu.etaxonomy.taxeditor.model.MessagingUtils;
  */
 public class UpdateHandler extends PreloadingRepositoryHandler {
 
  */
 public class UpdateHandler extends PreloadingRepositoryHandler {
 
-    boolean hasNoRepos = false;
 
     @Override
     protected void doExecute(LoadMetadataRepositoryJob job) {
 
     @Override
     protected void doExecute(LoadMetadataRepositoryJob job) {
-        if (hasNoRepos) {
-            return;
-        }
+
         UpdateOperation operation = new UpdateOperation(ProvisioningUI.getDefaultUI().getSession());
 
         // check for updates
         UpdateOperation operation = new UpdateOperation(ProvisioningUI.getDefaultUI().getSession());
 
         // check for updates
-        IStatus status = checkForUpdates(operation);
-
-
-        if (status.isOK() && status.getSeverity() != IStatus.ERROR) {
-
-            boolean doInstall = MessagingUtils.confirmDialog("Updates available", "Do you want to install the available updates ?");
-            if(doInstall) {
-                ProvisioningJob provisioningJob = operation.getProvisioningJob(null);
-                if (provisioningJob == null) {
-                    MessagingUtils.messageDialog("Error in performing update",
-                            operation,
-                            "ProvisioningJob could not be created." + System.getProperty("line.separator") +
-                            "Either this application does not support p2 software installation or this application has been launched from within the Eclipse IDE",
-                            null,
-                            false);
-
-                } else {
-                    if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
-                        if (UpdateSingleIUWizard.validFor(operation)) {
-                            // Special case for only updating a single root
-                            UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
-                            WizardDialog dialog = new WizardDialog(getShell(), wizard);
-                            dialog.create();
-                            dialog.open();
-                        } else {
-                            // Open the normal version of the update wizard
-                            getProvisioningUI().openUpdateWizard(false, operation, job);
-                        }
-                    }
-                }
+        checkForUpdates(operation);
+
+        ProvisioningJob provisioningJob = operation.getProvisioningJob(null);
+        if (provisioningJob == null) {
+            MessagingUtils.messageDialog("Error in performing update",
+                    operation,
+                    "ProvisioningJob could not be created." + System.getProperty("line.separator") +
+                    "Either this application does not support p2 software installation or this application has been launched from within the Eclipse IDE",
+                    null,
+                    false);
+
+        } else if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
+            if (UpdateSingleIUWizard.validFor(operation)) {
+                // Special case for only updating a single root
+                UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
+                WizardDialog dialog = new WizardDialog(getShell(), wizard);
+                dialog.create();
+                dialog.open();
+            } else {
+                // Open the normal version of the update wizard
+                getProvisioningUI().openUpdateWizard(false, operation, job);
             }
             }
-        } else {
-            MessagingUtils.informationDialog("Checking for updates", status);
         }
     }
 
         }
     }