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 46811
Collapse All | Expand All

(-)core/src/org/netbeans/core/ShortcutsEditor.java (-1 / +1 lines)
Lines 190-196 Link Here
190
        if (changes == null) {
190
        if (changes == null) {
191
            changes = new ArrayList();
191
            changes = new ArrayList();
192
        }
192
        }
193
        changes.add(new ShortcutsFolder.ChangeRequest(key, action, true));
193
        changes.add(new ShortcutsFolder.ChangeRequest(key, action, true, true));
194
    }
194
    }
195
195
196
    /** Adds removing request to the changes. */
196
    /** Adds removing request to the changes. */
(-)core/src/org/netbeans/core/ShortcutsFolder.java (-1 / +18 lines)
Lines 120-125 Link Here
120
     * @return KeyActionPair or null if it cannot be created
120
     * @return KeyActionPair or null if it cannot be created
121
     */
121
     */
122
    protected InstanceCookie acceptDataObject(final DataObject dob) {
122
    protected InstanceCookie acceptDataObject(final DataObject dob) {
123
        if (Boolean.TRUE.equals(dob.getPrimaryFile().getAttribute("hidden"))) {
124
            return null;
125
        }
126
        
123
        InstanceCookie ic = super.acceptDataObject(dob);
127
        InstanceCookie ic = super.acceptDataObject(dob);
124
        if (ic != null) {
128
        if (ic != null) {
125
            try {
129
            try {
Lines 444-450 Link Here
444
                            }
448
                            }
445
                        }
449
                        }
446
                    } else {
450
                    } else {
447
                        InstanceDataObject.remove(f, r.instanceName(), r.instanceClass());
451
                        String instanceName = r.instanceName();
452
                        if (!InstanceDataObject.remove(f, instanceName, r.instanceClass())) {
453
                            //We may be deleting an explicitly (user) defined keystroke,
454
                            //which will have X- prepended to its filename - explicitly
455
                            //defined keystrokes do not get CTRL- remapped to Command-
456
                            //on mac os
457
                            InstanceDataObject.remove(f, "X-" + instanceName, r.instanceClass());
458
                        }
448
                    }
459
                    }
449
                } else { // It is '.shadow' file
460
                } else { // It is '.shadow' file
450
                    FileObject root = f.getPrimaryFile();
461
                    FileObject root = f.getPrimaryFile();
Lines 530-535 Link Here
530
        public boolean add;
541
        public boolean add;
531
        public ChangeRequest(KeyStroke key, Action action, boolean add) {
542
        public ChangeRequest(KeyStroke key, Action action, boolean add) {
532
            super(Utilities.keyToString(key), action);
543
            super(Utilities.keyToString(key), action);
544
            this.add = add;
545
        }
546
        
547
        public ChangeRequest(KeyStroke key, Action action, boolean add, boolean explicit) {
548
            super (explicit ? "X-" + Utilities.keyToString(key) : Utilities.keyToString(key),
549
                action);
533
            this.add = add;
550
            this.add = add;
534
        }
551
        }
535
    }
552
    }
(-)core/ui/src/org/netbeans/core/ui/resources/layer.xml (-1 / +6 lines)
Lines 270-276 Link Here
270
	    <attr name="instanceClass" stringvalue="org.openide.actions.CutAction"/>
270
	    <attr name="instanceClass" stringvalue="org.openide.actions.CutAction"/>
271
	</file>
271
	</file>
272
    
272
    
273
        <file name="C-G.instance">
273
        <!-- X- comes from issue 26854 - remap CTRL to Command on mac.  We actually
274
             don't want to remap this, because on the mac, Command-G is Find Next.
275
             The X- prepended specifies that this is an explicit mapping which
276
             should not be remapped on the mac.  See Issue 46808.
277
         -->
278
        <file name="X-C-G.instance">
274
	    <attr name="instanceClass" stringvalue="org.openide.actions.GotoAction"/>
279
	    <attr name="instanceClass" stringvalue="org.openide.actions.GotoAction"/>
275
	</file>
280
	</file>
276
281
(-)core/windows/src/org/netbeans/core/windows/Constants.java (+13 lines)
Lines 129-133 Link Here
129
    public static final String CUSTOM_STATUS_LINE_PATH = System.getProperty("netbeans.winsys.status_line.path"); // NOI18N
129
    public static final String CUSTOM_STATUS_LINE_PATH = System.getProperty("netbeans.winsys.status_line.path"); // NOI18N
130
    
130
    
131
    private Constants() {}
131
    private Constants() {}
132
    
133
    /**
134
     * See the layer file - this controls mapping of keys - alt+arrow should
135
     * be select-word, etc. on mac-os, and Command(meta) arrow should switch
136
     * views. 
137
     */
138
    public static final boolean isMac() {
139
        return Utilities.getOperatingSystem() == Utilities.OS_MAC;
140
    }
141
    
142
    public static final boolean isNotMac() {
143
        return !isMac();
144
    }
132
}
145
}
133
146
(-)core/windows/src/org/netbeans/core/windows/resources/layer.xml (+13 lines)
Lines 130-140 Link Here
130
    </folder>
130
    </folder>
131
    
131
    
132
    <folder name="Shortcuts">
132
    <folder name="Shortcuts">
133
        <!-- The pair below used on non-mac platforms -->
