Java Code Examples for com.intellij.util.ui.UIUtil#drawBoldDottedLine()

The following examples show how to use com.intellij.util.ui.UIUtil#drawBoldDottedLine() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DiffDrawUtil.java    From consulo with Apache License 2.0 6 votes vote down vote up
public static void drawChunkBorderLine(@Nonnull Graphics2D g, int x1, int x2, int y, @Nonnull Color color,
                                       boolean doubleLine, boolean dottedLine) {
  if (dottedLine && doubleLine) {
    UIUtil.drawBoldDottedLine(g, x1, x2, y - 1, null, color, false);
    UIUtil.drawBoldDottedLine(g, x1, x2, y, null, color, false);
  }
  else if (dottedLine) {
    UIUtil.drawBoldDottedLine(g, x1, x2, y - 1, null, color, false);
  }
  else if (doubleLine) {
    UIUtil.drawLine(g, x1, y, x2, y, null, color);
    UIUtil.drawLine(g, x1, y + 1, x2, y + 1, null, color);
  }
  else {
    UIUtil.drawLine(g, x1, y, x2, y, null, color);
  }
}
 
Example 2
Source File: EditorPlace.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void drawPolygon(@Nonnull Graphics2D g, int startY, int height, @Nonnull Color color, boolean applied) {
  int scrollbarWidth = myEditor.getScrollPane().getVerticalScrollBar().getWidth();
  int startX = 0;
  int endX = startX + scrollbarWidth - 1;

  int endY = startY + height;

  g.setColor(color);
  if (!applied) {
    if (height > 2) {
      g.fillRect(startX, startY, scrollbarWidth, height);

      Color framingColor = DiffUtil.getFramingColor(color);
      UIUtil.drawLine(g, startX, startY, endX, startY, null, framingColor);
      UIUtil.drawLine(g, startX, endY, endX, endY, null, framingColor);
    }
    else {
      DiffUtil.drawDoubleShadowedLine(g, startX, endX, startY, color);
    }
  }
  else {
    UIUtil.drawBoldDottedLine(g, startX, endX, startY, null, color, false);
    UIUtil.drawBoldDottedLine(g, startX, endX, endY, null, color, false);
  }
}
 
Example 3
Source File: DiffUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void drawBoldDottedFramingLines(@Nonnull Graphics2D g, int startX, int endX, int startY, int bottomY, @Nonnull Color color) {
  UIUtil.drawBoldDottedLine(g, startX, endX, startY, null, color, false);
  UIUtil.drawBoldDottedLine(g, startX, endX, bottomY, null, color, false);
}
 
Example 4
Source File: ChangeType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
private RangeHighlighter addBlock(String text, ChangeSide changeSide, final ChangeHighlighterHolder markup, TextDiffType diffType) {
  EditorColorsScheme colorScheme = markup.getEditor().getColorsScheme();
  Color separatorColor = getSeparatorColor(diffType.getLegendColor(colorScheme));

  int length = text.length();
  int start = changeSide.getStart();
  int end = start + length;
  RangeHighlighter highlighter = markup.addRangeHighlighter(start, end, LAYER, diffType, HighlighterTargetArea.EXACT_RANGE, myApplied);

  LineSeparatorRenderer lineSeparatorRenderer = new LineSeparatorRenderer() {
    @Override
    public void drawLine(Graphics g, int x1, int x2, int y) {
      Graphics2D g2 = (Graphics2D)g;
      Color color = myDiffType.getPolygonColor(markup.getEditor());
      if (color != null) {
        if (myApplied) {
          UIUtil.drawBoldDottedLine(g2, x1, x2, y, null, color, false);
        }
        else {
          UIUtil.drawLine(g2, x1, y, x2, y, null, DiffUtil.getFramingColor(color));
        }
      }
    }
  };

  if (highlighter != null) {
    highlighter.setLineSeparatorPlacement(SeparatorPlacement.TOP);
    highlighter.setLineSeparatorColor(separatorColor);
    highlighter.setLineSeparatorRenderer(lineSeparatorRenderer);
  }

  if (text.charAt(length - 1) == '\n') {
    end--;
  }

  highlighter = markup.addRangeHighlighter(start, end, LAYER, TextDiffType.NONE, HighlighterTargetArea.EXACT_RANGE, myApplied);
  if (highlighter != null) {
    highlighter.setLineSeparatorPlacement(SeparatorPlacement.BOTTOM);
    highlighter.setLineSeparatorColor(separatorColor);
    highlighter.setLineSeparatorRenderer(lineSeparatorRenderer);
  }
  return highlighter;
}