void (boolean moveToEnd) { Caret caret = getCaretModel().getCurrentCaret(); caret.selectLineAtCaret(); setMouseSelectionState(MOUSE_SELECTION_STATE_LINE_SELECTED); mySavedSelectionStart = caret.getSelectionStart(); mySavedSelectionEnd = caret.getSelectionEnd(); if (moveToEnd) { caret.moveToOffset(mySavedSelectionEnd); } }