private static String getConstantValueText(Object value, @Nullable PsiVariable constant) {
    if (constant != null) {
      return constant instanceof PsiMember
          ? PsiUtil.getMemberQualifiedName((PsiMember) constant)
          : constant.getName();
    }

    return value instanceof String
        ? "\"" + StringUtil.escapeStringCharacters((String) value) + "\""
        : String.valueOf(value);
  }
  public static boolean isInExcludedPackage(
      @NotNull final PsiMember member, boolean allowInstanceInnerClasses) {
    final String name = PsiUtil.getMemberQualifiedName(member);
    if (name == null) return false;

    if (!member.hasModifierProperty(PsiModifier.STATIC)) {
      if (member instanceof PsiMethod || member instanceof PsiField) {
        return false;
      }
      if (allowInstanceInnerClasses
          && member instanceof PsiClass
          && member.getContainingClass() != null) {
        return false;
      }
    }

    return ProjectCodeInsightSettings.getSettings(member.getProject()).isExcluded(name);
  }
Example #3
0
 private static boolean isJavaUtilMethod(PsiMethod method) {
   String name = PsiUtil.getMemberQualifiedName(method);
   return name != null && name.startsWith("java.util.");
 }
Example #4
0
 public static boolean isExcluded(PsiMember method) {
   String name = PsiUtil.getMemberQualifiedName(method);
   return name != null
       && JavaProjectCodeInsightSettings.getSettings(method.getProject()).isExcluded(name);
 }