use of com.google.gwt.uibinder.client.UiHandler in project gerrit by GerritCodeReview.
the class ChangeScreen method onCollapseAll.
@UiHandler("collapseAll")
void onCollapseAll(@SuppressWarnings("unused") ClickEvent e) {
int n = history.getWidgetCount();
for (int i = 0; i < n; i++) {
((Message) history.getWidget(i)).setOpen(false);
}
expandAll.setVisible(true);
collapseAll.setVisible(false);
}
use of com.google.gwt.uibinder.client.UiHandler in project gerrit by GerritCodeReview.
the class ProjectAccessEditor method onAddSection.
@UiHandler("addSection")
void onAddSection(@SuppressWarnings("unused") ClickEvent event) {
int index = local.getList().size();
local.getList().add(new AccessSection("refs/heads/*"));
AccessSectionEditor editor = local.getEditors().get(index);
editor.enableEditing();
editor.editRefPattern();
}
use of com.google.gwt.uibinder.client.UiHandler in project gerrit by GerritCodeReview.
the class ProjectAccessScreen method onReview.
@UiHandler("review")
void onReview(@SuppressWarnings("unused") ClickEvent event) {
final ProjectAccess access = driver.flush();
if (driver.hasErrors()) {
Window.alert(AdminConstants.I.errorsMustBeFixed());
return;
}
String message = commitMessage.getText().trim();
if ("".equals(message)) {
message = null;
}
enable(false);
//
Util.PROJECT_SVC.reviewProjectAccess(//
getProjectKey(), //
access.getRevision(), //
message, //
access.getLocal(), //
access.getInheritsFrom(), new GerritCallback<Change.Id>() {
@Override
public void onSuccess(Change.Id changeId) {
enable(true);
commitMessage.setText("");
error.clear();
if (changeId != null) {
Gerrit.display(PageLinks.toChange(changeId));
} else {
displayReadOnly(access);
}
}
@Override
public void onFailure(Throwable caught) {
error.clear();
enable(true);
super.onFailure(caught);
}
});
}
use of com.google.gwt.uibinder.client.UiHandler in project gerrit by GerritCodeReview.
the class ProjectAccessScreen method onCommit.
@UiHandler("commit")
void onCommit(@SuppressWarnings("unused") ClickEvent event) {
final ProjectAccess access = driver.flush();
if (driver.hasErrors()) {
Window.alert(AdminConstants.I.errorsMustBeFixed());
return;
}
String message = commitMessage.getText().trim();
if ("".equals(message)) {
message = null;
}
enable(false);
//
Util.PROJECT_SVC.changeProjectAccess(//
getProjectKey(), //
access.getRevision(), //
message, //
access.getLocal(), //
access.getInheritsFrom(), 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()));
}
}
}
private Set<String> getDiffs(ProjectAccess wantedAccess, ProjectAccess newAccess) {
List<AccessSection> wantedSections = mergeSections(removeEmptyPermissionsAndSections(wantedAccess.getLocal()));
List<AccessSection> newSections = removeEmptyPermissionsAndSections(newAccess.getLocal());
HashSet<AccessSection> same = new HashSet<>(wantedSections);
HashSet<AccessSection> different = new HashSet<>(wantedSections.size() + newSections.size());
different.addAll(wantedSections);
different.addAll(newSections);
same.retainAll(newSections);
different.removeAll(same);
Set<String> differentNames = new HashSet<>();
for (AccessSection s : different) {
differentNames.add(s.getName());
}
return differentNames;
}
@Override
public void onFailure(Throwable caught) {
error.clear();
enable(true);
if (caught instanceof RemoteJsonException && caught.getMessage().startsWith(UpdateParentFailedException.MESSAGE)) {
new ErrorDialog(Gerrit.M.parentUpdateFailed(caught.getMessage().substring(UpdateParentFailedException.MESSAGE.length() + 1))).center();
} else {
super.onFailure(caught);
}
}
});
}
use of com.google.gwt.uibinder.client.UiHandler in project gerrit by GerritCodeReview.
the class Reviewers method onAddMe.
@UiHandler("addMe")
void onAddMe(@SuppressWarnings("unused") ClickEvent e) {
String accountId = String.valueOf(Gerrit.getUserAccount()._accountId());
addReviewer(accountId, false);
}
Aggregations