133
        <file name="A-LEFT.shadow">
134
        <file name="A-LEFT.shadow">
134
            <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-windows-actions-PreviousTabAction.instance" />
135
            <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-windows-actions-PreviousTabAction.instance" />
136
            <attr name="hidden" methodvalue="org.netbeans.core.ui.MenuWarmUpTask.isMac"/> 
135
        </file>
137
        </file>
136
        <file name="A-RIGHT.shadow">
138
        <file name="A-RIGHT.shadow">
137
	    <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-windows-actions-NextTabAction.instance"/>
139
	    <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-windows-actions-NextTabAction.instance"/>
140
            <attr name="hidden" methodvalue="org.netbeans.core.ui.MenuWarmUpTask.isNotMac"/> 
141
	</file>
142
        
143
        <!-- On the mac, alt left-right is select, etc. next/prev word-->
144
        <file name="M-LEFT.shadow">
145
            <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-windows-actions-PreviousTabAction.instance" />
146
            <attr name="hidden" methodvalue="org.netbeans.core.windows.Constants.isNotMac"/> 
147
        </file>
148
        <file name="M-RIGHT.shadow">
149
	    <attr name="originalFile" stringvalue="Actions/Window/org-netbeans-core-windows-actions-NextTabAction.instance"/>
150
            <attr name="hidden" methodvalue="org.netbeans.core.windows.Constants.isNotMac"/> 
138
	</file>
151
	</file>
139
152
140
        <file name="C-F4.shadow">
153
        <file name="C-F4.shadow">
(-)openide/src/org/openide/util/Utilities.java (+47 lines)
Lines 1252-1258 Link Here
1252
                } else {
1252
                } else {
1253
                    // last text must be the key code
1253
                    // last text must be the key code
1254
                    Integer i = (Integer)names.get (el);
1254
                    Integer i = (Integer)names.get (el);
1255
                    boolean explicit = (needed & EXPLICIT_MASK) != 0;
1256
                    //Strip out the explicit mask - KeyStroke won't know
1257
                    //what to do with it
1258
                    needed = needed & ~EXPLICIT_MASK;
1259
                    
1255
                    if (i != null) {
1260
                    if (i != null) {
1261
                        //#26854 - Default accelerator should be Command on mac
1262
                        boolean remapForMac = !explicit &&
1263
                            getOperatingSystem() == OS_MAC &&
1264
                            (needed & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK &&
1265
                            usableKeyOnMac(i.intValue(), needed);
1266
                            
1267
                        if (remapForMac) {
1268
                            needed &= ~KeyEvent.CTRL_MASK;
1269
                            needed |= KeyEvent.META_MASK;
1270
                        }
1256
                        return KeyStroke.getKeyStroke (i.intValue (), needed);
1271
                        return KeyStroke.getKeyStroke (i.intValue (), needed);
1257
                    } else {
1272
                    } else {
1258
                        return null;
1273
                        return null;
Lines 1263-1268 Link Here
1263
            return null;
1278
            return null;
1264
        }
1279
        }
1265
    }
1280
    }
1281
    
1282
    private static final boolean usableKeyOnMac (int key, int mask) {
1283
        //All permutations fail for Q except ctrl
1284
        if (key == KeyEvent.VK_Q) return false;
1285
        
1286
        boolean isCtrl = ((mask & KeyEvent.CTRL_MASK) != 0) || 
1287
            ((mask & KeyEvent.CTRL_DOWN_MASK) != 0);
1288
        
1289
        boolean isAlt = ((mask & KeyEvent.ALT_MASK) != 0) || 
1290
            ((mask & KeyEvent.ALT_DOWN_MASK) != 0);
1291
        
1292
        boolean isOnlyCtrl = isCtrl && (mask & ~(KeyEvent.CTRL_DOWN_MASK | KeyEvent.CTRL_MASK)) == 0;
1293
        
1294
        //Mac OS consumes keys Command+ these keys - the app will never see
1295
        //them, so CTRL should not be remapped for these
1296
        if (isOnlyCtrl) {
1297
            return key != KeyEvent.VK_H && key != 
1298
                KeyEvent.VK_SPACE && key != KeyEvent.VK_TAB;
1299
        } else if (key == KeyEvent.VK_D && isCtrl && isAlt) {
1300
            return false;
1301
        } else {
1302
            return true;
1303
        }
1304
    }
