chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1294622 - /chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
Date Tue, 28 Feb 2012 12:30:49 GMT
Author: fmui
Date: Tue Feb 28 12:30:49 2012
New Revision: 1294622

URL: http://svn.apache.org/viewvc?rev=1294622&view=rev
Log:
Workbench: sort repositories by name

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java?rev=1294622&r1=1294621&r2=1294622&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
Tue Feb 28 12:30:49 2012
@@ -29,6 +29,8 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -197,6 +199,22 @@ public class LoginDialog extends JDialog
                     createClientSession();
 
                     List<Repository> repositories = clientSession.getRepositories();
+
+                    Collections.sort(repositories, new Comparator<Repository>() {
+                        @Override
+                        public int compare(Repository r1, Repository r2) {
+                            if (r1 == null || r1.getName() == null) {
+                                return 1;
+                            }
+
+                            if (r2 == null || r2.getName() == null) {
+                                return -1;
+                            }
+
+                            return r1.getName().compareTo(r2.getName());
+                        }
+                    });
+
                     if (repositories.size() > 0) {
 
                         for (Repository repository : repositories) {



Mime
View raw message