void (boolean brokenOff) { if (isDisposed()) return; if (getEditor() != null) { getEditor().getSelectionModel().removeSelection(); } if (brokenOff && skipSettingFinalEditorState()) return; int endSegmentNumber = getFinalSegmentNumber(); int offset = -1; if (endSegmentNumber >= 0) { offset = getSegments().getSegmentStart(endSegmentNumber); } else { if (!getTemplate().isSelectionTemplate() && !getTemplate().isInline()) { //do not move caret to the end of range for selection templates offset = myTemplateRange.getEndOffset(); } } if (!isInteractiveModeSupported() && getCurrentVariableNumber() > -1) { offset = -1; //do not move caret in multicaret mode if at least one tab had been made already } if (offset >= 0) { getEditor().getCaretModel().moveToOffset(offset); getEditor().getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } int selStart = getTemplate().getSelectionStartSegmentNumber(); int selEnd = getTemplate().getSelectionEndSegmentNumber(); if (selStart >= 0 && selEnd >= 0) { getEditor().getSelectionModel().setSelection(getSegments().getSegmentStart(selStart), getSegments().getSegmentStart(selEnd)); } }