当前位置: 首页>>代码示例>>Java>>正文


Java HighlightDisplayLevel.ERROR属性代码示例

本文整理汇总了Java中com.intellij.codeHighlighting.HighlightDisplayLevel.ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java HighlightDisplayLevel.ERROR属性的具体用法?Java HighlightDisplayLevel.ERROR怎么用?Java HighlightDisplayLevel.ERROR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.codeHighlighting.HighlightDisplayLevel的用法示例。


在下文中一共展示了HighlightDisplayLevel.ERROR属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCategoryByHighlightDisplayLevel

public CompilerMessageCategory getCategoryByHighlightDisplayLevel(@NotNull final HighlightDisplayLevel severity,
                                                                  @NotNull final VirtualFile virtualFile,
                                                                  @NotNull final CompileContext context) {
  if (severity == HighlightDisplayLevel.ERROR) return CompilerMessageCategory.ERROR;
  if (severity == HighlightDisplayLevel.WARNING) return CompilerMessageCategory.WARNING;
  return CompilerMessageCategory.INFORMATION;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:InspectionValidator.java

示例2: runXmlFileSchemaValidation

private Map<ProblemDescriptor, HighlightDisplayLevel> runXmlFileSchemaValidation(@NotNull XmlFile xmlFile) {
  final AnnotationHolderImpl holder = new AnnotationHolderImpl(new AnnotationSession(xmlFile));

  final List<ExternalAnnotator> annotators = ExternalLanguageAnnotators.allForFile(StdLanguages.XML, xmlFile);
  for (ExternalAnnotator<?, ?> annotator : annotators) {
    processAnnotator(xmlFile, holder, annotator);
  }

  if (!holder.hasAnnotations()) return Collections.emptyMap();

  Map<ProblemDescriptor, HighlightDisplayLevel> problemsMap = new LinkedHashMap<ProblemDescriptor, HighlightDisplayLevel>();
  for (final Annotation annotation : holder) {
    final HighlightInfo info = HighlightInfo.fromAnnotation(annotation);
    if (info.getSeverity() == HighlightSeverity.INFORMATION) continue;

    final PsiElement startElement = xmlFile.findElementAt(info.startOffset);
    final PsiElement endElement = info.startOffset == info.endOffset ? startElement : xmlFile.findElementAt(info.endOffset - 1);
    if (startElement == null || endElement == null) continue;

    final ProblemDescriptor descriptor =
      myInspectionManager.createProblemDescriptor(startElement, endElement, info.getDescription(), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
                                                  false);
    final HighlightDisplayLevel level = info.getSeverity() == HighlightSeverity.ERROR? HighlightDisplayLevel.ERROR: HighlightDisplayLevel.WARNING;
    problemsMap.put(descriptor, level);
  }
  return problemsMap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:InspectionValidatorWrapper.java

示例3: apply

@Override
public void apply(@NotNull PsiFile file, MyInfo[] infos, @NotNull AnnotationHolder holder) {
  if (infos == null || infos.length == 0) {
    return;
  }

  final HighlightDisplayLevel displayLevel = getHighlightDisplayLevel(file);

  for (MyInfo info : infos) {
    if (!info.myResult) {
      final PsiElement element = info.myAnchor.retrieve();
      if (element != null) {
        final int start = element.getTextRange().getStartOffset();
        final TextRange range = new TextRange(start + info.myRangeInElement.getStartOffset(),
                                              start + info.myRangeInElement.getEndOffset());
        final String message = getErrorMessage(info.myUrl);

        final Annotation annotation;

        if (displayLevel == HighlightDisplayLevel.ERROR) {
          annotation = holder.createErrorAnnotation(range, message);
        }
        else if (displayLevel == HighlightDisplayLevel.WARNING) {
          annotation = holder.createWarningAnnotation(range, message);
        }
        else if (displayLevel == HighlightDisplayLevel.WEAK_WARNING) {
          annotation = holder.createInfoAnnotation(range, message);
        }
        else {
          annotation = holder.createWarningAnnotation(range, message);
        }

        for (IntentionAction action : getQuickFixes()) {
          annotation.registerFix(action);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:WebReferencesAnnotatorBase.java

示例4: createAnnotationForRef

@Nullable
private static HighlightInfo createAnnotationForRef(@NotNull GrReferenceElement ref,
                                                    boolean strongError,
                                                    @NotNull String message) {
  HighlightDisplayLevel displayLevel = strongError ? HighlightDisplayLevel.ERROR : GrUnresolvedAccessInspection.getHighlightDisplayLevel(ref.getProject(), ref);
  return GrInspectionUtil.createAnnotationForRef(ref, displayLevel, message);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GrUnresolvedAccessChecker.java

示例5: showHint

private void showHint() {
  if (!myComponent.isShowing() || !IJSwingUtilities.hasFocus(myComponent)) {
    hideHint();
    return;
  }

  // 1. Hide previous hint (if any)
  hideHint();

  // 2. Found error (if any)
  List<ErrorInfo> infos = getErrorInfos();
  if (!ErrorInfo.haveFixes(infos)) {
    hideHint();
    return;
  }

  boolean error = false;
  for (ErrorInfo errorInfo : infos) {
    if (errorInfo.getLevel() == HighlightDisplayLevel.ERROR) {
      error = true;
      break;
    }
  }

  // 3. Determine position where this hint should be shown
  Rectangle bounds = getErrorBounds();
  if (bounds == null) {
    return;
  }

  // 4. Show light bulb to fix this error
  myHint = new LightweightHint(new InspectionHint(error ? AllIcons.Actions.QuickfixBulb : AllIcons.Actions.IntentionBulb));
  myLastHintBounds = bounds;
  myHint.show(myComponent, bounds.x - AllIcons.Actions.IntentionBulb.getIconWidth() - 4, bounds.y, myComponent, new HintHint(myComponent, bounds.getLocation()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:AbstractQuickFixManager.java

示例6: getDefaultLevel

@Override
@NotNull
public HighlightDisplayLevel getDefaultLevel() {
  return HighlightDisplayLevel.ERROR;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:JavaDocReferenceInspectionBase.java

示例7: getDefaultLevel

@NotNull
public HighlightDisplayLevel getDefaultLevel() {
  return HighlightDisplayLevel.ERROR;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:UnknownLanguageID.java

示例8: getDefaultLevel

@NotNull
@Override
public HighlightDisplayLevel getDefaultLevel() {
  return HighlightDisplayLevel.ERROR;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DefaultHighlightVisitorBasedInspection.java

示例9: getDefaultLevel

@NotNull
public HighlightDisplayLevel getDefaultLevel() {
    return HighlightDisplayLevel.ERROR;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TemplateInvocationInspection.java


注:本文中的com.intellij.codeHighlighting.HighlightDisplayLevel.ERROR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。