Ignore:
Timestamp:
2008-10-05T17:06:27+02:00 (16 years ago)
Author:
stoecker
Message:

close bug #1622. Keyboard shortcuts and specific OS handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/CopyAction.java

    r627 r1023  
    2424import org.openstreetmap.josm.data.osm.Way;
    2525import org.openstreetmap.josm.data.osm.visitor.Visitor;
     26import org.openstreetmap.josm.tools.ShortCut;
    2627
    2728public final class CopyAction extends JosmAction implements SelectionChangedListener {
    2829
    2930        private LinkedList<JosmAction> listeners;
    30        
     31
    3132        public CopyAction() {
    3233                super(tr("Copy"), "copy",
    3334                                tr("Copy selected objects to paste buffer."),
    34                                 KeyEvent.VK_C, KeyEvent.CTRL_MASK, true);
     35                                ShortCut.registerShortCut("system:copy", tr("Edit: Copy"), KeyEvent.VK_C, ShortCut.GROUP_MENU), true);
    3536                setEnabled(false);
    3637                DataSet.selListeners.add(this);
     
    4142                listeners.add(a);
    4243        }
    43        
     44
    4445        public void actionPerformed(ActionEvent e) {
    4546                Collection<OsmPrimitive> sel = Main.ds.getSelected();
    46                 if (sel.isEmpty()) { 
     47                if (sel.isEmpty()) {
    4748                        JOptionPane.showMessageDialog(Main.parent,
    48                                         tr("Please select something to copy."));       
     49                                        tr("Please select something to copy."));
    4950                        return;
    5051                }
     
    5556                /* temporarily maps old nodes to new so we can do a true deep copy */
    5657
    57                 /* scan the selected objects, mapping them to copies; when copying a way or relation, 
     58                /* scan the selected objects, mapping them to copies; when copying a way or relation,
    5859                 * the copy references the copies of their child objects */
    5960                new Visitor(){
    6061                        public void visit(Node n) {
    61                                 /* check if already in pasteBuffer - e.g. two ways are selected which share a node; 
    62                                  * or a way and a node in that way is selected, we'll see it twice, once via the 
     62                                /* check if already in pasteBuffer - e.g. two ways are selected which share a node;
     63                                 * or a way and a node in that way is selected, we'll see it twice, once via the
    6364                                 * way and once directly; and so on. */
    6465                                if (map.containsKey(n)) { return; }
     
    107108                Main.pasteBuffer = pasteBuffer;
    108109                Main.main.menu.paste.setEnabled(true); /* now we have a paste buffer we can make paste available */
    109                
     110
    110111                for(JosmAction a : listeners) {
    111112                        a.pasteBufferChanged(Main.pasteBuffer);
Note: See TracChangeset for help on using the changeset viewer.