Admin{Constants|Messages}: Move static instances from Util class

The Util class will eventually be removed after the project access
RPC is replaced with the REST API.

As a preparatory step, move the constants and messages instances out
of this class into the respective interfaces. This also makes these
implementations consistent with how messages and constants are defined
in other such interfaces.

Change-Id: Ie9fbfb901870d7ce7caad5cbb253194f81632c0f
This commit is contained in:
David Pursehouse 2017-02-15 20:26:08 +09:00
parent 7635930138
commit 8e84feec18
28 changed files with 158 additions and 149 deletions

@ -88,7 +88,7 @@ public class AccessSectionEditor extends Composite
new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
if (!Util.C.addPermission().equals(event.getValue())) {
if (!AdminConstants.I.addPermission().equals(event.getValue())) {
onAddPermission(event.getValue());
}
}
@ -113,14 +113,13 @@ public class AccessSectionEditor extends Composite
isDeleted = true;
if (name.isVisible() && RefConfigSection.isValid(name.getValue())) {
deletedName.setInnerText(Util.M.deletedReference(name.getValue()));
deletedName.setInnerText(AdminMessages.I.deletedReference(name.getValue()));
} else {
String name = Util.C.sectionNames().get(value.getName());
String name = AdminConstants.I.sectionNames().get(value.getName());
if (name == null) {
name = value.getName();
}
deletedName.setInnerText(Util.M.deletedSection(name));
deletedName.setInnerText(AdminMessages.I.deletedSection(name));
}
normal.getStyle().setDisplay(Display.NONE);
@ -181,18 +180,18 @@ public class AccessSectionEditor extends Composite
if (RefConfigSection.isValid(value.getName())) {
name.setVisible(true);
name.setIgnoreEditorValue(false);
sectionType.setInnerText(Util.C.sectionTypeReference());
sectionType.setInnerText(AdminConstants.I.sectionTypeReference());
} else {
name.setVisible(false);
name.setIgnoreEditorValue(true);
String name = Util.C.sectionNames().get(value.getName());
String name = AdminConstants.I.sectionNames().get(value.getName());
if (name != null) {
sectionType.setInnerText(name);
sectionName.getStyle().setDisplay(Display.NONE);
} else {
sectionType.setInnerText(Util.C.sectionTypeSection());
sectionType.setInnerText(AdminConstants.I.sectionTypeSection());
sectionName.setInnerText(value.getName());
sectionName.getStyle().clearDisplay();
}
@ -223,7 +222,7 @@ public class AccessSectionEditor extends Composite
for (LabelType t : projectAccess.getLabelTypes().getLabelTypes()) {
addPermission(Permission.forLabelAs(t.getName()), perms);
}
for (String varName : Util.C.permissionNames().keySet()) {
for (String varName : AdminConstants.I.permissionNames().keySet()) {
addPermission(varName, perms);
}
}
@ -231,8 +230,8 @@ public class AccessSectionEditor extends Composite
addContainer.getStyle().setDisplay(Display.NONE);
} else {
addContainer.getStyle().setDisplay(Display.BLOCK);
perms.add(0, Util.C.addPermission());
permissionSelector.setValue(Util.C.addPermission());
perms.add(0, AdminConstants.I.addPermission());
permissionSelector.setValue(AdminConstants.I.addPermission());
permissionSelector.setAcceptableValues(perms);
}
}

