public boolean configureVM() throws CoreException { String javaHome = preferenceManager.getPreferences().getJavaHome(); if (javaHome != null) { File jvmHome = new File(javaHome); if (jvmHome.isDirectory()) { IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); File location = defaultVM.getInstallLocation(); if (!location.equals(jvmHome)) { IVMInstall vm = findVM(jvmHome); if (vm == null) { IVMInstallType installType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE); long unique = System.currentTimeMillis(); while (installType.findVMInstall(String.valueOf(unique)) != null) { unique++; } String vmId = String.valueOf(unique); VMStandin vmStandin = new VMStandin(installType, vmId); String name = StringUtils.defaultIfBlank(jvmHome.getName(), "JRE"); vmStandin.setName(name); vmStandin.setInstallLocation(jvmHome); vm = vmStandin.convertToRealVM(); } JavaRuntime.setDefaultVMInstall(vm, new NullProgressMonitor()); JDTUtils.setCompatibleVMs(vm.getId()); return true; } } } return false; }
private static IVMInstall registerNewVM(String name, File location) { // use the 'Standard VM' type to register a new VM IVMInstallType installType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE); // both the id and the name have to be unique for the registration String vmId = generateUniqueVMId(installType); // create the VM without firing events on individual method calls VMStandin vm = new VMStandin(installType, vmId); vm.setName(name); vm.setInstallLocation(location); return vm.convertToRealVM(); }
standin.convertToRealVM(); JavaRuntime.saveVMConfiguration();
standin.convertToRealVM(); JavaRuntime.saveVMConfiguration();
while (iter.hasNext()) { VMStandin standin = (VMStandin)iter.next(); standin.convertToRealVM();
while (iter.hasNext()) { VMStandin standin = (VMStandin)iter.next(); standin.convertToRealVM();
protected IVMInstall addInstalledJre(IVMInstallType type, InstalledJre jreToAdd) throws Exception { IVMInstall retVal = findJre(jreToAdd.getVersion(), jreToAdd.getInstalledLocation()); if (retVal == null) { IStatus validationStatus = type.validateInstallLocation(jreToAdd.getInstalledLocation()); if (!validationStatus.isOK()) { throw new CoreException(validationStatus); } VMStandin vmStandin = new VMStandin(type, EcoreUtil.generateUUID()); vmStandin.setInstallLocation(jreToAdd.getInstalledLocation()); vmStandin.setName("JRE for " + jreToAdd.getVersion()); IVMInstall realVM = vmStandin.convertToRealVM(); retVal = realVM; } return retVal; }
while (vmListIterator.hasNext()) { VMStandin vmStandin = (VMStandin) vmListIterator.next(); vmStandin.convertToRealVM();
while (vmListIterator.hasNext()) { VMStandin vmStandin = (VMStandin) vmListIterator.next(); vmStandin.convertToRealVM();