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");
  }
Exemple #2
0
 /** opens pop-up menu or displays context node content */
 public void mouseReleased(MouseEvent e) {
   // on Solaris, the right mouse button somehow seems not be a popup trigger, so we
   // accept mouse 3 explicitly
   if (e.isPopupTrigger() || e.getModifiers() == java.awt.event.InputEvent.BUTTON3_MASK) {
     popup.pack();
     popup.show(tree, e.getX(), e.getY());
   } else {
     TreePath path = tree.getPathForLocation(e.getX(), e.getY());
     if (path != null) {
       DefaultMutableTreeNode node =
           (DefaultMutableTreeNode) path.getPathComponent(path.getPathCount() - 1);
       ((ContextNode) node.getUserObject()).display();
     }
   }
 }
Exemple #3
0
 /** @param k java.awt.event.KeyEvent */
 public void keyReleased(KeyEvent k) {
   if (k.getKeyCode() == KeyEvent.VK_DELETE) tree.unbind();
 }