use of com.google.gerrit.client.RangeInfo in project gerrit by GerritCodeReview.
the class Extras method setAnnotations.
public final void setAnnotations(JsArray<BlameInfo> blameInfos) {
if (blameInfos.length() > 0) {
setBlameInfo(blameInfos);
JsArrayString gutters = ((JsArrayString) JsArrayString.createArray());
gutters.push(ANNOTATION_GUTTER_ID);
cm.setOption("gutters", gutters);
annotated = true;
DateTimeFormat format = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_SHORT);
JsArray<LintLine> annotations = JsArray.createArray().cast();
for (BlameInfo blameInfo : Natives.asList(blameInfos)) {
for (RangeInfo range : Natives.asList(blameInfo.ranges())) {
Date commitTime = new Date(blameInfo.time() * 1000L);
String shortId = blameInfo.id().substring(0, 8);
String shortBlame = C.shortBlameMsg(shortId, format.format(commitTime), blameInfo.author());
String detailedBlame = C.detailedBlameMsg(blameInfo.id(), blameInfo.author(), FormatUtil.mediumFormat(commitTime), blameInfo.commitMsg());
annotations.push(LintLine.create(shortBlame, detailedBlame, shortId, Pos.create(range.start() - 1)));
}
}
cm.setOption("lint", getAnnotation(annotations));
}
}
Aggregations