slight refactoring (code cleanup)
authorClaus Gittinger <cg@exept.de>
Wed, 20 Apr 2005 11:23:00 +0200
changeset 6263 8e8d05794453
parent 6262 944ab8f00e52
child 6264 039dc5c1710b
slight refactoring (code cleanup)
BrowserView.st
--- a/BrowserView.st	Wed Apr 20 09:49:11 2005 +0200
+++ b/BrowserView.st	Wed Apr 20 11:23:00 2005 +0200
@@ -4085,23 +4085,12 @@
 classDerivedInstancesInspect
     "inspect the current classes derived instances"
 
-    |insts|
-
-    self checkClassSelected ifFalse:[^ self].
-
-    insts := currentClass allSubInstances.
-    insts size == 0 ifTrue:[
-	self warn:'no direct or derived instances'.
-	^ self
-    ].
-    insts size == 1 ifTrue:[
-	insts first inspect.
-	^ self.
-    ].
-    insts inspect
-
-    "Created: / 24.2.1996 / 16:12:14 / cg"
-    "Modified: / 21.7.1998 / 11:32:49 / cg"
+    self
+        classInspectObjectsReturnedBy:[currentClass allSubInstances] 
+        ifNone:[self warn:'no direct or derived instances'. ^ self]
+
+    "Created: / 24-02-1996 / 16:12:14 / cg"
+    "Modified: / 20-04-2005 / 11:20:26 / cg"
 !
 
 classDocumentation
@@ -4343,26 +4332,40 @@
     currentClass inspect.
 !
 
-classInstancesInspect
-    "inspect the current classes instances"
-
-    |insts|
+classInspectObjectsReturnedBy:aBlock ifNone:warnBlock
+    "inspect the current classes derived instances"
+
+    |insts numInsts inspectedObject|
 
     self checkClassSelected ifFalse:[^ self].
 
-    insts := currentClass allInstances.
-    insts size == 0 ifTrue:[
-	self warn:'no instances'.
-	^ self
-    ].
-    insts size == 1 ifTrue:[
-	insts first inspect.
-	^ self.
-    ].
-    insts inspect
-
-    "Created: / 24.2.1996 / 16:12:14 / cg"
-    "Modified: / 21.7.1998 / 11:32:49 / cg"
+    insts := aBlock value.
+
+    numInsts := insts size.
+    numInsts == 0 ifTrue:[
+        warnBlock value.
+        ^ self
+    ].
+    numInsts == 1 ifTrue:[
+        inspectedObject := insts first.
+    ] ifFalse:[
+        inspectedObject := insts
+    ].
+    inspectedObject inspect
+
+    "Created: / 24-02-1996 / 16:12:14 / cg"
+    "Modified: / 20-04-2005 / 11:21:18 / cg"
+!
+
+classInstancesInspect
+    "inspect the current classes instances"
+
+    self
+        classInspectObjectsReturnedBy:[currentClass allInstances] 
+        ifNone:[self warn:'no instances'. ^ self]
+
+    "Created: / 24-02-1996 / 16:12:14 / cg"
+    "Modified: / 20-04-2005 / 11:21:08 / cg"
 !
 
 classLoad
@@ -11873,11 +11876,7 @@
 
     areas := OrderedCollection new.
 
-    isSelector ifTrue:[
-        sel := self selectorToSearchFor.
-    ] ifFalse:[
-        sel := self stringToSearchFor.
-    ].
+    sel := isSelector ifTrue:[self selectorToSearchFor] ifFalse:[self stringToSearchFor].
     sel size == 0 ifTrue:[
         "/ use last searchString
         LastSearchPatterns size > 0 ifTrue:[
@@ -12296,7 +12295,7 @@
     aBlock value:aClass value:level.
 
     subclasses := subclassDictionary at:aClass ifAbsent:[nil].
-    (subclasses size == 0) ifFalse:[
+    (subclasses size > 0) ifTrue:[
         names := subclasses collect:[:class | class name].
         names sortWith:subclasses.
         subclasses do:[:aSubClass |
@@ -14627,7 +14626,7 @@
 !BrowserView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.784 2005-04-12 17:17:57 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/BrowserView.st,v 1.785 2005-04-20 09:23:00 cg Exp $'
 ! !
 
 BrowserView initialize!