Editor (@NotNull VirtualFile file) { final FileEditorManager instance = FileEditorManager.getInstance(myProject); if (file.getFileType().isBinary()) return null; PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); Editor editor = instance.openTextEditor(new OpenFileDescriptor(myProject, file, 0), false); ((EditorImpl)editor).setCaretActive(); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); DaemonCodeAnalyzer.getInstance(getProject()).restart(); return editor; }