use of com.google.gerrit.client.projects.BranchInfo in project gerrit by GerritCodeReview.
the class ProjectBranchesScreen method doAddNewBranch.
private void doAddNewBranch() {
final String branchName = nameTxtBox.getText().trim();
if ("".equals(branchName)) {
nameTxtBox.setFocus(true);
return;
}
final String rev = irevTxtBox.getText().trim();
if ("".equals(rev)) {
irevTxtBox.setText("HEAD");
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
irevTxtBox.selectAll();
irevTxtBox.setFocus(true);
}
});
return;
}
addBranch.setEnabled(false);
ProjectApi.createBranch(getProjectKey(), branchName, rev, new GerritCallback<BranchInfo>() {
@Override
public void onSuccess(BranchInfo branch) {
showAddedBranch(branch);
nameTxtBox.setText("");
irevTxtBox.setText("");
query = new Query(match).start(start).run();
}
@Override
public void onFailure(Throwable caught) {
addBranch.setEnabled(true);
selectAllAndFocus(nameTxtBox);
new ErrorDialog(caught.getMessage()).center();
}
});
}
Aggregations