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.

View | Details | Raw Unified | Return to bug 16188
Collapse All | Expand All

(-)src/org/netbeans/core/windows/frames/ShortcutAndMenuKeyEventProcessor.java (-20 / +43 lines)
Lines 55-82 Link Here
55
        if (ev.isConsumed())
55
        if (ev.isConsumed())
56
            return false;
56
            return false;
57
57
58
        KeyStroke ks = KeyStroke.getKeyStrokeForEvent(ev);
58
        if (processShortcut(ev))
59
        Window w = SwingUtilities.windowForComponent(ev.getComponent());
60
        
61
        if (!isTransmodalAction(ks)
62
            && (w instanceof Dialog && ((Dialog)w).isModal())
63
            ) {
64
            return false;
65
        }
66
        
67
        // Provide a reasonably useful action event that identifies what was focused
68
        // when the key was pressed, as well as what keystroke ran the action.
69
        ActionEvent aev = new ActionEvent(
70
            ev.getSource(), ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks));
71
72
        Keymap root = TopManager.getDefault ().getGlobalKeymap ();
73
        Action a = root.getAction (ks);
74
        if (a != null && a.isEnabled()) {
75
            TopManager.getDefault().getActionManager().invokeAction(a, aev);
76
            ev.consume();
77
            return true;
59
            return true;
78
        }
79
60
61
        Window w = SwingUtilities.windowForComponent(ev.getComponent());        
80
        if (w instanceof Dialog)
62
        if (w instanceof Dialog)
81
            return false;
63
            return false;
82
        
64
        
Lines 118-123 Link Here
118
        MenuElement[] arr = MenuSelectionManager.defaultManager().getSelectedPath();
100
        MenuElement[] arr = MenuSelectionManager.defaultManager().getSelectedPath();
119
        if (arr == null || arr.length == 0) {
101
        if (arr == null || arr.length == 0) {
120
            wasPopupDisplayed = false;
102
            wasPopupDisplayed = false;
103
104
            // XXX(-ttran) special case for Shift+F10 on braindead Windoze.
105
            // Shortcuts are handled in postProcessKeyEvent() so that the
106
            // focused components can decide to handle and consume the key
107
            // event itself.  Buttons' and labels' mnemonics in components will
108
            // work even though they conflict with shortcuts.  But if we do so
109
            // for Shift+F10 on Windoze then for some mysterious reason the
110
            // system menu (left-upper icon in the native window caption) will
111
            // be invoked, no matter how hard we try to consume the event.
112
113
            if (Utilities.isWindows()
114
                && ev.getModifiers() == InputEvent.SHIFT_MASK
115
                && ev.getKeyCode() == KeyEvent.VK_F10
116
                ) {
117
                return processShortcut(ev);
118
            }
121
            return false;
119
            return false;
122
        }
120
        }
123
        
121
        
Lines 141-146 Link Here
141
            ev.setSource(WindowManagerImpl.mainWindow());
139
            ev.setSource(WindowManagerImpl.mainWindow());
142
        }
140
        }
143
        return ev.isConsumed();
141
        return ev.isConsumed();
142
    }
143
144
    private boolean processShortcut(KeyEvent ev) {
145
        KeyStroke ks = KeyStroke.getKeyStrokeForEvent(ev);
146
        Window w = SwingUtilities.windowForComponent(ev.getComponent());
147
        
148
        if (!isTransmodalAction(ks)
149
            && (w instanceof Dialog && ((Dialog)w).isModal())
150
            ) {
151
            return false;
152
        }
153
        
154
        // Provide a reasonably useful action event that identifies what was focused
155
        // when the key was pressed, as well as what keystroke ran the action.
156
        ActionEvent aev = new ActionEvent(
157
            ev.getSource(), ActionEvent.ACTION_PERFORMED, Utilities.keyToString(ks));
158
            
159
        Keymap root = TopManager.getDefault ().getGlobalKeymap ();
160
        Action a = root.getAction (ks);
161
        if (a != null && a.isEnabled()) {
162
            TopManager.getDefault().getActionManager().invokeAction(a, aev);
163
            ev.consume();
164
            return true;
165
        }
166
        return false;
144
    }
167
    }
145
168
146
    private static boolean invokeProcessKeyBindingsForAllComponents(
169
    private static boolean invokeProcessKeyBindingsForAllComponents(

Return to bug 16188