1266
1305
1267
    /** Convert a space-separated list of user-friendly key binding names to a list of Swing key strokes.
1306
    /** Convert a space-separated list of user-friendly key binding names to a list of Swing key strokes.
1268
    * @param s the string with keys
1307
    * @param s the string with keys
Lines 1283-1288 Link Here
1283
        return (KeyStroke[])arr.toArray (new KeyStroke[arr.size ()]);
1322
        return (KeyStroke[])arr.toArray (new KeyStroke[arr.size ()]);
1284
    }
1323
    }
1285
1324
1325
    private static final int EXPLICIT_MASK = 32768;
1286
1326
1287
    /** Adds characters for modifiers to the buffer.
1327
    /** Adds characters for modifiers to the buffer.
1288
    * @param buf buffer to add to
1328
    * @param buf buffer to add to
Lines 1308-1313 Link Here
1308
            buf.append("M"); // NOI18N
1348
            buf.append("M"); // NOI18N
1309
            b = true;
1349
            b = true;
1310
        }
1350
        }
1351
        if ((modif & EXPLICIT_MASK) != 0) {
1352
            buf.append("X");
1353
            b = true;
1354
        }
1311
1355
1312
        return b;
1356
        return b;
1313
    }
1357
    }
Lines 1332-1337 Link Here
1332
                break;
1376
                break;
1333
            case 'S':
1377
            case 'S':
1334
                m |= KeyEvent.SHIFT_MASK;
1378
                m |= KeyEvent.SHIFT_MASK;
1379
                break;
1380
            case 'X':
1381
                m |= EXPLICIT_MASK;
1335
                break;
1382
                break;
1336
            default:
1383
            default:
1337
                throw new NoSuchElementException ();
1384
                throw new NoSuchElementException ();
(-)editor/libsrc/org/netbeans/editor/SettingsDefaults.java (-47 / +63 lines)
Lines 191-196 Link Here
191
          SettingsNames.STATUS_BAR_BOLD_COLORING
191
          SettingsNames.STATUS_BAR_BOLD_COLORING
192
      };
192
      };
193
193
194
    
195
    private static final int FIND_NEXT_KEY = 
196
        System.getProperty("mrj.version") == null ?
197
        KeyEvent.VK_F3 : KeyEvent.VK_G;
198
        
199
    private static final int FIND_NEXT_MASK = 
200
        System.getProperty("mrj.version") == null ?
201
        0 : KeyEvent.META_DOWN_MASK;
202
203
    //#26854 - use Command, not Ctrl, on mac    
204
    private static final int MENU_MASK = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
205
    
206
    //Default behavior on mac is that alt+arrows is word jumps
207
    private static final int WORD_SELECT_MASK = System.getProperty("mrj.version") == null ?
208
        InputEvent.CTRL_DOWN_MASK : InputEvent.ALT_DOWN_MASK;
209
        
194
    public static final MultiKeyBinding[] defaultKeyBindings
210
    public static final MultiKeyBinding[] defaultKeyBindings
195
    = new MultiKeyBinding[] {
211
    = new MultiKeyBinding[] {
196
          new MultiKeyBinding(
212
          new MultiKeyBinding(
Lines 202-208 Link Here
202
              BaseKit.insertBreakAction
218
              BaseKit.insertBreakAction
203
          ),
219
          ),
204
          new MultiKeyBinding(
220
          new MultiKeyBinding(
205
              KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.CTRL_MASK),
221
              KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, MENU_MASK),
206
              BaseKit.splitLineAction
222
              BaseKit.splitLineAction
207
          ),
223
          ),
208
          new MultiKeyBinding(
224
          new MultiKeyBinding(
Lines 234-240 Link Here
234
              BaseKit.deletePrevCharAction
250
              BaseKit.deletePrevCharAction
235
          ),
251
          ),
236
/*          new MultiKeyBinding(
252
/*          new MultiKeyBinding(
237
              KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
253
              KeyStroke.getKeyStroke(KeyEvent.VK_H, MENU_MASK | InputEvent.SHIFT_MASK),
238
              BaseKit.deletePrevCharAction
254
              BaseKit.deletePrevCharAction
239
          ),
255
          ),
240
*/          new MultiKeyBinding(
256
*/          new MultiKeyBinding(
Lines 254-264 Link Here
254
              BaseKit.selectionForwardAction
270
              BaseKit.selectionForwardAction
255
          ),
271
          ),
256
          new MultiKeyBinding(
272
          new MultiKeyBinding(
257
              KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.CTRL_MASK),
273
              KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, WORD_SELECT_MASK),
258
              BaseKit.nextWordAction
274
              BaseKit.nextWordAction
259
          ),
275
          ),
260
          new MultiKeyBinding(
276
          new MultiKeyBinding(
261
              KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK),
277
              KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, InputEvent.SHIFT_MASK | WORD_SELECT_MASK),
262
              BaseKit.selectionNextWordAction
278
              BaseKit.selectionNextWordAction
263
          ),
279
          ),
264
          new MultiKeyBinding(
280
          new MultiKeyBinding(
Lines 270-284 Link Here
270
              BaseKit.backwardAction
286
              BaseKit.backwardAction
271
          ),
287
          ),
272
          new MultiKeyBinding(
288
          new MultiKeyBinding(
273
              KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK),
289
              KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, WORD_SELECT_MASK),
274
              BaseKit.selectionBackwardAction
290
              BaseKit.selectionBackwardAction
275
          ),
291
          ),
276
          new MultiKeyBinding(
292
          new MultiKeyBinding(
277
              KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.CTRL_MASK),
293
              KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, WORD_SELECT_MASK),
278
              BaseKit.previousWordAction
294
              BaseKit.previousWordAction
279
          ),
295
          ),
280
          new MultiKeyBinding(
296
          new MultiKeyBinding(
281
              KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK),
297
              KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, InputEvent.SHIFT_MASK | MENU_MASK),
282
              BaseKit.selectionPreviousWordAction
298
              BaseKit.selectionPreviousWordAction
283
          ),
299
          ),
284
          new MultiKeyBinding(
300
          new MultiKeyBinding(
Lines 294-300 Link Here
294
              BaseKit.selectionDownAction
310
              BaseKit.selectionDownAction
295
          ),
311
          ),
