Search in sources :

Example 1 with ConfirmationDialog

use of com.google.gerrit.client.ConfirmationDialog in project gerrit by GerritCodeReview.

the class Reviewers method addReviewer.

private void addReviewer(final String reviewer, boolean confirmed) {
    if (reviewer.isEmpty()) {
        return;
    }
    ChangeApi.reviewers(changeId.get()).post(PostInput.create(reviewer, confirmed), new GerritCallback<PostResult>() {

        @Override
        public void onSuccess(PostResult result) {
            if (result.confirm()) {
                askForConfirmation(result.error());
            } else if (result.error() != null) {
                UIObject.setVisible(error, true);
                error.setInnerText(result.error());
            } else {
                UIObject.setVisible(error, false);
                error.setInnerText("");
                suggestBox.setText("");
                if (result.reviewers() != null && result.reviewers().length() > 0) {
                    updateReviewerList();
                }
            }
        }

        private void askForConfirmation(String text) {
            new ConfirmationDialog(Util.C.approvalTableAddManyReviewersConfirmationDialogTitle(), new SafeHtmlBuilder().append(text), new ConfirmationCallback() {

                @Override
                public void onOk() {
                    addReviewer(reviewer, true);
                }
            }).center();
        }

        @Override
        public void onFailure(Throwable err) {
            if (isSigninFailure(err)) {
                new NotSignedInDialog().center();
            } else {
                UIObject.setVisible(error, true);
                error.setInnerText(err instanceof StatusCodeException ? ((StatusCodeException) err).getEncodedResponse() : err.getMessage());
            }
        }
    });
}
Also used : ConfirmationCallback(com.google.gerrit.client.ConfirmationCallback) NotSignedInDialog(com.google.gerrit.client.NotSignedInDialog) StatusCodeException(com.google.gwt.user.client.rpc.StatusCodeException) NativeString(com.google.gerrit.client.rpc.NativeString) SafeHtmlBuilder(com.google.gwtexpui.safehtml.client.SafeHtmlBuilder) ConfirmationDialog(com.google.gerrit.client.ConfirmationDialog)

Example 2 with ConfirmationDialog

use of com.google.gerrit.client.ConfirmationDialog in project gerrit by GerritCodeReview.

the class ProjectBranchesScreen method showAddedBranch.

void showAddedBranch(BranchInfo branch) {
    SafeHtmlBuilder b = new SafeHtmlBuilder();
    b.openElement("b");
    b.append(Gerrit.C.branchCreationConfirmationMessage());
    b.closeElement("b");
    b.openElement("p");
    b.append(branch.ref());
    b.closeElement("p");
    ConfirmationDialog confirmationDialog = new ConfirmationDialog(Gerrit.C.branchCreationDialogTitle(), b.toSafeHtml(), new ConfirmationCallback() {

        @Override
        public void onOk() {
        //do nothing
        }
    });
    confirmationDialog.center();
    confirmationDialog.setCancelVisible(false);
}
Also used : ConfirmationCallback(com.google.gerrit.client.ConfirmationCallback) SafeHtmlBuilder(com.google.gwtexpui.safehtml.client.SafeHtmlBuilder) ConfirmationDialog(com.google.gerrit.client.ConfirmationDialog)

Example 3 with ConfirmationDialog

use of com.google.gerrit.client.ConfirmationDialog in project gerrit by GerritCodeReview.

the class ProjectTagsScreen method showAddedTag.

void showAddedTag(TagInfo tag) {
    SafeHtmlBuilder b = new SafeHtmlBuilder();
    b.openElement("b");
    b.append(Gerrit.C.tagCreationConfirmationMessage());
    b.closeElement("b");
    b.openElement("p");
    b.append(tag.ref());
    b.closeElement("p");
    ConfirmationDialog confirmationDialog = new ConfirmationDialog(Gerrit.C.tagCreationDialogTitle(), b.toSafeHtml(), new ConfirmationCallback() {

        @Override
        public void onOk() {
        //do nothing
        }
    });
    confirmationDialog.center();
    confirmationDialog.setCancelVisible(false);
}
Also used : ConfirmationCallback(com.google.gerrit.client.ConfirmationCallback) SafeHtmlBuilder(com.google.gwtexpui.safehtml.client.SafeHtmlBuilder) ConfirmationDialog(com.google.gerrit.client.ConfirmationDialog)

Aggregations

ConfirmationCallback (com.google.gerrit.client.ConfirmationCallback)3 ConfirmationDialog (com.google.gerrit.client.ConfirmationDialog)3 SafeHtmlBuilder (com.google.gwtexpui.safehtml.client.SafeHtmlBuilder)3 NotSignedInDialog (com.google.gerrit.client.NotSignedInDialog)1 NativeString (com.google.gerrit.client.rpc.NativeString)1 StatusCodeException (com.google.gwt.user.client.rpc.StatusCodeException)1