IDEA-47906 alt+i (shortcut to press the commit button) does not work on the commit dialog

This commit is contained in:
Denis Fokin
2016-11-17 17:27:37 +03:00
parent e22917cc93
commit 501f9ce3b1
3 changed files with 5 additions and 10 deletions
@@ -151,10 +151,7 @@ public class MnemonicHelper extends ComponentTreeWatcher {
*/
public static CustomShortcutSet createShortcut(char ch) {
Character mnemonic = Character.valueOf(ch);
String shortcut = SystemInfo.isMac && SystemInfo.isJavaVersionAtLeast("1.7")
? "control alt pressed "
: "alt pressed ";
return CustomShortcutSet.fromString(shortcut + mnemonic);
return CustomShortcutSet.fromString("alt " + (SystemInfo.isMac ? "released" : "pressed") + " " + mnemonic);
}
/**
@@ -750,7 +750,7 @@ public abstract class DialogWrapper {
final char mnemonic = (char)eachInfo.getMnemonic();
JRootPane rootPane = getPeer().getRootPane();
if (rootPane != null) {
new DumbAwareAction() {
new DumbAwareAction("Show JBOptionButton popup") {
@Override
public void actionPerformed(AnActionEvent e) {
final JBOptionButton buttonToActivate = eachInfo.getButton();
@@ -420,10 +420,8 @@ public final class IdeKeyEventDispatcher implements Disposable {
if (SystemInfo.isMac) {
boolean keyTyped = e.getID() == KeyEvent.KEY_TYPED;
boolean hasMnemonicsInWindow = (e.getID() == KeyEvent.KEY_PRESSED
|| e.getID() == KeyEvent.KEY_RELEASED)
&& hasMnemonicInWindow(focusOwner, e.getKeyCode());
boolean hasMnemonicsInWindow = e.getID() == KeyEvent.KEY_PRESSED && hasMnemonicInWindow(focusOwner, e.getKeyCode()) ||
keyTyped && hasMnemonicInWindow(focusOwner, e.getKeyChar());
boolean imEnabled = IdeEventQueue.getInstance().isInputMethodEnabled();
if (e.getModifiersEx() == InputEvent.ALT_DOWN_MASK && (hasMnemonicsInWindow || !imEnabled && keyTyped)) {
@@ -499,7 +497,7 @@ public final class IdeKeyEventDispatcher implements Disposable {
private static boolean hasMnemonicInWindow(Component focusOwner, int keyCode) {
if (keyCode == KeyEvent.VK_ALT || keyCode == 0) return false; // Optimization
final Container container = SwingUtilities.getWindowAncestor(focusOwner);
final Container container = UIUtil.getWindow(focusOwner);
return hasMnemonic(container, keyCode) || hasMnemonicInBalloons(container, keyCode);
}