@Override public EditorFontType getStyle(int line, Editor editor) { LastRevision revision = myRevisions.get(line); return revision != null && revision.getDate().equals(myNewestDate) ? EditorFontType.BOLD : EditorFontType.PLAIN; }
@Override public String getLineText(int line, Editor editor) { LastRevision revision = myRevisions.get(line); if (revision != null) { return String.format( "%" + myMaxDateLength + "s", DateFormatUtil.formatPrettyDate(revision.getDate())) + " " + revision.getAuthor(); } return ""; }
@Override public String getToolTip(int line, Editor editor) { LastRevision revision = myRevisions.get(line); if (revision != null) { return XmlStringUtil.escapeString( revision.getAuthor() + " " + DateFormatUtil.formatDateTime(revision.getDate()) + "\n" + revision.getMessage()); } return null; }
@CalledInAwt public void updateData(@NotNull Map<Integer, LastRevision> revisions) { myRevisions = revisions; Date newestDate = null; int maxDateLength = 0; for (LastRevision revision : myRevisions.values()) { Date date = revision.getDate(); if (newestDate == null || date.after(newestDate)) { newestDate = date; } int length = DateFormatUtil.formatPrettyDate(date).length(); if (length > maxDateLength) { maxDateLength = length; } } myNewestDate = newestDate; myMaxDateLength = maxDateLength; }