296
          new MultiKeyBinding(
312
          new MultiKeyBinding(
297
              KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.CTRL_MASK),
313
              KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, MENU_MASK),
298
              BaseKit.scrollUpAction
314
              BaseKit.scrollUpAction
299
          ),
315
          ),
300
          new MultiKeyBinding(
316
          new MultiKeyBinding(
Lines 310-316 Link Here
310
              BaseKit.selectionUpAction
326
              BaseKit.selectionUpAction
311
          ),
327
          ),
312
          new MultiKeyBinding(
328
          new MultiKeyBinding(
313
              KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.CTRL_MASK),
329
              KeyStroke.getKeyStroke(KeyEvent.VK_UP, MENU_MASK),
314
              BaseKit.scrollDownAction
330
              BaseKit.scrollDownAction
315
          ),
331
          ),
316
          new MultiKeyBinding(
332
          new MultiKeyBinding(
Lines 338-348 Link Here
338
              BaseKit.selectionBeginLineAction
354
              BaseKit.selectionBeginLineAction
339
          ),
355
          ),
340
          new MultiKeyBinding(
356
          new MultiKeyBinding(
341
              KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.CTRL_MASK),
357
              KeyStroke.getKeyStroke(KeyEvent.VK_HOME, MENU_MASK),
342
              BaseKit.beginAction
358
              BaseKit.beginAction
343
          ),
359
          ),
344
          new MultiKeyBinding(
360
          new MultiKeyBinding(
345
              KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK),
361
              KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.SHIFT_MASK | MENU_MASK),
346
              BaseKit.selectionBeginAction
362
              BaseKit.selectionBeginAction
347
          ),
363
          ),
348
          new MultiKeyBinding(
364
          new MultiKeyBinding(
Lines 354-374 Link Here
354
              BaseKit.selectionEndLineAction
370
              BaseKit.selectionEndLineAction
355
          ),
371
          ),
356
          new MultiKeyBinding(
372
          new MultiKeyBinding(
357
              KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.CTRL_MASK),
373
              KeyStroke.getKeyStroke(KeyEvent.VK_END, MENU_MASK),
358
              BaseKit.endAction
374
              BaseKit.endAction
359
          ),
375
          ),
360
          new MultiKeyBinding(
376
          new MultiKeyBinding(
361
              KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.SHIFT_MASK | InputEvent.CTRL_MASK),
377
              KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.SHIFT_MASK | MENU_MASK),
362
              BaseKit.selectionEndAction
378
              BaseKit.selectionEndAction
363
          ),
379
          ),
364
380
365
          // clipboard bindings
381
          // clipboard bindings
366
          new MultiKeyBinding(
382
          new MultiKeyBinding(
367
              KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK),
383
              KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK),
368
              BaseKit.copyAction
384
              BaseKit.copyAction
369
          ),
385
          ),
370
          new MultiKeyBinding(
386
          new MultiKeyBinding(
371
              KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, InputEvent.CTRL_MASK),
387
              KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, MENU_MASK),
372
              BaseKit.copyAction
388
              BaseKit.copyAction
373
          ),
389
          ),
374
          new MultiKeyBinding(
390
          new MultiKeyBinding(
Lines 380-386 Link Here
380
              BaseKit.cutAction
396
              BaseKit.cutAction
381
          ),
397
          ),
382
          new MultiKeyBinding(
398
          new MultiKeyBinding(
383
              KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK),
399
              KeyStroke.getKeyStroke(KeyEvent.VK_X, MENU_MASK),
384
              BaseKit.cutAction
400
              BaseKit.cutAction
385
          ),
401
          ),
386
          new MultiKeyBinding(
402
          new MultiKeyBinding(
Lines 388-394 Link Here
388
              BaseKit.cutAction
404
              BaseKit.cutAction
389
          ),
405
          ),
390
          new MultiKeyBinding(
406
          new MultiKeyBinding(
391
              KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK),
407
              KeyStroke.getKeyStroke(KeyEvent.VK_V, MENU_MASK),
392
              BaseKit.pasteAction
408
              BaseKit.pasteAction
393
          ),
409
          ),
394
          new MultiKeyBinding(
410
          new MultiKeyBinding(
Lines 400-412 Link Here
400
              BaseKit.pasteAction
416
              BaseKit.pasteAction
401
          ),
417
          ),
402
          new MultiKeyBinding(
418
          new MultiKeyBinding(
403
              KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
419
              KeyStroke.getKeyStroke(KeyEvent.VK_V, MENU_MASK | InputEvent.SHIFT_MASK),
404
              BaseKit.pasteFormatedAction
420
              BaseKit.pasteFormatedAction
405
          ),
421
          ),
406
422
407
          // undo and redo bindings - handled at system level
423
          // undo and redo bindings - handled at system level
408
          new MultiKeyBinding(
424
          new MultiKeyBinding(
409
              KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK),
425
              KeyStroke.getKeyStroke(KeyEvent.VK_Z, MENU_MASK),
410
              BaseKit.undoAction
426
              BaseKit.undoAction
411
          ),
427
          ),
412
          new MultiKeyBinding(
428
          new MultiKeyBinding(
Lines 414-426 Link Here
414
              BaseKit.undoAction
430
              BaseKit.undoAction
415
          ),
431
          ),
