boolean (Object o1, Object o2) { if (o1 instanceof PsiField && o2 instanceof PsiField && !o1.equals(o2)) { PsiClass clazz = ((PsiField)o1).getContainingClass(); return clazz != null && clazz == ((PsiField)o2).getContainingClass(); } return false; }