mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ui: generate valid keystrokes in KeymapsTestCase
ActionManagerEx#getKeyStroke and KeyStrokeAdapter use different case
This commit is contained in:
@@ -668,20 +668,28 @@ public abstract class KeymapsTestCase extends PlatformTestCase {
|
||||
return new KeyboardShortcut(fst, snd);
|
||||
}
|
||||
|
||||
private static String getText(Shortcut shortcut) {
|
||||
@NotNull
|
||||
private static String getText(@NotNull Shortcut shortcut) {
|
||||
if (shortcut instanceof KeyboardShortcut) {
|
||||
KeyStroke fst = ((KeyboardShortcut)shortcut).getFirstKeyStroke();
|
||||
String s = KeyStrokeAdapter.toString(fst);
|
||||
String s = getText(fst);
|
||||
|
||||
KeyStroke snd = ((KeyboardShortcut)shortcut).getSecondKeyStroke();
|
||||
if (snd != null) {
|
||||
s += "," + KeyStrokeAdapter.toString(snd);
|
||||
s += "," + getText(snd);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
return KeymapUtil.getShortcutText(shortcut);
|
||||
}
|
||||
|
||||
private static String getText(KeyStroke fst) {
|
||||
String text = KeyStrokeAdapter.toString(fst);
|
||||
int offset = text.lastIndexOf(' ');
|
||||
if (offset == -1) offset = 0;
|
||||
return text.substring(0, offset) + text.substring(offset).toUpperCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
private static void convertMac(@NotNull Shortcut[] there) {
|
||||
for (int i = 0; i < there.length; i++) {
|
||||
there[i] = MacOSDefaultKeymap.convertShortcutFromParent(there[i]);
|
||||
|
||||
Reference in New Issue
Block a user