Search in sources :

Example 1 with TextAreaActionDialog

use of com.google.gerrit.client.ui.TextAreaActionDialog in project gerrit by GerritCodeReview.

the class RevertAction method call.

static void call(final Button b, final Change.Id id, final String revision, final String commitSubject) {
    // TODO Replace ActionDialog with a nicer looking display.
    b.setEnabled(false);
    new TextAreaActionDialog(Util.C.revertChangeTitle(), Util.C.headingRevertMessage()) {

        {
            sendButton.setText(Util.C.buttonRevertChangeSend());
            message.setText(Util.M.revertChangeDefaultMessage(commitSubject, revision));
        }

        @Override
        public void onSend() {
            ChangeApi.revert(id.get(), 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) ChangeInfo(com.google.gerrit.client.info.ChangeInfo) PopupPanel(com.google.gwt.user.client.ui.PopupPanel) TextAreaActionDialog(com.google.gerrit.client.ui.TextAreaActionDialog)

Aggregations

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