Fix: Creating Editor comment in Unified view.

In UnifiedDiff view, if there is a line
followed by 2 comments like

   code line
   published comment of patchset 2.
   editor comment of patchset 3.

The bug is any option of below will open the
existing editor.

1> Click line number of this line.
2> Click the "Reply" or "Reply 'Done'" button
of the published comment.

This patchset fixes this bug, don't open the
existing editor which belongs to patchset 3,
instead create a new one for patchset 2.

This is also a preparatory step for 'file comment'
feature.

Change-Id: I05ec27e5112bc75fc304d743b1378e1faa8d36e3
Signed-off-by: Bruce Zu <bruce.zu@sonymobile.com>
This commit is contained in:
Bruce Zu
2012-10-10 16:05:30 +08:00
committed by Bruce Zu
parent dea59c4953
commit 586722317e
2 changed files with 10 additions and 4 deletions

View File

@@ -427,7 +427,9 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
spans[col] = table.getFlexCellFormatter().getRowSpan(row, cell);
if (col == column) {
final Widget w = table.getWidget(row, cell);
if (w instanceof CommentEditorPanel) {
if (w instanceof CommentEditorPanel
&& ((CommentEditorPanel) w).getComment().getKey().getParentKey()
.equals(newComment.getKey().getParentKey())) {
// Don't insert two editors on the same position, it doesn't make
// any sense to the user.
//
@@ -809,10 +811,10 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
}
private void cannedReply(String message) {
CommentEditorPanel p = createEditor(null);
final PatchLineComment newComment = newComment();
newComment.setMessage(message);
CommentEditorPanel p = createEditor(newComment);
if (p == null) {
final PatchLineComment newComment = newComment();
newComment.setMessage(message);
enableButtons(false);
PatchUtil.DETAIL_SVC.saveDraft(newComment,

View File

@@ -198,6 +198,10 @@ public class CommentEditorPanel extends CommentPanel implements ClickHandler,
return comment.getKey().get() == null;
}
public PatchLineComment getComment() {
return comment;
}
@Override
public void onDoubleClick(final DoubleClickEvent event) {
edit();