Search in sources :

Example 21 with JavaSdkVersion

use of com.intellij.openapi.projectRoots.JavaSdkVersion 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;
}
Also used : JavaSdkVersion(com.intellij.openapi.projectRoots.JavaSdkVersion) JavaSdk(com.intellij.openapi.projectRoots.JavaSdk) JavaSdk(com.intellij.openapi.projectRoots.JavaSdk) Sdk(com.intellij.openapi.projectRoots.Sdk)

Example 22 with JavaSdkVersion

use of com.intellij.openapi.projectRoots.JavaSdkVersion in project intellij by bazelbuild.

the class Jdks method getVersion.

private static JavaSdkVersion getVersion(String jdkRoot) {
    String version = JavaSdk.getInstance().getVersionString(jdkRoot);
    if (version == null) {
        return JavaSdkVersion.JDK_1_0;
    }
    JavaSdkVersion sdkVersion = JavaSdk.getInstance().getVersion(version);
    return sdkVersion == null ? JavaSdkVersion.JDK_1_0 : sdkVersion;
}
Also used : JavaSdkVersion(com.intellij.openapi.projectRoots.JavaSdkVersion)

Aggregations

JavaSdkVersion (com.intellij.openapi.projectRoots.JavaSdkVersion)22 Sdk (com.intellij.openapi.projectRoots.Sdk)16 JavaSdk (com.intellij.openapi.projectRoots.JavaSdk)13 Module (com.intellij.openapi.module.Module)5 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 File (java.io.File)5 JavaSdkType (com.intellij.openapi.projectRoots.JavaSdkType)3 LanguageLevel (com.intellij.pom.java.LanguageLevel)3 IOException (java.io.IOException)3 NotNull (org.jetbrains.annotations.NotNull)3 Nullable (org.jetbrains.annotations.Nullable)3 ExecutionException (com.intellij.execution.ExecutionException)2 ProjectData (com.intellij.openapi.externalSystem.model.project.ProjectData)2 Project (com.intellij.openapi.project.Project)2 JpsJavaSdkType (org.jetbrains.jps.model.java.JpsJavaSdkType)2 AndroidSdkHandler (com.android.sdklib.repository.AndroidSdkHandler)1 AndroidTargetManager (com.android.sdklib.repository.targets.AndroidTargetManager)1 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)1 StudioLoggerProgressIndicator (com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)1 CompilerConfiguration (com.intellij.compiler.CompilerConfiguration)1