boolean () { for(PsiElement element: myElements) { final PsiExpressionStatement statement = PsiTreeUtil.getParentOfType(element, PsiExpressionStatement.class); if (statement != null && JavaHighlightUtil.isSuperOrThisCall(statement, true, true)) { return true; } } PsiElement codeFragmentMember = myCodeFragmentMember; while (codeFragmentMember != null && PsiTreeUtil.isAncestor(myTargetClass, codeFragmentMember, true)) { if (codeFragmentMember instanceof PsiModifierListOwner && ((PsiModifierListOwner)codeFragmentMember).hasModifierProperty(PsiModifier.STATIC)) { return true; } codeFragmentMember = PsiTreeUtil.getParentOfType(codeFragmentMember, PsiModifierListOwner.class, true); } return false; }