416
          new MultiKeyBinding(
432
          new MultiKeyBinding(
417
              KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK),
433
              KeyStroke.getKeyStroke(KeyEvent.VK_Y, MENU_MASK),
418
              BaseKit.redoAction
434
              BaseKit.redoAction
419
          ),
435
          ),
420
436
421
          // other bindings
437
          // other bindings
422
          new MultiKeyBinding(
438
          new MultiKeyBinding(
423
              KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK),
439
              KeyStroke.getKeyStroke(KeyEvent.VK_A, MENU_MASK),
424
              BaseKit.selectAllAction
440
              BaseKit.selectAllAction
425
          ),
441
          ),
426
          new MultiKeyBinding(
442
          new MultiKeyBinding(
Lines 431-445 Link Here
431
              BaseKit.endWordAction
447
              BaseKit.endWordAction
432
          ),
448
          ),
433
          new MultiKeyBinding(
449
          new MultiKeyBinding(
434
              KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_MASK),
450
              KeyStroke.getKeyStroke(KeyEvent.VK_W, MENU_MASK),
435
              BaseKit.removeWordAction
451
              BaseKit.removeWordAction
436
          ),
452
          ),
437
          new MultiKeyBinding(
453
          new MultiKeyBinding(
438
              KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_MASK),
454
              KeyStroke.getKeyStroke(KeyEvent.VK_U, MENU_MASK),
439
              BaseKit.removeLineBeginAction
455
              BaseKit.removeLineBeginAction
440
          ),
456
          ),
441
          new MultiKeyBinding(
457
          new MultiKeyBinding(
442
              KeyStroke.getKeyStroke(KeyEvent.VK_E, InputEvent.CTRL_MASK),
458
              KeyStroke.getKeyStroke(KeyEvent.VK_E, MENU_MASK),
443
              BaseKit.removeLineAction
459
              BaseKit.removeLineAction
444
          ),
460
          ),
445
          new MultiKeyBinding(
461
          new MultiKeyBinding(
Lines 447-453 Link Here
447
              BaseKit.toggleTypingModeAction
463
              BaseKit.toggleTypingModeAction
448
          ),
464
          ),
449
          new MultiKeyBinding(
465
          new MultiKeyBinding(
450
              KeyStroke.getKeyStroke(KeyEvent.VK_F2, InputEvent.CTRL_MASK),
466
              KeyStroke.getKeyStroke(KeyEvent.VK_F2, MENU_MASK),
451
              BaseKit.toggleBookmarkAction
467
              BaseKit.toggleBookmarkAction
452
          ),
468
          ),
453
          new MultiKeyBinding(
469
          new MultiKeyBinding(
Lines 455-469 Link Here
455
              BaseKit.gotoNextBookmarkAction
471
              BaseKit.gotoNextBookmarkAction
456
          ),
472
          ),
457
          new MultiKeyBinding(
473
          new MultiKeyBinding(
458
              KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0),
474
              KeyStroke.getKeyStroke(FIND_NEXT_KEY, FIND_NEXT_MASK),
459
              BaseKit.findNextAction
475
              BaseKit.findNextAction
460
          ),
476
          ),
461
          new MultiKeyBinding(
477
          new MultiKeyBinding(
462
              KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.SHIFT_MASK),
478
              KeyStroke.getKeyStroke(FIND_NEXT_KEY, FIND_NEXT_MASK | InputEvent.SHIFT_MASK),
463
              BaseKit.findPreviousAction
479
              BaseKit.findPreviousAction
464
          ),
480
          ),
465
          new MultiKeyBinding(
481
          new MultiKeyBinding(
466
              KeyStroke.getKeyStroke(KeyEvent.VK_F3, InputEvent.CTRL_MASK),
482
              KeyStroke.getKeyStroke(FIND_NEXT_KEY, FIND_NEXT_MASK | InputEvent.CTRL_MASK),
467
              BaseKit.findSelectionAction
483
              BaseKit.findSelectionAction
468
          ),
484
          ),
469
          new MultiKeyBinding(
485
          new MultiKeyBinding(
Lines 471-489 Link Here
471
              BaseKit.toggleHighlightSearchAction
487
              BaseKit.toggleHighlightSearchAction
472
          ),
488
          ),
473
          new MultiKeyBinding(
489
          new MultiKeyBinding(
474
              KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_MASK),
490
              KeyStroke.getKeyStroke(KeyEvent.VK_L, MENU_MASK),
475
              BaseKit.wordMatchNextAction
491
              BaseKit.wordMatchNextAction
476
          ),
492
          ),
477
          new MultiKeyBinding(
493
          new MultiKeyBinding(
478
              KeyStroke.getKeyStroke(KeyEvent.VK_K, InputEvent.CTRL_MASK),
494
              KeyStroke.getKeyStroke(KeyEvent.VK_K, MENU_MASK),
479
              BaseKit.wordMatchPrevAction
495
              BaseKit.wordMatchPrevAction
480
          ),
496
          ),
481
          new MultiKeyBinding(
497
          new MultiKeyBinding(
482
              KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_MASK),
498
              KeyStroke.getKeyStroke(KeyEvent.VK_T, MENU_MASK),
483
              BaseKit.shiftLineRightAction
499
              BaseKit.shiftLineRightAction
484
          ),
500
          ),
