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;
}
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();
}
}
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;
}
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;
}
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;
}
Aggregations