Search in sources :

Example 1 with AbstractVMInstallType

use of org.eclipse.jdt.launching.AbstractVMInstallType in project mdw-designer by CenturyLinkCloud.

the class ProjectConfigurator method getJreContainerClasspathEntry.

private IClasspathEntry getJreContainerClasspathEntry(String desiredVersion) {
    for (IVMInstallType installType : JavaRuntime.getVMInstallTypes()) {
        if (installType instanceof AbstractVMInstallType) {
            AbstractVMInstallType install = (AbstractVMInstallType) installType;
            for (IVMInstall vmInstall : install.getVMInstalls()) {
                if (vmInstall instanceof IVMInstall2) {
                    IVMInstall2 vmInstall2 = (IVMInstall2) vmInstall;
                    if (vmInstall2.getJavaVersion() != null && vmInstall2.getJavaVersion().startsWith(desiredVersion)) {
                        IPath containerPath = new Path(JavaRuntime.JRE_CONTAINER);
                        IPath vmPath = containerPath.append(vmInstall.getVMInstallType().getId()).append(vmInstall.getName());
                        return JavaCore.newContainerEntry(vmPath);
                    }
                }
            }
        }
    }
    return null;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IVMInstall(org.eclipse.jdt.launching.IVMInstall) IPath(org.eclipse.core.runtime.IPath) IVMInstallType(org.eclipse.jdt.launching.IVMInstallType) AbstractVMInstallType(org.eclipse.jdt.launching.AbstractVMInstallType) IVMInstall2(org.eclipse.jdt.launching.IVMInstall2)

Aggregations

IPath (org.eclipse.core.runtime.IPath)1 Path (org.eclipse.core.runtime.Path)1 AbstractVMInstallType (org.eclipse.jdt.launching.AbstractVMInstallType)1 IVMInstall (org.eclipse.jdt.launching.IVMInstall)1 IVMInstall2 (org.eclipse.jdt.launching.IVMInstall2)1 IVMInstallType (org.eclipse.jdt.launching.IVMInstallType)1