use of org.eclipse.equinox.p2.operations.InstallOperation 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.operations.InstallOperation in project archi by archimatetool.
the class P2Handler method install.
public IStatus install(URI uri, IProgressMonitor monitor) throws ProvisionException {
loadRepository(uri, monitor);
Collection<IInstallableUnit> toInstall = getGroupInstallableUnits(uri, monitor);
InstallOperation operation = new InstallOperation(getProvisioningSession(), toInstall);
return performOperation(operation, monitor);
}
use of org.eclipse.equinox.p2.operations.InstallOperation in project gemoc-studio by eclipse.
the class PrepareInstallProfileJob method run.
public void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException {
try {
SubMonitor monitor = SubMonitor.convert(progressMonitor, Messages.InstallConnectorsJob_task_configuring, 100);
try {
final Collection<IInstallableUnit> ius = computeInstallableUnits(monitor.newChild(50));
checkCancelled(monitor);
final InstallOperation installOperation = resolve(monitor.newChild(50), ius, repositoryLocations.toArray(new URI[0]));
checkCancelled(monitor);
if (!headless) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
openInstallWizard(provisioningUI, ius, installOperation);
}
});
}
} finally {
monitor.done();
}
} catch (OperationCanceledException e) {
throw new InterruptedException();
} catch (Exception e) {
throw new InvocationTargetException(e);
}
}
use of org.eclipse.equinox.p2.operations.InstallOperation in project gemoc-studio by eclipse.
the class PrepareInstallProfileJob method resolve.
private InstallOperation resolve(IProgressMonitor monitor, final Collection<IInstallableUnit> ius, URI[] repositories) throws CoreException {
final InstallOperation installOperation = provisioningUI.getInstallOperation(ius, repositories);
IStatus operationStatus = installOperation.resolveModal(new SubProgressMonitor(monitor, installableConnectors.size()));
if (operationStatus.getSeverity() > IStatus.WARNING) {
Activator.getDefault().getLog().log(operationStatus);
throw new RuntimeException(getFullMessage(operationStatus));
}
return installOperation;
}
use of org.eclipse.equinox.p2.operations.InstallOperation in project azure-tools-for-java by Microsoft.
the class PluginUtil method forceInstallPluginUsingP2.
private static void forceInstallPluginUsingP2(String pluginGroupID) {
URI repoURI = getEclipseP2Repository();
ProvisioningUI provisioningUI = ProvisioningUI.getDefaultUI();
if (provisioningUI != null && repoURI != null) {
ProvisioningSession provisioningSession = provisioningUI.getSession();
IProvisioningAgent provisioningAgent = null;
if (provisioningSession != null && (provisioningAgent = provisioningSession.getProvisioningAgent()) != null) {
IMetadataRepositoryManager manager = (IMetadataRepositoryManager) provisioningAgent.getService(IMetadataRepositoryManager.SERVICE_NAME);
if (manager != null) {
try {
IMetadataRepository repository = manager.loadRepository(repoURI, null);
if (repository != null) {
IQueryResult<IInstallableUnit> iqr = repository.query(QueryUtil.createIUQuery(pluginGroupID), null);
if (iqr != null) {
Collection<IInstallableUnit> iuList = StreamSupport.stream(iqr.spliterator(), false).collect(Collectors.toList());
if (iuList.size() > 0) {
InstallOperation io = new InstallOperation(provisioningSession, iuList);
provisioningUI.openInstallWizard(iuList, io, null);
return;
}
}
}
} catch (Exception e) {
String errorMsg = "Error installing " + pluginGroupID + "! Please manually install using Eclipse P2 repository from: Help -> Install New Software.... Click OK to continue.";
PluginUtil.displayErrorDialogAndLog(getParentShell(), "Fail to install", errorMsg, e);
}
}
}
}
String errorMsg = "Error installing " + pluginGroupID + "! In the following installation wizard, please select the right repository and then filter by " + pluginGroupID + "! Click OK to continue.";
PluginUtil.displayErrorDialogAndLog(getParentShell(), "Fail to install", errorMsg, null);
provisioningUI.openInstallWizard(null, null, null);
}
Aggregations