Search in sources :

Example 1 with UpdateSingleIUWizard

use of org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard in project cubrid-manager by CUBRID.

the class UpdateHandler method doExecute.

protected void doExecute(LoadMetadataRepositoryJob job) {
    if (isNoRepos) {
        return;
    }
    UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
    // check for updates
    IStatus status = operation.resolveModal(null);
    // AUTO check update and there is not update
    if (isAutoCheckUpdate) {
        // user cancelled
        if (status.getSeverity() == IStatus.CANCEL) {
            return;
        }
        // Special case those statuses where we would never want to open a wizard
        if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
            return;
        }
        // there is no plan, so we can't continue.  Report any reason found
        if (operation.getProvisioningPlan() == null && !status.isOK()) {
            return;
        }
    }
    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);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) UpdateOperation(org.eclipse.equinox.p2.operations.UpdateOperation) UpdateSingleIUWizard(org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 2 with UpdateSingleIUWizard

use of org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard in project yamcs-studio by yamcs.

the class UpdateHandler method doExecute.

@Override
protected void doExecute(LoadMetadataRepositoryJob job) {
    if (hasNoRepos) {
        MessageDialog.openInformation(null, "Update Yamcs Studio", "Could not check for updates since no repository is configured");
        return;
    }
    UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
    // check for updates
    operation.resolveModal(null);
    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);
        }
    }
}
Also used : UpdateOperation(org.eclipse.equinox.p2.operations.UpdateOperation) UpdateSingleIUWizard(org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 3 with UpdateSingleIUWizard

use of org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard in project knime-core by knime.

the class InvokeUpdateAction method openWizard.

@Override
protected void openWizard(final LoadMetadataRepositoryJob job, final ProvisioningUI provUI) {
    final UpdateOperation operation = provUI.getUpdateOperation(null, null);
    // check for updates
    operation.resolveModal(null);
    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {

        @Override
        public void run() {
            Shell shell = PlatformUI.getWorkbench().getModalDialogShellProvider().getShell();
            if (!operation.hasResolved()) {
                MessageDialog.openInformation(shell, "Update KNIME...", "No updates were found");
            } else if (provUI.getPolicy().continueWorkingWithOperation(operation, shell)) {
                if (UpdateSingleIUWizard.validFor(operation)) {
                    // Special case for only updating a single root
                    UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(provUI, operation);
                    WizardDialog dialog = new WizardDialog(shell, wizard);
                    dialog.create();
                    if (dialog.open() == 0) {
                        clearOsgiAreaBeforeRestart();
                    }
                } else {
                    // Open the normal version of the update wizard
                    if (provUI.openUpdateWizard(false, operation, job) == 0) {
                        clearOsgiAreaBeforeRestart();
                    }
                }
            }
        }
    });
}
Also used : Shell(org.eclipse.swt.widgets.Shell) UpdateOperation(org.eclipse.equinox.p2.operations.UpdateOperation) UpdateSingleIUWizard(org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

UpdateSingleIUWizard (org.eclipse.equinox.internal.p2.ui.dialogs.UpdateSingleIUWizard)3 UpdateOperation (org.eclipse.equinox.p2.operations.UpdateOperation)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 IStatus (org.eclipse.core.runtime.IStatus)1 Shell (org.eclipse.swt.widgets.Shell)1