use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class CommentManager method renderPublished.
void renderPublished(DisplaySide forSide, JsArray<CommentInfo> in) {
for (CommentInfo info : Natives.asList(in)) {
DisplaySide side = displaySide(info, forSide);
if (side != null) {
int cmLinePlusOne = host.getCmLine(info.line() - 1, side) + 1;
CommentGroup group = group(side, cmLinePlusOne);
PublishedBox box = new PublishedBox(group, getCommentLinkProcessor(), getPatchSetIdFromSide(side), info, side, isOpen());
group.add(box);
box.setAnnotation(host.getDiffTable().scrollbar.comment(host.getCmFromSide(side), cmLinePlusOne - 1));
getPublished().put(info.id(), box);
}
}
}
use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class ReplyBox method onLoad.
@Override
protected void onLoad() {
commentsPanel.setVisible(false);
post.setEnabled(false);
if (lc.hasReplyComment()) {
message.setText(lc.getReplyComment());
lc.removeReplyComment();
}
ChangeApi.drafts(psId.getParentKey().get()).get(new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
@Override
public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
displayComments(result);
post.setEnabled(true);
}
@Override
public void onFailure(Throwable caught) {
post.setEnabled(true);
}
});
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
message.setFocus(true);
}
});
Scheduler.get().scheduleFixedDelay(new RepeatingCommand() {
@Override
public boolean execute() {
String t = message.getText();
if (t != null) {
message.setCursorPos(t.length());
}
return false;
}
}, 0);
}
use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class ReplyBox method displayComments.
private void displayComments(NativeMap<JsArray<CommentInfo>> m) {
comments.clear();
JsArray<CommentInfo> l = m.get(Patch.COMMIT_MSG);
if (l != null) {
comments.add(new FileComments(clp, psId, Util.C.commitMessage(), copyPath(Patch.COMMIT_MSG, l)));
}
l = m.get(Patch.MERGE_LIST);
if (l != null) {
comments.add(new FileComments(clp, psId, Util.C.commitMessage(), copyPath(Patch.MERGE_LIST, l)));
}
List<String> paths = new ArrayList<>(m.keySet());
Collections.sort(paths);
for (String path : paths) {
if (!Patch.isMagic(path)) {
comments.add(new FileComments(clp, psId, path, copyPath(path, m.get(path))));
}
}
commentsPanel.setVisible(comments.getWidgetCount() > 0);
}
use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class Message method byPath.
private static TreeMap<String, List<CommentInfo>> byPath(List<CommentInfo> list) {
TreeMap<String, List<CommentInfo>> m = new TreeMap<>();
for (CommentInfo c : list) {
List<CommentInfo> l = m.get(c.path());
if (l == null) {
l = new ArrayList<>();
m.put(c.path(), l);
}
l.add(c);
}
return m;
}
use of com.google.gerrit.client.changes.CommentInfo in project gerrit by GerritCodeReview.
the class ChangeScreen method loadConfigInfo.
private void loadConfigInfo(final ChangeInfo info, DiffObject base) {
final RevisionInfo rev = info.revision(revision);
if (base.isAutoMerge() && !initCurrentRevision(info).isMerge()) {
Gerrit.display(getToken(), new NotFoundScreen());
}
updateToken(info, base, rev);
RevisionInfo baseRev = resolveRevisionOrPatchSetId(info, base.asString(), null);
CallbackGroup group = new CallbackGroup();
Timestamp lastReply = myLastReply(info);
if (rev.isEdit()) {
// Comments are filtered for the current revision. Use parent
// patch set for edits, as edits themself can never have comments.
RevisionInfo p = RevisionInfo.findEditParentRevision(info.revisions().values());
List<NativeMap<JsArray<CommentInfo>>> comments = loadComments(p, group);
loadFileList(base, baseRev, rev, lastReply, group, comments, null);
} else {
loadDiff(base, baseRev, rev, lastReply, group);
}
group.addListener(new AsyncCallback<Void>() {
@Override
public void onSuccess(Void result) {
loadConfigInfo(info, rev);
}
@Override
public void onFailure(Throwable caught) {
logger.log(Level.SEVERE, "Loading file list and inline comments failed: " + caught.getMessage());
loadConfigInfo(info, rev);
}
});
group.done();
}
Aggregations