Editor (@NotNull VirtualFile file) { Project project = getProject(); FileEditorManager fileEditorManager = FileEditorManager.getInstance(project); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); Editor editor = fileEditorManager.openTextEditor(new OpenFileDescriptor(project, file), false); // to make UIUtil.hasFocus return true to make ShowAutoImportPass.showImports work UIUtil.markAsFocused(editor.getContentComponent(), true); DaemonCodeAnalyzer.getInstance(getProject()).restart(); return editor; }