| Summary: | [Combo] Selection is incorrect after adding item before selection | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Jason Roberts <jason.roberts> | ||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | eclipse, jason.roberts | ||||
| Version: | 3.4 | ||||||
| Target Milestone: | 3.5 M2 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| See Also: |
https://git.eclipse.org/r/116508 https://git.eclipse.org/c/rap/org.eclipse.rap.git/commit/?id=7c5e6e68a9b6febec961c8e033abc3c8b9e7e894 |
||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
ListModel#remove(int) makes a call to adjustSelectionIndices which explains why the issue doesn't exist when removing an item before the selection index. It seems like we just need to do a similar adjustment in ListModel#add(String, int). New Gerrit change created: https://git.eclipse.org/r/116508 Gerrit change https://git.eclipse.org/r/116508 was merged to [master]. Commit: http://git.eclipse.org/c/rap/org.eclipse.rap.git/commit/?id=7c5e6e68a9b6febec961c8e033abc3c8b9e7e894 |
Created attachment 272476 [details] An entry point to demonstrate the bug When adding a Combo item before the current selection, the selection is not adjusted properly. Steps to reproduce: 1. Run the code in the attached entry point. The item at index 0 is initially selected programatically. 2. Click "Add Item" to add a new Combo item at index 0. 3. The Combo text changes to "addedItem" and clicking the "Print Selection" button shows that the selection is still 0. The selection should have changed to 1 and the text should have remained "item1". I would have expected similar behavior when removing items before the selection but that seems to work fine. The snippet includes a remove button to demonstrate that as well. When I run a similar snippet with swt-win64, item1 remains selected when clicking the "Add Item" button and the new selection index is 1. A selection event is not raised however.