Bug 573221 - ListSelectionDialog: Improve usability and extend its API
Summary: ListSelectionDialog: Improve usability and extend its API
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.19   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.21 M3   Edit
Assignee: Holger Voormann CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks: 572939 574014
  Show dependency tree
 
Reported: 2021-04-28 11:34 EDT by Holger Voormann CLA
Modified: 2021-07-31 03:16 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Voormann CLA 2021-04-28 11:34:37 EDT
Improve the usability of org.eclipse.ui.dialogs.ListSelectionDialog (which is used e.g. in the "Save Resources" dialog: see bug 572939) and extend its API in the following ways:

(a) Enabling/Disabling of the "Select All" and the "Deselect All" buttons
Actual: Both buttons are always enabled.
Expected:
- When all elements are selected, the "Select All" button should be disabled, otherwise enabled.
- When no elements are selected, the "Deselect All" button should be disabled, otherwise enabled.

(b) Shorten button labels: "Select All" => "All" and "Deselect All" => "None"
Shortening labels is a tradeoff between better readability (shorter and more distinguishable) and that button labels should be verbs. The shortening leads to the following new mnemonics:
- Alt+S for "Select All" => Alt+A for "All"
- Alt+D for "Deselect All" => Alt+N for "None"

(c) Extend API
The class is marked as "@noextend This class is not intended to be subclassed by clients.", but internally, it is extended several times for different purposes. The goal is that subclassing should no longer be necessary for customizations, to achieve more consistency and avoid duplicate code, and to give clients the same capabilities as the dialogs used internally.
The extended API should provide following additional possibilities:
- Dialog title: to avoid that it will be missed, even the title can also be set via setTitle()
- OK button label:
  - When nothing is selected: For example, "Launch without Saving"
  - When one or more elements are selected: With {0} as placeholder for the current selected elements and with {1} for the total number of elements; for example, "Save {0} of {1} and Launch"
- Whether the dialog can be canceled (via Cancel button or by closing the dialog window)
- Whether to use SWT#SHEET (modal dialog that is attached to a parent window)
- Optional checkbox:
  - Label
  - Default value
The existing constructor should be marked as deprecated in favor of the new API.
Comment 1 Eclipse Genie CLA 2021-04-28 11:38:34 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/179930
Comment 3 Lars Vogel CLA 2021-07-30 07:05:10 EDT
Thanks Holger for this contribution and Marcus for the review. 

Holger, please add to N&N. Please also create bug for using this new API in platform code and update the Gerrit for Bug 572939.
Comment 4 Eclipse Genie CLA 2021-07-30 09:03:49 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/183549
Comment 5 Andrey Loskutov CLA 2021-07-30 09:15:11 EDT
(In reply to Eclipse Genie from comment #4)
> New Gerrit change created:
> https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/183549

Reopening. Lars, please review.
Comment 7 Andrey Loskutov CLA 2021-07-31 02:40:28 EDT
https://download.eclipse.org/eclipse/downloads/drops4/I20210730-1800/compilelogs/platform.doc.isv.javadoc.txt

../../../eclipse.platform.ui/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListSelectionDialog.java:482: error: reference not found
	 * @see #ListSelectionDialog(Shell, Object, IStructuredContentProvider,
	        ^
1 error
Comment 8 Eclipse Genie CLA 2021-07-31 02:41:30 EDT
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/183564