use of org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob 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.ui.LoadMetadataRepositoryJob in project knime-core by knime.
the class InstallMissingNodesJob method startInstallJob.
private void startInstallJob(final Set<IInstallableUnit> featuresToInstall) {
final ProvisioningUI provUI = ProvisioningUI.getDefaultUI();
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(provUI);
loadJob.setProperty(LoadMetadataRepositoryJob.ACCUMULATE_LOAD_ERRORS, Boolean.toString(true));
loadJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(final IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning() && event.getResult().isOK()) {
Display.getDefault().asyncExec(() -> {
if (Display.getDefault().isDisposed()) {
NodeLogger.getLogger("Display disposed, aborting install action");
// fixes AP-8376, AP-8380, AP-7184
return;
}
provUI.getPolicy().setRepositoriesVisible(false);
provUI.openInstallWizard(featuresToInstall, new InstallOperation(provUI.getSession(), featuresToInstall), loadJob);
provUI.getPolicy().setRepositoriesVisible(true);
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
}
use of org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob in project yamcs-studio by yamcs.
the class PreloadingRepositoryHandler method doExecuteAndLoad.
void doExecuteAndLoad() {
if (preloadRepositories()) {
// cancel any load that is already running
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI());
setLoadJobProperties(loadJob);
if (waitForPreload()) {
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
doExecute(loadJob);
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
} else {
loadJob.setSystem(true);
loadJob.setUser(false);
loadJob.schedule();
doExecute(null);
}
} else {
doExecute(null);
}
}
use of org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob 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.ui.LoadMetadataRepositoryJob in project translationstudio8 by heartsome.
the class PreloadingRepositoryHandler method doExecuteAndLoad.
void doExecuteAndLoad() {
if (preloadRepositories()) {
// cancel any load that is already running
final IStatus[] checkStatus = new IStatus[1];
Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY);
final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()) {
public IStatus runModal(IProgressMonitor monitor) {
SubMonitor sub = SubMonitor.convert(monitor, getProgressTaskName(), 1000);
IStatus status = super.runModal(sub.newChild(500));
if (status.getSeverity() == IStatus.CANCEL)
return status;
if (status.getSeverity() != IStatus.OK) {
// 记录检查错误
checkStatus[0] = status;
return Status.OK_STATUS;
}
try {
doPostLoadBackgroundWork(sub.newChild(500));
} catch (OperationCanceledException e) {
return Status.CANCEL_STATUS;
}
return status;
}
};
setLoadJobProperties(loadJob);
loadJob.setName(P2UpdateUtil.CHECK_UPDATE_JOB_NAME);
if (waitForPreload()) {
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (PlatformUI.isWorkbenchRunning())
if (event.getResult().isOK()) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
if (checkStatus[0] != null) {
// 提示连接异常
P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_CHECK);
return;
}
doExecute(loadJob);
}
});
}
}
});
loadJob.setUser(true);
loadJob.schedule();
} else {
loadJob.setSystem(true);
loadJob.setUser(false);
loadJob.schedule();
doExecute(null);
}
} else {
doExecute(null);
}
}
Aggregations