use of org.eclipse.equinox.p2.operations.UpdateOperation 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);
}
}
}
use of org.eclipse.equinox.p2.operations.UpdateOperation in project knime-core by knime.
the class BugfixMessageInjector method checkNewMinorVersion.
private List<String> checkNewMinorVersion() throws IOException, URISyntaxException {
final ProvisioningUI provUI = ProvisioningUI.getDefaultUI();
RepositoryTracker tracker = provUI.getRepositoryTracker();
if (tracker == null) {
// if run from the IDE there will be no tracker
return Collections.emptyList();
}
UpdateOperation op = new UpdateOperation(provUI.getSession());
op.resolveModal(new NullProgressMonitor());
return Stream.of(op.getPossibleUpdates()).map(u -> u.toUpdate.getProperty("org.eclipse.equinox.p2.name")).sorted().distinct().collect(Collectors.toList());
}
use of org.eclipse.equinox.p2.operations.UpdateOperation 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);
}
}
}
use of org.eclipse.equinox.p2.operations.UpdateOperation in project portfolio by buchen.
the class UpdateHelper method checkForUpdates.
private NewVersion checkForUpdates(IProgressMonitor monitor) throws OperationCanceledException, CoreException {
ProvisioningSession session = new ProvisioningSession(agent);
operation = new UpdateOperation(session);
configureUpdateOperation(operation);
IStatus status = operation.resolveModal(monitor);
if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE)
return null;
if (status.getSeverity() == IStatus.CANCEL)
throw new OperationCanceledException();
if (status.getSeverity() == IStatus.ERROR)
throw new CoreException(status);
Update[] possibleUpdates = operation.getPossibleUpdates();
Update update = possibleUpdates.length > 0 ? possibleUpdates[0] : null;
if (update == null) {
return new NewVersion(Messages.LabelUnknownVersion);
} else {
NewVersion v = new NewVersion(update.replacement.getVersion().toString());
v.setMinimumJavaVersionRequired(// $NON-NLS-1$
update.replacement.getProperty("latest.changes.minimumJavaVersionRequired", null));
// try for locale first
String history = //
update.replacement.getProperty(VERSION_HISTORY + "_" + Locale.getDefault().getLanguage(), // $NON-NLS-1$
null);
if (history == null)
history = update.replacement.getProperty(VERSION_HISTORY, null);
if (history != null)
v.setVersionHistory(history);
return v;
}
}
use of org.eclipse.equinox.p2.operations.UpdateOperation 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();
}
}
}
}
});
}
Aggregations