Changeset 4905 in josm


Ignore:
Timestamp:
2012-02-07T12:59:45+01:00 (8 years ago)
Author:
akks
Message:

fix #7288, #7301: based on patch by simon04 / 4 new Relation Editor shortcuts instead of non-working old ones

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r4590 r4905  
    3131import java.util.Set;
    3232
    33 import javax.swing.AbstractAction;
    34 import javax.swing.BorderFactory;
    35 import javax.swing.JComponent;
    36 import javax.swing.JLabel;
    37 import javax.swing.JMenu;
    38 import javax.swing.JMenuItem;
    39 import javax.swing.JOptionPane;
    40 import javax.swing.JPanel;
    41 import javax.swing.JScrollPane;
    42 import javax.swing.JSplitPane;
    43 import javax.swing.JTabbedPane;
    44 import javax.swing.JToolBar;
    45 import javax.swing.KeyStroke;
    46 import javax.swing.SwingUtilities;
     33import javax.swing.*;
    4734import javax.swing.event.ChangeEvent;
    4835import javax.swing.event.ChangeListener;
     
    472459        memberTableModel.getSelectionModel().addListSelectionListener(moveUpAction);
    473460        tb.add(moveUpAction);
     461        memberTable.getActionMap().put("moveUp", moveUpAction);
    474462
    475463        // -- move down action
     
    477465        memberTableModel.getSelectionModel().addListSelectionListener(moveDownAction);
    478466        tb.add(moveDownAction);
    479 
     467        memberTable.getActionMap().put("moveDown", moveDownAction);
     468       
    480469        tb.addSeparator();
    481470
     
    484473        memberTableModel.getSelectionModel().addListSelectionListener(editAction);
    485474        tb.add(editAction);
    486 
     475       
    487476        // -- delete action
    488477        RemoveAction removeSelectedAction = new RemoveAction();
    489478        memberTable.getSelectionModel().addListSelectionListener(removeSelectedAction);
    490479        tb.add(removeSelectedAction);
    491 
     480        memberTable.getActionMap().put("removeSelected", removeSelectedAction);
     481       
    492482        tb.addSeparator();
    493483        // -- sort action
     
    507497        memberTable.getModel().addTableModelListener(downloadIncompleteMembersAction);
    508498        tb.add(downloadIncompleteMembersAction);
     499        memberTable.getActionMap().put("downloadIncomplete", downloadIncompleteMembersAction);
    509500
    510501        // -- download selected action
     
    514505        tb.add(downloadSelectedIncompleteMembersAction);
    515506
     507        InputMap inputMap = memberTable.getInputMap(MemberTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
     508        inputMap.put((KeyStroke) removeSelectedAction.getValue(AbstractAction.ACCELERATOR_KEY),"removeSelected");
     509        inputMap.put((KeyStroke) moveUpAction.getValue(AbstractAction.ACCELERATOR_KEY),"moveUp");
     510        inputMap.put((KeyStroke) moveDownAction.getValue(AbstractAction.ACCELERATOR_KEY),"moveDown");
     511        inputMap.put((KeyStroke) downloadIncompleteMembersAction.getValue(AbstractAction.ACCELERATOR_KEY),"downloadIncomplete");
     512       
    516513        return tb;
    517514    }
     
    892889            putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "deletemembers"));
    893890            // putValue(NAME, tr("Remove Selected"));
    894             Shortcut.registerShortcut("relationeditor:removeselected", tr("Relation Editor: Remove Selected"),
    895                     KeyEvent.VK_S, Shortcut.GROUP_MNEMONIC);
    896 
    897891            updateEnabledState();
    898892        }
     
    983977            putValue(SMALL_ICON, ImageProvider.get("dialogs", "sort"));
    984978            putValue(NAME, tr("Sort"));
    985             Shortcut.registerShortcut("relationeditor:sort", tr("Relation Editor: Sort"), KeyEvent.VK_T,
    986                     Shortcut.GROUP_MNEMONIC);
     979            //    Shortcut.registerShortcut("relationeditor:sort", tr("Relation Editor: Sort"), KeyEvent.VK_HOME, Shortcut.GROUP_MNEMONIC)
    987980            updateEnabledState();
    988981        }
     
    1006999            putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "reverse"));
    10071000            putValue(NAME, tr("Reverse"));
    1008             Shortcut.registerShortcut("relationeditor:reverse", tr("Relation Editor: Reverse"), KeyEvent.VK_R,
    1009                     Shortcut.GROUP_MNEMONIC);
     1001            //   Shortcut.registerShortcut("relationeditor:reverse", tr("Relation Editor: Reverse"), KeyEvent.VK_END, Shortcut.GROUP_MNEMONIC)
    10101002            updateEnabledState();
    10111003        }
     
    10291021            putValue(SMALL_ICON, ImageProvider.get("dialogs", "moveup"));
    10301022            // putValue(NAME, tr("Move Up"));
    1031             Shortcut.registerShortcut("relationeditor:moveup", tr("Relation Editor: Move Up"), KeyEvent.VK_N,
    1032                     Shortcut.GROUP_MNEMONIC);
     1023            putValue(ACCELERATOR_KEY,
     1024                Shortcut.registerShortcut("relationeditor:moveup", tr("Relation Editor: Move Up"), KeyEvent.VK_UP, Shortcut.GROUP_MNEMONIC)
     1025                    .getKeyStroke()
     1026            );
    10331027            setEnabled(false);
    10341028        }
     
    10481042            putValue(SMALL_ICON, ImageProvider.get("dialogs", "movedown"));
    10491043            // putValue(NAME, tr("Move Down"));
    1050             Shortcut.registerShortcut("relationeditor:moveup", tr("Relation Editor: Move Down"), KeyEvent.VK_J,
    1051                     Shortcut.GROUP_MNEMONIC);
     1044            putValue(ACCELERATOR_KEY,
     1045                Shortcut.registerShortcut("relationeditor:movedown", tr("Relation Editor: Move Down"), KeyEvent.VK_DOWN, Shortcut.GROUP_MNEMONIC)
     1046                    .getKeyStroke()
     1047            );
    10521048            setEnabled(false);
    10531049        }
     
    10661062            putValue(SHORT_DESCRIPTION, tr("Remove the currently selected members from this relation"));
    10671063            putValue(SMALL_ICON, ImageProvider.get("dialogs", "remove"));
    1068             // putValue(NAME, tr("Remove"));
    1069             Shortcut.registerShortcut("relationeditor:remove", tr("Relation Editor: Remove"), KeyEvent.VK_J,
    1070                     Shortcut.GROUP_MNEMONIC);
     1064            putValue(NAME, tr("Remove"));
     1065            putValue(ACCELERATOR_KEY,
     1066                 Shortcut.registerShortcut("relationeditor:remove", tr("Relation Editor: Remove"), KeyEvent.VK_DELETE,
     1067                    Shortcut.GROUP_MNEMONIC).getKeyStroke());
    10711068            setEnabled(false);
    10721069        }
     
    14021399            putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "downloadincomplete"));
    14031400            putValue(NAME, tr("Download Members"));
    1404             Shortcut.registerShortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"),
    1405                     KeyEvent.VK_K, Shortcut.GROUP_MNEMONIC);
     1401            putValue(ACCELERATOR_KEY,
     1402                Shortcut.registerShortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"), KeyEvent.VK_HOME, Shortcut.GROUP_MNEMONIC)
     1403                    .getKeyStroke()
     1404            );
     1405               
    14061406            updateEnabledState();
    14071407        }
     
    14321432            putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "downloadincompleteselected"));
    14331433            putValue(NAME, tr("Download Members"));
    1434             Shortcut.registerShortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"),
    1435                     KeyEvent.VK_K, Shortcut.GROUP_MNEMONIC);
     1434        //  Shortcut.registerShortcut("relationeditor:downloadincomplete", tr("Relation Editor: Download Members"), KeyEvent.VK_K, Shortcut.GROUP_MNEMONIC);
    14361435            updateEnabledState();
    14371436        }
Note: See TracChangeset for help on using the changeset viewer.