boolean (int start, int end) { for (Editor activeEditor : getActiveEditors(document)) { for (Caret caret : activeEditor.getCaretModel().getAllCarets()) { int offset = caret.getOffset(); if (offset >= start && offset <= end) return true; } } return false; }