Access (@NotNull final PsiElement expression) { if (!(expression instanceof PsiExpression)) { if (expression instanceof PsiNameValuePair || expression instanceof PsiIdentifier) { return Access.Write; } return Access.Read; } PsiExpression expr = (PsiExpression) expression; boolean readAccess = PsiUtil.isAccessedForReading(expr); boolean writeAccess = PsiUtil.isAccessedForWriting(expr); if (!writeAccess && expr instanceof PsiReferenceExpression) { //when searching usages of fields, should show all found setters as a "only write usage" PsiElement actualReferee = ((PsiReferenceExpression) expr).resolve(); if (actualReferee instanceof PsiMethod && PropertyUtilBase.isSimplePropertySetter((PsiMethod)actualReferee)) { writeAccess = true; readAccess = false; } } if (writeAccess && readAccess) return Access.ReadWrite; return writeAccess ? Access.Write : Access.Read; }