void (FileAnnotation annotation, VirtualFile file, AbstractVcs vcs, int line) { TextEditor textFileEditor; FileEditor fileEditor = FileEditorManager.getInstance(myProject).getSelectedEditor(file); if (fileEditor instanceof TextEditor) { textFileEditor = ((TextEditor)fileEditor); } else { FileEditor[] editors = FileEditorManager.getInstance(myProject).getEditors(file); textFileEditor = ContainerUtil.findInstance(editors, TextEditor.class); } Editor editor; if (textFileEditor != null) { editor = textFileEditor.getEditor(); } else { OpenFileDescriptor openFileDescriptor = new OpenFileDescriptor(myProject, file, line, 0); editor = FileEditorManager.getInstance(myProject).openTextEditor(openFileDescriptor, true); } if (editor == null) { Messages.showMessageDialog(VcsBundle.message("message.text.cannot.open.editor", file.getPresentableUrl()), VcsBundle.message("message.title.cannot.open.editor"), Messages.getInformationIcon()); return; } AnnotateToggleAction.doAnnotate(editor, myProject, annotation, vcs); }