Make the armor kit dropdown searchable - #8963
Conversation
The Configure Pilots armor kit list runs to dozens of entries, so it now uses the same searchable dropdown as the ammunition lists: type a few letters instead of scrolling. Replaces the display-name-to-internal-name map with an ArmorKitChoice record, so the selection carries its own internal name and the read-back no longer has to look the display text up in a side map. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
The current implementation has a user-visible tooltip regression with SearchableComboBox (and a small cleanup needed) that should be addressed before merging.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR updates the “Configure Pilots” UI to make the armor kit dropdown searchable (matching the UX used by the ammunition selectors) and to store armor kit selections as a value object that carries both display and internal names.
Changes:
- Replace the armor kit
JComboBox<String>with aSearchableComboBox<ArmorKitChoice>so users can type-to-filter long kit lists. - Replace the display-name-to-internal-name side map with an
ArmorKitChoicerecord so reading back the selection no longer depends on a lookup map. - Update armor kit population/selection logic to operate on
ArmorKitChoiceand return the selected internal name (ornullfor none).
File summaries
| File | Description |
|---|---|
| megamek/src/megamek/client/ui/dialogs/customMek/CustomPilotViewPanel.java | Switch armor kit selection to a searchable combo box and carry internal names via an ArmorKitChoice record. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
SearchableComboBox puts its "type to search" hint on the editor field, which is what the pointer is over on an editable combo box. A tooltip set by the caller went on the combo box and was never seen. Overrides setToolTipText to put it on the editor as well, falling back to the hint when cleared. Also removes java.util.Map from CustomPilotViewPanel, unused since the display-name map became a record. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y1Lb2sbXg7jYcZoGDgyhWB
…armor-kit-dropdown
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y1Lb2sbXg7jYcZoGDgyhWB
|
Tested in game and working. Out of draft. Typing filters the list, a kit can be picked, and the selection round-trips when the dialog is reopened. Both Copilot findings from the earlier round are fixed in 41423ab, and a formatting-only commit followed for the import order Spotless wanted. |
What this changes
The armor kit dropdown in Configure Pilots is searchable, like the ammunition lists.
The list runs to dozens of kits, so typing a few letters beats scrolling for one.
Also replaces the display-name-to-internal-name side map with an
ArmorKitChoicerecord, so the selection carries its own internal name and reading it back no longer means looking the display text up in a map.No issue number; asked for directly.
Testing
Tested in game. Typing filters the list, a kit can be picked and selected, and the selection round-trips when the dialog is reopened.
compileJava,checkstyleMainandspotlessCheckpass.Two Copilot findings fixed. An import left unused once the display-name map became a record, and a tooltip that could never be seen:
SearchableComboBoxsets its own search hint on the editor field, and on an editable combo box that is what the pointer is over, so a caller's tooltip sat behind it. Fixed in the combo box rather than here, since every caller that sets a tooltip on one hits it.What is not proven yet
SearchableComboBox, not just this one. Other callers were not re-checked on screen.