Search in sources :

Example 1 with CherryPickDialog

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();
}
Also used : GerritCallback(com.google.gerrit.client.rpc.GerritCallback) CherryPickDialog(com.google.gerrit.client.ui.CherryPickDialog) ChangeInfo(com.google.gerrit.client.info.ChangeInfo) PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

Aggregations

ChangeInfo (com.google.gerrit.client.info.ChangeInfo)1 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)1 CherryPickDialog (com.google.gerrit.client.ui.CherryPickDialog)1 PopupPanel (com.google.gwt.user.client.ui.PopupPanel)1