Editor (PsiElement element, @NotNull Project project) { Editor editor = null; if (findInjectionHost(element) != null) { editor = InjectedLanguageUtil.openEditorFor(element.getContainingFile(), project); } if (editor == null) { editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); } if (editor == null) { editor = PsiEditorUtil.findEditor(element); } return editor; }