This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 80753

Summary: Esc key should focus Editor
Product: platform Reporter: David Simonek <dsimonek>
Component: Window SystemAssignee: issues@platform <issues>
Status: NEW ---    
Severity: blocker CC: tboudreau
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description David Simonek 2006-07-20 18:19:59 UTC
Quoting conversation from nb_usability mailing list:

[tboudreau]:
I remember when we introduced sliding views a while back, at least Dafe and I
discussed the idea that pressing Escape in any view in the IDE should
automatically send focus to the editor (unless you're dismissing quick search or
an inline editor or similar - pretty easy to check if focus is on a
JTextComponent and do nothing).

Anyway, I notice we haven't done that (though I thought we did at least for a
while).  We should do it, unless there's some major blocking reason.

[dsimonek]
I remember, would be useful, but not as trivial as it may seem:

- Esc is used for dialog escaping, shouldn't be mixed (should focus what was
focused before, not editor by first key press)
- Esc is used for escaping DnD, the same as above
- Esc is used for escaping from sliding views

So for example in quick search inside sliding view, first Esc will dismiss quick
search, second one sliding view and third one will finally focus editor. Wow,
truly hierarchical escape! :-) Complex, but not bad...
Comment 1 David Simonek 2006-07-20 18:20:46 UTC
Btw, patch would be welcomed. Only fully working! :-)
Comment 2 _ tboudreau 2006-07-23 09:14:26 UTC
In a smaller project with similar popups, I just did something like this:

        getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
                KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
                "hidePopup"); //NOI18N
        getActionMap().put ("hidePopup", popupComponentManager); //NOI18N

where popupComponentManager.hide() gets called whenever esc is pressed - if
something else has already consumed the key event, it shouldn't be triggered. 
Can't guarantee it will work given the weird stuff we do with actionmaps & such,
but it might just work fine.