Merge "ProjectConfig sections refactoring"

This commit is contained in:
Edwin Kempin
2012-04-03 23:53:50 -07:00
committed by gerrit code review
12 changed files with 221 additions and 161 deletions

View File

@@ -19,6 +19,7 @@ import com.google.gerrit.common.data.AccessSection;
import com.google.gerrit.common.data.ApprovalType;
import com.google.gerrit.common.data.Permission;
import com.google.gerrit.common.data.ProjectAccess;
import com.google.gerrit.common.data.RefConfigSection;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
@@ -122,7 +123,8 @@ public class AccessSectionEditor extends Composite implements
void onDeleteSection(ClickEvent event) {
isDeleted = true;
if (name.isVisible() && AccessSection.isAccessSection(name.getValue())){
if (name.isVisible()
&& RefConfigSection.isValid(name.getValue())) {
deletedName.setInnerText(Util.M.deletedReference(name.getValue()));
} else {
@@ -185,7 +187,7 @@ public class AccessSectionEditor extends Composite implements
name.setEnabled(!readOnly);
deleteSection.setVisible(!readOnly);
if (AccessSection.isAccessSection(value.getName())) {
if (RefConfigSection.isValid(value.getName())) {
name.setVisible(true);
name.setIgnoreEditorValue(false);
sectionType.setInnerText(Util.C.sectionTypeReference());
@@ -225,8 +227,9 @@ public class AccessSectionEditor extends Composite implements
perms.add(varName);
}
}
} else if (AccessSection.isAccessSection(value.getName())) {
for (ApprovalType t : Gerrit.getConfig().getApprovalTypes().getApprovalTypes()) {
} else if (RefConfigSection.isValid(value.getName())) {
for (ApprovalType t : Gerrit.getConfig().getApprovalTypes()
.getApprovalTypes()) {
String varName = Permission.LABEL + t.getCategory().getLabelName();
if (value.getPermission(varName) == null) {
perms.add(varName);

View File

@@ -24,6 +24,7 @@ import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.common.data.Permission;
import com.google.gerrit.common.data.PermissionRange;
import com.google.gerrit.common.data.PermissionRule;
import com.google.gerrit.common.data.RefConfigSection;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
@@ -114,7 +115,8 @@ public class PermissionEditor extends Composite implements Editor<Permission>,
rules = ListEditor.of(new RuleEditorSource());
exclusiveGroup.setEnabled(!readOnly);
exclusiveGroup.setVisible(AccessSection.isAccessSection(section.getName()));
exclusiveGroup.setVisible(RefConfigSection
.isValid(section.getName()));
if (readOnly) {
addContainer.removeFromParent();