void (@NotNull Project project, PsiElement @NotNull [] elements, DataContext dataContext) { LOG.assertTrue(elements.length >= 1 && elements[0] instanceof PsiExpression, "incorrect invoke() parameters"); final PsiElement tempExpr = elements[0]; final Editor editor; if (dataContext != null) { final Editor editorFromDC = CommonDataKeys.EDITOR.getData(dataContext); final PsiFile cachedPsiFile = editorFromDC != null ? PsiDocumentManager.getInstance(project).getCachedPsiFile(editorFromDC.getDocument()) : null; if (PsiTreeUtil.isAncestor(cachedPsiFile, tempExpr, false)) { editor = editorFromDC; } else { editor = null; } } else { editor = null; } invoke(project, tempExpr, editor); }