Search in sources :

Example 6 with ChangeInfo

use of com.google.gerrit.client.info.ChangeInfo 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)

Example 7 with ChangeInfo

use of com.google.gerrit.client.info.ChangeInfo in project gerrit by GerritCodeReview.

the class PatchSetsBox method onLoad.

@Override
protected void onLoad() {
    if (!loaded) {
        RestApi call = ChangeApi.detail(changeId.get());
        ChangeList.addOptions(call, EnumSet.of(ListChangesOption.ALL_COMMITS, ListChangesOption.ALL_REVISIONS));
        call.get(new AsyncCallback<ChangeInfo>() {

            @Override
            public void onSuccess(ChangeInfo result) {
                if (edit != null) {
                    edit.setName(edit.commit().commit());
                    result.revisions().put(edit.name(), RevisionInfo.fromEdit(edit));
                }
                render(result.revisions());
                loaded = true;
            }

            @Override
            public void onFailure(Throwable caught) {
            }
        });
    }
}
Also used : RestApi(com.google.gerrit.client.rpc.RestApi) ChangeInfo(com.google.gerrit.client.info.ChangeInfo)

Example 8 with ChangeInfo

use of com.google.gerrit.client.info.ChangeInfo in project gerrit by GerritCodeReview.

the class RebaseAction method call.

static void call(final Button b, final String project, final String branch, final Change.Id id, final String revision, final boolean enabled) {
    b.setEnabled(false);
    new RebaseDialog(project, branch, id, enabled) {

        @Override
        public void onSend() {
            ChangeApi.rebase(id.get(), revision, getBase(), new GerritCallback<ChangeInfo>() {

                @Override
                public void onSuccess(ChangeInfo result) {
                    sent = true;
                    hide();
                    Gerrit.display(PageLinks.toChange(id));
                }

                @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) RebaseDialog(com.google.gerrit.client.ui.RebaseDialog) ChangeInfo(com.google.gerrit.client.info.ChangeInfo) PopupPanel(com.google.gwt.user.client.ui.PopupPanel)

Example 9 with ChangeInfo

use of com.google.gerrit.client.info.ChangeInfo in project gerrit by GerritCodeReview.

the class ChangeTable method onOpenRow.

@Override
protected void onOpenRow(final int row) {
    final ChangeInfo c = getRowItem(row);
    final Change.Id id = c.legacyId();
    Gerrit.display(PageLinks.toChange(id));
}
Also used : ChangeInfo(com.google.gerrit.client.info.ChangeInfo) Change(com.google.gerrit.reviewdb.client.Change)

Example 10 with ChangeInfo

use of com.google.gerrit.client.info.ChangeInfo 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)11 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)7 PopupPanel (com.google.gwt.user.client.ui.PopupPanel)4 EditInfo (com.google.gerrit.client.info.ChangeInfo.EditInfo)3 CallbackGroup (com.google.gerrit.client.rpc.CallbackGroup)3 RestApi (com.google.gerrit.client.rpc.RestApi)3 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)3 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)2 Change (com.google.gerrit.reviewdb.client.Change)2 ChangeList (com.google.gerrit.client.changes.ChangeList)1 DiffInfo (com.google.gerrit.client.diff.DiffInfo)1 HttpCallback (com.google.gerrit.client.rpc.HttpCallback)1 HttpResponse (com.google.gerrit.client.rpc.HttpResponse)1 CherryPickDialog (com.google.gerrit.client.ui.CherryPickDialog)1 CreateChangeDialog (com.google.gerrit.client.ui.CreateChangeDialog)1 RebaseDialog (com.google.gerrit.client.ui.RebaseDialog)1 TextAreaActionDialog (com.google.gerrit.client.ui.TextAreaActionDialog)1 JsArray (com.google.gwt.core.client.JsArray)1 AddonInjector (net.codemirror.addon.AddonInjector)1