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 - Esc key should focus Editor
Summary: Esc key should focus Editor
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@platform
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-20 18:19 UTC by David Simonek
Modified: 2010-08-11 13:29 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.