485
          new MultiKeyBinding(
501
          new MultiKeyBinding(
486
              KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK),
502
              KeyStroke.getKeyStroke(KeyEvent.VK_D, MENU_MASK),
487
              BaseKit.shiftLineLeftAction
503
              BaseKit.shiftLineLeftAction
488
          ),
504
          ),
489
          new MultiKeyBinding(
505
          new MultiKeyBinding(
Lines 491-497 Link Here
491
              BaseKit.abbrevResetAction
507
              BaseKit.abbrevResetAction
492
          ),
508
          ),
493
          new MultiKeyBinding(
509
          new MultiKeyBinding(
494
              KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
510
              KeyStroke.getKeyStroke(KeyEvent.VK_C, MENU_MASK | InputEvent.SHIFT_MASK),
495
              BaseKit.annotationsCyclingAction
511
              BaseKit.annotationsCyclingAction
496
          ),
512
          ),
497
513
Lines 531-537 Link Here
531
          ),
547
          ),
532
548
533
          new MultiKeyBinding(
549
          new MultiKeyBinding(
534
              KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK ),
550
              KeyStroke.getKeyStroke(KeyEvent.VK_F, MENU_MASK | InputEvent.SHIFT_MASK ),
535
              BaseKit.formatAction
551
              BaseKit.formatAction
536
          ),
552
          ),
537
          new MultiKeyBinding(
553
          new MultiKeyBinding(
Lines 577-589 Link Here
577
          ),
593
          ),
578
594
579
          new MultiKeyBinding(
595
          new MultiKeyBinding(
580
              KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_MASK),
596
              KeyStroke.getKeyStroke(KeyEvent.VK_M, MENU_MASK),
581
              BaseKit.selectNextParameterAction
597
              BaseKit.selectNextParameterAction
582
          ),
598
          ),
583
599
584
          new MultiKeyBinding(
600
          new MultiKeyBinding(
585
              new KeyStroke[] {
601
              new KeyStroke[] {
586
                  KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.CTRL_MASK),
602
                  KeyStroke.getKeyStroke(KeyEvent.VK_J, MENU_MASK),
587
                  KeyStroke.getKeyStroke(KeyEvent.VK_S, 0),
603
                  KeyStroke.getKeyStroke(KeyEvent.VK_S, 0),
588
              },
604
              },
589
              BaseKit.startMacroRecordingAction
605
              BaseKit.startMacroRecordingAction
Lines 591-649 Link Here
591
607
592
          new MultiKeyBinding(
608
          new MultiKeyBinding(
593
              new KeyStroke[] {
609
              new KeyStroke[] {
594
                  KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.CTRL_MASK),
610
                  KeyStroke.getKeyStroke(KeyEvent.VK_J, MENU_MASK),
595
                  KeyStroke.getKeyStroke(KeyEvent.VK_E, 0),
611
                  KeyStroke.getKeyStroke(KeyEvent.VK_E, 0),
596
              },
612
              },
597
              BaseKit.stopMacroRecordingAction
613
              BaseKit.stopMacroRecordingAction
598
          ),
614
          ),
599
          
615
          
600
          new MultiKeyBinding(
616
          new MultiKeyBinding(
601
              KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_MASK),
617
              KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, MENU_MASK),
602
              BaseKit.collapseFoldAction
618
              BaseKit.collapseFoldAction
603
          ),
619
          ),
604
620
605
          new MultiKeyBinding(
621
          new MultiKeyBinding(
606
              KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_MASK),
622
              KeyStroke.getKeyStroke(KeyEvent.VK_ADD, MENU_MASK),
607
              BaseKit.expandFoldAction
623
              BaseKit.expandFoldAction
608
          ),
624
          ),
609
          
625
          
610
          new MultiKeyBinding(
626
          new MultiKeyBinding(
611
              KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
627
              KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, MENU_MASK | InputEvent.SHIFT_MASK),
612
              BaseKit.collapseAllFoldsAction
628
              BaseKit.collapseAllFoldsAction
613
          ),
629
          ),
614
          
630
          
615
          new MultiKeyBinding(
631
          new MultiKeyBinding(
616
              KeyStroke.getKeyStroke(KeyEvent.VK_ADD, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
632
              KeyStroke.getKeyStroke(KeyEvent.VK_ADD, MENU_MASK | InputEvent.SHIFT_MASK),
617
              BaseKit.expandAllFoldsAction
633
              BaseKit.expandAllFoldsAction
618
          ),
634
          ),
619
635
620
          new MultiKeyBinding(
636
          new MultiKeyBinding(
621
              KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_MASK),
637
              KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, MENU_MASK),
622
              BaseKit.collapseFoldAction
638
              BaseKit.collapseFoldAction
623
          ),
639
          ),
624
640
625
          new MultiKeyBinding(
641
          new MultiKeyBinding(
626
              KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_MASK),
642
              KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, MENU_MASK),
627
              BaseKit.expandFoldAction
643
              BaseKit.expandFoldAction
628
          ),
644
          ),
629
645
630
          new MultiKeyBinding(
646
          new MultiKeyBinding(
631
              KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, InputEvent.CTRL_MASK),
647
              KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, MENU_MASK),
632
              BaseKit.expandFoldAction
648
              BaseKit.expandFoldAction
633
          ),
649
          ),
