示例#1
0
 /** Build the cache */
 private void buildCache() {
   single.idMap = new HashMap<Integer, Object[]>();
   single.nameMap = new HashMap<String, Integer>();
   NodeList eventList = single.eventRoot.getElementsByTagName(EVENT);
   // FIXME: Temporary fix for Eclipse Bz 338270. Apparently
   // there is still some dead code due to opxml removal.
   for (int val = 0; val < eventList.getLength(); val++) {
     Element elem = (Element) eventList.item(val);
     String eventName = elem.getAttribute(EVENT_NAME);
     single.idMap.put(val, new Object[] {eventName, elem});
     single.nameMap.put(eventName, val);
   }
 }
示例#2
0
  /** Read the XML from ophelp */
  private void readXML() {
    try {
      Process p = Runtime.getRuntime().exec(OPHELP + " " + "-X");
      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      DocumentBuilder builder;
      try {
        builder = factory.newDocumentBuilder();
        try {
          single.eventDoc = builder.parse(p.getInputStream());
          Element elem = (Element) single.eventDoc.getElementsByTagName(HELP_EVENTS).item(0);
          single.eventRoot = elem;
        } catch (IOException e) {
        } catch (SAXException e) {
        }
      } catch (ParserConfigurationException e1) {
        e1.printStackTrace();
      }

    } catch (IOException e) {
      e.printStackTrace();
    }
  }