How to change default sorting of ElementListSelectionDialog [message #1773243] |
Mon, 25 September 2017 06:17  |
Eclipse User |
|
|
|
HI,
Im using Eclipse Oxygen for my custom plugin development.
Im using a SWT Dialog - ElementListSelectionDialog, to display the list of items.
My requirement is to retain the order of Items to be displayed in same order as specified in "setElements()" method. But when the Dialog is displayed, it always list the items in Alphabetical Order.
How to change this sorting order of the listed items in the dialog?
ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new LabelProvider());
dialog.setTitle("Select SCM Provider");
dialog.setMessage("Select the SCM Provider for this project");
Object[] unsortedList = new Object[] { "GitHub", "RTC", "SVN","Others" };
dialog.setElements(unsortedList);
dialog.open();
For above code, the Dialog always displays the items in Alphabetical order (ie., GitHub, Others, RTC, SVN).
I need to keep the "Others" item as last item in the Dialog, but it is always displayed as second element.
Regards
Suresh
|
|
|
|
Re: How to change default sorting of ElementListSelectionDialog [message #1773287 is a reply to message #1773248] |
Tue, 26 September 2017 01:26  |
Eclipse User |
|
|
|
Thanks Brain for the quick response.
If possible, Can you share sample code snippet using 'FilteredItemsSelectionDialog' for listing the 4 items in the above code snippet.
The examples I can find in internet for using 'FilteredItemsSelectionDialog', are mostly referring to Resources/Files or using different sub-classes of this class.
Regards
Suresh
|
|
|
Powered by
FUDForum. Page generated in 0.06067 seconds