geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r700082 - /geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileObjectNameCompleter.java
Date Mon, 29 Sep 2008 12:09:54 GMT
Author: jdillon
Date: Mon Sep 29 05:09:53 2008
New Revision: 700082

URL: http://svn.apache.org/viewvc?rev=700082&view=rev
Log:
Optimize a wee bit

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileObjectNameCompleter.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileObjectNameCompleter.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileObjectNameCompleter.java?rev=700082&r1=700081&r2=700082&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileObjectNameCompleter.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileObjectNameCompleter.java
Mon Sep 29 05:09:53 2008
@@ -76,21 +76,26 @@
             log.trace("Search: {}", search);
 
             if (dir != null) {
-                FileFilter filter = new FileFilter() {
-                    public boolean accept(final FileSelectInfo selection) {
-                        assert selection != null;
+                FileObject[] files;
 
-                        if (log.isTraceEnabled()) {
-                            log.trace("Filtering selection: {}", selection.getFile().getName());
-                        }
-
-                        // If we have something to search for then only include selections
which match (start with search), else select everything
-                        return search == null || selection.getFile().getName().getBaseName().startsWith(search);
+                if (search != null) {
+                    FileFilter filter = new FileFilter() {
+                        public boolean accept(final FileSelectInfo selection) {
+                            assert selection != null;
+
+                            if (log.isTraceEnabled()) {
+                                log.trace("Filtering selection: {}", selection.getFile().getName());
+                            }
 
-                    }
-                };
+                            return selection.getFile().getName().getBaseName().startsWith(search);
+                        }
+                    };
 
-                FileObject[] files = dir.findFiles(new FileFilterSelector(filter));
+                    files = dir.findFiles(new FileFilterSelector(filter));
+                }
+                else {
+                    files = dir.getChildren();
+                }
 
                 if (files == null || files.length == 0) {
                     log.trace("No matching files found");



Mime
View raw message