/** * Returns the color for a revision based on relative age and author. * * @param revision the revision * @param focus <code>true</code> to return the focus color * @return the color for a revision */ public RGB getColor(Revision revision, boolean focus) { Map<Revision, RGB> map= focus ? fFocusColors : fColors; RGB color= map.get(revision); if (color != null) return color; color= adaptColor(revision, focus); map.put(revision, color); return color; } }
/** * Sets the revision information, which is needed to compute the relative age of a revision. * * @param info the new revision info, <code>null</code> for none. */ public void setInfo(RevisionInformation info) { fRevisions= null; fColors.clear(); fFocusColors.clear(); if (info == null) return; List<Long> revisions= new ArrayList<>(); for (Iterator<Revision> it= info.getRevisions().iterator(); it.hasNext();) { Revision revision= it.next(); revisions.add(new Long(computeAge(revision))); } Collections.sort(revisions); fRevisions= revisions; }
float scale; if (fRenderingMode == IRevisionRulerColumnExtension.AGE) { int index= computeAgeIndex(revision); if (index == -1 || fRevisions.size() == 0) { rgb= getBackground().getRGB(); rgb= revision.getColor(); rgb= Colors.adjustBrightness(rgb, AVERAGE_INTENSITY); int index= computeAgeIndex(revision); int size= fRevisions.size(); return null; // dummy rgb= getShadedColor(rgb, scale, focus); return rgb;
fColorTool.setInfo(fRevisionInfo); fLastWidth= width;
float scale; if (fRenderingMode == IRevisionRulerColumnExtension.AGE) { int index= computeAgeIndex(revision); if (index == -1 || fRevisions.size() == 0) { rgb= getBackground().getRGB(); rgb= revision.getColor(); rgb= Colors.adjustBrightness(rgb, AVERAGE_INTENSITY); int index= computeAgeIndex(revision); int size= fRevisions.size(); return null; // dummy rgb= getShadedColor(rgb, scale, focus); return rgb;
fColorTool.setInfo(fRevisionInfo); fLastWidth= width;
/** * Sets the revision information to be drawn and triggers a redraw. * * @param info the revision information to show, <code>null</code> to draw none */ public void setRevisionInformation(RevisionInformation info) { if (fRevisionInfo != info) { fRequiredWidth= -1; fRevisionIdChars= 0; fRevisionInfo= info; clearRangeCache(); updateFocusRange(null); handleRevisionSelected((Revision) null); fColorTool.setInfo(info); postRedraw(); informListeners(); } }
/** * Sets the revision information to be drawn and triggers a redraw. * * @param info the revision information to show, <code>null</code> to draw none */ public void setRevisionInformation(RevisionInformation info) { if (fRevisionInfo != info) { fRequiredWidth= -1; fRevisionIdChars= 0; fRevisionInfo= info; clearRangeCache(); updateFocusRange(null); handleRevisionSelected((Revision) null); fColorTool.setInfo(info); postRedraw(); informListeners(); } }
/** * Sets the revision information, which is needed to compute the relative age of a revision. * * @param info the new revision info, <code>null</code> for none. */ public void setInfo(RevisionInformation info) { fRevisions= null; fColors.clear(); fFocusColors.clear(); if (info == null) return; List<Long> revisions= new ArrayList<>(); for (Revision revision : info.getRevisions()) { revisions.add(Long.valueOf(computeAge(revision))); } Collections.sort(revisions); fRevisions= revisions; }
/** * Changes the rendering mode and triggers redrawing if needed. * * @param renderingMode the rendering mode * @since 3.3 */ public void setRenderingMode(RenderingMode renderingMode) { Assert.isLegal(renderingMode != null); if (fRenderingMode != renderingMode) { fRenderingMode= renderingMode; fColorTool.setInfo(fRevisionInfo); postRedraw(); } }
/** * Changes the rendering mode and triggers redrawing if needed. * * @param renderingMode the rendering mode * @since 3.3 */ public void setRenderingMode(RenderingMode renderingMode) { Assert.isLegal(renderingMode != null); if (fRenderingMode != renderingMode) { fRenderingMode= renderingMode; fColorTool.setInfo(fRevisionInfo); postRedraw(); } }
/** * Returns the color for a revision based on relative age and author. * * @param revision the revision * @param focus <code>true</code> to return the focus color * @return the color for a revision */ public RGB getColor(Revision revision, boolean focus) { Map<Revision, RGB> map= focus ? fFocusColors : fColors; RGB color= map.get(revision); if (color != null) return color; color= adaptColor(revision, focus); map.put(revision, color); return color; } }
private int computeAgeIndex(Revision revision) { long age= computeAge(revision); int index= fRevisions.indexOf(new Long(age)); return index; }
/** * Looks up the color for a certain revision. * * @param revision the revision to get the color for * @param focus <code>true</code> if it is the focus revision * @return the color for the revision */ private Color lookupColor(Revision revision, boolean focus) { return fSharedColors.getColor(fColorTool.getColor(revision, focus)); }
/** * Looks up the color for a certain revision. * * @param revision the revision to get the color for * @param focus <code>true</code> if it is the focus revision * @return the color for the revision */ private Color lookupColor(Revision revision, boolean focus) { return fSharedColors.getColor(fColorTool.getColor(revision, focus)); }
private int computeAgeIndex(Revision revision) { long age= computeAge(revision); int index= fRevisions.indexOf(Long.valueOf(age)); return index; }