Search in sources :

Example 1 with IJavaRuntime

use of org.eclipse.jst.server.core.IJavaRuntime in project liferay-ide by liferay.

the class LiferayTomcatRuntimeComposite method updateJREs.

protected void updateJREs() {
    IJavaRuntime iJavaRuntime = getJavaRuntime();
    IVMInstall currentVM = null;
    if ((iJavaRuntime != null) && (iJavaRuntime.getVMInstall() != null)) {
        currentVM = iJavaRuntime.getVMInstall();
    } else {
        currentVM = JavaRuntime.getDefaultVMInstall();
    }
    int currentJREIndex = -1;
    // get all installed JVMs
    installedJREs = new ArrayList<>();
    IVMInstallType[] vmInstallTypes = JavaRuntime.getVMInstallTypes();
    int size = vmInstallTypes.length;
    for (int i = 0; i < size; i++) {
        IVMInstall[] vmInstalls = vmInstallTypes[i].getVMInstalls();
        int size2 = vmInstalls.length;
        for (int j = 0; j < size2; j++) {
            installedJREs.add(vmInstalls[j]);
        }
    }
    size = installedJREs.size();
    jreNames = new String[size + 1];
    jreNames[0] = "<Default Workbench JRE>";
    for (int i = 0; i < size; i++) {
        IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
        jreNames[i + 1] = vmInstall.getName();
        if (vmInstall.equals(currentVM)) {
            currentJREIndex = i + 1;
        }
    }
    if (jreCombo != null) {
        jreCombo.setItems(jreNames);
        jreCombo.select(currentJREIndex);
    }
}
Also used : IJavaRuntime(org.eclipse.jst.server.core.IJavaRuntime) IVMInstall(org.eclipse.jdt.launching.IVMInstall) IVMInstallType(org.eclipse.jdt.launching.IVMInstallType)

Example 2 with IJavaRuntime

use of org.eclipse.jst.server.core.IJavaRuntime in project webtools.servertools by eclipse.

the class JRERuntimeComponentProvider method getRuntimeComponents.

public List<IRuntimeComponent> getRuntimeComponents(IRuntime runtime) {
    // define JRE component
    IJavaRuntime javaRuntime = (IJavaRuntime) runtime.loadAdapter(IJavaRuntime.class, null);
    if (javaRuntime != null) {
        final IVMInstall vmInstall = javaRuntime.getVMInstall();
        final IRuntimeComponent rc = StandardJreRuntimeComponent.create(vmInstall);
        return Collections.singletonList(rc);
    }
    return null;
}
Also used : IJavaRuntime(org.eclipse.jst.server.core.IJavaRuntime) IVMInstall(org.eclipse.jdt.launching.IVMInstall) IRuntimeComponent(org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent)

Aggregations

IVMInstall (org.eclipse.jdt.launching.IVMInstall)2 IJavaRuntime (org.eclipse.jst.server.core.IJavaRuntime)2 IVMInstallType (org.eclipse.jdt.launching.IVMInstallType)1 IRuntimeComponent (org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent)1