Search in sources :

Example 11 with IVMInstallType

use of org.eclipse.jdt.launching.IVMInstallType in project webtools.servertools by eclipse.

the class GenericServerRuntime method getVMInstall.

/* (non-Javadoc)
	 * @see org.eclipse.jst.server.core.IGenericRuntime#getVMInstall()
	 */
public IVMInstall getVMInstall() {
    if (getVMInstallTypeId() == null)
        return JavaRuntime.getDefaultVMInstall();
    try {
        IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
        IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
        int size = vmInstalls.length;
        String id = getVMInstallId();
        for (int i = 0; i < size; i++) {
            if (id.equals(vmInstalls[i].getId()))
                return vmInstalls[i];
        }
    } catch (Exception e) {
    // ignore
    }
    return null;
}
Also used : IVMInstall(org.eclipse.jdt.launching.IVMInstall) IVMInstallType(org.eclipse.jdt.launching.IVMInstallType)

Example 12 with IVMInstallType

use of org.eclipse.jdt.launching.IVMInstallType in project webtools.servertools by eclipse.

the class TomcatRuntimeComposite method updateJREs.

protected void updateJREs() {
    // 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]);
        }
    }
    // get names
    size = installedJREs.size();
    jreNames = new String[size + 1];
    jreNames[0] = Messages.runtimeDefaultJRE;
    for (int i = 0; i < size; i++) {
        IVMInstall vmInstall = (IVMInstall) installedJREs.get(i);
        jreNames[i + 1] = vmInstall.getName();
    }
}
Also used : IVMInstall(org.eclipse.jdt.launching.IVMInstall) ArrayList(java.util.ArrayList) IVMInstallType(org.eclipse.jdt.launching.IVMInstallType)

Example 13 with IVMInstallType

use of org.eclipse.jdt.launching.IVMInstallType in project webtools.servertools by eclipse.

the class PreviewRuntime method getVMInstall.

public IVMInstall getVMInstall() {
    if (getVMInstallTypeId() == null)
        return JavaRuntime.getDefaultVMInstall();
    try {
        IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
        IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
        String id = getVMInstallId();
        for (IVMInstall vmInstall : vmInstalls) {
            if (id.equals(vmInstall.getId()))
                return vmInstall;
        }
    } catch (Exception e) {
    // ignore
    }
    return null;
}
Also used : IVMInstall(org.eclipse.jdt.launching.IVMInstall) IVMInstallType(org.eclipse.jdt.launching.IVMInstallType) IOException(java.io.IOException)

Example 14 with IVMInstallType

use of org.eclipse.jdt.launching.IVMInstallType in project liferay-ide by liferay.

the class PortalRuntime method getVMInstall.

public IVMInstall getVMInstall() {
    if (getVMInstallTypeId() == null) {
        return JavaRuntime.getDefaultVMInstall();
    }
    try {
        final IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(getVMInstallTypeId());
        final IVMInstall[] vmInstalls = vmInstallType.getVMInstalls();
        final int size = vmInstalls.length;
        final String id = getVMInstallId();
        for (int i = 0; i < size; i++) {
            if (id.equals(vmInstalls[i].getId())) {
                return vmInstalls[i];
            }
        }
    } catch (Exception e) {
    // ignore
    }
    return null;
}
Also used : IVMInstall(org.eclipse.jdt.launching.IVMInstall) IVMInstallType(org.eclipse.jdt.launching.IVMInstallType)

Example 15 with IVMInstallType

use of org.eclipse.jdt.launching.IVMInstallType in project liferay-ide by liferay.

the class LiferayTomcatRuntime method findPortalBundledJRE.

public IVMInstall findPortalBundledJRE(boolean addVM) {
    IPath jrePath = findBundledJREPath(getRuntime().getLocation());
    if (jrePath == null)
        return null;
    // make sure we don't have an existing JRE that has the same path
    for (IVMInstallType vmInstallType : JavaRuntime.getVMInstallTypes()) {
        for (IVMInstall vmInstall : vmInstallType.getVMInstalls()) {
            if (vmInstall.getInstallLocation().equals(jrePath.toFile())) {
                return vmInstall;
            }
        }
    }
    if (addVM) {
        IVMInstallType installType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE);
        VMStandin newVM = new VMStandin(installType, JavaUtil.createUniqueId(installType));
        newVM.setInstallLocation(jrePath.toFile());
        if (!CoreUtil.isNullOrEmpty(getRuntime().getName())) {
            // $NON-NLS-1$
            newVM.setName(getRuntime().getName() + " JRE");
        } else {
            // $NON-NLS-1$
            newVM.setName("Liferay JRE");
        }
        // make sure the new VM name isn't the same as existing name
        boolean existingVMWithSameName = ServerUtil.isExistingVMName(newVM.getName());
        int num = 1;
        while (existingVMWithSameName) {
            // $NON-NLS-1$ //$NON-NLS-2$
            newVM.setName(getRuntime().getName() + " JRE (" + (num++) + ")");
            existingVMWithSameName = ServerUtil.isExistingVMName(newVM.getName());
        }
        return newVM.convertToRealVM();
    }
    return null;
}
Also used : IPath(org.eclipse.core.runtime.IPath) IVMInstall(org.eclipse.jdt.launching.IVMInstall) IVMInstallType(org.eclipse.jdt.launching.IVMInstallType) VMStandin(org.eclipse.jdt.launching.VMStandin)

Aggregations

IVMInstall (org.eclipse.jdt.launching.IVMInstall)19 IVMInstallType (org.eclipse.jdt.launching.IVMInstallType)19 File (java.io.File)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)4 VMStandin (org.eclipse.jdt.launching.VMStandin)4 ArrayList (java.util.ArrayList)2 IPath (org.eclipse.core.runtime.IPath)2 PortalRuntime (com.liferay.ide.server.core.portal.PortalRuntime)1 IOException (java.io.IOException)1 Path (org.eclipse.core.runtime.Path)1 AbstractVMInstallType (org.eclipse.jdt.launching.AbstractVMInstallType)1 IVMInstall2 (org.eclipse.jdt.launching.IVMInstall2)1 IExecutionEnvironment (org.eclipse.jdt.launching.environments.IExecutionEnvironment)1 IJavaRuntime (org.eclipse.jst.server.core.IJavaRuntime)1 Test (org.junit.Test)1 JvmCoreException (org.talend.designer.runtime.visualization.JvmCoreException)1