void () { // we have to do this in dispatch thread, because ConsoleViewImpl can flush something to document otherwise myOriginalDocument = getOriginalDocument(); if (myOriginalDocument != null) { final Editor editor = getEditor(); LOG.assertTrue(editor != null); final Document document = editor.getDocument(); final int caretOffset = editor.getCaretModel().getOffset(); myLineUnderSelection = null; myLineOffset = -1; if (caretOffset > -1 && caretOffset < document.getTextLength()) { int line; try { line = document.getLineNumber(caretOffset); } catch (IllegalStateException e) { throw new IllegalStateException("document.length=" + document.getTextLength() + ", caret offset = " + caretOffset + "; " + e.getMessage(), e); } if (line > -1 && line < document.getLineCount()) { final int startOffset = document.getLineStartOffset(line); myLineUnderSelection = document.getText().substring(startOffset, document.getLineEndOffset(line)); myLineOffset = caretOffset - startOffset; } } } ApplicationManager.getApplication().executeOnPooledThread(() -> doFilter()); }