FileEditor (@NotNull PsiElement element, boolean switchToText, boolean focusEditor) { PsiFile file; int offset; if (element instanceof PsiFile){ file = (PsiFile)element; offset = -1; } else{ file = element.getContainingFile(); offset = element.getTextOffset(); } if (file == null) return null;//SCR44414 VirtualFile virtualFile = file.getVirtualFile(); if (virtualFile == null) return null; OpenFileDescriptor descriptor = new OpenFileDescriptor(element.getProject(), virtualFile, offset); Project project = element.getProject(); if (offset == -1 && !switchToText) { FileEditorManager.getInstance(project).openEditor(descriptor, focusEditor); } else { FileEditorManager.getInstance(project).openTextEditor(descriptor, focusEditor); } return FileEditorManager.getInstance(project).getSelectedEditor(virtualFile); }