/** * Creates a new ruler column. * * @deprecated since 3.2 use {@link #ChangeRulerColumn(ISharedTextColors)} instead */ @Deprecated public ChangeRulerColumn() { fRevisionPainter= null; fDiffPainter= new DiffPainter(this, null); }
/** * Delegates the painting of the quick diff colors to this painter. The painter will draw the * color boxes onto the passed {@link GC} for all model (document) lines in * <code>visibleModelLines</code>. * * @param gc the {@link GC} to draw onto * @param visibleModelLines the lines (in document offsets) that are currently (perhaps only * partially) visible */ public void paint(GC gc, ILineRange visibleModelLines) { connectIfNeeded(); if (!isConnected()) return; // draw diff info final int lastLine= end(visibleModelLines); final int width= getWidth(); final Color deletionColor= getDeletionColor(); for (int line= visibleModelLines.getStartLine(); line < lastLine; line++) { paintLine(line, gc, width, deletionColor); } }
/** * Returns the color for deleted lines. * * @return the color to be used for the deletion indicator */ private Color getDeletionColor() { return fDeletedColor == null ? getBackground() : fDeletedColor; }
/** * Returns the display character for the accessibility mode for a certain model line. * * @param line the document line of interest * @return the display character for <code>line</code> */ public String getDisplayCharacter(int line) { return getDisplayCharacter(getDiffInfo(line)); }
return; ILineDiffInfo info= getDiffInfo(line); if (hasSpecialColor(info)) { gc.setBackground(getColor(info)); gc.fillRectangle(0, autoScaleUp(y), autoScaleUp(width), autoScaleUp(lineHeight)); if (delBefore > 0 || delBelow > 0) { gc.setForeground(deletionColor); gc.setLineWidth(autoScaleUp(1)); if (delBefore > 0) gc.drawLine(0, autoScaleUp(y), autoScaleUp(width), autoScaleUp(y)); if (delBelow > 0) gc.drawLine(0, autoScaleUp(y + lineHeight - 1), autoScaleUp(width), autoScaleUp(y + lineHeight - 1));
/** * Sets the background color for changed lines. * * @param color the new color to be used for the changed lines background * @return the shaded color */ private Color getShadedColor(Color color) { if (color == null) return null; if (fSharedColors == null) return color; RGB baseRGB= color.getRGB(); RGB background= getBackground().getRGB(); boolean darkBase= isDark(baseRGB); boolean darkBackground= isDark(background); if (darkBase && darkBackground) background= new RGB(255, 255, 255); else if (!darkBase && !darkBackground) background= new RGB(0, 0, 0); return fSharedColors.getColor(interpolate(baseRGB, background, 0.6)); }
return; ILineDiffInfo info= getDiffInfo(line); if (hasSpecialColor(info)) { gc.setBackground(getColor(info)); gc.fillRectangle(0, y, width, lineHeight);
/** * Returns the color for the given line diff info. * * @param info the <code>ILineDiffInfo</code> being queried * @return the correct background color for the line type being described by <code>info</code> */ private Color getColor(ILineDiffInfo info) { Assert.isTrue(info != null && info.getChangeType() != ILineDiffInfo.UNCHANGED); Color ret= null; switch (info.getChangeType()) { case ILineDiffInfo.CHANGED: ret= getShadedColor(fChangedColor); break; case ILineDiffInfo.ADDED: ret= getShadedColor(fAddedColor); break; } return ret == null ? getBackground() : ret; }
@Override protected String createDisplayString(int line) { StringBuilder buffer= new StringBuilder(); if (fShowNumbers) buffer.append(super.createDisplayString(line)); if (fCharacterDisplay && getModel() != null) buffer.append(fDiffPainter.getDisplayCharacter(line)); return buffer.toString(); }
/** * Sets the background color for changed lines. * * @param color the new color to be used for the changed lines background * @return the shaded color */ private Color getShadedColor(Color color) { if (color == null) return null; if (fSharedColors == null) return color; RGB baseRGB= color.getRGB(); RGB background= getBackground().getRGB(); boolean darkBase= isDark(baseRGB); boolean darkBackground= isDark(background); if (darkBase && darkBackground) background= new RGB(255, 255, 255); else if (!darkBase && !darkBackground) background= new RGB(0, 0, 0); return fSharedColors.getColor(interpolate(baseRGB, background, 0.6)); }
/** * Returns the display character for the accessibility mode for a certain model line. * * @param line the document line of interest * @return the display character for <code>line</code> */ public String getDisplayCharacter(int line) { return getDisplayCharacter(getDiffInfo(line)); }
/** * Returns the color for the given line diff info. * * @param info the <code>ILineDiffInfo</code> being queried * @return the correct background color for the line type being described by <code>info</code> */ private Color getColor(ILineDiffInfo info) { Assert.isTrue(info != null && info.getChangeType() != ILineDiffInfo.UNCHANGED); Color ret= null; switch (info.getChangeType()) { case ILineDiffInfo.CHANGED: ret= getShadedColor(fChangedColor); break; case ILineDiffInfo.ADDED: ret= getShadedColor(fAddedColor); break; } return ret == null ? getBackground() : ret; }
@Override protected String createDisplayString(int line) { StringBuffer buffer= new StringBuffer(); if (fShowNumbers) buffer.append(super.createDisplayString(line)); if (fCharacterDisplay && getModel() != null) buffer.append(fDiffPainter.getDisplayCharacter(line)); return buffer.toString(); }
/** * Delegates the painting of the quick diff colors to this painter. The painter will draw the * color boxes onto the passed {@link GC} for all model (document) lines in * <code>visibleModelLines</code>. * * @param gc the {@link GC} to draw onto * @param visibleModelLines the lines (in document offsets) that are currently (perhaps only * partially) visible */ public void paint(GC gc, ILineRange visibleModelLines) { connectIfNeeded(); if (!isConnected()) return; // draw diff info final int lastLine= end(visibleModelLines); final int width= getWidth(); final Color deletionColor= getDeletionColor(); for (int line= visibleModelLines.getStartLine(); line < lastLine; line++) { paintLine(line, gc, width, deletionColor); } }
/** * Creates a new ruler column. * * @deprecated since 3.2 use {@link #ChangeRulerColumn(ISharedTextColors)} instead */ @Deprecated public ChangeRulerColumn() { fRevisionPainter= null; fDiffPainter= new DiffPainter(this, null); }
/** * Returns the color for deleted lines. * * @return the color to be used for the deletion indicator */ private Color getDeletionColor() { return fDeletedColor == null ? getBackground() : fDeletedColor; }