From 149c241a17430837f864ef79995d7372646bbf4b Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Thu, 21 Oct 2010 10:45:03 +0000 Subject: [PATCH] Fix for F2 key not working in contact list. F2 now properly opens the rename dialog when a contact or group has been selected. --- .../communicator/impl/gui/main/MainFrame.java | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java index 0b3bf14b0..23fd87feb 100644 --- a/src/net/java/sip/communicator/impl/gui/main/MainFrame.java +++ b/src/net/java/sip/communicator/impl/gui/main/MainFrame.java @@ -223,15 +223,7 @@ private void init() ? JFrame.DISPOSE_ON_CLOSE : JFrame.HIDE_ON_CLOSE); - this.setKeybindingInput(KeybindingSet.Category.MAIN); - this.addKeybindingAction("main-rename", - new RenameAction()); - - // Remove the default escape key mapping as its a special - // one for the main frame and the contactlist - getRootPane().getInputMap( - JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) - .remove(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)); + registerKeyActions(); TransparentPanel northPanel = new TransparentPanel(new BorderLayout(0, 0)); @@ -1703,4 +1695,20 @@ else if (contactListPanel.isVisible()) GuiActivator.getContactList().startSelectedContactCall(); } } + + /** + * Registers key actions for this window. + */ + private void registerKeyActions() + { + InputMap inputMap = getRootPane() + .getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); + + inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "main-rename"); + getRootPane().getActionMap().put("main-rename", new RenameAction()); + + // Remove the default escape key mapping as its a special + // one for the main frame and the contactlist + inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0)); + } } \ No newline at end of file