Ejemplo n.º 1
0
    /**
     * Make the edit menu
     *
     * @param popup The popup
     * @param row The row
     */
    void makeEditableMenu(JPopupMenu popup, final int row) {

      JMenuItem mi;
      popup.add(GuiUtils.makeMenuItem("Add New Field", this, "addNewRow"));
      ParamInfo paramInfo = getInfo(row);
      if (paramInfo == null) {
        return;
      }

      popup.add(GuiUtils.makeMenuItem("Edit Settings", this, "editRow", paramInfo));

      mi = new JMenuItem("Delete Settings For Parameter");
      mi.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
              removeRow(row);
            }
          });
      popup.add(mi);
    }
Ejemplo n.º 2
0
 /**
  * Make the popup menu
  *
  * @param popup The popup menu
  * @param row The row the user clicked on
  */
 void makePopupMenu(JPopupMenu popup, final int row) {
   ParamInfo info = getInfo(row);
   if (isEditable) {
     makeEditableMenu(popup, row);
   } else {
     JMenuItem mi = new JMenuItem("Copy Row to Users Defaults");
     mi.addActionListener(
         new ActionListener() {
           public void actionPerformed(ActionEvent ae) {
             try {
               copyToUsers(getInfo(row));
             } catch (Exception exc) {
               LogUtil.printException(log_, "Copying row: " + row + " to users table.", exc);
             }
           }
         });
     popup.add(mi);
   }
   if (info != null) {
     popup.add(
         GuiUtils.makeMenuItem(
             "Export to Plugin", getIdv().getPluginManager(), "addObject", info));
   }
 }