Corrected detection of CTRL key. Test whether it is VK_CONTROL BLD200308080100
authormentlicher@netbeans.org
Thu, 07 Aug 2003 12:01:45 +0000
changeset 349647e76fde7f85
parent 3495 ff0282adff1e
child 3497 3c5370b3cf15
Corrected detection of CTRL key. Test whether it is VK_CONTROL
and alter the signs only if CTRL is detected.
This is a fix of issue #30055.
vcscore/src/org/netbeans/modules/vcscore/actions/ClusteringAction.java
vcscore/src/org/netbeans/modules/vcscore/actions/CommandMenu.java
     1.1 --- a/vcscore/src/org/netbeans/modules/vcscore/actions/ClusteringAction.java	Thu Aug 07 10:20:17 2003 +0000
     1.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/actions/ClusteringAction.java	Thu Aug 07 12:01:45 2003 +0000
     1.3 @@ -103,14 +103,18 @@
     1.4          public void menuKeyTyped(javax.swing.event.MenuKeyEvent p1) {
     1.5          }
     1.6          public void menuKeyPressed(javax.swing.event.MenuKeyEvent p1) {
     1.7 -            boolean newCTRL_Down = "Ctrl".equals(p1.getKeyText(p1.getKeyCode())) || !p1.isControlDown(); // NOI18N            
     1.8 -            changeCtrlSigns(newCTRL_Down);
     1.9 -            CTRL_Down = newCTRL_Down;
    1.10 +            boolean CTRL_IsDown = p1.getKeyCode() == javax.swing.event.MenuKeyEvent.VK_CONTROL; // NOI18N            
    1.11 +            if (CTRL_IsDown) {
    1.12 +                changeCtrlSigns(CTRL_IsDown);
    1.13 +                CTRL_Down = CTRL_IsDown;
    1.14 +            }
    1.15          }
    1.16          public void menuKeyReleased(javax.swing.event.MenuKeyEvent p1) {
    1.17 -            boolean newCTRL_Down = "Ctrl".equals(p1.getKeyText(p1.getKeyCode())) || !p1.isControlDown(); // NOI18N            
    1.18 -            changeCtrlSigns(!newCTRL_Down);
    1.19 -            CTRL_Down = !newCTRL_Down;
    1.20 +            boolean CTRL_IsUp = p1.getKeyCode() == javax.swing.event.MenuKeyEvent.VK_CONTROL; // NOI18N            
    1.21 +            if (CTRL_IsUp) {
    1.22 +                changeCtrlSigns(!CTRL_IsUp);
    1.23 +                CTRL_Down = !CTRL_IsUp;
    1.24 +            }
    1.25          }
    1.26      };
    1.27              
     2.1 --- a/vcscore/src/org/netbeans/modules/vcscore/actions/CommandMenu.java	Thu Aug 07 10:20:17 2003 +0000
     2.2 +++ b/vcscore/src/org/netbeans/modules/vcscore/actions/CommandMenu.java	Thu Aug 07 12:01:45 2003 +0000
     2.3 @@ -425,18 +425,22 @@
     2.4          public void menuKeyTyped(javax.swing.event.MenuKeyEvent p1) {
     2.5          }
     2.6          public void menuKeyPressed(javax.swing.event.MenuKeyEvent p1) {
     2.7 -            boolean newCTRL_Down = "Ctrl".equals(p1.getKeyText(p1.getKeyCode())) || p1.isControlDown(); // NOI18N
     2.8 +            boolean CTRL_IsDown = p1.getKeyCode() == javax.swing.event.MenuKeyEvent.VK_CONTROL;
     2.9  //            System.out.println("key pressed=" + newCTRL_Down);
    2.10  //            System.out.println("is down=" + p1.isControlDown());
    2.11 -            changeCtrlSigns(newCTRL_Down);
    2.12 -            CTRL_Down[0] = newCTRL_Down;
    2.13 +            if (CTRL_IsDown) {
    2.14 +                changeCtrlSigns(CTRL_IsDown);
    2.15 +                CTRL_Down[0] = CTRL_IsDown;
    2.16 +            }
    2.17          }
    2.18          public void menuKeyReleased(javax.swing.event.MenuKeyEvent p1) {
    2.19 -            boolean newCTRL_Down = "Ctrl".equals(p1.getKeyText(p1.getKeyCode())) || !p1.isControlDown(); // NOI18N
    2.20 +            boolean CTRL_IsUp = p1.getKeyCode() == javax.swing.event.MenuKeyEvent.VK_CONTROL;
    2.21  //            System.out.println("key Released=" + newCTRL_Down);
    2.22  //            System.out.println("keykode=" + p1.getKeyText(p1.getKeyCode()));
    2.23 -            changeCtrlSigns(!newCTRL_Down);
    2.24 -            CTRL_Down[0] = !newCTRL_Down;
    2.25 +            if (CTRL_IsUp) {
    2.26 +                changeCtrlSigns(!CTRL_IsUp);
    2.27 +                CTRL_Down[0] = !CTRL_IsUp;
    2.28 +            }
    2.29          }
    2.30          
    2.31          private void changeCtrlSigns(boolean newValue) {