Пример #1
0
 private static boolean isAcceptedByFilters(
     @NotNull HighlightInfo info, @Nullable PsiElement psiElement) {
   PsiFile file = psiElement == null ? null : psiElement.getContainingFile();
   for (HighlightInfoFilter filter : FILTERS) {
     if (!filter.accept(info, file)) {
       return false;
     }
   }
   info.psiElement = psiElement;
   return true;
 }
Пример #2
0
    @Nullable
    @Override
    public HighlightInfo create() {
      HighlightInfo info = createUnconditionally();
      LOG.assertTrue(
          psiElement != null
              || severity == HighlightInfoType.SYMBOL_TYPE_SEVERITY
              || severity == HighlightInfoType.INJECTED_FRAGMENT_SEVERITY
              || ArrayUtilRt.find(HighlightSeverity.DEFAULT_SEVERITIES, severity) != -1,
          "Custom type demands element to detect its text attributes");

      PsiFile file = psiElement == null ? null : psiElement.getContainingFile();
      for (HighlightInfoFilter filter : getFilters()) {
        if (!filter.accept(info, file)) {
          return null;
        }
      }

      return info;
    }
Пример #3
0
 /**
  * @deprecated To be removed in idea 13. Use {@link
  *     HighlightInfo#newHighlightInfo(HighlightInfoType)} instead.
  */
 @Deprecated
 @Nullable
 public static HighlightInfo createHighlightInfo(
     @NotNull HighlightInfoType type,
     @Nullable PsiElement element,
     int start,
     int end,
     @Nullable String description,
     @Nullable String toolTip,
     boolean isEndOfLine,
     @Nullable TextAttributes forcedAttributes) {
   LOG.assertTrue(
       element != null
           || ArrayUtilRt.find(HighlightSeverity.DEFAULT_SEVERITIES, type.getSeverity(element))
               != -1,
       "Custom type demands element to detect its text attributes");
   HighlightInfo highlightInfo =
       new HighlightInfo(
           forcedAttributes,
           null,
           type,
           start,
           end,
           description,
           toolTip,
           type.getSeverity(element),
           isEndOfLine,
           null,
           false,
           0);
   PsiFile file = element == null ? null : element.getContainingFile();
   for (HighlightInfoFilter filter : getFilters()) {
     if (!filter.accept(highlightInfo, file)) {
       return null;
     }
   }
   return highlightInfo;
 }