/** * 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; }
/** * 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; }
/** * Generates a key used to cache system property for this VM in this plug-ins * preference store. * * @param property system property name * @return preference store key */ private String getSystemPropertyKey(String property) { StringBuffer buffer = new StringBuffer(); buffer.append(PREF_VM_INSTALL_SYSTEM_PROPERTY); buffer.append("."); //$NON-NLS-1$ buffer.append(getVMInstallType().getId()); buffer.append("."); //$NON-NLS-1$ buffer.append(getId()); buffer.append("."); //$NON-NLS-1$ buffer.append(property); return buffer.toString(); }
/** * Generates a key used to cache system property for this VM in this plug-ins * preference store. * * @param property system property name * @return preference store key */ private String getSystemPropertyKey(String property) { StringBuilder buffer = new StringBuilder(); buffer.append(PREF_VM_INSTALL_SYSTEM_PROPERTY); buffer.append("."); //$NON-NLS-1$ buffer.append(getVMInstallType().getId()); buffer.append("."); //$NON-NLS-1$ buffer.append(getId()); buffer.append("."); //$NON-NLS-1$ buffer.append(property); return buffer.toString(); }
/** * Create and return a node for the specified VM install type in the specified Document. * * @param doc the backing {@link Document} * @param vmType the {@link IVMInstallType} to create an {@link Element} for * @return the new {@link Element} */ private Element vmTypeAsElement(Document doc, IVMInstallType vmType) { // Create a node for the VM type and set its 'id' attribute Element element= doc.createElement("vmType"); //$NON-NLS-1$ element.setAttribute("id", vmType.getId()); //$NON-NLS-1$ // For each VM of the specified type, create a subordinate node for it List<IVMInstall> vmList = getVMTypeToVMMap().get(vmType); Iterator<IVMInstall> vmIterator = vmList.iterator(); while (vmIterator.hasNext()) { IVMInstall vm = vmIterator.next(); Element vmElement = vmAsElement(doc, vm); element.appendChild(vmElement); } return element; }
/** * Create and return a node for the specified VM install type in the specified Document. * * @param doc the backing {@link Document} * @param vmType the {@link IVMInstallType} to create an {@link Element} for * @return the new {@link Element} */ private Element vmTypeAsElement(Document doc, IVMInstallType vmType) { // Create a node for the VM type and set its 'id' attribute Element element= doc.createElement("vmType"); //$NON-NLS-1$ element.setAttribute("id", vmType.getId()); //$NON-NLS-1$ // For each VM of the specified type, create a subordinate node for it List<IVMInstall> vmList = getVMTypeToVMMap().get(vmType); Iterator<IVMInstall> vmIterator = vmList.iterator(); while (vmIterator.hasNext()) { IVMInstall vm = vmIterator.next(); Element vmElement = vmAsElement(doc, vm); element.appendChild(vmElement); } return element; }
/** * Returns the JRE container id that the given VM would map to, or * <code>null</code> if none. * * @param vm the new path id of the {@link IVMInstall} * @return container id or <code>null</code> */ private IPath getContainerId(IVMInstall vm) { if (vm != null) { String name = vm.getName(); if (name != null) { IPath path = new Path(JavaRuntime.JRE_CONTAINER); path = path.append(new Path(vm.getVMInstallType().getId())); path = path.append(new Path(name)); return path; } } return null; }
/** * Returns a path for the JRE classpath container identifying the * specified VM install by type and name. * * @param vm VM install * @return classpath container path * @since 3.2 */ public static IPath newJREContainerPath(IVMInstall vm) { return newJREContainerPath(vm.getVMInstallType().getId(), vm.getName()); }
/** * Returns the JRE container id that the given VM would map to, or * <code>null</code> if none. * * @param vm the new path id of the {@link IVMInstall} * @return container id or <code>null</code> */ private IPath getContainerId(IVMInstall vm) { if (vm != null) { String name = vm.getName(); if (name != null) { IPath path = new Path(JavaRuntime.JRE_CONTAINER); path = path.append(new Path(vm.getVMInstallType().getId())); path = path.append(new Path(name)); return path; } } return null; }
/** * Returns a path for the JRE classpath container identifying the * specified VM install by type and name. * * @param vm VM install * @return classpath container path * @since 3.2 */ public static IPath newJREContainerPath(IVMInstall vm) { return newJREContainerPath(vm.getVMInstallType().getId(), vm.getName()); }
@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); } } } }
@SuppressWarnings("deprecation") private void setDefaultVMInstallAttributes(IVMInstall defaultVMInstall, ILaunchConfigurationWorkingCopy config) { String vmName = defaultVMInstall.getName(); String vmTypeID = defaultVMInstall.getVMInstallType().getId(); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, vmName); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, vmTypeID); }
public void setVMInstall(IVMInstall vmInstall) { if (vmInstall == null) { setVMInstall(null, null); } else setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId()); }
public void setVMInstall(IVMInstall vmInstall) { if (vmInstall == null) { setVMInstall(null, null); } else setVMInstall(vmInstall.getVMInstallType().getId(), vmInstall.getId()); }
/** * Returns a String that uniquely identifies the specified VM across all VM types. * * @param vm the instance of IVMInstallType to be identified * @return the unique identifier for the specified VM * * @since 2.1 */ public static String getCompositeIdFromVM(IVMInstall vm) { if (vm == null) { return null; } IVMInstallType vmType = vm.getVMInstallType(); String typeID = vmType.getId(); CompositeId id = new CompositeId(new String[] { typeID, vm.getId() }); return id.toString(); }
/** * Returns a String that uniquely identifies the specified VM across all VM types. * * @param vm the instance of IVMInstallType to be identified * @return the unique identifier for the specified VM * * @since 2.1 */ public static String getCompositeIdFromVM(IVMInstall vm) { if (vm == null) { return null; } IVMInstallType vmType = vm.getVMInstallType(); String typeID = vmType.getId(); CompositeId id = new CompositeId(new String[] { typeID, vm.getId() }); return id.toString(); }
/** * Returns a JRE runtime classpath entry * * @param configuration * the launch configuration * @return a JRE runtime classpath entry * @throws CoreException * if the JRE associated with the launch configuration cannot be found * or if unable to retrieve the launch configuration attributes */ private IRuntimeClasspathEntry getJREEntry(ILaunchConfiguration configuration) throws CoreException { IVMInstall jre = VMHelper.createLauncher(configuration); IPath containerPath = new Path(JavaRuntime.JRE_CONTAINER); containerPath = containerPath.append(jre.getVMInstallType().getId()); containerPath = containerPath.append(jre.getName()); return JavaRuntime.newRuntimeContainerClasspathEntry(containerPath, IRuntimeClasspathEntry.BOOTSTRAP_CLASSES); }
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); } } } } }
/** * Set the VM attributes on the working copy based on the workbench default VM. */ private void initializeDefaultVM(ILaunchConfigurationWorkingCopy config) { IVMInstall vmInstall= JavaRuntime.getDefaultVMInstall(); if (vmInstall == null) { config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, (String)null); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String)null); } else { config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, vmInstall.getName()); config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, vmInstall.getVMInstallType().getId()); } }
/** * Return the class that implements <code>ILaunchConfigurationTab</code> * that is registered against the install type of the currently selected VM. */ protected ILaunchConfigurationTab getTabForCurrentJRE() { if (!fJREBlock.isDefaultJRE()) { IPath path = fJREBlock.getPath(); if (path != null && JavaRuntime.getExecutionEnvironmentId(path) == null) { IVMInstall vm = fJREBlock.getJRE(); if (vm != null) { String vmInstallTypeID = vm.getVMInstallType().getId(); return JDIDebugUIPlugin.getDefault().getVMInstallTypePage(vmInstallTypeID); } } } return null; }