IStatus status = EEVMType.validateDefinitionFile(description); if (status.isOK()) { VMStandin standin = new VMStandin(getVMInstallType(EEVMType.ID_EE_VM_TYPE), id); if (name != null && name.length() > 0){ standin.setName(name); } else { name = description.getProperty(ExecutionEnvironmentDescription.EE_NAME); name = eeFile.getName(); standin.setName(name); standin.setInstallLocation(new File(home)); standin.setLibraryLocations(description.getLibraryLocations()); standin.setVMArgs(description.getVMArguments()); standin.setJavadocLocation(EEVMType.getJavadocLocation(description.getProperties())); standin.setAttribute(EEVMInstall.ATTR_EXECUTION_ENVIRONMENT_ID, description.getProperty(ExecutionEnvironmentDescription.CLASS_LIB_LEVEL)); File exe = description.getExecutable(); if (exe == null) { standin.setAttribute(EEVMInstall.ATTR_JAVA_EXE, exe.getCanonicalPath()); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), standin.setAttribute(EEVMInstall.ATTR_JAVA_VERSION, description.getProperty(ExecutionEnvironmentDescription.LANGUAGE_LEVEL)); standin.setAttribute(EEVMInstall.ATTR_DEFINITION_FILE, eeFile.getPath()); standin.setAttribute(EEVMInstall.ATTR_DEBUG_ARGS, description.getProperty(ExecutionEnvironmentDescription.DEBUG_ARGS)); return standin;
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(); }
IVMInstallType vmType= getVMInstallType(); IVMInstall realVM= vmType.findVMInstall(getId()); boolean notify = true; realVM= vmType.createVMInstall(getId()); notify = false; ((AbstractVMInstall)realVM).setNotify(notify); realVM.setName(getName()); realVM.setInstallLocation(getInstallLocation()); realVM.setLibraryLocations(getLibraryLocations()); realVM.setJavadocLocation(getJavadocLocation()); if (realVM instanceof IVMInstall2) { IVMInstall2 vm2 = (IVMInstall2) realVM; vm2.setVMArgs(getVMArgs()); } else { realVM.setVMArguments(getVMArguments()); Iterator<Entry<String, String>> iterator = getAttributes().entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next();
/** * 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()); } } }
private IVMInstall[] getWorkspaceJREs() { List standins = new ArrayList(); IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (int i = 0; i < types.length; i++) { IVMInstallType type = types[i]; IVMInstall[] installs = type.getVMInstalls(); for (int j = 0; j < installs.length; j++) { IVMInstall install = installs[j]; standins.add(new VMStandin(install)); } } return ((IVMInstall[])standins.toArray(new IVMInstall[standins.size()])); }
VMStandin standin = new VMStandin(vm); standin.setLibraryLocations(libs); standin.convertToRealVM(); JavaRuntime.saveVMConfiguration();
/** * 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())); }
while (deletedIterator.hasNext()) { VMStandin deletedVMStandin = (VMStandin) deletedIterator.next(); deletedVMStandin.getVMInstallType().disposeVMInstall(deletedVMStandin.getId()); while (iter.hasNext()) { VMStandin standin = (VMStandin)iter.next(); standin.convertToRealVM();
while (vmListIterator.hasNext()) { VMStandin vmStandin = (VMStandin) vmListIterator.next(); vmStandin.convertToRealVM();
private IVMInstall[] getWorkspaceJREs() { List<VMStandin> standins = new ArrayList<>(); IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (int i = 0; i < types.length; i++) { IVMInstallType type = types[i]; IVMInstall[] installs = type.getVMInstalls(); for (int j = 0; j < installs.length; j++) { IVMInstall install = installs[j]; standins.add(new VMStandin(install)); } } return standins.toArray(new IVMInstall[standins.size()]); }
/** * 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()); } } }
VMStandin standin = new VMStandin(vm); standin.setLibraryLocations(libs); standin.convertToRealVM(); JavaRuntime.saveVMConfiguration();
while (deletedIterator.hasNext()) { VMStandin deletedVMStandin = (VMStandin) deletedIterator.next(); deletedVMStandin.getVMInstallType().disposeVMInstall(deletedVMStandin.getId()); while (iter.hasNext()) { VMStandin standin = (VMStandin)iter.next(); standin.convertToRealVM();
while (vmListIterator.hasNext()) { VMStandin vmStandin = (VMStandin) vmListIterator.next(); vmStandin.convertToRealVM();
IStatus status = EEVMType.validateDefinitionFile(description); if (status.isOK()) { VMStandin standin = new VMStandin(getVMInstallType(EEVMType.ID_EE_VM_TYPE), id); if (name != null && name.length() > 0){ standin.setName(name); } else { name = description.getProperty(ExecutionEnvironmentDescription.EE_NAME); name = eeFile.getName(); standin.setName(name); standin.setInstallLocation(new File(home)); standin.setLibraryLocations(description.getLibraryLocations()); standin.setVMArgs(description.getVMArguments()); standin.setJavadocLocation(EEVMType.getJavadocLocation(description.getProperties())); standin.setAttribute(EEVMInstall.ATTR_EXECUTION_ENVIRONMENT_ID, description.getProperty(ExecutionEnvironmentDescription.CLASS_LIB_LEVEL)); File exe = description.getExecutable(); if (exe == null) { standin.setAttribute(EEVMInstall.ATTR_JAVA_EXE, exe.getCanonicalPath()); } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), standin.setAttribute(EEVMInstall.ATTR_JAVA_VERSION, description.getProperty(ExecutionEnvironmentDescription.LANGUAGE_LEVEL)); standin.setAttribute(EEVMInstall.ATTR_DEFINITION_FILE, eeFile.getPath()); standin.setAttribute(EEVMInstall.ATTR_DEBUG_ARGS, description.getProperty(ExecutionEnvironmentDescription.DEBUG_ARGS)); return standin;
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; }
private IVMInstall[] getWorkspaceJREs() { final List<VMStandin> standins = new ArrayList<>(); final IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (int i = 0; i < types.length; i++) { final IVMInstallType type = types[i]; final IVMInstall[] installs = type.getVMInstalls(); for (int j = 0; j < installs.length; j++) { final IVMInstall install = installs[j]; standins.add(new VMStandin(install)); } } return standins.toArray(new IVMInstall[standins.size()]); }
IVMInstallType vmType= getVMInstallType(); IVMInstall realVM= vmType.findVMInstall(getId()); boolean notify = true; realVM= vmType.createVMInstall(getId()); notify = false; ((AbstractVMInstall)realVM).setNotify(notify); realVM.setName(getName()); realVM.setInstallLocation(getInstallLocation()); realVM.setLibraryLocations(getLibraryLocations()); realVM.setJavadocLocation(getJavadocLocation()); if (realVM instanceof IVMInstall2) { IVMInstall2 vm2 = (IVMInstall2) realVM; vm2.setVMArgs(getVMArgs()); } else { realVM.setVMArguments(getVMArguments()); Iterator<Entry<String, String>> iterator = getAttributes().entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> entry = iterator.next();
VMStandin detectedVMStandin = new VMStandin(vmType, vmID); detectedVMStandin.setInstallLocation(detectedLocation); detectedVMStandin.setName(generateDetectedVMName(detectedVMStandin)); if (vmType instanceof AbstractVMInstallType) { AbstractVMInstallType abs = (AbstractVMInstallType)vmType; URL url = abs.getDefaultJavadocLocation(detectedLocation); detectedVMStandin.setJavadocLocation(url); String arguments = abs.getDefaultVMArguments(detectedLocation); if (arguments != null) { detectedVMStandin.setVMArgs(arguments);
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; }