@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; }
@Override public void doAction(int lineNum) { LastRevision revision = myRevisions.get(lineNum); if (revision == null) return; VirtualFile file = getHyperlinkVirtualFile(myHyperlinks.findAllHyperlinksOnLine(lineNum)); if (file == null) return; AbstractVcs vcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(file); if (vcs != null) { VcsRevisionNumber number = revision.getNumber(); VcsKey vcsKey = vcs.getKeyInstanceMethod(); ShowAllAffectedGenericAction.showSubmittedFiles(myProject, number, file, vcsKey); } }
@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; }