Editor (@NotNull PsiElement element) { final Project project = element.getProject(); final Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor(); if (editor != null && editor.getDocument() == PsiDocumentManager.getInstance(project).getDocument(element.getContainingFile())) { return editor; } return null; }