search protocol enhanced
authorClaus Gittinger <cg@exept.de>
Fri, 21 Jul 2000 14:40:12 +0200
changeset 2677 a5ef0e288aae
parent 2676 06199a1e7dba
child 2678 90eb8be47ac4
search protocol enhanced
SystemBrowser.st
--- a/SystemBrowser.st	Mon Jul 17 15:34:28 2000 +0200
+++ b/SystemBrowser.st	Fri Jul 21 14:40:12 2000 +0200
@@ -1419,16 +1419,15 @@
     |filter browser pattern|
 
     filter := self filterToSearchRefsTo:varName classVars:classVars modificationsOnly:modsOnly.
-    browser := self browseMethodsIn:aCollectionOfClasses 
-			inst:true class:classVars where:filter title:title.
+    browser := self browseMethodsIn:aCollectionOfClasses inst:true class:classVars where:filter title:title.
 
     browser notNil ifTrue:[
-	modsOnly ifTrue:[
-	    pattern := varName , ' :='
-	] ifFalse:[
-	    pattern := varName
-	].
-	browser autoSearch:pattern 
+        modsOnly ifTrue:[
+            pattern := varName , ' :='
+        ] ifFalse:[
+            pattern := varName
+        ].
+        browser autoSearch:pattern 
     ].
     ^ browser
 !
@@ -1665,6 +1664,23 @@
     "Modified: 19.6.1997 / 18:27:57 / cg"
 !
 
+findClassRefsTo:aString in:aCollectionOfClasses modificationsOnly:modsOnly
+    "return all methods in aClass where the classVar named
+     aString is referenced; 
+     if modsOnly is true, browse only methods where the classvar is modified"
+
+    ^ self findRefsTo:aString classVars:true in:aCollectionOfClasses modificationsOnly:modsOnly
+!
+
+findClassRefsTo:aString under:aClass modificationsOnly:modsOnly
+    "return all methods in aClass and subclasses
+     where the classVar named aString is referenced; 
+     if modsOnly is true, browse only methods where the classvar is modified"
+
+    ^ self findClassRefsTo:aString in:(aClass withAllSubclasses) modificationsOnly:modsOnly
+
+!
+
 findImplementorsOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
     "search for all implementors of aSelector in
      the classes contained in aCollectionOfClasses and its metaclasses.
@@ -1769,6 +1785,41 @@
 
 !
 
+findInstRefsTo:aString in:aCollectionOfClasses modificationsOnly:modsOnly
+    "return all methods in aClass where the instVar named
+     aString is referenced; if modsOnly is true, browse only methods where the
+     instvar is modified"
+
+    ^ self findRefsTo:aString classVars:false in:aCollectionOfClasses modificationsOnly:modsOnly
+!
+
+findInstRefsTo:aString under:aClass modificationsOnly:modsOnly
+    "return all methods in aClass and subclasses
+     where the instVar named aString is referenced; 
+     if modsOnly is true, browse only methods where the instvar is modified"
+
+    ^ self findInstRefsTo:aString in:(aClass withAllSubclasses) modificationsOnly:modsOnly
+!
+
+findRefsTo:varName classVars:classVars in:aCollectionOfClasses modificationsOnly:modsOnly
+    "return a list of all methods in aCollectionOfClasses where the instVar/classVar named
+     varName is referenced; 
+     if modsOnly is true, browse only methods where the instvar is modified"
+
+    |filter|
+
+    filter := self filterToSearchRefsTo:varName classVars:classVars modificationsOnly:modsOnly.
+    ^ self findMethodsIn:aCollectionOfClasses inst:true class:classVars where:filter.
+
+    "
+     self
+        findRefsTo:'x'
+        classVars:false
+        in:(Array with:Point)
+        modificationsOnly:true
+    "
+!
+
 findSendersOf:aSelectorString in:aCollectionOfClasses ignoreCase:ignoreCase
     "search for all senders of aSelector in
      the classes contained in aCollectionOfClasses and its metaclasses.
@@ -2194,18 +2245,6 @@
     "Modified: 24.1.1997 / 19:44:30 / cg"
 !
 
-browseindMethodsIn:aCollectionOfClasses where:aBlock title:title
-    "find all instance- and classmethods from classes in aCollectionOfClasses,
-     where aBlock evaluates to true.
-     The block is called with 3 arguments, class, method and seelctor."
-
-    ^ self 
-        findMethodsIn:aCollectionOfClasses 
-        inst:true 
-        class:true 
-        where:aBlock 
-!
-
 findMethodsIn:aCollectionOfClasses inst:wantInst class:wantClass where:aBlock
     "return all instance- (if wantInst is true) and/or classmethods (if wantClass is true) 
      from classes in aCollectionOfClasses, where aBlock evaluates to true."
@@ -2319,6 +2358,6 @@
 !SystemBrowser class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.105 2000-07-14 16:56:27 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/SystemBrowser.st,v 1.106 2000-07-21 12:40:12 cg Exp $'
 ! !
 SystemBrowser initialize!