Package com.google.gerrit.reviewdb.client

Examples of com.google.gerrit.reviewdb.client.PatchLineComment


    fmt.addStyleName(row, PC, Gerrit.RESOURCES.css().diffText());
  }

  private int insert(final List<PatchLineComment> in, int row, boolean expandComment) {
    for (Iterator<PatchLineComment> ci = in.iterator(); ci.hasNext();) {
      final PatchLineComment c = ci.next();
      insertRow(row);
      bindComment(row, PC, c, !ci.hasNext(), expandComment);
      row++;
    }
    return row;
View Full Code Here


        row++;

        final Iterator<PatchLineComment> ai = fora.iterator();
        final Iterator<PatchLineComment> bi = forb.iterator();
        while (ai.hasNext() && bi.hasNext()) {
          final PatchLineComment ac = ai.next();
          final PatchLineComment bc = bi.next();
          insertRow(row);
          bindComment(row, A, ac, !ai.hasNext(), expandComments);
          bindComment(row, B, bc, !bi.hasNext(), expandComments);
          row++;
        }
View Full Code Here

    fmt.addStyleName(row, B + 1, Gerrit.RESOURCES.css().lineNumber());
  }

  private int finish(final Iterator<PatchLineComment> i, int row, final int col, boolean expandComment) {
    while (i.hasNext()) {
      final PatchLineComment c = i.next();
      insertRow(row);
      bindComment(row, col, c, !i.hasNext(), expandComment);
      row++;
    }
    return row;
View Full Code Here

            break;
          default:
            throw new RuntimeException("unexpected file id " + file);
        }

        final PatchLineComment newComment =
            new PatchLineComment(new PatchLineComment.Key(parentKey, null),
                line, Gerrit.getUserAccount().getId(), null);
        newComment.setSide(side);
        newComment.setMessage("");

        createCommentEditor(suggestRow, column, newComment).setFocus(true);
      }
    } else {
      Gerrit.doSignIn(History.getToken());
View Full Code Here

          throw new IllegalStateException("Comment line must be >= 1, not "
              + comment.getLine());
        }

        if (comment.getParentUuid() != null) {
          final PatchLineComment parent =
              db.patchComments().get(
                  new PatchLineComment.Key(patchKey, comment.getParentUuid()));
          if (parent == null || parent.getSide() != comment.getSide()) {
            throw new IllegalStateException("Parent comment must be on same side");
          }
        }

        final PatchLineComment nc =
            new PatchLineComment(new PatchLineComment.Key(patchKey, ChangeUtil
                .messageUUID(db)), comment.getLine(), me, comment.getParentUuid());
        nc.setSide(comment.getSide());
        nc.setMessage(comment.getMessage());
        db.patchComments().insert(Collections.singleton(nc));
        db.commit();
        return nc;

      } else {
View Full Code Here

    run(callback, new Action<VoidResult>() {
      public VoidResult run(ReviewDb db) throws OrmException, Failure {
        Change.Id id = commentKey.getParentKey().getParentKey().getParentKey();
        db.changes().beginTransaction(id);
        try {
          final PatchLineComment comment = db.patchComments().get(commentKey);
          if (comment == null) {
            throw new Failure(new NoSuchEntityException());
          }
          if (!getAccountId().equals(comment.getAuthor())) {
            throw new Failure(new NoSuchEntityException());
          }
          if (comment.getStatus() != PatchLineComment.Status.DRAFT) {
            throw new Failure(new IllegalStateException("Comment published"));
          }
          db.patchComments().delete(Collections.singleton(comment));
          db.commit();
          return VoidResult.INSTANCE;
View Full Code Here

        Gerrit.doSignIn(History.getToken());
      }
    }

    private void createReplyEditor() {
      final PatchLineComment newComment = newComment();
      newComment.setMessage("");
      createEditor(newComment).setFocus(true);
    }
View Full Code Here

    }

    private void cannedReply(String message) {
      CommentEditorPanel p = createEditor(null);
      if (p == null) {
        final PatchLineComment newComment = newComment();
        newComment.setMessage(message);

        enableButtons(false);
        PatchUtil.DETAIL_SVC.saveDraft(newComment,
            new GerritCallback<PatchLineComment>() {
              public void onSuccess(final PatchLineComment result) {
View Full Code Here

      int column = columnOf(getElement());
      return createCommentEditor(row + 1, column, newComment);
    }

    private PatchLineComment newComment() {
      PatchLineComment newComment =
          new PatchLineComment(new PatchLineComment.Key(comment.getKey()
              .getParentKey(), null), comment.getLine(), Gerrit
              .getUserAccount().getId(), comment.getKey().get());
      newComment.setSide(comment.getSide());
      return newComment;
    }
View Full Code Here

TOP

Related Classes of com.google.gerrit.reviewdb.client.PatchLineComment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.