PsiElement (@NotNull PsiElement element) { if (element instanceof PsiAssignmentExpression) { PsiExpression target = PsiUtil.skipParenthesizedExprDown(((PsiAssignmentExpression)element).getLExpression()); return ObjectUtils.tryCast(target, PsiReferenceExpression.class); } if (element instanceof PsiUnaryExpression) { PsiExpression target = PsiUtil.skipParenthesizedExprDown(((PsiUnaryExpression)element).getOperand()); return ObjectUtils.tryCast(target, PsiReferenceExpression.class); } if (element instanceof PsiDeclarationStatement) { //should not happen return element; } return null; }