Exemple #1
0
  public void actionPerformed(ActionEvent e) {
    if (e.getActionCommand().equals("Quit")) {
      System.exit(0);
    } else if (e.getActionCommand().equals("Unbind name")) {
      tree.unbind();
    } else if (e.getActionCommand().equals("Bind Object")) {
      ObjectDialog dialog = new ObjectDialog((Frame) frame);
      // dialog.pack();
      // dialog.show();

      if (dialog.isOk) {
        try {
          tree.bindObject(dialog.getName(), dialog.getIOR(), dialog.isRebind());
        } catch (org.omg.CORBA.UserException ue) {
          JOptionPane.showMessageDialog(
              frame,
              ue.getClass().getName() + (ue.getMessage() != null ? (":" + ue.getMessage()) : ""),
              "Exception",
              JOptionPane.INFORMATION_MESSAGE);
        }
      }
    } else if (e.getActionCommand().equals("BindNewContext")) {
      try {
        String contextName =
            JOptionPane.showInputDialog(
                frame, "Name of the new context", "BindNewContext", JOptionPane.QUESTION_MESSAGE);

        // check if user input is okay or if CANCEL was hit
        if (contextName != null && contextName.length() > 0) tree.bind(contextName);
      } catch (org.omg.CORBA.UserException ue) {
        JOptionPane.showMessageDialog(
            frame,
            ue.getClass().getName() + (ue.getMessage() != null ? (":" + ue.getMessage()) : ""),
            "Exception",
            JOptionPane.INFORMATION_MESSAGE);
      }
    } else if (e.getActionCommand().equals("About...")) {
      JOptionPane.showMessageDialog(
          frame,
          "JacORB NameManager 1.2\n(C) 1998-2004 Gerald Brose, Wei-ju Wu & Volker Siegel\nFreie Universitaet Berlin",
          "About",
          JOptionPane.INFORMATION_MESSAGE);
    } else if (e.getActionCommand().equals("Options")) {
      NSPrefsDlg dlg = new NSPrefsDlg((Frame) frame, updateInterval);
      dlg.pack();
      dlg.show();
      if (dlg.isOk) updater.setSeconds(dlg.updateInterval);
    } else throw new RuntimeException("Should not happen");
  }