diff -r 3d8556368fe9 -r d4f1cd8626e6 MethodFinderWindow.st --- a/MethodFinderWindow.st Fri Jun 01 13:12:25 2012 +0200 +++ b/MethodFinderWindow.st Fri Jun 01 13:22:10 2012 +0200 @@ -5,7 +5,7 @@ resultSelectors arg2BoxVisible arg1BoxVisible arg4BoxVisible arg3BoxVisible argCountHolder argCountList argument1Editor argument2Editor argument3Editor argument4Editor resultSelected - lookAtResultEditor codeHolder' + lookAtResultEditor codeHolder searchProcess' classVariableNames:'' poolDictionaries:'' category:'Interface-MethodFinder' @@ -702,6 +702,13 @@ "Modified: / 26-09-2011 / 12:42:28 / cg" ! +searchPatternChanged + "/ self searchPatternMatches + self searchPatternMatchesInBackground + + "Created: / 01-06-2012 / 13:18:16 / cg" +! + searchPatternMatches "Do a search based on the pattern match" @@ -735,6 +742,32 @@ "Created: / 27-04-2012 / 14:46:35 / cg" ! +searchPatternMatchesInBackground + "Do a search based on the pattern match" + + | p pattern list| + + (p := searchProcess) notNil ifTrue:[ + searchProcess := nil. + p terminate. + ]. + + searchProcess := + [ + pattern := self selectorPattern value. + + self withCursor:Cursor execute do:[ + pattern includesMatchCharacters ifFalse:[ + pattern := '*',pattern,'*' + ]. + list := SystemBrowser findImplementorsMatching:pattern in:Smalltalk allClasses ignoreCase:true. + ]. + self enqueueDelayedAction:[ self updateListAfterPatternSearch: list ] + ] fork. + + "Created: / 01-06-2012 / 13:16:54 / cg" +! + selectedClassOfResultHolderChanged |sel classAndSelector mthd| @@ -775,6 +808,30 @@ self selectedClassOfResultHolder value:nil. "Modified: / 13.11.2001 / 12:07:31 / cg" +! + +updateListAfterPatternSearch:list + "Do a search based on the pattern match" + + | selectors counts| + + self resultHolder value: nil. "reset the result list" + self classOfResultHolder value: nil. "reset the implementorOf list" + self codeHolder value: nil. "reset the source" + + counts := IdentityDictionary new. + selectors := IdentitySet new. + + list do:[:eachMethod | + selectors add: eachMethod selector. + (counts at:(eachMethod selector) ifAbsentPut:[0 asValue]) increment + ]. + + resultSelectors := selectors asOrderedCollection sort. + + self resultHolder value: (resultSelectors collect:[:sel | sel,' --> ',(counts at:sel) value printString,' implementor(s)']). + + "Created: / 01-06-2012 / 13:17:34 / cg" ! ! !MethodFinderWindow methodsFor:'aspects'! @@ -893,7 +950,7 @@ (holder := builder bindingAt:#selectorPattern) isNil ifTrue:[ holder := ValueHolder new. builder aspectAt:#selectorPattern put:holder. - holder onChangeSend:#searchPatternMatches to:self. + holder onChangeSend:#searchPatternChanged to:self. ]. ^ holder