geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r699849 - in /geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs: FileObjectNameCompleter.java FileSystemAccessImpl.java
Date Sun, 28 Sep 2008 16:15:04 GMT
Author: jdillon
Date: Sun Sep 28 09:15:03 2008
New Revision: 699849

URL: http://svn.apache.org/viewvc?rev=699849&view=rev
Log:
Changed debug -> trace
Fixed completer to work as desired (er so I think)

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileObjectNameCompleter.java
    geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileSystemAccessImpl.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=699849&r1=699848&r2=699849&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
Sun Sep 28 09:15:03 2008
@@ -53,49 +53,53 @@
 
         String path = buffer == null ? "" : buffer;
 
-        log.debug("Path: '{}'", path);
+        log.trace("Path: '{}'", path);
         
         try {
             assert fileSystemAccess != null;
             FileObject dir = fileSystemAccess.resolveFile(path);
 
-            //
-            // FIXME: The processing logic here is not correct...
-            //
-            
-            /*
-            log.debug("Dir (before): {}", dir);
-            if (!path.endsWith(File.separator)) {
+            final String search;
+
+            // If we have resolved to a directory which does not exist, then base the selection
on its parent and set the
+            // search criteria to the name of the non-existant file
+            if (!dir.exists()) {
+                search = dir.getName().getBaseName();
                 dir = dir.getParent();
             }
-            log.debug("Dir (after): {}", dir);
-            */
-            log.debug("Dir: {}", dir);
+            else {
+                // Else we want to show all contents
+                search = null;
+            }
+
+            log.trace("Dir: {}", dir);
+            log.trace("Search: {}", search);
 
             if (dir != null) {
-                final String prefix = path;
                 FileFilter filter = new FileFilter() {
                     public boolean accept(final FileSelectInfo selection) {
                         assert selection != null;
 
-                        if (log.isDebugEnabled()) {
-                            log.debug("Filtering selection: {}", selection.getFile().getName());
+                        if (log.isTraceEnabled()) {
+                            log.trace("Filtering selection: {}", selection.getFile().getName());
                         }
 
-                        return selection.getFile().getName().getPath().startsWith(prefix);
+                        // 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);
+
                     }
                 };
 
                 FileObject[] files = dir.findFiles(new FileFilterSelector(filter));
 
                 if (files == null || files.length == 0) {
-                    log.debug("No matching files found");
+                    log.trace("No matching files found");
                 }
                 else {
-                    log.debug("Found {} matching files:", files.length);
+                    log.trace("Found {} matching files:", files.length);
 
                     for (FileObject file : files) {
-                        log.debug("    {}", file);
+                        log.trace("    {}", file);
 
                         StringBuilder buff = new StringBuilder();
                         buff.append(file.getName().getBaseName());

Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileSystemAccessImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileSystemAccessImpl.java?rev=699849&r1=699848&r2=699849&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileSystemAccessImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs/src/main/java/org/apache/geronimo/gshell/vfs/FileSystemAccessImpl.java
Sun Sep 28 09:15:03 2008
@@ -57,7 +57,7 @@
 
         Object var = vars.get(CWD);
         if (var instanceof String) {
-            log.debug("Resolving CWD from string: {}", var);
+            log.trace("Resolving CWD from string: {}", var);
 
             cwd = getManager().resolveFile((String)var);
         }
@@ -69,7 +69,7 @@
         }
 
         if (cwd == null) {
-            log.debug("CWD not set, resolving from user.dir");
+            log.trace("CWD not set, resolving from user.dir");
 
             // TODO: May need to ask the Application for this, as it might be different depending
on the context (ie. remote user, etc)
             String userDir = System.getProperty("user.dir");
@@ -82,7 +82,7 @@
     public FileObject getCurrentDirectory() throws FileSystemException {
         assert applicationManager != null;
 
-        log.debug("Resolving CWD from application variables");
+        log.trace("Resolving CWD from application variables");
 
         return getCurrentDirectory(applicationManager.getApplication().getVariables());
     }
@@ -91,7 +91,7 @@
         assert vars != null;
         assert dir != null;
 
-        log.debug("Setting CWD: {}", dir);
+        log.trace("Setting CWD: {}", dir);
 
         // Make sure that the given file object exists and is really a directory
         if (!dir.exists()) {
@@ -109,7 +109,7 @@
 
         assert applicationManager != null;
 
-        log.debug("Setting CWD to application variables");
+        log.trace("Setting CWD to application variables");
 
         setCurrentDirectory(applicationManager.getApplication().getVariables(), dir);
     }



Mime
View raw message