use of com.google.gerrit.client.ui.CherryPickDialog in project gerrit by GerritCodeReview.
the class CherryPickAction method call.
static void call(final Button b, final ChangeInfo info, final String revision, String project, final String commitMessage) {
// TODO Replace CherryPickDialog with a nicer looking display.
b.setEnabled(false);
new CherryPickDialog(new Project.NameKey(project)) {
{
sendButton.setText(Util.C.buttonCherryPickChangeSend());
if (info.status() == Change.Status.MERGED) {
message.setText(Util.M.cherryPickedChangeDefaultMessage(commitMessage.trim(), revision));
} else {
message.setText(commitMessage.trim());
}
}
@Override
public void onSend() {
ChangeApi.cherrypick(info.legacyId().get(), revision, getDestinationBranch(), getMessageText(), new GerritCallback<ChangeInfo>() {
@Override
public void onSuccess(ChangeInfo result) {
sent = true;
hide();
Gerrit.display(PageLinks.toChange(result.legacyId()));
}
@Override
public void onFailure(Throwable caught) {
enableButtons(true);
super.onFailure(caught);
}
});
}
@Override
public void onClose(CloseEvent<PopupPanel> event) {
super.onClose(event);
b.setEnabled(true);
}
}.center();
}
Aggregations