use of org.eclipse.equinox.p2.ui.ProvisioningUI 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.ProvisioningUI 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.ui.ProvisioningUI in project knime-core by knime.
the class AbstractP2Action method checkSDKAndReadOnly.
/**
* Checks whether the current instance is run from an SDK and if the configuration area is writable.
*
* @return <code>true</code> if the action should continue, <code>false</code> if it should be aborted
*/
protected final boolean checkSDKAndReadOnly() {
final ProvisioningUI provUI = ProvisioningUI.getDefaultUI();
if (provUI.getRepositoryTracker() == null) {
MessageBox mbox = new MessageBox(ProvUI.getDefaultParentShell(), SWT.ICON_WARNING | SWT.OK);
mbox.setText("Action impossible");
mbox.setMessage("It seems you are running KNIME from an SDK. " + "Installing extension is not possible in this case.");
mbox.open();
return false;
}
String installLocation = Platform.getInstallLocation().getURL().toString();
String configurationLocation = Platform.getConfigurationLocation().getURL().toString();
if (!configurationLocation.contains(installLocation)) {
MessageBox mbox = new MessageBox(ProvUI.getDefaultParentShell(), SWT.ICON_WARNING | SWT.YES | SWT.NO);
mbox.setText("Permission problem");
mbox.setMessage("Your KNIME installation directory seems to be " + "read-only, maybe because KNIME was installed by a " + "different user. Installing extensions or updating KNIME " + "may cause problems. Do you really want to continue?");
return (mbox.open() == SWT.YES);
}
return true;
}
use of org.eclipse.equinox.p2.ui.ProvisioningUI 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.ui.ProvisioningUI 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