Gerrit.display(PageLinks.toProjectAcceess(getProjectKey()));
}
@UiHandler("commit")
void onCommit(ClickEvent event) {
final ProjectAccess access = driver.flush();
if (driver.hasErrors()) {
Window.alert(Util.C.errorsMustBeFixed());
return;
}
String message = commitMessage.getText().trim();
if ("".equals(message)) {
message = null;
}
enable(false);
Util.PROJECT_SVC.changeProjectAccess( //
getProjectKey(), //
access.getRevision(), //
message, //
access.getLocal(), //
new GerritCallback<ProjectAccess>() {
@Override
public void onSuccess(ProjectAccess newAccess) {
enable(true);
commitMessage.setText("");
error.clear();
final Set<String> diffs = getDiffs(access, newAccess);
if (diffs.isEmpty()) {
displayReadOnly(newAccess);
} else {
error.add(new Label(Gerrit.C.projectAccessError()));
for (final String diff : diffs) {
error.add(new Label(diff));
}
if (access.canUpload()) {
error.add(new Label(Gerrit.C.projectAccessProposeForReviewHint()));
}
}
}