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());
}
}
});
}
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);
}
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);
}
Aggregations