PsiType (@NotNull PsiElement element) { PsiExpression expression = ObjectUtils.tryCast(element, PsiExpression.class); PsiReferenceExpression referenceExpression = ObjectUtils.tryCast(PsiUtil.skipParenthesizedExprDown(expression), PsiReferenceExpression.class); if (referenceExpression == null) return null; PsiEnumConstant enumConstant = ObjectUtils.tryCast(referenceExpression.resolve(), PsiEnumConstant.class); if (enumConstant == null) return null; return referenceExpression.getType(); }