Bug 172841 - [Dialogs] FilteredItemsSelectionDialog should always select first item on update
Summary: [Dialogs] FilteredItemsSelectionDialog should always select first item on update
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: Krzysztof Michalski CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks: 173098
  Show dependency tree
 
Reported: 2007-02-05 04:58 EST by Markus Keller CLA
Modified: 2007-06-05 14:23 EDT (History)
2 users (show)

See Also:


Attachments
Patch fixes this bug (1.68 KB, patch)
2007-02-22 05:03 EST, Krzysztof Michalski CLA
no flags Details | Diff
Changes depend on Markus suggestion (1.01 KB, patch)
2007-02-23 11:25 EST, Krzysztof Michalski CLA
no flags Details | Diff
Patch is an answered to Markus suggestion. (919 bytes, patch)
2007-02-27 07:57 EST, Krzysztof Michalski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2007-02-05 04:58:08 EST
I20070205-0009

The FilteredItemsSelectionDialog should always select the first item of the new result list on update. The item should be selected as soon as the first result (from history or from the content provider) is available and shown.

Steps:
- with a JDK 5.0, open Open Type dialog
- write "Read"
- select "Reader - java.io"
- Shift+Tab, press "e" to turn the filter into "Reade"

=> Expected: first item should be selected
=> Was: a completely unrelated type is selected (ReaderThreadImpl in my case).
It looks like the selection stays at the table element with the same index. This is almost never what the user expects.
Comment 1 Krzysztof Michalski CLA 2007-02-22 05:03:27 EST
Created attachment 59555 [details]
Patch fixes this bug
Comment 2 Tod Creasey CLA 2007-02-22 13:00:25 EST
Patch updated and released for build >20070222
Comment 3 Markus Keller CLA 2007-02-23 10:14:06 EST
Fix is not good:

	list.getTable().deselectAll();
	list.getTable().setSelection(0);

- deselectAll() is redundant since setSelection(..) first clears selection (please read Javadoc)

- Table#setSelection(..) does not send out JFace selection events, which is why the status line is not updated when the filter changes. You need to select domain elements via TableViewer#setSelection(..) to get the notification right.
Comment 4 Krzysztof Michalski CLA 2007-02-23 11:25:12 EST
Created attachment 59669 [details]
Changes depend on Markus suggestion

Right Markus, i changed it.
Comment 5 Markus Keller CLA 2007-02-23 15:01:01 EST
Notes to patch from comment 4:
- extracting list.getElementAt(0) into a local var would save a call
- getElementAt(int) is marked as "This method is internal to the framework."
- TypeInfoViewer did:
		fTable.setSelection(0);
		fTable.notifyListeners(SWT.Selection, new Event());

Comment 6 Krzysztof Michalski CLA 2007-02-27 07:57:11 EST
Created attachment 59866 [details]
Patch is an answered to Markus suggestion.
Comment 7 Tod Creasey CLA 2007-03-01 10:28:34 EST
Patch released for build >20060301