boolean (final Match match, final PsiMethod method) { if (!method.hasModifierProperty(PsiModifier.STATIC)) { final PsiExpression instanceExpression = match.getInstanceExpression(); if (instanceExpression != null) return false; if (isExternal(match, method)) return true; final PsiElement matchStart = match.getMatchStart(); final PsiClass containingClass = method.getContainingClass(); if (PsiTreeUtil.isAncestor(containingClass, matchStart, false)) { if (CommonJavaRefactoringUtil.isInStaticContext(matchStart, containingClass)) return true; } else { PsiClass psiClass = PsiTreeUtil.getParentOfType(matchStart, PsiClass.class); while (psiClass != null) { if (InheritanceUtil.isInheritorOrSelf(psiClass, containingClass, true)) { if (CommonJavaRefactoringUtil.isInStaticContext(matchStart, psiClass)) return true; break; } psiClass = PsiTreeUtil.getParentOfType(psiClass, PsiClass.class); } } } return false; }