Index: /trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java	(revision 10791)
@@ -23,5 +23,4 @@
 import javax.swing.Icon;
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
@@ -41,4 +40,5 @@
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.Utils;
 import org.openstreetmap.josm.tools.WindowGeometry;
@@ -473,7 +473,5 @@
         };
 
-        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
-            .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE");
-        getRootPane().getActionMap().put("ESCAPE", actionListener);
+        InputMapUtils.addEscapeAction(getRootPane(), actionListener);
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java	(revision 10791)
@@ -8,5 +8,4 @@
 import java.awt.GraphicsEnvironment;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -20,8 +19,6 @@
 import javax.swing.Icon;
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JOptionPane;
-import javax.swing.KeyStroke;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
@@ -287,7 +284,5 @@
             }
         });
-        dialog.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
-                KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "close");
-        dialog.getRootPane().getActionMap().put("close", new AbstractAction() {
+        InputMapUtils.addEscapeAction(dialog.getRootPane(), new AbstractAction() {
             @Override
             public void actionPerformed(ActionEvent e) {
Index: /trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java	(revision 10791)
@@ -49,4 +49,5 @@
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.StreamUtils;
 import org.openstreetmap.josm.tools.UserCancelException;
@@ -170,4 +171,5 @@
         addWindowListener(new AdjustDividerLocationAction());
         HelpUtil.setHelpContext(getRootPane(), ht("/"));
+        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java	(revision 10791)
@@ -41,4 +41,5 @@
 import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.WindowGeometry;
 
@@ -104,4 +105,6 @@
         gc.weighty = 0.0;
         getContentPane().add(buildButtonPanel(), gc);
+        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
+
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManager.java	(revision 10791)
@@ -291,7 +291,5 @@
 
         // make the dialog respond to ESC
-        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
-                KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancelAndClose");
-        getRootPane().getActionMap().put("cancelAndClose", new CancelAction());
+        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
 
         // install a window event handler
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/ChangesetQueryDialog.java	(revision 10791)
@@ -10,5 +10,4 @@
 import java.awt.Window;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -16,10 +15,8 @@
 import javax.swing.AbstractAction;
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JTabbedPane;
-import javax.swing.KeyStroke;
 
 import org.openstreetmap.josm.Main;
@@ -29,4 +26,5 @@
 import org.openstreetmap.josm.io.ChangesetQuery;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.WindowGeometry;
 
@@ -90,6 +88,5 @@
 
         // cancel on ESC
-        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
-        getRootPane().getActionMap().put("cancel", new CancelAction());
+        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
 
         // context sensitive help
Index: /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java	(revision 10791)
@@ -6,8 +6,5 @@
 import java.awt.event.ActionEvent;
 
-import javax.swing.JComponent;
 import javax.swing.JOptionPane;
-import javax.swing.JRootPane;
-import javax.swing.KeyStroke;
 import javax.swing.RootPaneContainer;
 
@@ -23,4 +20,5 @@
 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 
 /**
@@ -47,7 +45,5 @@
 
         if (editor instanceof RootPaneContainer) {
-            JRootPane root = ((RootPaneContainer) editor).getRootPane();
-            root.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE");
-            root.getActionMap().put("ESCAPE", this);
+            InputMapUtils.addEscapeAction(((RootPaneContainer) editor).getRootPane(), this);
         }
         setEnabled(true);
Index: /trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java	(revision 10791)
@@ -190,6 +190,5 @@
 
         // -- cancel on ESC
-        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
-        getRootPane().getActionMap().put("cancel", actCancel);
+        InputMapUtils.addEscapeAction(getRootPane(), actCancel);
 
         // -- help button
Index: /trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java	(revision 10791)
@@ -12,5 +12,4 @@
 import java.awt.Rectangle;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -24,5 +23,4 @@
 import javax.swing.AbstractAction;
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JMenuItem;
@@ -32,5 +30,4 @@
 import javax.swing.JSeparator;
 import javax.swing.JToolBar;
-import javax.swing.KeyStroke;
 import javax.swing.SwingUtilities;
 import javax.swing.event.ChangeEvent;
@@ -54,4 +51,5 @@
 import org.openstreetmap.josm.gui.widgets.JosmHTMLEditorKit;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.LanguageInfo.LocaleType;
 import org.openstreetmap.josm.tools.OpenBrowser;
@@ -195,6 +193,5 @@
 
         p.add(buildToolBar(), BorderLayout.NORTH);
-        help.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "Close");
-        help.getActionMap().put("Close", new AbstractAction() {
+        InputMapUtils.addEscapeAction(getRootPane(), new AbstractAction() {
             @Override
             public void actionPerformed(ActionEvent e) {
Index: /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java	(revision 10791)
@@ -9,5 +9,4 @@
 import java.awt.FlowLayout;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -15,9 +14,7 @@
 import javax.swing.AbstractAction;
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
-import javax.swing.KeyStroke;
 
 import org.openstreetmap.josm.Main;
@@ -30,4 +27,5 @@
 import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 
 /**
@@ -107,9 +105,7 @@
         btn = new JButton(closeAction);
         final String closeHistoryBrowserDialogKey = "CloseHistoryBrowserDialog";
-        KeyStroke escapeKey = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false);
-        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(escapeKey, closeHistoryBrowserDialogKey);
-        getRootPane().getActionMap().put(closeHistoryBrowserDialogKey, closeAction);
         btn.setName("btn.close");
         pnl.add(btn);
+        InputMapUtils.addEscapeAction(getRootPane(), closeAction);
 
         btn = new JButton(new ContextSensitiveHelpAction(ht("/Action/ObjectHistory")));
Index: /trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java	(revision 10791)
@@ -8,5 +8,4 @@
 import java.awt.FlowLayout;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -18,5 +17,4 @@
 import javax.swing.BorderFactory;
 import javax.swing.DefaultListModel;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
@@ -24,5 +22,4 @@
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
-import javax.swing.KeyStroke;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
@@ -91,6 +88,5 @@
         getContentPane().add(buildSouthPanel(), BorderLayout.SOUTH);
 
-        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
-        getRootPane().getActionMap().put("escape", new CancelAction());
+        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
         addWindowListener(new WindowEventHandler());
     }
Index: /trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java	(revision 10791)
@@ -23,10 +23,8 @@
 import javax.swing.BorderFactory;
 import javax.swing.JCheckBox;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JTextField;
-import javax.swing.KeyStroke;
 
 import org.openstreetmap.josm.Main;
@@ -40,4 +38,5 @@
 import org.openstreetmap.josm.io.OsmApi;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.WindowGeometry;
 
@@ -97,7 +96,5 @@
 
         addWindowListener(new WindowEventHander());
-        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
-                KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
-        getRootPane().getActionMap().put("escape", new CancelAction());
+        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
 
         getRootPane().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
Index: /trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java	(revision 10791)
@@ -30,5 +30,4 @@
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
@@ -37,5 +36,4 @@
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
-import javax.swing.KeyStroke;
 import javax.swing.ListCellRenderer;
 import javax.swing.WindowConstants;
@@ -54,4 +52,5 @@
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.UserCancelException;
 import org.openstreetmap.josm.tools.Utils;
@@ -299,7 +298,5 @@
             putValue(SHORT_DESCRIPTION, tr("Close this dialog and resume editing in JOSM"));
             putValue(SMALL_ICON, ImageProvider.get("cancel"));
-            getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
-            .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE");
-            getRootPane().getActionMap().put("ESCAPE", this);
+            InputMapUtils.addEscapeAction(getRootPane(), this);
         }
 
Index: /trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java	(revision 10791)
@@ -12,5 +12,4 @@
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -31,9 +30,7 @@
 import javax.swing.Icon;
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JTabbedPane;
-import javax.swing.KeyStroke;
 
 import org.openstreetmap.josm.Main;
@@ -189,9 +186,5 @@
         CancelAction cancelAction = new CancelAction(this);
         pnl.add(new JButton(cancelAction));
-        getRootPane().registerKeyboardAction(
-                cancelAction,
-                KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
-                JComponent.WHEN_IN_FOCUSED_WINDOW
-        );
+        InputMapUtils.addEscapeAction(getRootPane(), cancelAction);
         pnl.add(new JButton(new ContextSensitiveHelpAction(ht("/Dialog/Upload"))));
         HelpUtil.setHelpContext(getRootPane(), ht("/Dialog/Upload"));
Index: /trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java	(revision 10791)
@@ -20,5 +20,4 @@
 import javax.swing.Action;
 import javax.swing.BorderFactory;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
@@ -27,5 +26,4 @@
 import javax.swing.JScrollPane;
 import javax.swing.JSplitPane;
-import javax.swing.KeyStroke;
 import javax.swing.ListSelectionModel;
 import javax.swing.event.ListSelectionEvent;
@@ -42,4 +40,5 @@
 import org.openstreetmap.josm.gui.util.GuiHelper;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.WindowGeometry;
 
@@ -258,7 +257,5 @@
             putValue(Action.NAME, tr("Cancel"));
             new ImageProvider("cancel").getResource().attachImageIcon(this);
-            getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW)
-            .put(KeyStroke.getKeyStroke("ESCAPE"), "ESCAPE");
-            getRootPane().getActionMap().put("ESCAPE", this);
+            InputMapUtils.addEscapeAction(getRootPane(), this);
             setEnabled(true);
         }
Index: /trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java	(revision 10791)
@@ -17,5 +17,4 @@
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
-import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -27,10 +26,8 @@
 import javax.swing.BorderFactory;
 import javax.swing.JButton;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
-import javax.swing.KeyStroke;
 import javax.swing.UIManager;
 import javax.swing.event.HyperlinkEvent;
@@ -51,4 +48,5 @@
 import org.openstreetmap.josm.tools.CheckParameterUtil;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.OpenBrowser;
 import org.openstreetmap.josm.tools.UserCancelException;
@@ -232,6 +230,5 @@
 
         addWindowListener(new WindowEventHandler());
-        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
-        getRootPane().getActionMap().put("cancel", new CancelAction());
+        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
 
         refreshAuthorisationProcedurePanel();
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 10791)
@@ -12,5 +12,4 @@
 import java.awt.Insets;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 import java.awt.event.WindowAdapter;
 import java.awt.event.WindowEvent;
@@ -20,8 +19,6 @@
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JPanel;
-import javax.swing.KeyStroke;
 
 import org.openstreetmap.josm.actions.ExpertToggleAction;
@@ -32,4 +29,5 @@
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 import org.openstreetmap.josm.tools.WindowGeometry;
 
@@ -79,6 +77,5 @@
         addWindowListener(new WindowEventHandler());
 
-        getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel");
-        getRootPane().getActionMap().put("cancel", new CancelAction());
+        InputMapUtils.addEscapeAction(getRootPane(), new CancelAction());
         HelpUtil.setHelpContext(getRootPane(), HelpUtil.ht("/Action/Preferences"));
     }
Index: /trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/tools/InputMapUtils.java	(revision 10791)
@@ -105,3 +105,15 @@
          c.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), "spacebar");
     }
+
+    /**
+     * Add an action activated with ESCAPE key on a component or its children.
+     * @param c The Swing component
+     * @param a action activated with ESCAPE key
+     * @see JComponent#WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
+     * @since 10791
+     */
+    public static void addEscapeAction(JComponent c, Action a) {
+         c.getActionMap().put("escape", a);
+         c.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
+    }
 }
Index: /trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportDialog.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportDialog.java	(revision 10790)
+++ /trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportDialog.java	(revision 10791)
@@ -9,5 +9,4 @@
 import java.awt.GridBagLayout;
 import java.awt.event.ActionEvent;
-import java.awt.event.KeyEvent;
 
 import javax.swing.AbstractAction;
@@ -16,9 +15,7 @@
 import javax.swing.JButton;
 import javax.swing.JCheckBox;
-import javax.swing.JComponent;
 import javax.swing.JDialog;
 import javax.swing.JLabel;
 import javax.swing.JPanel;
-import javax.swing.KeyStroke;
 import javax.swing.UIManager;
 
@@ -29,4 +26,5 @@
 import org.openstreetmap.josm.tools.GBC;
 import org.openstreetmap.josm.tools.ImageProvider;
+import org.openstreetmap.josm.tools.InputMapUtils;
 
 /**
@@ -72,6 +70,5 @@
         setDefaultCloseOperation(DISPOSE_ON_CLOSE);
 
-        getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
-        getRootPane().getActionMap().put("escape", new AbstractAction() {
+        InputMapUtils.addEscapeAction(getRootPane(), new AbstractAction() {
             @Override
             public void actionPerformed(ActionEvent e) {
