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 217279 - Shortscuts not in german keyboard layout
Summary: Shortscuts not in german keyboard layout
Status: RESOLVED DUPLICATE of bug 227247
Alias: None
Product: editor
Classification: Unclassified
Component: Key bindings (show other bugs)
Version: 7.3
Hardware: Macintosh All
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords: I18N, JDK_SPECIFIC
Depends on:
Blocks:
 
Reported: 2012-08-23 08:34 UTC by to123
Modified: 2013-03-15 09:56 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description to123 2012-08-23 08:34:04 UTC
When using shortcuts the keyboard layout is not german, i.e. when I press "cmd+minus" a "cmd+slash" is interpreted, tested in search shortcuts, config section.

Entering text in a file etc. works fine, so mac os layout is right.

How to change ? Is it a bug.








Product Version = NetBeans IDE 7.2 (Build 201207301726)
Operating System = Mac OS X version 10.7.4 running on x86_64
Java; VM; Vendor = 1.6.0_33
Runtime = Java HotSpot(TM) 64-Bit Server VM 20.8-b03-424
Comment 1 mfriedenhagen 2012-11-08 22:45:48 UTC
I can second this with NB 7.3 Beta2.

Product Version: NetBeans IDE 7.3 Beta 2 (Build 201211062253)
Updates: NetBeans IDE is updated to version , NetBeans 7.3 Beta 2
Java: 1.6.0_37; Java HotSpot(TM) 64-Bit Server VM 20.12-b01-434
Runtime: Java(TM) SE Runtime Environment 1.6.0_37-b06-434-11M3909
System: Mac OS X version 10.8.2 running on x86_64; MacRoman; de_DE (nb)
Comment 2 Theofanis Oikonomou 2012-11-14 10:34:41 UTC
This is expected. AFAICT this is how it should behave. The keystroke is constructed from the code of the key that was pressed (not typed) and any modifiers. 

For example (sorry for having Greek layout and not German):
In the Greek layout if you press letter 'Q' it produces the char ';'
when catching the keyPressed event in both cases we have keyCode=81
but they produce completely different char. 

