SystemBrowser.st
changeset 5256 c37bc91f2460
parent 5254 f3cbb68eb847
child 5270 d72d63a6dfac
--- a/SystemBrowser.st	Wed Oct 08 21:36:58 2003 +0200
+++ b/SystemBrowser.st	Thu Oct 09 11:28:40 2003 +0200
@@ -2117,15 +2117,35 @@
     "Modified: 24.1.1997 / 19:49:34 / cg"
 !
 
-browseAllCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase title:title
+browseAllCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase title:titleArg
     "launch a browser for all senders of aSelector in aCollectionOfClasses"
 
-    |list browser|
+    |list list2 browser selWithColon title rs|
+
+    title := titleArg.
 
     list := self allCallsOn:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase match:true.
     list isEmpty ifTrue:[
-        self showNoneFound:title.
-        ^ nil
+        aSelectorString numArgs == 0 ifTrue:[
+            selWithColon := aSelectorString , ':'.
+            selWithColon knownAsSymbol ifTrue:[
+                list2 := self allCallsOn:selWithColon in:aCollectionOfClasses ignoreCase:ignoreCase match:true.
+            ].            
+        ].
+        list2 size == 0 ifTrue:[
+            self showNoneFound:title.
+            ^ nil
+        ].
+        rs := self classResources.
+        (Dialog confirm:((rs string:title) , 
+                         (rs string:'...\\... none found.') ,
+                         (rs string:'\\But I found %1 sends of the "%2" message (with colon).\\Browse those ?'
+                             with:list2 size
+                             with:selWithColon allBold)) withCRs) ifFalse:[
+            ^ nil
+        ].
+        list := list2.
+        title := title , ':'.
     ].
 
     browser := self browseMethods:list title:title.
@@ -2787,20 +2807,40 @@
     "Modified: / 5.11.2001 / 17:30:43 / cg"
 !
 
-browseImplementorsOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase title:title
+browseImplementorsOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase title:titleArg
     "launch a browser for all implementors of aSelector in
      the classes contained in aCollectionOfClasses and its metaclasses"
 
-    |list|
-
+    |list list2 rs selWithColon title|
+
+    title := titleArg.
     list := self 
                 findImplementorsOf:aSelectorString 
                 in:aCollectionOfClasses 
                 ignoreCase:ignoreCase.
 
     list size == 0 ifTrue:[
-        self showNoneFound:title.
-        ^ nil
+        aSelectorString numArgs == 0 ifTrue:[
+            selWithColon := aSelectorString , ':'.
+            selWithColon knownAsSymbol ifTrue:[
+                list2 := self findImplementorsOf:selWithColon in:aCollectionOfClasses ignoreCase:ignoreCase.
+            ].            
+        ].
+        list2 size == 0 ifTrue:[
+            self showNoneFound:title.
+            ^ nil
+        ].
+        rs := self classResources.
+        (Dialog confirm:((rs string:title) , 
+                         (rs string:'...\\... none found.') ,
+                         (rs string:'\\But I found %1 implementor(s) of the "%2" message (with colon).\\Browse those ?'
+                             with:list2 size
+                             with:selWithColon allBold)) withCRs) ifFalse:[
+            ^ nil
+        ].
+        list := list2.
+        title := title , ':'.
+
     ].
 
     ^ self browseMethods:list asOrderedCollection title:title
@@ -4150,7 +4190,23 @@
 searchBlockForCode:aCodeString isMethod:isMethod
     "return a block to search for a pice of code (intelligent search)."
 
-    |errAction searchTree searcher variables messages searchBlock foundMatch|
+    |rule rslt errAction searchTree searcher variables messages searchBlock foundMatch|
+
+"/self halt.
+"/rule := ParseTreeLintRule 
+"/    createParseTreeRule: (Array with: aCodeString)
+"/    method: isMethod
+"/    name: 'Search for: ' , aCodeString.
+"/self halt.
+"/
+"/    searchBlock := [:c :m :sel | 
+"/        rslt := SmalllintChecker
+"/            runRule:rule
+"/            onEnvironment: (ClassEnvironment onEnvironment:(BrowserEnvironment new) classes:(Array with:c)).
+"/        
+"/        self halt.
+"/    ].
+"/^ searchBlock.
 
     errAction := [:str :pos | 
                     Dialog warn:'Error during parse: ' , str , ' (position ' , pos printString , ')'.
@@ -4178,9 +4234,15 @@
                     thenCollect:[:node | node name asSymbol]. 
 
     searcher := ParseTreeSearcher new.
-    searcher 
-        matchesTree:searchTree
-        do:[:aNode :answer | foundMatch := true].
+    isMethod ifTrue:[
+        searcher 
+            matchesMethod:searchTree
+            do:[:aNode :answer | foundMatch := true].
+    ] ifFalse:[
+        searcher 
+            matchesTree:searchTree
+            do:[:aNode :answer | foundMatch := true].
+    ]..
 
     messages size > 0 ifTrue:[
         "/ can speedup the search, by filtering for sent messages first...
@@ -4208,7 +4270,11 @@
                                                         onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos. nil].
 
                                         foundMatch := false.
-                                        rslt := searcher executeTree:parseTree.
+                                        false "isMethod" ifTrue:[
+                                            rslt := searcher executeMethod:parseTree.
+                                        ] ifFalse:[
+                                            rslt := searcher executeTree:parseTree.
+                                        ].
                                         foundMatch.
                                     ]
                                 ]
@@ -4227,7 +4293,11 @@
                                                 onError: [:str :pos | Transcript showCR:str. Transcript showCR:pos. nil].
 
                                 foundMatch := false.
-                                rslt := searcher executeTree:parseTree.
+                                false "isMethod" ifTrue:[
+                                    rslt := searcher executeMethod:parseTree.
+                                ] ifFalse:[
+                                    rslt := searcher executeTree:parseTree.
+                                ].
                                 foundMatch.
                             ]
                        ].
@@ -5135,7 +5205,7 @@
 !SystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.200 2003-10-08 16:27:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.201 2003-10-09 09:28:40 cg Exp $'
 ! !
 
 SystemBrowser initialize!