Revision: 3340
Author: ferguson.sebastian
Date: Thu Feb 25 14:40:55 2010
Log: Added sorting to the list of project names. Previously they were
showing up in no apparent order.
http://code.google.com/p/power-architect/source/detail?r=3340
Modified:
/trunk/src/ca/sqlpower/architect/swingui/enterprise/ServerProjectsManagerPanel.java
=======================================
---
/trunk/src/ca/sqlpower/architect/swingui/enterprise/ServerProjectsManagerPanel.java
Thu Feb 18 08:05:59 2010
+++
/trunk/src/ca/sqlpower/architect/swingui/enterprise/ServerProjectsManagerPanel.java
Thu Feb 25 14:40:55 2010
@@ -24,6 +24,9 @@
import java.awt.event.ActionEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -313,9 +316,18 @@
SPServerInfo serviceInfo = getSelectedServerInfo();
if (serviceInfo != null) {
try {
- for (ProjectLocation pl :
ArchitectClientSideSession.getWorkspaceNames(serviceInfo)) {
+ // Sorts the project locations alphabetically
+ List<ProjectLocation> projects =
ArchitectClientSideSession.getWorkspaceNames(serviceInfo);
+ Collections.sort(projects, new
Comparator<ProjectLocation>() {
+ public int compare(ProjectLocation proj1,
ProjectLocation proj2) {
+ return proj1.getName().compareTo(proj2.getName());
+ }
+ });
+
+ for (ProjectLocation pl : projects) {
model.addElement(pl);
}
+
connected = true;
} catch (Exception ex) {
model.removeAllElements();