boolean (Match match) { PsiClass matchClass = PsiTreeUtil.getParentOfType(match.getMatchStart(), PsiClass.class); PsiClass psiClass = PsiTreeUtil.getParentOfType(myExtractedMethod, PsiClass.class); return matchClass != null && PsiTreeUtil.isAncestor(psiClass, matchClass, false); }