ProjectConfig sections refactoring

Add a new class RefConfigSection to be superclass for some
sections in project.config file.
This is a preparation to include "Merge Strategy per branch"
feature which will add another section to project.config file.

Change-Id: I559aad8325358823471665b24186470a76aaf967
This commit is contained in:
monica.dionisio
2012-01-02 14:05:58 -02:00
committed by Gustaf Lundh
parent 040834ffc4
commit 45fd656895
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();