Bug 532580 - Sort launchers in debug launcher selection dialog
Sort the available launchers by name. That makes the dialog more
consistent with the same workspace preferences and is easier to read for
the user.
Change-Id: I844eaaa5b8b99513f7b8259c2be69571689aed33
Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
Bug:532580
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java
index 18ff746..01662e6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/SelectLaunchersDialog.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.debug.internal.ui.launchConfigurations;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -63,12 +64,7 @@
@Override
public String getText(Object element) {
if(element instanceof ILaunchDelegate) {
- ILaunchDelegate ldp = (ILaunchDelegate) element;
- String name = ldp.getName();
- if(name == null) {
- name = ldp.getContributorName();
- }
- return name;
+ return getDelegateName((ILaunchDelegate) element);
}
return element.toString();
}
@@ -96,7 +92,8 @@
super(parentShell);
super.setTitle(LaunchConfigurationsMessages.SelectLaunchersDialog_0);
setShellStyle(getShellStyle() | SWT.RESIZE);
- fDelegates = delegates;
+ fDelegates = delegates.clone();
+ Arrays.sort(fDelegates, (delegate1, delegate2) -> String.CASE_INSENSITIVE_ORDER.compare(getDelegateName(delegate1), getDelegateName(delegate2)));
fConfiguration = configuration;
fLaunchMode = launchmode;
}
@@ -314,4 +311,12 @@
protected String getViewerLabel() {
return LaunchConfigurationsMessages.SelectLaunchersDialog_launchers;
}
+
+ private String getDelegateName(ILaunchDelegate ldp) {
+ String name = ldp.getName();
+ if(name == null) {
+ name = ldp.getContributorName();
+ }
+ return name;
+ }
}