vmStandin.setName(name); File installLocation= new File(installPath); vmStandin.setInstallLocation(installLocation);
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(); }
vmStandin.setName(name); File installLocation= new File(installPath); vmStandin.setInstallLocation(installLocation);
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; }
VMStandin detectedVMStandin = new VMStandin(vmType, vmID); detectedVMStandin.setInstallLocation(detectedLocation); detectedVMStandin.setName(generateDetectedVMName(detectedVMStandin)); if (vmType instanceof AbstractVMInstallType) { AbstractVMInstallType abs = (AbstractVMInstallType)vmType;
VMStandin detectedVMStandin = new VMStandin(vmType, vmID); detectedVMStandin.setInstallLocation(detectedLocation); detectedVMStandin.setName(generateDetectedVMName(detectedVMStandin)); if (vmType instanceof AbstractVMInstallType) { AbstractVMInstallType abs = (AbstractVMInstallType)vmType;
/** * Adds a duplicate of the selected VM to the block * @since 3.2 */ protected void copyVM() { IStructuredSelection selection = (IStructuredSelection) fVMList.getSelection(); Iterator it = selection.iterator(); ArrayList newEntries = new ArrayList(); while (it.hasNext()) { IVMInstall selectedVM = (IVMInstall) it.next(); // duplicate & add vm VMStandin standin = new VMStandin(selectedVM, createUniqueId(selectedVM.getVMInstallType())); standin.setName(generateName(selectedVM.getName())); AddVMDialog dialog = new AddVMDialog(this, getShell(), JavaRuntime.getVMInstallTypes(), standin); dialog.setTitle(JREMessages.InstalledJREsBlock_18); if (dialog.open() != Window.OK) { return; } newEntries.add(standin); fVMs.add(standin); } fVMList.refresh(); fVMList.setSelection(new StructuredSelection(newEntries.toArray())); }
/** * Initializes the settings of this stand-in based on the settings in the given * VM install. * * @param realVM VM to copy settings from */ private void init(IVMInstall realVM) { setName(realVM.getName()); setInstallLocation(realVM.getInstallLocation()); setLibraryLocations(realVM.getLibraryLocations()); setJavadocLocation(realVM.getJavadocLocation()); if (realVM instanceof IVMInstall2) { IVMInstall2 vm2 = (IVMInstall2) realVM; setVMArgs(vm2.getVMArgs()); fJavaVersion = vm2.getJavaVersion(); } else { setVMArguments(realVM.getVMArguments()); fJavaVersion = null; } if (realVM instanceof AbstractVMInstall) { AbstractVMInstall vm2 = (AbstractVMInstall) realVM; Map<String, String> attributes = vm2.getAttributes(); Iterator<Entry<String, String>> iterator = attributes.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next(); setAttribute(entry.getKey(), entry.getValue()); } } }
/** * Initializes the settings of this stand-in based on the settings in the given * VM install. * * @param realVM VM to copy settings from */ private void init(IVMInstall realVM) { setName(realVM.getName()); setInstallLocation(realVM.getInstallLocation()); setLibraryLocations(realVM.getLibraryLocations()); setJavadocLocation(realVM.getJavadocLocation()); if (realVM instanceof IVMInstall2) { IVMInstall2 vm2 = (IVMInstall2) realVM; setVMArgs(vm2.getVMArgs()); fJavaVersion = vm2.getJavaVersion(); } else { setVMArguments(realVM.getVMArguments()); fJavaVersion = null; } if (realVM instanceof AbstractVMInstall) { AbstractVMInstall vm2 = (AbstractVMInstall) realVM; Map<String, String> attributes = vm2.getAttributes(); Iterator<Entry<String, String>> iterator = attributes.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next(); setAttribute(entry.getKey(), entry.getValue()); } } }
} else { standin = new VMStandin(installType, id); standin.setName(name); IStatus status = installType.validateInstallLocation(homeDir); if (!status.isOK()) {
} else { standin = new VMStandin(installType, id); standin.setName(name); IStatus status = installType.validateInstallLocation(homeDir); if (!status.isOK()) {
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; }