Beispiel #1
0
  public static void showInfoTooltip(
      @NotNull final HighlightInfo info,
      final Editor editor,
      final int defaultOffset,
      final int currentWidth) {
    if (info.toolTip == null || info.getSeverity() == HighlightSeverity.INFORMATION) return;
    Rectangle visibleArea = editor.getScrollingModel().getVisibleArea();
    int endOffset = info.highlighter.getEndOffset();
    int startOffset = info.highlighter.getStartOffset();

    Point top = editor.logicalPositionToXY(editor.offsetToLogicalPosition(startOffset));
    Point bottom = editor.logicalPositionToXY(editor.offsetToLogicalPosition(endOffset));

    Point bestPoint = new Point(top.x, bottom.y + editor.getLineHeight());

    if (!visibleArea.contains(bestPoint)) {
      bestPoint = editor.logicalPositionToXY(editor.offsetToLogicalPosition(defaultOffset));
    }

    Point p =
        SwingUtilities.convertPoint(
            editor.getContentComponent(),
            bestPoint,
            editor.getComponent().getRootPane().getLayeredPane());
    TooltipController.getInstance()
        .showTooltip(editor, p, info.toolTip, currentWidth, false, DAEMON_INFO_GROUP);
  }
 private void incErrorCount(RangeHighlighter highlighter, int delta) {
   Object o = highlighter.getErrorStripeTooltip();
   if (!(o instanceof HighlightInfo)) return;
   HighlightInfo info = (HighlightInfo) o;
   HighlightSeverity infoSeverity = info.getSeverity();
   final int severityIdx = mySeverityRegistrar.getSeverityIdx(infoSeverity);
   if (severityIdx != -1) {
     errorCount[severityIdx] += delta;
   }
 }
  public boolean equalsByActualOffset(@NotNull HighlightInfo info) {
    if (info == this) return true;

    return info.getSeverity() == getSeverity()
        && info.getActualStartOffset() == getActualStartOffset()
        && info.getActualEndOffset() == getActualEndOffset()
        && Comparing.equal(info.type, type)
        && Comparing.equal(info.gutterIconRenderer, gutterIconRenderer)
        && Comparing.equal(info.forcedTextAttributes, forcedTextAttributes)
        && Comparing.equal(info.forcedTextAttributesKey, forcedTextAttributesKey)
        && Comparing.strEqual(info.getDescription(), getDescription());
  }
 private static List<Problem> convertToProblems(
     final Collection<HighlightInfo> infos,
     final VirtualFile file,
     final boolean hasErrorElement) {
   List<Problem> problems = new SmartList<Problem>();
   for (HighlightInfo info : infos) {
     if (info.getSeverity() == HighlightSeverity.ERROR) {
       Problem problem = new ProblemImpl(file, info, hasErrorElement);
       problems.add(problem);
     }
   }
   return problems;
 }
  public boolean equals(Object obj) {
    if (obj == this) return true;
    if (!(obj instanceof HighlightInfo)) return false;
    HighlightInfo info = (HighlightInfo) obj;

    return info.getSeverity() == getSeverity()
        && info.startOffset == startOffset
        && info.endOffset == endOffset
        && Comparing.equal(info.type, type)
        && Comparing.equal(info.gutterIconRenderer, gutterIconRenderer)
        && Comparing.equal(info.forcedTextAttributes, forcedTextAttributes)
        && Comparing.equal(info.forcedTextAttributesKey, forcedTextAttributesKey)
        && Comparing.strEqual(info.getDescription(), getDescription());
  }