634
650
635
          new MultiKeyBinding(
651
          new MultiKeyBinding(
636
              KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
652
              KeyStroke.getKeyStroke(KeyEvent.VK_MINUS, MENU_MASK | InputEvent.SHIFT_MASK),
637
              BaseKit.collapseAllFoldsAction
653
              BaseKit.collapseAllFoldsAction
638
          ),
654
          ),
639
          
655
          
640
          new MultiKeyBinding(
656
          new MultiKeyBinding(
641
              KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
657
              KeyStroke.getKeyStroke(KeyEvent.VK_EQUALS, MENU_MASK | InputEvent.SHIFT_MASK),
642
              BaseKit.expandAllFoldsAction
658
              BaseKit.expandAllFoldsAction
643
          ),
659
          ),
644
          
660
          
645
          new MultiKeyBinding(
661
          new MultiKeyBinding(
646
              KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
662
              KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, MENU_MASK | InputEvent.SHIFT_MASK),
647
              BaseKit.expandAllFoldsAction
663
              BaseKit.expandAllFoldsAction
648
          ),
664
          ),
649
          
665
          
(-)editor/libsrc/org/netbeans/editor/ext/ExtSettingsDefaults.java (-6 / +7 lines)
Lines 72-77 Link Here
72
    public static final Integer defaultJavaDocAutoPopupDelay = new Integer(200);
72
    public static final Integer defaultJavaDocAutoPopupDelay = new Integer(200);
73
    public static final Dimension defaultJavaDocPreferredSize = new Dimension(500, 300);    
73
    public static final Dimension defaultJavaDocPreferredSize = new Dimension(500, 300);    
74
    public static final Boolean defaultJavaDocAutoPopup = Boolean.TRUE;
74
    public static final Boolean defaultJavaDocAutoPopup = Boolean.TRUE;
75
    private static int MENU_MASK = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
75
    
76
    
76
    public static final MultiKeyBinding[] defaultExtKeyBindings
77
    public static final MultiKeyBinding[] defaultExtKeyBindings
77
    = new MultiKeyBinding[] {
78
    = new MultiKeyBinding[] {
Lines 80-86 Link Here
80
              ExtKit.gotoDeclarationAction
81
              ExtKit.gotoDeclarationAction
81
          ),
82
          ),
82
          new MultiKeyBinding(
83
          new MultiKeyBinding(
83
              KeyStroke.getKeyStroke(KeyEvent.VK_F, InputEvent.CTRL_MASK),
84
              KeyStroke.getKeyStroke(KeyEvent.VK_F, MENU_MASK),
84
              ExtKit.findAction
85
              ExtKit.findAction
85
          ),
86
          ),
86
          new MultiKeyBinding(
87
          new MultiKeyBinding(
Lines 88-94 Link Here
88
              ExtKit.findAction
89
              ExtKit.findAction
89
          ),
90
          ),
90
          new MultiKeyBinding(
91
          new MultiKeyBinding(
91
              KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_MASK),
92
              KeyStroke.getKeyStroke(KeyEvent.VK_H, MENU_MASK),
92
              ExtKit.replaceAction
93
              ExtKit.replaceAction
93
          ),
94
          ),
94
          new MultiKeyBinding(
95
          new MultiKeyBinding(
Lines 108-118 Link Here
108
              ExtKit.escapeAction
109
              ExtKit.escapeAction
109
          ),
110
          ),
110
          new MultiKeyBinding(
111
          new MultiKeyBinding(
111
              KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, InputEvent.CTRL_MASK),
112
              KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, MENU_MASK),
112
              ExtKit.matchBraceAction
113
              ExtKit.matchBraceAction
113
          ),
114
          ),
114
          new MultiKeyBinding(
115
          new MultiKeyBinding(
115
              KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
116
              KeyStroke.getKeyStroke(KeyEvent.VK_OPEN_BRACKET, MENU_MASK | InputEvent.SHIFT_MASK),
116
              ExtKit.selectionMatchBraceAction
117
              ExtKit.selectionMatchBraceAction
117
          ),
118
          ),
118
          new MultiKeyBinding(
119
          new MultiKeyBinding(
Lines 120-127 Link Here
120
              ExtKit.showPopupMenuAction
121
              ExtKit.showPopupMenuAction
121
          ),
122
          ),
122
          /*      new MultiKeyBinding(
123
          /*      new MultiKeyBinding(
123
                    KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.CTRL_MASK),
124
                    KeyStroke.getKeyStroke(KeyEvent.VK_U, MENU_MASK),
124
          //          KeyStroke.getKeyStroke(KeyEvent.VK_BRACELEFT, InputEvent.CTRL_MASK),
125
          //          KeyStroke.getKeyStroke(KeyEvent.VK_BRACELEFT, MENU_MASK),
125
                    ExtKit.braceCodeSelectAction
126
                    ExtKit.braceCodeSelectAction
126
                ),
127
                ),
127
          */
128
          */
(-)editor/libsrc/org/netbeans/editor/ext/java/JavaSettingsDefaults.java (-3 / +5 lines)
Lines 154-173 Link Here
154
    }
154
    }
