void (VirtualFile file, final int startOffset, final int endOffset, final boolean toSelectLine, final boolean toUseNormalSelection) { releaseAll(); final TextRange textRange; if (file instanceof VirtualFileWindow) { DocumentWindow documentWindow = ((VirtualFileWindow)file).getDocumentWindow(); textRange = documentWindow.injectedToHost(new TextRange(startOffset, endOffset)); file = ((VirtualFileWindow)file).getDelegate(); } else { textRange = new ProperTextRange(startOffset, endOffset); } openEditor(file, endOffset); final Editor editor = openEditor(file, textRange.getStartOffset()); SwingUtilities.invokeLater(() -> { if (editor != null && !editor.isDisposed()) { doSelect(toUseNormalSelection, editor, toSelectLine, textRange); } }); }