/** * Sets a VM as the system-wide default VM, and notifies registered VM install * change listeners of the change. * * @param vm The VM to make the default. May be <code>null</code> to clear * the default. * @param monitor progress monitor or <code>null</code> * @throws CoreException if trying to set the default VM install encounters problems */ public static void setDefaultVMInstall(IVMInstall vm, IProgressMonitor monitor) throws CoreException { setDefaultVMInstall(vm, monitor, true); }
/** * Sets a VM as the system-wide default VM, and notifies registered VM install * change listeners of the change. * * @param vm The VM to make the default. May be <code>null</code> to clear * the default. * @param monitor progress monitor or <code>null</code> * @throws CoreException if trying to set the default VM install encounters problems */ public static void setDefaultVMInstall(IVMInstall vm, IProgressMonitor monitor) throws CoreException { setDefaultVMInstall(vm, monitor, true); }
public void run(IProgressMonitor monitor) throws InvocationTargetException { try { JavaRuntime.setDefaultVMInstall(vm, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } } };
* * @param monitor progress monitor */ private void loadJRE(IProgressMonitor monitor) { IPath container = fTarget.getJREContainer(); monitor.beginTask(Messages.LoadTargetOperation_jreTaskName, 1); if (container != null) { IVMInstall jre = JavaRuntime.getVMInstall(container); if (jre != null) { IVMInstall def = JavaRuntime.getDefaultVMInstall(); if (!jre.equals(def)) { try { JavaRuntime.setDefaultVMInstall(jre, null); } catch (CoreException e) { } } } } monitor.done(); } /** * Resets the PDE workspace models with the new state information
protected void loadJREInfo(Preferences pref, IProgressMonitor monitor) { ITargetJRE jreInfo = fTarget.getTargetJREInfo(); monitor.beginTask(PDECoreMessages.LoadTargetOperation_jreTaskName, 1); if (jreInfo != null) { String jre = jreInfo.getCompatibleJRE(); IVMInstall install = JavaRuntime.getDefaultVMInstall(); if (install != null && !jre.equals(install.getName())) try { JavaRuntime.setDefaultVMInstall(getVMInstall(jre), null); } catch (CoreException e) { } } monitor.done(); }
@Override protected void runWithinEclipse() throws Throwable { IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (IVMInstallType type : types) { if ("org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType".equals(type.getId())) { for (InstalledJre jreToAdd : host.installedJres) { IVMInstall realVM = addInstalledJre(type, jreToAdd); if (jreToAdd.isMarkDefault()) { JavaRuntime.setDefaultVMInstall(realVM, new NullProgressMonitor()); } linkWithExecutionEnvironments(realVM, jreToAdd); } } } }
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; }
JavaRuntime.setDefaultVMInstall(vmInstall, new SubProgressMonitor(monitor, 3), true); return false;
JavaRuntime.setDefaultVMInstall(vmInstall, new SubProgressMonitor(monitor, 3), true); return false;
JavaRuntime.setDefaultVMInstall(vm50Install, new SubProgressMonitor(monitor, 3), true); return false;
if (newDefaultVM != null) { try { JavaRuntime.setDefaultVMInstall(newDefaultVM, null, false); } catch (CoreException ce) { log(ce);
if (newDefaultVM != null) { try { JavaRuntime.setDefaultVMInstall(newDefaultVM, null, false); } catch (CoreException ce) { log(ce);