@NonNls
 private static String computeConstantBooleanText(PsiExpression expression) {
   if (!(expression instanceof PsiReferenceExpression)) {
     return null;
   }
   final PsiReferenceExpression referenceExpression = (PsiReferenceExpression) expression;
   final PsiElement target = referenceExpression.resolve();
   if (!(target instanceof PsiField)) {
     return null;
   }
   final PsiField field = (PsiField) target;
   final PsiClass containingClass = field.getContainingClass();
   if (containingClass == null) {
     return null;
   }
   final String qualifiedName = containingClass.getQualifiedName();
   if (!CommonClassNames.JAVA_LANG_BOOLEAN.equals(qualifiedName)) {
     return null;
   }
   @NonNls final String name = field.getName();
   if ("TRUE".equals(name)) {
     return "true";
   } else if ("FALSE".equals(name)) {
     return "false";
   } else {
     return null;
   }
 }
Пример #2
0
 private static boolean isBoolean(@Nullable PsiType propertyType) {
   return PsiType.BOOLEAN.equals(propertyType)
       || propertyType != null
           && CommonClassNames.JAVA_LANG_BOOLEAN.equals(propertyType.getCanonicalText());
 }