--- a/AbstractFileFinderApplicationComponent.st Sun Jan 12 23:30:25 2014 +0000
+++ b/AbstractFileFinderApplicationComponent.st Wed Apr 01 10:38:01 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2002 by eXept Software AG
All Rights Reserved
@@ -11,11 +13,13 @@
"
"{ Package: 'stx:libtool' }"
+"{ NameSpace: Smalltalk }"
+
AbstractFileApplicationNoteBookComponent subclass:#AbstractFileFinderApplicationComponent
instanceVariableNames:'findFileView searchResultTable resultList enableStop enableSearch
stopSignal accessLock searchTask expanded searchRecursively
selectionHolder hasListEntries targetApplication matchedFilesList
- shownListHolder autoSelectInBrowserHolder'
+ shownListHolder autoSelectInBrowserHolder filesSearchedCount'
classVariableNames:''
poolDictionaries:''
category:'Interface-Tools-File'
@@ -126,7 +130,7 @@
searchTask := thisSearchTask :=
[
- |message t|
+ |message time nFound|
[
(self stopSignal) catch:[
@@ -134,17 +138,26 @@
self resultList removeAll.
self matchedFilesList removeAll.
self notify:'Searching...'.
+ filesSearchedCount := 0.
-"/ self changeInformationTo:'Find File ' , '- searching ' toTab:true.
- t := Time millisecondsToRun:[
+ "/ self changeInformationTo:'Find File ' , '- searching ' toTab:true.
+ time := Time millisecondsToRun:[
aBlock value.
].
- t > 100 ifTrue:[
- t := ((t / 1000) asFixedPoint:2) printString , ' s'
+ time > 100 ifTrue:[
+ time := ((time / 1000) asFixedPoint:2) printString , ' s'
] ifFalse:[
- t := t printString , ' ms'
+ time := time printString , ' ms'
].
- message := 'Found %1 file%2 in %3.' bindWith:(resultList size) with:(resultList size == 1 ifTrue:'' ifFalse:'s') with:t.
+ nFound := resultList size.
+ message := resources
+ string:((nFound == filesSearchedCount)
+ ifTrue:['Found %1 file%2 in %3.']
+ ifFalse:['Found %1 file%2 in %3 (%4 files visited).'])
+ with:nFound
+ with:(nFound == 1 ifTrue:'' ifFalse:'s')
+ with:time
+ with:filesSearchedCount.
self enableStop value:false.
self enableSearch value:true.
self changeInformationTo:'Find File ' , '- done.' toTab:true.
@@ -158,7 +171,7 @@
]
] newProcess.
- searchTask priorityRange:(Processor systemBackgroundPriority to:Processor userSchedulingPriority).
+ searchTask priorityRange:(Processor userBackgroundPriority to:Processor userSchedulingPriority).
searchTask name:taskName.
searchTask resume.
^ searchTask
@@ -365,7 +378,7 @@
app notNil ifTrue:[
openedAppl := app openApplForFile:file.
(openedAppl notNil and:[openedAppl isTextEditor]) ifTrue:[
- openedAppl window assignKeyboardFocusToFirstInputField. "/ should this be done in openApplForFile?
+ openedAppl window assignKeyboardFocusToFirstKeyboardConsumer. "/ should this be done in openApplForFile?
contentsPattern := self contentsPatternHolder value.
(contentsPattern notNil and:[ contentsPattern notEmpty and:[contentsPattern ~= '*']]) ifTrue:[
openedAppl searchForPattern:contentsPattern ignoreCase:(self ignoreCaseInContents value).
@@ -448,17 +461,15 @@
!AbstractFileFinderApplicationComponent methodsFor:'queries'!
hasOneFileSelected
- | sel |
-
- sel := self selectionHolder value.
- ^ sel size == 1
+ ^ self selectionHolder value size == 1
!
hasSelectionInResultList
- | sel |
+ ^ self selectionHolder value notEmptyOrNil
+!
- sel := self selectionHolder value.
- ^ sel notEmptyOrNil
+hasTwoFilesSelected
+ ^ self selectionHolder value size == 2
! !
!AbstractFileFinderApplicationComponent methodsFor:'tasks'!
@@ -479,19 +490,10 @@
!AbstractFileFinderApplicationComponent class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/AbstractFileFinderApplicationComponent.st,v 1.11 2013-09-24 20:13:11 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/AbstractFileFinderApplicationComponent.st,v 1.16 2015-02-27 23:11:37 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libtool/AbstractFileFinderApplicationComponent.st,v 1.11 2013-09-24 20:13:11 cg Exp $'
-!
-
-version_HG
-
- ^ '$Changeset: <not expanded> $'
-!
-
-version_SVN
- ^ '$Id: AbstractFileFinderApplicationComponent.st 7854 2012-01-30 17:49:41Z vranyj1 $'
+ ^ '$Header: /cvs/stx/stx/libtool/AbstractFileFinderApplicationComponent.st,v 1.16 2015-02-27 23:11:37 cg Exp $'
! !