Search in sources :

Example 1 with CreateChangeDialog

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

the class CreateChangeAction method call.

static void call(final Button b, final String project) {
    // TODO Replace CreateChangeDialog with a nicer looking display.
    b.setEnabled(false);
    new CreateChangeDialog(new Project.NameKey(project)) {

        {
            sendButton.setText(AdminConstants.I.buttonCreate());
            message.setText(AdminConstants.I.buttonCreateDescription());
        }

        @Override
        public void onSend() {
            ChangeApi.createChange(project, getDestinationBranch(), getDestinationTopic(), message.getText(), null, 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) CreateChangeDialog(com.google.gerrit.client.ui.CreateChangeDialog) 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 CreateChangeDialog (com.google.gerrit.client.ui.CreateChangeDialog)1 PopupPanel (com.google.gwt.user.client.ui.PopupPanel)1