[hg] main-silver: #186557 - ALT-ENTER selects pulldown menu

  • From: Roman Svitanic < >
  • To:
  • Subject: [hg] main-silver: #186557 - ALT-ENTER selects pulldown menu
  • Date: Mon, 15 Jul 2013 01:58:56 -0700

changeset 0db81c614b0e in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/0db81c614b0e
description:
        #186557 - ALT-ENTER selects pulldown menu

diffstat:

 spi.editor.hints/src/org/netbeans/modules/editor/hints/HintsUI.java |  31 
++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diffs (62 lines):

diff --git 
a/spi.editor.hints/src/org/netbeans/modules/editor/hints/HintsUI.java 
b/spi.editor.hints/src/org/netbeans/modules/editor/hints/HintsUI.java
--- a/spi.editor.hints/src/org/netbeans/modules/editor/hints/HintsUI.java
+++ b/spi.editor.hints/src/org/netbeans/modules/editor/hints/HintsUI.java
@@ -45,6 +45,7 @@
 package org.netbeans.modules.editor.hints;
 
 import java.awt.AWTEvent;
+import java.awt.AWTException;
 import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
@@ -185,6 +186,9 @@
     private JTextArea errorTooltip;
     private AtomicBoolean cancel;
     
+    private boolean altEnterPressed = false;
+    private boolean altReleased = false;
+
     @SuppressWarnings("LeakingThisInConstructor")
     private HintsUI() {
         EditorRegistry.addPropertyChangeListener(this);
@@ -738,6 +742,12 @@
         if ( e.getKeyCode() == KeyEvent.VK_ENTER ) {
             if (e.getModifiersEx() == KeyEvent.ALT_DOWN_MASK) {
                 if ( !popupShowing) {
+                    if (org.openide.util.Utilities.isWindows()
+                            && 
!Boolean.getBoolean("HintsUI.disable.AltEnter.hack")) { // NOI18N
+                        // Fix (workaround) for issue #186557
+                        altEnterPressed = true;
+                        altReleased = false;
+                    }
                     invokeDefaultAction(false);
                     e.consume();
                 }
@@ -781,6 +791,27 @@
     }    
 
     public void keyReleased(KeyEvent e) {
+        // Fix (workaround) for issue #186557
+        if (org.openide.util.Utilities.isWindows()) {
+            if (Boolean.getBoolean("HintsUI.disable.AltEnter.hack")) { // 
NOI18N
+                return;
+            }
+
+            if (altEnterPressed && e.getKeyCode() == KeyEvent.VK_ALT) {
+                e.consume();
+                altReleased = true;
+            } else if (altEnterPressed && e.getKeyCode() == 
KeyEvent.VK_ENTER) {
+                altEnterPressed = false;
+                if (altReleased) {
+                    try {
+                        java.awt.Robot r = new java.awt.Robot();
+                        r.keyRelease(KeyEvent.VK_ALT);
+                    } catch (AWTException ex) {
+                        Exceptions.printStackTrace(ex);
+                    }
+                }
+            }
+        }
     }
 
     public void keyTyped(KeyEvent e) {

[hg] main-silver: #186557 - ALT-ENTER selects pulldown menu

Roman Svitanic 07/15/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close