FindFileApplication.st
changeset 6808 af925359c659
parent 6633 6843fedf7516
child 6810 5f8874df978f
--- a/FindFileApplication.st	Mon Jul 03 16:55:10 2006 +0200
+++ b/FindFileApplication.st	Tue Jul 04 11:41:55 2006 +0200
@@ -300,14 +300,14 @@
                   )
                  (LabelSpec
                     label: 'File Size:'
-                    name: 'Label1'
+                    name: 'FileSizeLabel'
                     layout: (LayoutFrame 2 0 127 0 154 0 144 0)
                     translateLabel: true
                     adjust: right
                   )
                  (PopUpListSpec
                     label: 'PopUp List'
-                    name: 'OperatorPopUpList'
+                    name: 'FileSizeOperatorPopUpList'
                     layout: (LayoutFrame 157 0 124 0 212 0 144 0)
                     tabable: true
                     model: fileSizeOperatorHolder
@@ -319,14 +319,16 @@
                     )
                   )
                  (InputFieldSpec
-                    name: 'EntryField1'
+                    name: 'FileSizeEntryField'
                     layout: (LayoutFrame 219 0 124 0 -430 1 144 0)
                     enableChannel: enableFileSizeFilterAndNotSearchForSameContents
                     tabable: true
                     model: fileSizeHolder
                     type: fileSize
-                    immediateAccept: true
-                    acceptOnPointerLeave: false
+                    immediateAccept: false
+                    acceptOnLeave: true
+                    acceptOnLostFocus: true
+                    acceptOnPointerLeave: true
                   )
                  (CheckToggleSpec
                     name: 'EnableSizeCheckToggle'
@@ -350,6 +352,7 @@
               hasVerticalScrollBar: true
               isMultiSelect: true
               doubleClickSelector: fileDoubleClick:
+              valueChangeSelector: fileSelected:
               useIndex: true
               sequenceList: shownListHolder
             )
@@ -366,6 +369,7 @@
         )
       )
 
+    "Modified: / 04-07-2006 / 11:38:50 / cg"
 ! !
 
 !FindFileApplication class methodsFor:'menu specs'!
@@ -742,7 +746,7 @@
                     self resultList removeAll.
                     self matchedFilesList removeAll.
                     self changeInformationTo:'Find File ' , '- searching ' toTab:true.
-                    self notify:'searching...'.
+                    self notify:'Searching...'.
                     t := Time millisecondsToRun:[
 
                         self 
@@ -780,6 +784,8 @@
     searchTask priorityRange:(Processor systemBackgroundPriority to:Processor userSchedulingPriority).
     searchTask name:('FindFile[', self searchDirectoryHolder value asFilename baseName, ']').
     searchTask resume.
+
+    "Modified: / 04-07-2006 / 11:34:21 / cg"
 !
 
 openInNewBrowser
@@ -1168,6 +1174,25 @@
     ]
 !
 
+fileSelected:entries
+    |file fn|
+
+    file := self shownList at:entries first.
+    fn := file asFilename.
+    fn exists ifFalse:[
+        self notify:('%1 does not (no longer ?) exist or is not accessable.' bindWith:file allBold).
+        ^ self
+    ].
+    fn isDirectory ifTrue:[
+        self notify:nil.
+        ^ self.
+    ].
+
+    self notify:('%1: %2.' bindWith:fn baseName allBold with:(UnitConverter fileSizeStringFor:fn fileSize)).
+
+    "Created: / 04-07-2006 / 11:35:38 / cg"
+!
+
 processEvent:anEvent
     "filter keyboard events.
      Return true, if I have eaten the event"
@@ -1508,10 +1533,10 @@
             fileSizeToCompare := self fileSizeHolder value.
             op := self fileSizeOperatorHolder value.
             op = '~' ifTrue:[
-                sizeMatch := [:f | |sz| sz := f fileSize. sz between:fileSizeToCompare*0.9 and:fileSizeToCompare*1.1].
+                sizeMatch := [:f | |sz| sz := f fileSize. sz notNil and:[sz between:fileSizeToCompare*0.9 and:fileSizeToCompare*1.1]].
             ] ifFalse:[
                 op := op asSymbol.
-                sizeMatch := [:f | f fileSize perform:op with:fileSizeToCompare].
+                sizeMatch := [:f | |sz| sz := f fileSize. sz notNil and:[sz perform:op with:fileSizeToCompare]].
             ].
             oldDoesFileMatch := doesFileMatch.
             doesFileMatch := [:f | (sizeMatch value:f) and:[ oldDoesFileMatch value:f ]]    
@@ -1606,6 +1631,8 @@
         nameMatch:nameMatch 
         contentsMatch:doesFileMatch 
         in:dir.
+
+    "Modified: / 04-07-2006 / 11:32:05 / cg"
 !
 
 doFindFileNamed:namePatterns directories:searchDirectories nameMatch:nameMatch contentsMatch:doesFileMatch in:aDirectory
@@ -1725,5 +1752,5 @@
 !FindFileApplication class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/FindFileApplication.st,v 1.76 2006-03-06 08:44:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/FindFileApplication.st,v 1.77 2006-07-04 09:41:55 cg Exp $'
 ! !