Example usage for javax.swing.text DefaultEditorKit selectionEndLineAction

List of usage examples for javax.swing.text DefaultEditorKit selectionEndLineAction

Introduction

In this page you can find the example usage for javax.swing.text DefaultEditorKit selectionEndLineAction.

Prototype

String selectionEndLineAction

To view the source code for javax.swing.text DefaultEditorKit selectionEndLineAction.

Click Source Link

Document

Name of the Action for moving the caret to the end of a line, extending the selection.

Usage

From source file:com.hp.alm.ali.idea.ui.editor.field.HTMLAreaField.java

public static void installNavigationShortCuts(final JTextPane desc) {
    Keymap keymap = KeymapManager.getInstance().getActiveKeymap();
    new AnAction() {
        public void actionPerformed(AnActionEvent e) {
            // default action moves to the end of the document - override
            desc.getActionMap().get(DefaultEditorKit.endLineAction).actionPerformed(null);
        }//from   w ww. j a va  2s.  c o  m
    }.registerCustomShortcutSet(
            new CustomShortcutSet(keymap.getShortcuts(IdeActions.ACTION_EDITOR_MOVE_LINE_END)), desc);
    new AnAction() {
        public void actionPerformed(AnActionEvent e) {
            // default action moves to the beginning of the document - override
            desc.getActionMap().get(DefaultEditorKit.beginLineAction).actionPerformed(null);
        }
    }.registerCustomShortcutSet(
            new CustomShortcutSet(keymap.getShortcuts(IdeActions.ACTION_EDITOR_MOVE_LINE_START)), desc);
    new AnAction() {
        public void actionPerformed(AnActionEvent e) {
            // default action moves to the end of the document - override
            desc.getActionMap().get(DefaultEditorKit.selectionEndLineAction).actionPerformed(null);
        }
    }.registerCustomShortcutSet(
            new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.SHIFT_MASK)), desc);
    new AnAction() {
        public void actionPerformed(AnActionEvent e) {
            // default action moves to the beginning of the document - override
            desc.getActionMap().get(DefaultEditorKit.selectionBeginLineAction).actionPerformed(null);
        }
    }.registerCustomShortcutSet(
            new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.SHIFT_MASK)), desc);
    new AnAction() {
        public void actionPerformed(AnActionEvent e) {
            // when editing html insert hard break
            new InsertHardBreakAction().actionPerformed(null);
        }
    }.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)), desc);
}