boolean (PsiElement element, Editor editor) { if (canInlineElement(element)) { PsiReference reference = editor != null ? TargetElementUtil.findReference(editor, editor.getCaretModel().getOffset()) : null; if (!InlineMethodHandler.isThisReference(reference)) { if (element instanceof PsiMethod && reference != null) { final PsiElement referenceElement = reference.getElement(); return !PsiTreeUtil.isAncestor(((PsiMethod)element).getContainingClass(), referenceElement, false); } return true; } } return false; }