Search in sources :

Example 1 with TagInfo

use of com.google.gerrit.client.projects.TagInfo in project gerrit by GerritCodeReview.

the class ProjectTagsScreen method doAddNewTag.

private void doAddNewTag() {
    String tagName = nameTxtBox.getText().trim();
    if (tagName.isEmpty()) {
        nameTxtBox.setFocus(true);
        return;
    }
    String rev = irevTxtBox.getText().trim();
    if (rev.isEmpty()) {
        irevTxtBox.setText("HEAD");
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            @Override
            public void execute() {
                irevTxtBox.selectAll();
                irevTxtBox.setFocus(true);
            }
        });
        return;
    }
    addTag.setEnabled(false);
    ProjectApi.createTag(getProjectKey(), tagName, rev, new GerritCallback<TagInfo>() {

        @Override
        public void onSuccess(TagInfo tag) {
            showAddedTag(tag);
            nameTxtBox.setText("");
            irevTxtBox.setText("");
            query = new Query(match).start(start).run();
        }

        @Override
        public void onFailure(Throwable caught) {
            addTag.setEnabled(true);
            selectAllAndFocus(nameTxtBox);
            new ErrorDialog(caught.getMessage()).center();
        }
    });
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) TagInfo(com.google.gerrit.client.projects.TagInfo) ErrorDialog(com.google.gerrit.client.ErrorDialog)

Aggregations

ErrorDialog (com.google.gerrit.client.ErrorDialog)1 TagInfo (com.google.gerrit.client.projects.TagInfo)1 ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1