public static IVMInstall[] getAllVMInstances() { ArrayList<IVMInstall> res = new ArrayList<>(); IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (int i = 0; i < types.length; i++) { IVMInstall[] installs = types[i].getVMInstalls(); for (int k = 0; k < installs.length; k++) { res.add(installs[k]); } } return res.toArray(new IVMInstall[res.size()]); }
/** * Returns the VM install type with the given unique id. * @param id the VM install type unique id * @return The VM install type for the given id, or <code>null</code> if no * VM install type with the given id is registered. */ public static IVMInstallType getVMInstallType(String id) { IVMInstallType[] vmTypes= getVMInstallTypes(); for (int i= 0; i < vmTypes.length; i++) { if (vmTypes[i].getId().equals(id)) { return vmTypes[i]; } } return null; }
private static String generateUniqueVMId(IVMInstallType type) { // return a unique id for the VM int counter = 1; String vmId = VM_ID_PREFIX + counter; while (type.findVMInstall(vmId) != null) { counter++; vmId = VM_ID_PREFIX + counter; } return vmId; }
new String[]{id, element.getContributor().getName(), vmType}), null); IVMInstall install = installType.findVMInstall(id); if (install == null) { if (EEVMType.ID_EE_VM_TYPE.equals(installType.getId())) { standin = createVMFromDefinitionFile(homeDir, name, id); } else { standin = new VMStandin(installType, id); standin.setName(name); IStatus status = installType.validateInstallLocation(homeDir); if (!status.isOK()) { abort(NLS.bind("Illegal install location {0} for vmInstall {1} contributed by {2}: {3}", //$NON-NLS-1$
public static void setCompatibleVMs(String id) { // update all environments compatible to use the test JRE IExecutionEnvironmentsManager manager = JavaRuntime.getExecutionEnvironmentsManager(); IExecutionEnvironment[] environments = manager.getExecutionEnvironments(); for (IExecutionEnvironment environment : environments) { IVMInstall[] compatibleVMs = environment.getCompatibleVMs(); for (IVMInstall compatibleVM : compatibleVMs) { if (id.equals(compatibleVM.getVMInstallType().getId()) && compatibleVM.getVMInstallType().findVMInstall(compatibleVM.getId()) != null && !compatibleVM.equals(environment.getDefaultVM()) // Fugly way to ensure the lowest VM version is set: && (environment.getDefaultVM() == null || compatibleVM.getId().compareTo(environment.getDefaultVM().getId()) < 0)) { environment.setDefaultVM(compatibleVM); } } } } }
if (installPath == null) { container.addStatus(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, NLS.bind(LaunchingMessages.VMDefinitionsContainer_3, new String[]{vmType.getName()}))); return; String install = installLocation.getAbsolutePath(); boolean changed = StandardVMType.ID_STANDARD_VM_TYPE.equals(vmType.getId()) && LaunchingPlugin.timeStampChanged(install); container.addVM(vmStandin); } else { container.addStatus(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, NLS.bind(LaunchingMessages.VMDefinitionsContainer_9, new String[]{vmType.getName()})));
LibraryLocation[] defaultLibs = vm.getVMInstallType().getDefaultLibraryLocations(vm.getInstallLocation()); boolean overrideJavadoc = false; if (libs == null) {
public IVMInstall convertToRealVM() { IVMInstallType vmType= getVMInstallType(); IVMInstall realVM= vmType.findVMInstall(getId()); boolean notify = true; realVM= vmType.createVMInstall(getId()); notify = false;
while (vmTypes[i].findVMInstall(String.valueOf(unique)) != null) { unique++; File detectedLocation= vmTypes[i].detectInstallLocation(); if (detectedLocation != null) { while (vmType.findVMInstall(String.valueOf(unique)) != null) { unique++;
public void run() { temp[0] = fSelectedVMType.validateInstallLocation(tempFile); } };
/** * Returns the VM type names * @return an array of strings with the names of the applicable VMs */ private String[] getVMTypeNames() { String[] names = new String[fVMTypes.length]; for (int i = 0; i < fVMTypes.length; i++) { names[i]= fVMTypes[i].getName(); } return names; }
return getDefaultVMInstall(); vm = vt.findVMInstallByName(name); if (vm == null) { abort(NLS.bind(LaunchingMessages.JavaRuntime_Specified_VM_install_not_found__type__0___name__1__2, new String[] {vt.getName(), name}), null); } else { return vm;
new String[]{id, element.getContributor().getName(), vmType}), null); IVMInstall install = installType.findVMInstall(id); if (install == null) { if (EEVMType.ID_EE_VM_TYPE.equals(installType.getId())) { standin = createVMFromDefinitionFile(homeDir, name, id); } else { standin = new VMStandin(installType, id); standin.setName(name); IStatus status = installType.validateInstallLocation(homeDir); if (!status.isOK()) { abort(NLS.bind("Illegal install location {0} for vmInstall {1} contributed by {2}: {3}", //$NON-NLS-1$
if (installPath == null) { container.addStatus(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, NLS.bind(LaunchingMessages.VMDefinitionsContainer_3, new String[]{vmType.getName()}))); return; String install = installLocation.getAbsolutePath(); boolean changed = StandardVMType.ID_STANDARD_VM_TYPE.equals(vmType.getId()) && LaunchingPlugin.timeStampChanged(install); container.addVM(vmStandin); } else { container.addStatus(new Status(IStatus.ERROR, LaunchingPlugin.ID_PLUGIN, NLS.bind(LaunchingMessages.VMDefinitionsContainer_9, new String[]{vmType.getName()})));
/** * The "default" button has been toggled */ public void restoreDefaultLibraries() { LibraryLocation[] libs = null; File installLocation = getHomeDirectory(); if (installLocation == null) { libs = new LibraryLocation[0]; } else { libs = getVMInstallType().getDefaultLibraryLocations(installLocation); } fLibraryContentProvider.setLibraries(libs); update(); }
public IVMInstall convertToRealVM() { IVMInstallType vmType= getVMInstallType(); IVMInstall realVM= vmType.findVMInstall(getId()); boolean notify = true; realVM= vmType.createVMInstall(getId()); notify = false;
while (vmTypes[i].findVMInstall(String.valueOf(unique)) != null) { unique++; File detectedLocation= vmTypes[i].detectInstallLocation(); if (detectedLocation != null) { while (vmType.findVMInstall(String.valueOf(unique)) != null) { unique++;
/** * Add the specified VM to the VM definitions managed by this container. * <p> * If distinguishing valid from invalid VMs is important, the specified VM must * have already had its install location set. An invalid VM is one whose install * location doesn't exist. * </p> * * @param vm the VM to be added to this container */ public void addVM(IVMInstall vm) { if (!fVMList.contains(vm)) { IVMInstallType vmInstallType = vm.getVMInstallType(); List<IVMInstall> vmList = fVMTypeToVMMap.get(vmInstallType); if (vmList == null) { vmList = new ArrayList<IVMInstall>(3); fVMTypeToVMMap.put(vmInstallType, vmList); } vmList.add(vm); File installLocation = vm.getInstallLocation(); if (installLocation == null || vmInstallType.validateInstallLocation(installLocation).getSeverity() == IStatus.ERROR) { fInvalidVMList.add(vm); } fVMList.add(vm); } }
return getDefaultVMInstall(); vm = vt.findVMInstallByName(name); if (vm == null) { abort(NLS.bind(LaunchingMessages.JavaRuntime_Specified_VM_install_not_found__type__0___name__1__2, new String[] {vt.getName(), name}), null); } else { return vm;