Hide scheme selector in download box if there are no choices

If the user has only one valid scheme to download this change from
hide the selector widget. This avoids confusion about being able
to switch the scheme used for download commands.

Change-Id: I8c46efecc517a44f1ed7fe020a1f5b93e88ae9c7
This commit is contained in:
Shawn Pearce 2013-08-26 15:30:26 -07:00
parent 5314a0ed02
commit 44de7dce7a

View File

@ -150,19 +150,22 @@ class DownloadBox extends Composite {
}
scheme.addItem(u, id);
}
int select = 0;
String find = getUserPreference();
if (find != null) {
for (int i = 0; i < scheme.getItemCount(); i++) {
if (find.equals(scheme.getValue(i))) {
select = i;
break;
if (scheme.getItemCount() == 1) {
scheme.setSelectedIndex(0);
scheme.setVisible(false);
} else {
int select = 0;
String find = getUserPreference();
if (find != null) {
for (int i = 0; i < scheme.getItemCount(); i++) {
if (find.equals(scheme.getValue(i))) {
select = i;
break;
}
}
}
scheme.setSelectedIndex(select);
}
scheme.setSelectedIndex(select);
renderCommands();
}