use of com.intellij.openapi.projectRoots.JavaSdk in project moe-ide-integration by multi-os-engine.
the class MOESdkType method findPotentialJdkPaths.
private static List<File> findPotentialJdkPaths() {
JavaSdk javaSdk = JavaSdk.getInstance();
List<String> jdkPaths = Lists.newArrayList(javaSdk.suggestHomePaths());
String javaHome = SystemProperties.getJavaHome();
if (javaHome == null || javaHome.isEmpty()) {
return null;
}
jdkPaths.add(javaHome);
List<File> javaHomePaths = Lists.newArrayListWithCapacity(jdkPaths.size());
for (String jdkPath : jdkPaths) {
if (jdkPath == null) {
continue;
}
File javaHomeDir = new File(jdkPath);
if (javaHomeDir.isDirectory()) {
javaHomePaths.add(javaHomeDir);
}
}
return javaHomePaths;
}
use of com.intellij.openapi.projectRoots.JavaSdk in project moe-ide-integration by multi-os-engine.
the class MOESdkType method getJDK.
public static Sdk getJDK() {
Sdk sdk = null;
for (Sdk jdk : ProjectJdkTable.getInstance().getAllJdks()) {
if (jdk != null && jdk.getSdkType() instanceof JavaSdk) {
if (sdk == null) {
sdk = jdk;
} else {
JavaSdkVersion version = ((JavaSdk) jdk.getSdkType()).getVersion(jdk);
JavaSdkVersion desiredVersion = ((JavaSdk) sdk.getSdkType()).getVersion(sdk);
if (version != null && desiredVersion != null && version.isAtLeast(desiredVersion)) {
sdk = jdk;
}
}
}
}
return sdk;
}
Aggregations