Пример #1
0
  /*
   * (non-Javadoc)
   *
   * @see javax.swing.tree.TreeModel#valueForPathChanged(javax.swing.tree.TreePath,
   *      java.lang.Object)
   */
  public void valueForPathChanged(TreePath path, Object newValue) {
    Object obj = path.getLastPathComponent();

    if (obj instanceof UDOCategory) {
      ((UDOCategory) obj).setCategoryName(newValue.toString());
    } else if (obj instanceof UserDefinedOpcode) {
      ((UserDefinedOpcode) obj).setOpcodeName(newValue.toString());
    }

    TreeModelEvent e = new TreeModelEvent(this, path);
    fireNodesChanged(e);
  }
Пример #2
0
  public static UserDefinedOpcode loadFromXML(Element data) {
    UserDefinedOpcode retVal = new UserDefinedOpcode();

    Elements nodes = data.getElements();

    while (nodes.hasMoreElements()) {
      Element node = nodes.next();

      String val = node.getTextString();

      if (val == null) {
        val = "";
      }
      switch (node.getName()) {
        case "opcodeName":
          retVal.opcodeName = val;
          break;
        case "outTypes":
          retVal.outTypes = val;
          break;
        case "inTypes":
          retVal.inTypes = val;
          break;
        case "codeBody":
          retVal.codeBody = val;
          break;
        case "comments":
          retVal.comments = val;
          break;
      }
    }

    return retVal;
  }
Пример #3
0
  public static void main(String[] args) {
    UserDefinedOpcode udo = new UserDefinedOpcode();
    udo.opcodeName = "getFrequency";

    udo.outTypes = "i";
    udo.inTypes = "i";

    // udo.useLocalKsmps = false;
    // udo.localKsmps = 1;
    //
    // udo.inArgs = "ipch";
    // udo.outArgs = "iout";

    udo.codeBody = "ipch\t xin\niout	= (ipch < 15 ? cpspch(ipch) : ipch)\n\txout iout	";

    System.out.println(udo.toString());
    // System.out.println(udo.getArgs());
  }