use of org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager in project eclipse.jdt.ls by eclipse.
the class JDTUtils method setCompatibleVMs.
public static void setCompatibleVMs(String id) {
// update all environments compatible to use the test JRE
IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
IExecutionEnvironment[] environments = manager.getExecutionEnvironments();
for (IExecutionEnvironment environment : environments) {
IVMInstall[] compatibleVMs = environment.getCompatibleVMs();
for (IVMInstall compatibleVM : compatibleVMs) {
if (id.equals(compatibleVM.getVMInstallType().getId()) && compatibleVM.getVMInstallType().findVMInstall(compatibleVM.getId()) != null && !compatibleVM.equals(environment.getDefaultVM()) && // Fugly way to ensure the lowest VM version is set:
(environment.getDefaultVM() == null || compatibleVM.getId().compareTo(environment.getDefaultVM().getId()) < 0)) {
environment.setDefaultVM(compatibleVM);
}
}
}
}
use of org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager in project eclipse.jdt.ls by eclipse.
the class ProjectsManager method getWorkspaceInfo.
private String getWorkspaceInfo() {
StringBuilder b = new StringBuilder();
b.append("Projects:\n");
for (IProject project : getWorkspaceRoot().getProjects()) {
b.append(project.getName()).append(": ").append(project.getLocation().toOSString()).append('\n');
if (ProjectUtils.isJavaProject(project)) {
IJavaProject javaProject = JavaCore.create(project);
try {
b.append(" resolved classpath:\n");
IClasspathEntry[] cpEntries = javaProject.getRawClasspath();
for (IClasspathEntry cpe : cpEntries) {
b.append(" ").append(cpe.getPath().toString()).append('\n');
if (cpe.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
IPackageFragmentRoot[] roots = javaProject.findPackageFragmentRoots(cpe);
for (IPackageFragmentRoot root : roots) {
b.append(" ").append(root.getPath().toString()).append('\n');
}
}
}
} catch (CoreException e) {
// ignore
}
} else {
b.append(" non-Java project\n");
}
}
b.append("Java Runtimes:\n");
IVMInstall defaultVMInstall = JavaRuntime.getDefaultVMInstall();
b.append(" default: ");
if (defaultVMInstall != null) {
b.append(defaultVMInstall.getInstallLocation().toString());
} else {
b.append("-");
}
IExecutionEnvironmentsManager eem = JavaRuntime.getExecutionEnvironmentsManager();
for (IExecutionEnvironment ee : eem.getExecutionEnvironments()) {
IVMInstall[] vms = ee.getCompatibleVMs();
b.append(" ").append(ee.getDescription()).append(": ");
if (vms.length > 0) {
b.append(vms[0].getInstallLocation().toString());
} else {
b.append("-");
}
b.append("\n");
}
return b.toString();
}
Aggregations