Exemplo n.º 1
0
 private static void importLegacyInterpreters(Element config, VMDefinitionsContainer container) {
   IVMInstallType vmType =
       RubyRuntime.getVMInstallType("org.rubypeople.rdt.launching.StandardVMType");
   // Traverse the parsed structure and populate the VMType to VM Map
   NodeList list = config.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 vmElement = (Element) node;
       if (vmElement.getNodeName().equalsIgnoreCase("interpreter")) { // $NON-NLS-1$
         legacyPopulateVMForType(vmType, vmElement, container);
       }
     }
   }
 }
Exemplo n.º 2
0
  /**
   * For the specified vm type node, parse all subordinate VM definitions and add them to the
   * specified container.
   */
  private static void populateVMTypes(Element vmTypeElement, VMDefinitionsContainer container) {

    // Retrieve the 'id' attribute and the corresponding VM type object
    String id = vmTypeElement.getAttribute("id"); // $NON-NLS-1$
    IVMInstallType vmType = RubyRuntime.getVMInstallType(id);
    if (vmType != null) {

      // For each VM child node, populate the container with a subordinate node
      NodeList vmNodeList = vmTypeElement.getChildNodes();
      for (int i = 0; i < vmNodeList.getLength(); ++i) {
        Node vmNode = vmNodeList.item(i);
        short type = vmNode.getNodeType();
        if (type == Node.ELEMENT_NODE) {
          Element vmElement = (Element) vmNode;
          if (vmElement.getNodeName().equalsIgnoreCase("vm")) { // $NON-NLS-1$
            populateVMForType(vmType, vmElement, container);
          }
        }
      }
    } else {
      LaunchingPlugin.log(LaunchingMessages.RubyRuntime_VM_type_element_with_unknown_id_1);
    }
  }