Changeset 5726 in josm for trunk


Ignore:
Timestamp:
2013-02-18T09:37:18+01:00 (7 years ago)
Author:
akks
Message:

fix #4828: "Paste value" added to context menu of properties toggle dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r5656 r5726  
    170170    private final DataSetListenerAdapter dataChangedAdapter = new DataSetListenerAdapter(this);
    171171    private final HelpAction helpAction = new HelpAction();
     172    private final PasteValueAction pasteValueAction = new PasteValueAction();
    172173    private final CopyValueAction copyValueAction = new CopyValueAction();
    173174    private final CopyKeyValueAction copyKeyValueAction = new CopyKeyValueAction();
     
    325326        // setting up the properties table
    326327        propertyMenu = new JPopupMenu();
     328        propertyMenu.add(pasteValueAction);
    327329        propertyMenu.add(copyValueAction);
    328330        propertyMenu.add(copyKeyValueAction);
     
    11261128        }
    11271129    }
     1130   
     1131    class PasteValueAction extends AbstractAction {
     1132        public PasteValueAction() {
     1133            putValue(NAME, tr("Paste Value"));
     1134            putValue(SHORT_DESCRIPTION, tr("Paste the value of the selected tag from clipboard"));
     1135        }
     1136
     1137        @Override
     1138        public void actionPerformed(ActionEvent ae) {
     1139            if (propertyTable.getSelectedRowCount() != 1)
     1140                return;
     1141            String key = propertyData.getValueAt(propertyTable.getSelectedRow(), 0).toString();
     1142            Collection<OsmPrimitive> sel = Main.main.getCurrentDataSet().getSelected();
     1143            String value = Utils.getClipboardContent().trim();
     1144            if (sel.isEmpty())
     1145                return;
     1146            Main.main.undoRedo.add(new ChangePropertyCommand(sel, key, value));
     1147        }
     1148    }
    11281149
    11291150    abstract class AbstractCopyAction extends AbstractAction {
Note: See TracChangeset for help on using the changeset viewer.