use of org.eclipse.jdt.launching.IVMInstall2 in project xtext-eclipse by eclipse.
the class JavaProjectSetupUtil method makeJava7Default.
public static void makeJava7Default() {
if (!isJava7Default) {
IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager();
IExecutionEnvironment[] environments = manager.getExecutionEnvironments();
for (int i = 0; i < environments.length; i++) {
IExecutionEnvironment environment = environments[i];
if (environment.getId().equals("JavaSE-1.6") && environment.getDefaultVM() == null) {
IVMInstall[] compatibleVMs = environment.getCompatibleVMs();
for (IVMInstall ivmInstall : compatibleVMs) {
if (ivmInstall instanceof IVMInstall2) {
IVMInstall2 install2 = (IVMInstall2) ivmInstall;
if (install2.getJavaVersion().startsWith("1.7")) {
environment.setDefaultVM(ivmInstall);
}
}
}
}
}
isJava7Default = true;
}
}
Aggregations