/** * Parse the specified VM node, create a VMStandin for it, and add this to the specified * container. */ private static void legacyPopulateVMForType( IVMInstallType vmType, Element vmElement, VMDefinitionsContainer container) { String id = vmElement.getAttribute("name"); // $NON-NLS-1$ if (id != null) { // Retrieve the 'path' attribute. If none, skip this node. String installPath = vmElement.getAttribute("path"); // $NON-NLS-1$ if (installPath == null) { return; } // Create a VMStandin for the node and set its 'name' & 'installLocation' attributes VMStandin vmStandin = new VMStandin(vmType, id); vmStandin.setName(id); // $NON-NLS-1$ File installLocation = new File(installPath); // If the path is to the executable (which it should be), chop off last part of path! if (installLocation.isFile()) { installLocation = installLocation.getParentFile(); // move up to "bin" if (installLocation != null && installLocation.getParentFile() != null) { installLocation = installLocation.getParentFile(); // this should now be ruby install location } } if (installLocation == null) return; vmStandin.setInstallLocation(installLocation); container.addVM(vmStandin); } else { LaunchingPlugin.log( LaunchingMessages.RubyRuntime_VM_element_specified_with_no_id_attribute_2); } }
/** * Parse the specified VM node, create a VMStandin for it, and add this to the specified * container. */ private static void populateVMForType( IVMInstallType vmType, Element vmElement, VMDefinitionsContainer container) { String id = vmElement.getAttribute("id"); // $NON-NLS-1$ if (id != null) { // Retrieve the 'path' attribute. If none, skip this node. String installPath = vmElement.getAttribute("path"); // $NON-NLS-1$ if (installPath == null) { return; } // Create a VMStandin for the node and set its 'name' & 'installLocation' attributes VMStandin vmStandin = new VMStandin(vmType, id); vmStandin.setName(vmElement.getAttribute("name")); // $NON-NLS-1$ File installLocation = new File(installPath); vmStandin.setInstallLocation(installLocation); container.addVM(vmStandin); // Look for subordinate nodes. These may be 'libraryLocation', // 'libraryLocations' or 'versionInfo'. NodeList list = vmElement.getChildNodes(); int length = list.getLength(); for (int i = 0; i < length; ++i) { Node node = list.item(i); short type = node.getNodeType(); if (type == Node.ELEMENT_NODE) { Element subElement = (Element) node; String subElementName = subElement.getNodeName(); if (subElementName.equals("libraryLocation")) { // $NON-NLS-1$ IPath loc = getLibraryLocation(subElement); vmStandin.setLibraryLocations(new IPath[] {loc}); break; } else if (subElementName.equals("libraryLocations")) { // $NON-NLS-1$ setLibraryLocations(vmStandin, subElement); break; } } } // vm Arguments String vmArgs = vmElement.getAttribute("vmargs"); // $NON-NLS-1$ if (vmArgs != null && vmArgs.length() > 0) { vmStandin.setVMArgs(vmArgs); } } else { LaunchingPlugin.log( LaunchingMessages.RubyRuntime_VM_element_specified_with_no_id_attribute_2); } }