155
155
156
    public static MultiKeyBinding[] getJavaKeyBindings() {
156
    public static MultiKeyBinding[] getJavaKeyBindings() {
157
        int MENU_MASK = java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
158
        
157
        return new MultiKeyBinding[] {
159
        return new MultiKeyBinding[] {
158
                   new MultiKeyBinding(
160
                   new MultiKeyBinding(
159
                       new KeyStroke[] {
161
                       new KeyStroke[] {
160
                           KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.CTRL_MASK),
162
                           KeyStroke.getKeyStroke(KeyEvent.VK_J, MENU_MASK),
161
                           KeyStroke.getKeyStroke(KeyEvent.VK_D, 0)
163
                           KeyStroke.getKeyStroke(KeyEvent.VK_D, 0)
162
                       },
164
                       },
163
                       "macro-debug-var"
165
                       "macro-debug-var"
164
                   ),
166
                   ),
165
                   new MultiKeyBinding(
167
                   new MultiKeyBinding(
166
                       KeyStroke.getKeyStroke(KeyEvent.VK_T, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
168
                       KeyStroke.getKeyStroke(KeyEvent.VK_T, MENU_MASK | InputEvent.SHIFT_MASK),
167
                       ExtKit.commentAction
169
                       ExtKit.commentAction
168
                   ),
170
                   ),
169
                  new MultiKeyBinding(
171
                  new MultiKeyBinding(
170
                      KeyStroke.getKeyStroke(KeyEvent.VK_D, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
172
                      KeyStroke.getKeyStroke(KeyEvent.VK_D, MENU_MASK | InputEvent.SHIFT_MASK),
171
                      ExtKit.uncommentAction
173
                      ExtKit.uncommentAction
172
                  )
174
                  )
173
               };
175
               };
(-)editor/src/org/netbeans/modules/editor/java/NbJavaSettingsInitializer.java (-5 / +7 lines)
Lines 13-18 Link Here
13
13
14
package org.netbeans.modules.editor.java;
14
package org.netbeans.modules.editor.java;
15
15
16
import java.awt.Toolkit;
16
import java.awt.event.KeyEvent;
17
import java.awt.event.KeyEvent;
17
import java.awt.event.InputEvent;
18
import java.awt.event.InputEvent;
18
import java.util.Map;
19
import java.util.Map;
Lines 98-103 Link Here
98
    }
99
    }
99
100
100
    public MultiKeyBinding[] getJavaKeyBindings() {
101
    public MultiKeyBinding[] getJavaKeyBindings() {
102
        int mask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
101
        return new MultiKeyBinding[] {
103
        return new MultiKeyBinding[] {
102
                   new MultiKeyBinding(
104
                   new MultiKeyBinding(
103
                       new KeyStroke[] {
105
                       new KeyStroke[] {
Lines 127-133 Link Here
127
                   ),
129
                   ),
128
                   new MultiKeyBinding(
130
                   new MultiKeyBinding(
129
                       KeyStroke.getKeyStroke(KeyEvent.VK_B,
131
                       KeyStroke.getKeyStroke(KeyEvent.VK_B,
130
                           InputEvent.CTRL_MASK),
132
                           mask),
131
                       JavaKit.gotoSuperImplementationAction
133
                       JavaKit.gotoSuperImplementationAction
132
                   ),
134
                   ),
133
                   new MultiKeyBinding(
135
                   new MultiKeyBinding(
Lines 137-161 Link Here
137
                   ),
139
                   ),
138
//                   new MultiKeyBinding(
140
//                   new MultiKeyBinding(
139
//                       KeyStroke.getKeyStroke(KeyEvent.VK_S,
141
//                       KeyStroke.getKeyStroke(KeyEvent.VK_S,
140
//                           InputEvent.ALT_MASK | InputEvent.CTRL_MASK),
142
//                           InputEvent.ALT_MASK | mask),
141
//                       JavaKit.tryCatchAction
143
//                       JavaKit.tryCatchAction
142
//                       ),
144
//                       ),
143
145
144
                   new MultiKeyBinding(
146
                   new MultiKeyBinding(
145
                       KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,
147
                       KeyStroke.getKeyStroke(KeyEvent.VK_SPACE,
146
                           InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK),
148
                           mask | InputEvent.SHIFT_MASK),
147
                       JavaKit.javaDocShowAction
149
                       JavaKit.javaDocShowAction
148
                   ),
150
                   ),
149
                   
151
                   
150
                   new MultiKeyBinding(
152
                   new MultiKeyBinding(
151
                       KeyStroke.getKeyStroke(KeyEvent.VK_A,
153
                       KeyStroke.getKeyStroke(KeyEvent.VK_A,
152
                           InputEvent.CTRL_MASK | InputEvent.ALT_MASK),
154
                           mask | InputEvent.ALT_MASK),
153
                       JavaKit.selectNextElementAction
155
                       JavaKit.selectNextElementAction
154
                   ),
156
                   ),
155
                   
157
                   
156
                   new MultiKeyBinding(
158
                   new MultiKeyBinding(
157
                       KeyStroke.getKeyStroke(KeyEvent.VK_A,
159
                       KeyStroke.getKeyStroke(KeyEvent.VK_A,
158
                           InputEvent.CTRL_MASK | InputEvent.ALT_MASK | InputEvent.SHIFT_MASK),
160
                           mask | InputEvent.ALT_MASK | InputEvent.SHIFT_MASK),
159
                       JavaKit.selectPreviousElementAction
161
                       JavaKit.selectPreviousElementAction
160
                   )
162
                   )
161
                   
163
                   

Return to bug 46811