src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java

Print this page




 512                     unifiedList.add(key);
 513                     unifiedList.add(value);
 514                 } else {
 515                     unifiedList.set(keyIndex, key);
 516                     unifiedList.set(keyIndex + 1, value);
 517                 }
 518             }
 519         }
 520     }
 521 
 522     void installAquaUpDownActions(final JTextComponent component) {
 523         final ActionMap actionMap = component.getActionMap();
 524         actionMap.put(upMultilineAction, moveUpMultilineAction);
 525         actionMap.put(downMultilineAction, moveDownMultilineAction);
 526         actionMap.put(pageUpMultiline, pageUpMultilineAction);
 527         actionMap.put(pageDownMultiline, pageDownMultilineAction);
 528     }
 529 
 530     // extracted and adapted from DefaultEditorKit in 1.6
 531     @SuppressWarnings("serial") // Superclass is not serializable across versions
 532     static abstract class DeleteWordAction extends TextAction {
 533         public DeleteWordAction(final String name) { super(name); }
 534 
 535         public void actionPerformed(final ActionEvent e) {
 536             if (e == null) return;
 537 
 538             final JTextComponent target = getTextComponent(e);
 539             if (target == null) return;
 540 
 541             if (!target.isEditable() || !target.isEnabled()) {
 542                 UIManager.getLookAndFeel().provideErrorFeedback(target);
 543                 return;
 544             }
 545 
 546             try {
 547                 final int start = target.getSelectionStart();
 548                 final Element line = Utilities.getParagraphElement(target, start);
 549                 final int end = getEnd(target, line, start);
 550 
 551                 final int offs = Math.min(start, end);
 552                 final int len = Math.abs(end - start);




 512                     unifiedList.add(key);
 513                     unifiedList.add(value);
 514                 } else {
 515                     unifiedList.set(keyIndex, key);
 516                     unifiedList.set(keyIndex + 1, value);
 517                 }
 518             }
 519         }
 520     }
 521 
 522     void installAquaUpDownActions(final JTextComponent component) {
 523         final ActionMap actionMap = component.getActionMap();
 524         actionMap.put(upMultilineAction, moveUpMultilineAction);
 525         actionMap.put(downMultilineAction, moveDownMultilineAction);
 526         actionMap.put(pageUpMultiline, pageUpMultilineAction);
 527         actionMap.put(pageDownMultiline, pageDownMultilineAction);
 528     }
 529 
 530     // extracted and adapted from DefaultEditorKit in 1.6
 531     @SuppressWarnings("serial") // Superclass is not serializable across versions
 532     abstract static class DeleteWordAction extends TextAction {
 533         public DeleteWordAction(final String name) { super(name); }
 534 
 535         public void actionPerformed(final ActionEvent e) {
 536             if (e == null) return;
 537 
 538             final JTextComponent target = getTextComponent(e);
 539             if (target == null) return;
 540 
 541             if (!target.isEditable() || !target.isEnabled()) {
 542                 UIManager.getLookAndFeel().provideErrorFeedback(target);
 543                 return;
 544             }
 545 
 546             try {
 547                 final int start = target.getSelectionStart();
 548                 final Element line = Utilities.getParagraphElement(target, start);
 549                 final int end = getEnd(target, line, start);
 550 
 551                 final int offs = Math.min(start, end);
 552                 final int len = Math.abs(end - start);