Ejemplo n.º 1
0
    public ConfigEditPopup() {
      super("Config Properties");

      newDescriptor = new JMenuItem("New Descriptor Type");
      newDescriptor.addActionListener(newConfigListener);

      newAttribute = new JMenuItem("New Attribute Type");
      newAttribute.addActionListener(new NewAttributeAction());

      delete = new JMenuItem("Delete");
      delete.addActionListener(new DeleteAction());

      duplicate = new JMenuItem("Duplicate");
      duplicate.addActionListener(new DuplicateAction());

      add(newDescriptor);
      add(newAttribute);
      // add(duplicate);
      add(new JSeparator());
      add(delete);
    }
Ejemplo n.º 2
0
 public void show(Component invoker, int x, int y) {
   Object o = getTree().getClosestPathForLocation(x, y).getLastPathComponent();
   if (null != o) {
     node = (Node) o;
     if ((node instanceof AttrConfig) || (node instanceof Config)) {
       newAttribute.setEnabled(true);
       duplicate.setEnabled(true);
       delete.setEnabled(true);
     } else {
       newAttribute.setEnabled(false);
       duplicate.setEnabled(false);
       delete.setEnabled(false);
     }
     super.show(invoker, x, y);
   }
 }