From eaa5d32cec7404a50beb87c607ae60b8ccc519f6 Mon Sep 17 00:00:00 2001 From: fros4943 Date: Tue, 7 Dec 2010 11:59:55 +0000 Subject: [PATCH] hide .directories, sort directories --- .../dialogs/ProjectDirectoriesDialog.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java b/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java index 903cd4a88..baff3fa04 100644 --- a/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java +++ b/tools/cooja/java/se/sics/cooja/dialogs/ProjectDirectoriesDialog.java @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ProjectDirectoriesDialog.java,v 1.17 2010/12/02 15:28:06 fros4943 Exp $ + * $Id: ProjectDirectoriesDialog.java,v 1.18 2010/12/07 11:59:55 fros4943 Exp $ */ package se.sics.cooja.dialogs; @@ -824,7 +824,7 @@ class DirectoryTreePanel extends JPanel { if (td.subdirs != null) { children = td.subdirs; } else { - children = td.dir.listFiles(DIRECTORIES); + children = getDirectoryList(td.dir); td.subdirs = children; } if (children == null) { @@ -846,7 +846,7 @@ class DirectoryTreePanel extends JPanel { if (td.subdirs != null) { children = td.subdirs; } else { - children = td.dir.listFiles(DIRECTORIES); + children = getDirectoryList(td.dir); td.subdirs = children; } if ((children == null) || (index >= children.length)) { @@ -872,7 +872,7 @@ class DirectoryTreePanel extends JPanel { if (td.subdirs != null) { children = td.subdirs; } else { - children = td.dir.listFiles(DIRECTORIES); + children = getDirectoryList(td.dir); td.subdirs = children; } if (children == null) { @@ -896,12 +896,20 @@ class DirectoryTreePanel extends JPanel { private final FileFilter DIRECTORIES = new FileFilter() { public boolean accept(File file) { - if (file.isDirectory()) { - return true; + if (!file.isDirectory()) { + return false; } - return false; + if (file.getName().startsWith(".")) { + return false; + } + return true; } }; + private File[] getDirectoryList(File parent) { + File[] dirs = parent.listFiles(DIRECTORIES); + Arrays.sort(dirs); + return dirs; + } } }