Sort the projects by their display name in the remote usages window.
authorJan Lahoda <jlahoda@netbeans.org>
Fri, 02 Sep 2011 21:14:06 +0200
changeset 6899ff2cadc6e69
parent 688 4386b7bcc616
child 690 ec7ffe8b7195
Sort the projects by their display name in the remote usages window.
remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Nodes.java
     1.1 --- a/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Nodes.java	Fri Sep 02 16:13:39 2011 +0200
     1.2 +++ b/remoting/ide/usages/src/org/netbeans/modules/jackpot30/ide/usages/Nodes.java	Fri Sep 02 21:14:06 2011 +0200
     1.3 @@ -54,6 +54,8 @@
     1.4  import java.io.IOException;
     1.5  import java.util.ArrayList;
     1.6  import java.util.Collection;
     1.7 +import java.util.Collections;
     1.8 +import java.util.Comparator;
     1.9  import java.util.HashMap;
    1.10  import java.util.HashSet;
    1.11  import java.util.LinkedList;
    1.12 @@ -137,12 +139,18 @@
    1.13  
    1.14          projects.remove(null);//XXX!!!XXX
    1.15  
    1.16 -        List<Node> nodes = new LinkedList<Node>();
    1.17 +        List<Node> nodes = new ArrayList<Node>(projects.size());
    1.18  
    1.19          for (Project p : projects.keySet()) {
    1.20              nodes.add(constructSemiLogicalView(p, projects.get(p), eh, options));
    1.21          }
    1.22  
    1.23 +        Collections.sort(nodes, new Comparator<Node>() {
    1.24 +            @Override public int compare(Node o1, Node o2) {
    1.25 +                return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName());
    1.26 +            }
    1.27 +        });
    1.28 +        
    1.29          return new AbstractNode(new DirectChildren(nodes));
    1.30      }
    1.31