/** * 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 color for deleted lines. * * @return the color to be used for the deletion indicator */ private Color getDeletionColor() { return fDeletedColor == null ? getBackground() : fDeletedColor; }
/** * 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; }
/** * 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; }
/** * 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)); }
/** * 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)); }