*/
public class UpdateHandler extends PreloadingRepositoryHandler {
- boolean hasNoRepos = false;
@Override
protected void doExecute(LoadMetadataRepositoryJob job) {
- if (hasNoRepos) {
- return;
- }
+
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);
}
}