@ -44,7 +44,7 @@ public class AccountGroupAuditLogScreen extends AccountGroupScreen {
@Override
protected void onInitUI() {
super.onInitUI();
add(new SmallHeading(Util.C.headingAuditLog()));
add(new SmallHeading(AdminConstants.I.headingAuditLog()));
auditEventTable = new AuditEventTable();
add(auditEventTable);
}
@ -63,10 +63,10 @@ public class AccountGroupAuditLogScreen extends AccountGroupScreen {
private class AuditEventTable extends FancyFlexTable<GroupAuditEventInfo> {
AuditEventTable() {
table.setText(0, 1, Util.C.columnDate());
table.setText(0, 2, Util.C.columnType());
table.setText(0, 3, Util.C.columnMember());
table.setText(0, 4, Util.C.columnByUser());
table.setText(0, 1, AdminConstants.I.columnDate());
table.setText(0, 2, AdminConstants.I.columnType());
table.setText(0, 3, AdminConstants.I.columnMember());
table.setText(0, 4, AdminConstants.I.columnByUser());
FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());
@ -95,11 +95,11 @@ public class AccountGroupAuditLogScreen extends AccountGroupScreen {
switch (auditEvent.type()) {
case ADD_USER:
case ADD_GROUP:
table.setText(row, 2, Util.C.typeAdded());
table.setText(row, 2, AdminConstants.I.typeAdded());
break;
case REMOVE_USER:
case REMOVE_GROUP:
table.setText(row, 2, Util.C.typeRemoved());
table.setText(row, 2, AdminConstants.I.typeRemoved());
break;
}

@ -72,7 +72,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
private void initUUID() {
final VerticalPanel groupUUIDPanel = new VerticalPanel();
groupUUIDPanel.setStyleName(Gerrit.RESOURCES.css().groupUUIDPanel());
groupUUIDPanel.add(new SmallHeading(Util.C.headingGroupUUID()));
groupUUIDPanel.add(new SmallHeading(AdminConstants.I.headingGroupUUID()));
groupUUIDLabel = new CopyableLabel("");
groupUUIDPanel.add(groupUUIDLabel);
add(groupUUIDPanel);
@ -86,7 +86,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
groupNameTxt.setVisibleLength(60);
groupNamePanel.add(groupNameTxt);
saveName = new Button(Util.C.buttonRenameGroup());
saveName = new Button(AdminConstants.I.buttonRenameGroup());
saveName.setEnabled(false);
saveName.addClickHandler(
new ClickHandler() {
@ -100,7 +100,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
@Override
public void onSuccess(final com.google.gerrit.client.VoidResult result) {
saveName.setEnabled(false);
setPageTitle(Util.M.group(newName));
setPageTitle(AdminMessages.I.group(newName));
groupNameTxt.setText(newName);
if (getGroupUUID().equals(getOwnerGroupUUID())) {
ownerTxt.setText(newName);
@ -116,7 +116,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
private void initOwner() {
final VerticalPanel ownerPanel = new VerticalPanel();
ownerPanel.setStyleName(Gerrit.RESOURCES.css().groupOwnerPanel());
ownerPanel.add(new SmallHeading(Util.C.headingOwner()));
ownerPanel.add(new SmallHeading(AdminConstants.I.headingOwner()));
final AccountGroupSuggestOracle accountGroupOracle = new AccountGroupSuggestOracle();
ownerTxt = new RemoteSuggestBox(accountGroupOracle);
@ -124,7 +124,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
ownerTxt.setVisibleLength(60);
ownerPanel.add(ownerTxt);
saveOwner = new Button(Util.C.buttonChangeGroupOwner());
saveOwner = new Button(AdminConstants.I.buttonChangeGroupOwner());
saveOwner.setEnabled(false);
saveOwner.addClickHandler(
new ClickHandler() {
@ -154,14 +154,14 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
private void initDescription() {
final VerticalPanel vp = new VerticalPanel();
vp.setStyleName(Gerrit.RESOURCES.css().groupDescriptionPanel());
vp.add(new SmallHeading(Util.C.headingDescription()));
vp.add(new SmallHeading(AdminConstants.I.headingDescription()));
descTxt = new NpTextArea();
descTxt.setVisibleLines(6);
descTxt.setCharacterWidth(60);
vp.add(descTxt);
saveDesc = new Button(Util.C.buttonSaveDescription());
saveDesc = new Button(AdminConstants.I.buttonSaveDescription());
saveDesc.setEnabled(false);
saveDesc.addClickHandler(
new ClickHandler() {
@ -188,13 +188,13 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
final VerticalPanel vp = new VerticalPanel();
vp.setStyleName(Gerrit.RESOURCES.css().groupOptionsPanel());
vp.add(new SmallHeading(Util.C.headingGroupOptions()));
vp.add(new SmallHeading(AdminConstants.I.headingGroupOptions()));
visibleToAllCheckBox = new CheckBox(Util.C.isVisibleToAll());
visibleToAllCheckBox = new CheckBox(AdminConstants.I.isVisibleToAll());
vp.add(visibleToAllCheckBox);
groupOptionsPanel.add(vp);
saveGroupOptions = new Button(Util.C.buttonSaveGroupOptions());
saveGroupOptions = new Button(AdminConstants.I.buttonSaveGroupOptions());
saveGroupOptions.setEnabled(false);
saveGroupOptions.addClickHandler(
new ClickHandler() {
@ -226,7 +226,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
ownerTxt.setText(
group.owner() != null
? group.owner()
: Util.M.deletedReference(group.getOwnerUUID().get()));
: AdminMessages.I.deletedReference(group.getOwnerUUID().get()));
descTxt.setText(group.description());
visibleToAllCheckBox.setValue(group.options().isVisibleToAll());
setMembersTabVisible(AccountGroup.isInternalGroup(group.getGroupUUID()));

@ -81,7 +81,9 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
private void initMemberList() {
addMemberBox =
new AddMemberBox(
Util.C.buttonAddGroupMember(), Util.C.defaultAccountName(), new AccountSuggestOracle());
AdminConstants.I.buttonAddGroupMember(),
AdminConstants.I.defaultAccountName(),
new AccountSuggestOracle());
addMemberBox.addClickHandler(
new ClickHandler() {
@ -94,7 +96,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
members = new MemberTable();
members.addStyleName(Gerrit.RESOURCES.css().groupMembersTable());
delMember = new Button(Util.C.buttonDeleteGroupMembers());
delMember = new Button(AdminConstants.I.buttonDeleteGroupMembers());
delMember.addClickHandler(
new ClickHandler() {
@Override
@ -104,7 +106,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
});
memberPanel = new FlowPanel();
memberPanel.add(new SmallHeading(Util.C.headingMembers()));
memberPanel.add(new SmallHeading(AdminConstants.I.headingMembers()));
memberPanel.add(addMemberBox);
memberPanel.add(members);
memberPanel.add(delMember);
@ -115,8 +117,8 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
accountGroupSuggestOracle = new AccountGroupSuggestOracle();
addIncludeBox =
new AddMemberBox(
Util.C.buttonAddIncludedGroup(),
Util.C.defaultAccountGroupName(),
AdminConstants.I.buttonAddIncludedGroup(),
AdminConstants.I.defaultAccountGroupName(),
accountGroupSuggestOracle);
addIncludeBox.addClickHandler(
@ -130,7 +132,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
includes = new IncludeTable();
includes.addStyleName(Gerrit.RESOURCES.css().groupIncludesTable());
delInclude = new Button(Util.C.buttonDeleteIncludedGroup());
delInclude = new Button(AdminConstants.I.buttonDeleteIncludedGroup());
delInclude.addClickHandler(
new ClickHandler() {
@Override
@ -140,7 +142,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
});
includePanel = new FlowPanel();
includePanel.add(new SmallHeading(Util.C.headingIncludedGroups()));
includePanel.add(new SmallHeading(AdminConstants.I.headingIncludedGroups()));
includePanel.add(addIncludeBox);
includePanel.add(includes);
includePanel.add(delInclude);
@ -150,7 +152,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
private void initNoMembersInfo() {
noMembersInfo = new FlowPanel();
noMembersInfo.setVisible(false);
noMembersInfo.add(new SmallHeading(Util.C.noMembersInfo()));
noMembersInfo.add(new SmallHeading(AdminConstants.I.noMembersInfo()));
add(noMembersInfo);
}
@ -231,8 +233,8 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
private boolean enabled = true;
MemberTable() {
table.setText(0, 2, Util.C.columnMember());
table.setText(0, 3, Util.C.columnEmailAddress());
table.setText(0, 2, AdminConstants.I.columnMember());
table.setText(0, 3, AdminConstants.I.columnEmailAddress());
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
@ -341,8 +343,8 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
private boolean enabled = true;
IncludeTable() {
table.setText(0, 2, Util.C.columnGroupName());
table.setText(0, 3, Util.C.columnGroupDescription());
table.setText(0, 2, AdminConstants.I.columnGroupName());
table.setText(0, 3, AdminConstants.I.columnGroupDescription());
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());

@ -40,9 +40,9 @@ public abstract class AccountGroupScreen extends MenuScreen {
this.membersTabToken = getTabToken(token, MEMBERS);
this.auditLogTabToken = getTabToken(token, AUDIT_LOG);
link(Util.C.groupTabGeneral(), getTabToken(token, INFO));
link(AdminConstants.I.groupTabGeneral(), getTabToken(token, INFO));
link(
Util.C.groupTabMembers(),
AdminConstants.I.groupTabMembers(),
membersTabToken,
AccountGroup.isInternalGroup(group.getGroupUUID()));
}
@ -57,7 +57,7 @@ public abstract class AccountGroupScreen extends MenuScreen {
@Override
protected void onLoad() {
super.onLoad();
setPageTitle(Util.M.group(group.name()));
setPageTitle(AdminMessages.I.group(group.name()));
display();
GroupApi.isGroupOwner(
group.name(),
@ -66,7 +66,7 @@ public abstract class AccountGroupScreen extends MenuScreen {
public void onSuccess(Boolean result) {
if (result) {
link(
Util.C.groupTabAuditLog(),
AdminConstants.I.groupTabAuditLog(),
auditLogTabToken,
AccountGroup.isInternalGroup(group.getGroupUUID()));
setToken(token);

@ -14,10 +14,13 @@
package com.google.gerrit.client.admin;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.Constants;
import java.util.Map;
public interface AdminConstants extends Constants {
AdminConstants I = GWT.create(AdminConstants.class);
String defaultAccountName();
String defaultAccountGroupName();

@ -14,9 +14,12 @@
package com.google.gerrit.client.admin;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.Messages;
public interface AdminMessages extends Messages {
AdminMessages I = GWT.create(AdminMessages.class);
String group(String name);
String label(String name);

@ -31,8 +31,8 @@ class CreateChangeAction {
b.setEnabled(false);
new CreateChangeDialog(new Project.NameKey(project)) {
{
sendButton.setText(Util.C.buttonCreate());
message.setText(Util.C.buttonCreateDescription());
sendButton.setText(AdminConstants.I.buttonCreate());
message.setText(AdminConstants.I.buttonCreateDescription());
}
@Override

@ -70,14 +70,14 @@ public class CreateGroupScreen extends Screen {
@Override
protected void onInitUI() {
super.onInitUI();
setPageTitle(Util.C.createGroupTitle());
setPageTitle(AdminConstants.I.createGroupTitle());
addCreateGroupPanel();
}
private void addCreateGroupPanel() {
VerticalPanel addPanel = new VerticalPanel();
addPanel.setStyleName(Gerrit.RESOURCES.css().addSshKeyPanel());
addPanel.add(new SmallHeading(Util.C.headingCreateGroup()));
addPanel.add(new SmallHeading(AdminConstants.I.headingCreateGroup()));
addTxt =
new NpTextBox() {
@ -112,7 +112,7 @@ public class CreateGroupScreen extends Screen {
});
addPanel.add(addTxt);
addNew = new Button(Util.C.buttonCreateGroup());
addNew = new Button(AdminConstants.I.buttonCreateGroup());
addNew.setEnabled(false);
addNew.addClickHandler(
new ClickHandler() {

@ -94,7 +94,7 @@ public class CreateProjectScreen extends Screen {
@Override
protected void onInitUI() {
super.onInitUI();
setPageTitle(Util.C.createProjectTitle());
setPageTitle(AdminConstants.I.createProjectTitle());
addCreateProjectPanel();
/* popup */
@ -108,7 +108,7 @@ public class CreateProjectScreen extends Screen {
}
}
};
projectsPopup.initPopup(Util.C.projects(), PageLinks.ADMIN_PROJECTS);
projectsPopup.initPopup(AdminConstants.I.projects(), PageLinks.ADMIN_PROJECTS);
}
private void addCreateProjectPanel() {
@ -121,8 +121,8 @@ public class CreateProjectScreen extends Screen {
addGrid(fp);
emptyCommit = new CheckBox(Util.C.checkBoxEmptyCommit());
permissionsOnly = new CheckBox(Util.C.checkBoxPermissionsOnly());
emptyCommit = new CheckBox(AdminConstants.I.checkBoxEmptyCommit());
permissionsOnly = new CheckBox(AdminConstants.I.checkBoxPermissionsOnly());
fp.add(emptyCommit);
fp.add(permissionsOnly);
fp.add(create);
@ -168,7 +168,7 @@ public class CreateProjectScreen extends Screen {
}
private void initCreateButton() {
create = new Button(Util.C.buttonCreateProject());
create = new Button(AdminConstants.I.buttonCreateProject());
create.setEnabled(false);
create.addClickHandler(
new ClickHandler() {
@ -178,7 +178,7 @@ public class CreateProjectScreen extends Screen {
}
});
browse = new Button(Util.C.buttonBrowseProjects());
browse = new Button(AdminConstants.I.buttonBrowseProjects());
browse.addClickHandler(
new ClickHandler() {
@Override
@ -207,7 +207,7 @@ public class CreateProjectScreen extends Screen {
suggestedParentsTab =
new ProjectsTable() {
{
table.setText(0, 1, Util.C.parentSuggestions());
table.setText(0, 1, AdminConstants.I.parentSuggestions());
}
@Override
@ -246,9 +246,9 @@ public class CreateProjectScreen extends Screen {
private void addGrid(final VerticalPanel fp) {
grid = new Grid(2, 3);
grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
grid.setText(0, 0, Util.C.columnProjectName() + ":");
grid.setText(0, 0, AdminConstants.I.columnProjectName() + ":");
grid.setWidget(0, 1, project);
grid.setText(1, 0, Util.C.headingParentProjectName() + ":");
grid.setText(1, 0, AdminConstants.I.headingParentProjectName() + ":");
grid.setWidget(1, 1, parent);
grid.setWidget(1, 2, browse);
fp.add(grid);

@ -31,7 +31,7 @@ public class EditConfigAction {
project,
RefNames.REFS_CONFIG,
null,
Util.C.editConfigMessage(),
AdminConstants.I.editConfigMessage(),
null,
new GerritCallback<ChangeInfo>() {
@Override

@ -95,7 +95,7 @@ public class GroupListScreen extends Screen {
@Override
protected void onInitUI() {
super.onInitUI();
setPageTitle(Util.C.groupListTitle());
setPageTitle(AdminConstants.I.groupListTitle());
initPageHeader();
prev = PagingHyperlink.createPrev();
@ -117,7 +117,7 @@ public class GroupListScreen extends Screen {
private void initPageHeader() {
final HorizontalPanel hp = new HorizontalPanel();
hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
final Label filterLabel = new Label(Util.C.projectFilter());
final Label filterLabel = new Label(AdminConstants.I.projectFilter());
filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
hp.add(filterLabel);
filterTxt = new NpTextBox();

@ -14,8 +14,6 @@
package com.google.gerrit.client.admin;
import static com.google.gerrit.client.admin.Util.C;
import com.google.gerrit.client.Dispatcher;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.groups.GroupList;
@ -46,12 +44,12 @@ public class GroupTable extends NavigationTable<GroupInfo> {
}
public GroupTable(final String pointerId) {
super(C.groupItemHelp());
super(AdminConstants.I.groupItemHelp());
setSavePointerId(pointerId);
table.setText(0, 1, C.columnGroupName());
table.setText(0, 2, C.columnGroupDescription());
table.setText(0, 3, C.columnGroupVisibleToAll());
table.setText(0, 1, AdminConstants.I.columnGroupName());
table.setText(0, 2, AdminConstants.I.columnGroupDescription());
table.setText(0, 3, AdminConstants.I.columnGroupVisibleToAll());
table.addClickHandler(
new ClickHandler() {
@Override

@ -25,7 +25,7 @@ class PermissionNameRenderer implements Renderer<String> {
static {
permissions = new HashMap<>();
for (Map.Entry<String, String> e : Util.C.permissionNames().entrySet()) {
for (Map.Entry<String, String> e : AdminConstants.I.permissionNames().entrySet()) {
permissions.put(e.getKey(), e.getValue());
permissions.put(e.getKey().toLowerCase(), e.getValue());
}
@ -40,9 +40,9 @@ class PermissionNameRenderer implements Renderer<String> {
@Override
public String render(String varName) {
if (Permission.isLabelAs(varName)) {
return Util.M.labelAs(Permission.extractLabel(varName));
return AdminMessages.I.labelAs(Permission.extractLabel(varName));
} else if (Permission.isLabel(varName)) {
return Util.M.label(Permission.extractLabel(varName));
return AdminMessages.I.label(Permission.extractLabel(varName));
}
String desc = permissions.get(varName);

@ -63,10 +63,10 @@ public class PluginListScreen extends PluginScreen {
private static class PluginTable extends FancyFlexTable<PluginInfo> {
PluginTable() {
table.setText(0, 1, Util.C.columnPluginName());
table.setText(0, 2, Util.C.columnPluginSettings());
table.setText(0, 3, Util.C.columnPluginVersion());
table.setText(0, 4, Util.C.columnPluginStatus());
table.setText(0, 1, AdminConstants.I.columnPluginName());
table.setText(0, 2, AdminConstants.I.columnPluginSettings());
table.setText(0, 3, AdminConstants.I.columnPluginVersion());
table.setText(0, 4, AdminConstants.I.columnPluginStatus());
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());
@ -99,13 +99,16 @@ public class PluginListScreen extends PluginScreen {
InlineHyperlink adminScreenLink = new InlineHyperlink();
adminScreenLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.gear()));
adminScreenLink.setTargetHistoryToken("/x/" + plugin.name() + "/settings");
adminScreenLink.setTitle(Util.C.pluginSettingsToolTip());
adminScreenLink.setTitle(AdminConstants.I.pluginSettingsToolTip());
table.setWidget(row, 2, adminScreenLink);
}
}
table.setText(row, 3, plugin.version());
table.setText(row, 4, plugin.disabled() ? Util.C.pluginDisabled() : Util.C.pluginEnabled());
table.setText(
row,
4,
plugin.disabled() ? AdminConstants.I.pluginDisabled() : AdminConstants.I.pluginEnabled());
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell());

@ -25,7 +25,7 @@ public abstract class PluginScreen extends Screen {
@Override
protected void onLoad() {
super.onLoad();
setPageTitle(Util.C.plugins());
setPageTitle(AdminConstants.I.plugins());
display();
}
}

@ -184,7 +184,7 @@ public class ProjectAccessScreen extends ProjectScreen {
final ProjectAccess access = driver.flush();
if (driver.hasErrors()) {
Window.alert(Util.C.errorsMustBeFixed());
Window.alert(AdminConstants.I.errorsMustBeFixed());
return;
}
@ -264,7 +264,7 @@ public class ProjectAccessScreen extends ProjectScreen {
final ProjectAccess access = driver.flush();
if (driver.hasErrors()) {
Window.alert(Util.C.errorsMustBeFixed());
Window.alert(AdminConstants.I.errorsMustBeFixed());
return;
}

@ -133,7 +133,7 @@ public class ProjectBranchesScreen extends PaginatedProjectScreen {
nameTxtBox = new HintTextBox();
nameTxtBox.setVisibleLength(texBoxLength);
nameTxtBox.setHintText(Util.C.defaultBranchName());
nameTxtBox.setHintText(AdminConstants.I.defaultBranchName());
nameTxtBox.addKeyPressHandler(
new KeyPressHandler() {
@Override
@ -143,12 +143,12 @@ public class ProjectBranchesScreen extends PaginatedProjectScreen {
}
}
});
addGrid.setText(0, 0, Util.C.columnBranchName() + ":");
addGrid.setText(0, 0, AdminConstants.I.columnBranchName() + ":");
addGrid.setWidget(0, 1, nameTxtBox);
irevTxtBox = new HintTextBox();
irevTxtBox.setVisibleLength(texBoxLength);
irevTxtBox.setHintText(Util.C.defaultRevisionSpec());
irevTxtBox.setHintText(AdminConstants.I.defaultRevisionSpec());
irevTxtBox.addKeyPressHandler(
new KeyPressHandler() {
@Override
@ -158,10 +158,10 @@ public class ProjectBranchesScreen extends PaginatedProjectScreen {
}
}
});
addGrid.setText(1, 0, Util.C.initialRevision() + ":");
addGrid.setText(1, 0, AdminConstants.I.initialRevision() + ":");
addGrid.setWidget(1, 1, irevTxtBox);
addBranch = new Button(Util.C.buttonAddBranch());
addBranch = new Button(AdminConstants.I.buttonAddBranch());
addBranch.addClickHandler(
new ClickHandler() {
@Override
@ -174,7 +174,7 @@ public class ProjectBranchesScreen extends PaginatedProjectScreen {
branchTable = new BranchesTable();
delBranch = new Button(Util.C.buttonDeleteBranch());
delBranch = new Button(AdminConstants.I.buttonDeleteBranch());
delBranch.setStyleName(Gerrit.RESOURCES.css().branchTableDeleteButton());
delBranch.addClickHandler(
new ClickHandler() {
@ -197,7 +197,7 @@ public class ProjectBranchesScreen extends PaginatedProjectScreen {
parseToken();
HorizontalPanel hp = new HorizontalPanel();
hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
Label filterLabel = new Label(Util.C.projectFilter());
Label filterLabel = new Label(AdminConstants.I.projectFilter());
filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
hp.add(filterLabel);
filterTxt = new NpTextBox();
@ -301,8 +301,8 @@ public class ProjectBranchesScreen extends PaginatedProjectScreen {
BranchesTable() {
table.setWidth("");
table.setText(0, 2, Util.C.columnBranchName());
table.setText(0, 3, Util.C.columnBranchRevision());
table.setText(0, 2, AdminConstants.I.columnBranchName());
table.setText(0, 3, AdminConstants.I.columnBranchRevision());
final FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
@ -499,11 +499,11 @@ public class ProjectBranchesScreen extends PaginatedProjectScreen {
input.setValue(headRevision);
input.setVisible(false);
final Button save = new Button();
save.setText(Util.C.saveHeadButton());
save.setText(AdminConstants.I.saveHeadButton());
save.setVisible(false);
save.setEnabled(false);
final Button cancel = new Button();
cancel.setText(Util.C.cancelHeadButton());
cancel.setText(AdminConstants.I.cancelHeadButton());
cancel.setVisible(false);
OnEditEnabler e = new OnEditEnabler(save);

@ -108,7 +108,7 @@ public class ProjectInfoScreen extends ProjectScreen {
super.onInitUI();
Resources.I.style().ensureInjected();
saveProject = new Button(Util.C.buttonSaveChanges());
saveProject = new Button(AdminConstants.I.buttonSaveChanges());
saveProject.setStyleName("");
saveProject.addClickHandler(
new ClickHandler() {
@ -203,7 +203,7 @@ public class ProjectInfoScreen extends ProjectScreen {
private void initDescription() {
final VerticalPanel vp = new VerticalPanel();
vp.add(new SmallHeading(Util.C.headingDescription()));
vp.add(new SmallHeading(AdminConstants.I.headingDescription()));
descTxt = new NpTextArea();
descTxt.setVisibleLines(6);
@ -216,14 +216,14 @@ public class ProjectInfoScreen extends ProjectScreen {
}
private void initProjectOptions() {
grid.addHeader(new SmallHeading(Util.C.headingProjectOptions()));
grid.addHeader(new SmallHeading(AdminConstants.I.headingProjectOptions()));
state = new ListBox();
for (ProjectState stateValue : ProjectState.values()) {
state.addItem(Util.toLongString(stateValue), stateValue.name());
}
saveEnabler.listenTo(state);
grid.add(Util.C.headingProjectState(), state);
grid.add(AdminConstants.I.headingProjectState(), state);
submitType = new ListBox();
for (final SubmitType type : SubmitType.values()) {
@ -237,32 +237,32 @@ public class ProjectInfoScreen extends ProjectScreen {
}
});
saveEnabler.listenTo(submitType);
grid.add(Util.C.headingProjectSubmitType(), submitType);
grid.add(AdminConstants.I.headingProjectSubmitType(), submitType);
contentMerge = newInheritedBooleanBox();
saveEnabler.listenTo(contentMerge);
grid.add(Util.C.useContentMerge(), contentMerge);
grid.add(AdminConstants.I.useContentMerge(), contentMerge);
newChangeForAllNotInTarget = newInheritedBooleanBox();
saveEnabler.listenTo(newChangeForAllNotInTarget);
grid.add(Util.C.createNewChangeForAllNotInTarget(), newChangeForAllNotInTarget);
grid.add(AdminConstants.I.createNewChangeForAllNotInTarget(), newChangeForAllNotInTarget);
requireChangeID = newInheritedBooleanBox();
saveEnabler.listenTo(requireChangeID);
grid.addHtml(Util.C.requireChangeID(), requireChangeID);
grid.addHtml(AdminConstants.I.requireChangeID(), requireChangeID);
if (Gerrit.info().receive().enableSignedPush()) {
enableSignedPush = newInheritedBooleanBox();
saveEnabler.listenTo(enableSignedPush);
grid.add(Util.C.enableSignedPush(), enableSignedPush);
grid.add(AdminConstants.I.enableSignedPush(), enableSignedPush);
requireSignedPush = newInheritedBooleanBox();
saveEnabler.listenTo(requireSignedPush);
grid.add(Util.C.requireSignedPush(), requireSignedPush);
grid.add(AdminConstants.I.requireSignedPush(), requireSignedPush);
}
rejectImplicitMerges = newInheritedBooleanBox();
saveEnabler.listenTo(rejectImplicitMerges);
grid.addHtml(Util.C.rejectImplicitMerges(), rejectImplicitMerges);
grid.addHtml(AdminConstants.I.rejectImplicitMerges(), rejectImplicitMerges);
maxObjectSizeLimit = new NpTextBox();
saveEnabler.listenTo(maxObjectSizeLimit);
@ -272,7 +272,7 @@ public class ProjectInfoScreen extends ProjectScreen {
HorizontalPanel p = new HorizontalPanel();
p.add(maxObjectSizeLimit);
p.add(effectiveMaxObjectSizeLimit);
grid.addHtml(Util.C.headingMaxObjectSizeLimit(), p);
grid.addHtml(AdminConstants.I.headingMaxObjectSizeLimit(), p);
}
private static ListBox newInheritedBooleanBox() {
@ -301,17 +301,17 @@ public class ProjectInfoScreen extends ProjectScreen {
}
private void initAgreements() {
grid.addHeader(new SmallHeading(Util.C.headingAgreements()));
grid.addHeader(new SmallHeading(AdminConstants.I.headingAgreements()));
contributorAgreements = newInheritedBooleanBox();
if (Gerrit.info().auth().useContributorAgreements()) {
saveEnabler.listenTo(contributorAgreements);
grid.add(Util.C.useContributorAgreements(), contributorAgreements);
grid.add(AdminConstants.I.useContributorAgreements(), contributorAgreements);
}
signedOffBy = newInheritedBooleanBox();
saveEnabler.listenTo(signedOffBy);
grid.addHtml(Util.C.useSignedOffBy(), signedOffBy);
grid.addHtml(AdminConstants.I.useSignedOffBy(), signedOffBy);
}
private void setSubmitType(final SubmitType newSubmitType) {
@ -401,9 +401,9 @@ public class ProjectInfoScreen extends ProjectScreen {
if (result.maxObjectSizeLimit().inheritedValue() != null) {
effectiveMaxObjectSizeLimit.setVisible(true);
effectiveMaxObjectSizeLimit.setText(
Util.M.effectiveMaxObjectSizeLimit(result.maxObjectSizeLimit().value()));
AdminMessages.I.effectiveMaxObjectSizeLimit(result.maxObjectSizeLimit().value()));
effectiveMaxObjectSizeLimit.setTitle(
Util.M.globalMaxObjectSizeLimit(result.maxObjectSizeLimit().inheritedValue()));
AdminMessages.I.globalMaxObjectSizeLimit(result.maxObjectSizeLimit().inheritedValue()));
} else {
effectiveMaxObjectSizeLimit.setVisible(false);
}
@ -421,7 +421,7 @@ public class ProjectInfoScreen extends ProjectScreen {
Map<String, HasEnabled> widgetMap = new HashMap<>();
pluginConfigWidgets.put(pluginName, widgetMap);
LabeledWidgetsGrid g = new LabeledWidgetsGrid();
g.addHeader(new SmallHeading(Util.M.pluginProjectOptionsTitle(pluginName)));
g.addHeader(new SmallHeading(AdminMessages.I.pluginProjectOptionsTitle(pluginName)));
pluginOptionsPanel.add(g);
NativeMap<ConfigParameterInfo> pluginConfig = info.pluginConfig(pluginName);
pluginConfig.copyKeysIntoChildren("name");
@ -460,7 +460,8 @@ public class ProjectInfoScreen extends ProjectScreen {
NpTextBox textBox = param.type().equals("STRING") ? new NpTextBox() : new NpIntTextBox();
if (param.inheritable()) {
textBox.setValue(param.configuredValue());
Label inheritedLabel = new Label(Util.M.pluginProjectInheritedValue(param.inheritedValue()));
Label inheritedLabel =
new Label(AdminMessages.I.pluginProjectInheritedValue(param.inheritedValue()));
inheritedLabel.setStyleName(Gerrit.RESOURCES.css().pluginProjectConfigInheritedValue());
HorizontalPanel p = new HorizontalPanel();
p.add(textBox);
@ -500,7 +501,7 @@ public class ProjectInfoScreen extends ProjectScreen {
}
ListBox listBox = new ListBox();
if (param.inheritable()) {
listBox.addItem(Util.M.pluginProjectInheritedListValue(param.inheritedValue()));
listBox.addItem(AdminMessages.I.pluginProjectInheritedListValue(param.inheritedValue()));
if (param.configuredValue() == null) {
listBox.setSelectedIndex(0);
}
@ -532,7 +533,7 @@ public class ProjectInfoScreen extends ProjectScreen {
// since the listBox is disabled the inherited value cannot be
// seen and we have to display it explicitly
Label inheritedLabel =
new Label(Util.M.pluginProjectInheritedValue(param.inheritedValue()));
new Label(AdminMessages.I.pluginProjectInheritedValue(param.inheritedValue()));
inheritedLabel.setStyleName(Gerrit.RESOURCES.css().pluginProjectConfigInheritedValue());
HorizontalPanel p = new HorizontalPanel();
p.add(listBox);
@ -599,11 +600,11 @@ public class ProjectInfoScreen extends ProjectScreen {
return;
}
actions.copyKeysIntoChildren("id");
actionsGrid.addHeader(new SmallHeading(Util.C.headingProjectCommands()));
actionsGrid.addHeader(new SmallHeading(AdminConstants.I.headingProjectCommands()));
FlowPanel actionsPanel = new FlowPanel();
actionsPanel.setStyleName(Gerrit.RESOURCES.css().projectActions());
actionsPanel.setVisible(true);
actionsGrid.add(Util.C.headingCommands(), actionsPanel);
actionsGrid.add(AdminConstants.I.headingCommands(), actionsPanel);
for (String id : actions.keySet()) {
actionsPanel.add(new ActionButton(getProjectKey(), actions.get(id)));
@ -621,9 +622,9 @@ public class ProjectInfoScreen extends ProjectScreen {
}
private Button createChangeAction() {
final Button createChange = new Button(Util.C.buttonCreateChange());
final Button createChange = new Button(AdminConstants.I.buttonCreateChange());
createChange.setStyleName("");
createChange.setTitle(Util.C.buttonCreateChangeDescription());
createChange.setTitle(AdminConstants.I.buttonCreateChangeDescription());
createChange.addClickHandler(
new ClickHandler() {
@Override
@ -635,9 +636,9 @@ public class ProjectInfoScreen extends ProjectScreen {
}
private Button createEditConfigAction() {
final Button editConfig = new Button(Util.C.buttonEditConfig());
final Button editConfig = new Button(AdminConstants.I.buttonEditConfig());
editConfig.setStyleName("");
editConfig.setTitle(Util.C.buttonEditConfigDescription());
editConfig.setTitle(AdminConstants.I.buttonEditConfigDescription());
editConfig.addClickHandler(
new ClickHandler() {
@Override

@ -71,7 +71,7 @@ public class ProjectListScreen extends PaginatedProjectScreen {
@Override
protected void onInitUI() {
super.onInitUI();
setPageTitle(Util.C.projectListTitle());
setPageTitle(AdminConstants.I.projectListTitle());
initPageHeader();
prev = PagingHyperlink.createPrev();
@ -85,7 +85,7 @@ public class ProjectListScreen extends PaginatedProjectScreen {
@Override
protected void initColumnHeaders() {
super.initColumnHeaders();
table.setText(0, ProjectsTable.C_REPO_BROWSER, Util.C.projectRepoBrowser());
table.setText(0, ProjectsTable.C_REPO_BROWSER, AdminConstants.I.projectRepoBrowser());
table
.getFlexCellFormatter()
.addStyleName(0, ProjectsTable.C_REPO_BROWSER, Gerrit.RESOURCES.css().dataHeader());
@ -162,7 +162,7 @@ public class ProjectListScreen extends PaginatedProjectScreen {
private void initPageHeader() {
final HorizontalPanel hp = new HorizontalPanel();
hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
final Label filterLabel = new Label(Util.C.projectFilter());
final Label filterLabel = new Label(AdminConstants.I.projectFilter());
filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
hp.add(filterLabel);
filterTxt = new NpTextBox();

@ -49,7 +49,7 @@ public abstract class ProjectScreen extends Screen {
protected void onInitUI() {
super.onInitUI();
if (name != null) {
setPageTitle(Util.M.project(name.get()));
setPageTitle(AdminMessages.I.project(name.get()));
}
}

@ -83,7 +83,7 @@ public class ProjectTagsScreen extends PaginatedProjectScreen {
parseToken();
HorizontalPanel hp = new HorizontalPanel();
hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
Label filterLabel = new Label(Util.C.projectFilter());
Label filterLabel = new Label(AdminConstants.I.projectFilter());
filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
hp.add(filterLabel);
filterTxt = new NpTextBox();
@ -109,8 +109,8 @@ public class ProjectTagsScreen extends PaginatedProjectScreen {
TagsTable() {
table.setWidth("");
table.setText(0, 1, Util.C.columnTagName());
table.setText(0, 2, Util.C.columnBranchRevision());
table.setText(0, 1, AdminConstants.I.columnTagName());
table.setText(0, 2, AdminConstants.I.columnBranchRevision());
FlexCellFormatter fmt = table.getFlexCellFormatter();
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());

@ -45,11 +45,11 @@ public class RefPatternBox extends ValueBox<String> {
String ref = text.toString();
if (ref.isEmpty()) {
throw new ParseException(Util.C.refErrorEmpty(), 0);
throw new ParseException(AdminConstants.I.refErrorEmpty(), 0);
}
if (ref.charAt(0) == '/') {
throw new ParseException(Util.C.refErrorBeginSlash(), 0);
throw new ParseException(AdminConstants.I.refErrorBeginSlash(), 0);
}
if (ref.charAt(0) == '^') {
@ -64,15 +64,15 @@ public class RefPatternBox extends ValueBox<String> {
final char c = ref.charAt(i);
if (c == '/' && 0 < i && ref.charAt(i - 1) == '/') {
throw new ParseException(Util.C.refErrorDoubleSlash(), i);
throw new ParseException(AdminConstants.I.refErrorDoubleSlash(), i);
}
if (c == ' ') {
throw new ParseException(Util.C.refErrorNoSpace(), i);
throw new ParseException(AdminConstants.I.refErrorNoSpace(), i);
}
if (c < ' ') {
throw new ParseException(Util.C.refErrorPrintable(), i);
throw new ParseException(AdminConstants.I.refErrorPrintable(), i);
}
}
return ref;

@ -21,8 +21,6 @@ import com.google.gwt.core.client.GWT;
import com.google.gwtjsonrpc.client.JsonUtil;
public class Util {
public static final AdminConstants C = GWT.create(AdminConstants.class);
public static final AdminMessages M = GWT.create(AdminMessages.class);
public static final ProjectAdminService PROJECT_SVC;
static {
@ -38,17 +36,17 @@ public class Util {
}
switch (type) {
case FAST_FORWARD_ONLY:
return C.projectSubmitType_FAST_FORWARD_ONLY();
return AdminConstants.I.projectSubmitType_FAST_FORWARD_ONLY();
case MERGE_IF_NECESSARY:
return C.projectSubmitType_MERGE_IF_NECESSARY();
return AdminConstants.I.projectSubmitType_MERGE_IF_NECESSARY();
case REBASE_IF_NECESSARY:
return C.projectSubmitType_REBASE_IF_NECESSARY();
return AdminConstants.I.projectSubmitType_REBASE_IF_NECESSARY();
case REBASE_ALWAYS:
return C.projectSubmitType_REBASE_ALWAYS();
return AdminConstants.I.projectSubmitType_REBASE_ALWAYS();
case MERGE_ALWAYS:
return C.projectSubmitType_MERGE_ALWAYS();
return AdminConstants.I.projectSubmitType_MERGE_ALWAYS();
case CHERRY_PICK:
return C.projectSubmitType_CHERRY_PICK();
return AdminConstants.I.projectSubmitType_CHERRY_PICK();
default:
return type.name();
}
@ -60,11 +58,11 @@ public class Util {
}
switch (type) {
case ACTIVE:
return C.projectState_ACTIVE();
return AdminConstants.I.projectState_ACTIVE();
case READ_ONLY:
return C.projectState_READ_ONLY();
return AdminConstants.I.projectState_READ_ONLY();
case HIDDEN:
return C.projectState_HIDDEN();
return AdminConstants.I.projectState_HIDDEN();
default:
return type.name();
}

@ -14,7 +14,7 @@
package com.google.gerrit.client.change;
import com.google.gerrit.client.admin.Util;
import com.google.gerrit.client.admin.AdminConstants;
import com.google.gerrit.client.changes.ChangeApi;
import com.google.gerrit.client.info.AccountInfo;
import com.google.gerrit.client.info.GroupBaseInfo;
@ -75,7 +75,8 @@ public class ReviewerSuggestOracle extends HighlightSuggestOracle {
this.displayString = replacementString;
} else {
this.replacementString = reviewer.group().name();
this.displayString = replacementString + " (" + Util.C.suggestedGroupLabel() + ")";
this.displayString =
replacementString + " (" + AdminConstants.I.suggestedGroupLabel() + ")";
}
}

@ -15,16 +15,16 @@
package com.google.gerrit.client.ui;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.admin.Util;
import com.google.gerrit.client.admin.AdminConstants;
public class PagingHyperlink extends Hyperlink {
public static PagingHyperlink createPrev() {
return new PagingHyperlink(Util.C.pagedListPrev());
return new PagingHyperlink(AdminConstants.I.pagedListPrev());
}
public static PagingHyperlink createNext() {
return new PagingHyperlink(Util.C.pagedListNext());
return new PagingHyperlink(AdminConstants.I.pagedListNext());
}
private PagingHyperlink(String text) {

@ -112,7 +112,8 @@ public class ProjectListPopup {
private void createWidgets(final String popupText, final String currentPageLink) {
filterPanel = new HorizontalPanel();
filterPanel.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
final Label filterLabel = new Label(com.google.gerrit.client.admin.Util.C.projectFilter());
final Label filterLabel =
new Label(com.google.gerrit.client.admin.AdminConstants.I.projectFilter());
filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
filterPanel.add(filterLabel);
filterTxt = new NpTextBox();

@ -15,7 +15,7 @@
package com.google.gerrit.client.ui;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.admin.Util;
import com.google.gerrit.client.admin.AdminConstants;
import com.google.gerrit.common.PageLinks;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gwt.user.client.DOM;
@ -25,7 +25,7 @@ public class ProjectSearchLink extends InlineHyperlink {
public ProjectSearchLink(Project.NameKey projectName) {
super(" ", PageLinks.toProjectDefaultDashboard(projectName));
setTitle(Util.C.projectListQueryLink());
setTitle(AdminConstants.I.projectListQueryLink());
final Image image = new Image(Gerrit.RESOURCES.queryIcon());
image.setStyleName(Gerrit.RESOURCES.css().queryIcon());
DOM.insertBefore(getElement(), image.getElement(), DOM.getFirstChild(getElement()));