Now we restore previous selected update mode after the corresponding combobox is repopulated (closes #7381)

This commit is contained in:
kifir23917 2025-02-12 20:09:11 +03:00 committed by rusefillc
parent b6ab24aea7
commit 60b99fdd68
1 changed files with 4 additions and 1 deletions

View File

@ -335,6 +335,7 @@ public class ProgramSelector {
boolean hasSerialPorts = !currentHardware.getKnownPorts().isEmpty();
boolean hasDfuDevice = currentHardware.isDfuFound();
Object updateModeToRestore = updateModeComboBox.getSelectedItem();
updateModeComboBox.removeAllItems();
if (FileLog.isWindows()) {
boolean requireBlt = FindFileHelper.isObfuscated();
@ -366,10 +367,12 @@ public class ProgramSelector {
List<PortResult> listOfBootloaders = currentHardware.getKnownPorts().stream().filter(portResult -> portResult.type == OpenBlt).collect(Collectors.toList());
if (!listOfBootloaders.isEmpty()) {
updateModeComboBox.setSelectedItem(OPENBLT_MANUAL);
updateModeToRestore = OPENBLT_MANUAL;
}
}
updateModeComboBox.setSelectedItem(updateModeToRestore);
AutoupdateUtil.trueLayout(updateModeComboBox);
AutoupdateUtil.trueLayout(content);
}