boolean (PsiElement element) { final PsiElement context = PsiTreeUtil.getParentOfType(element, GrMethod.class, GrSynchronizedStatement.class); if (context instanceof GrSynchronizedStatement) { return true; } if (context != null) { final PsiModifierListOwner modifierListOwner = (PsiModifierListOwner) context; if (modifierListOwner.hasModifierProperty( PsiModifier.SYNCHRONIZED)) { return true; } } return false; }