The shortcut set could be for example Ctrl+Q meaning that in order to access it you need to press Ctrl and the key with code 81 witch is 'Q'. The fact that in the editor it is translated to ';' in Greek layout should have IMHO no impact for the shortcut.
Comment 3 mfriedenhagen 2012-11-14 18:38:26 UTC
Sorry, but this would be completely different to every other application I have ever worked with before. When the menu states Ctrl+q or Cmd+q for quitting of course a user (and even developers are users of Netbeans) expect she has to press the Cmd or Ctrl key and additionally the key with q printed on it (of course in accordance to her keyboard layout).
Comment 4 Theofanis Oikonomou 2012-11-15 10:28:19 UTC
Any comment on how this situation should be resolved? Thank you
Comment 5 mfriedenhagen 2012-11-15 13:44:35 UTC
As stated in the original description:
- Netbeans has no problem to get this right in the editor-window, Alt+l (small L) is interpreted as @, Alt + 8 is interpreted as { etc. The key lettered z on my german (corresponding to the position of y on the english one) gives me a z.
- When I go to "Collapse Fold" in Preferences/Options/Keymap and press Cmd+- on my keyboard, Netbeans warns me that this is interpreted as Cmd+/ and that this shortcut is normally used for "Toggle Comment". However when I overwrite this nonetheless I am able to use Cmd+- for "Collapse Fold", only the menu states (incorrectly) "Cmd+/" as the short cut.
Comment 6 Theofanis Oikonomou 2012-11-15 14:16:49 UTC
Svata, any comments on how this should work? Thank you
Comment 7 Svata Dedic 2012-11-15 14:31:01 UTC
Not MacOS specific, I can see CTRL-SLASH on Linux too, when pressing CTRL-SLASH, while editor types '-' when slash is pressed. Surprisingly CTRL + '-' (american slash = german minus) is interpreted as collapse block by editor, traditionally assigned to CTRL-MINUS. I am puzzled.
Comment 8 Svata Dedic 2012-11-15 15:24:07 UTC
Oddly enough, JDK's KeyStroke.getKeyStroke() returns CTRL+SLASH and even low-level KeyStroke.getAWTKeyStroke(event) creates the same object.
We would have to use KeyStroke.getKeyStroke(char, mods) to get the correct KeyStroke.
Comment 9 Svata Dedic 2012-11-15 16:04:34 UTC
So, there's a new method in JDK 1.7, getExtendedKeyCode(), which should be used in preference to getKeyCode(). getExtendedKeyCode() gets the keycode translated through keyboard layout, while getKeyCode() gets the raw keycode.

So I'll probably fix the Options/Keymap with an ugly hack, since we still need to run on JDK 1.6, where the method does not exist at all. In JDK 1.6, even Editor will probably not recognize CTRL+MINUS as collapse, bcs it will get CTRL+SLASH.
Comment 10 Svata Dedic 2012-11-15 16:08:07 UTC
The following classes should (could) be fixed in addition to keymaps module:

org.apache.tools.ant.module.wizards.shortcut.SelectKeyboardShortcutPanel
org.netbeans.modules.form.editors.KeyStrokeEditor
Comment 11 Svata Dedic 2012-11-16 07:22:17 UTC
Changeset: 8af82a4710e4
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-11-16 08:22
Message:   Added JDK-specific KeyStroke creation
Comment 12 Svata Dedic 2012-11-16 07:25:55 UTC
Yet another class: org.netbeans.modules.apisupport.project.ui.wizard.action.ShortcutEnterPanel

When fixed in apisupport, please reassign to owners of the other classes mentioned in above comments. See the mentioned changeset for fix implementation details.
Comment 13 Svata Dedic 2012-11-16 08:47:34 UTC
Changeset: b6ff35d98bdc
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-11-16 09:47
Message:   ant: Fixed national keyboard key names
Comment 14 Svata Dedic 2012-11-16 09:07:13 UTC
Changeset: 1159aaa152b8
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2012-11-16 10:07
Message:   form: Fixed national keyboard key names
Comment 15 mfriedenhagen 2012-11-16 19:36:31 UTC
Do I read this correctly, that the fix should be part of 7.3 final?
Comment 16 Svata Dedic 2012-11-16 19:44:30 UTC
yes, it should be.
Comment 17 Quality Engineering 2012-11-17 02:43:25 UTC
Integrated into 'main-golden', will be available in build *201211170002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/8af82a4710e4
User: Svata Dedic <sdedic@netbeans.org>
Log: Issue #217279 - Shortscuts not in german keyboard layout: fixed
Added JDK-specific KeyStroke creation
Comment 18 Quality Engineering 2012-11-18 03:10:41 UTC
Integrated into 'main-golden', will be available in build *201211180002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/b6ff35d98bdc
User: Svata Dedic <sdedic@netbeans.org>
Log: Issue #217279 - Shortscuts not in german keyboard layout: fixed
ant: Fixed national keyboard key names
Comment 19 mfriedenhagen 2013-01-25 21:30:12 UTC
Sorry, but now I tried NetBeans IDE Dev (Build 201301220001) and still see this issue with JDK 1.6.0_37; Java HotSpot(TM) 64-Bit Server VM 20.12-b01-434 as well as Java(TM) SE Runtime Environment (build 1.7.0_11-b21). In the Keymap editor window I chose "Netbeans" Layout and neither with Java6 nor 7 CMD+- does work. When I run NB with Java7, the shortcuts suddenly switch from using CMD to META in the display. When I force a combination by pressing CMD+- in JDK7 it states a conflict with another key and this is shown as CMD+/ as before.

System: Mac OS X version 10.8.2 running on x86_64; MacRoman; de_DE (nb)
Comment 20 Svata Dedic 2013-01-25 21:35:46 UTC
not a HR fix candidate, moving to next release.
Comment 21 Svata Dedic 2013-03-15 09:56:17 UTC
Merging with issue #227247; the national keyboards are larger issue that it seemed at first. The original analysis was not complete enough.

*** This bug has been marked as a duplicate of bug 227247 ***