#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Wed, 27 Mar 2019 15:24:09 +0100
changeset 4399 4b80ef759ebe
parent 4398 9ca1c5dfcf2f
child 4400 978971f3de9e
#UI_ENHANCEMENT by cg class: Explainer class changed: #infoStringForClasses:withPrefix:
Explainer.st
--- a/Explainer.st	Fri Mar 22 13:26:09 2019 +0100
+++ b/Explainer.st	Wed Mar 27 15:24:09 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
               All Rights Reserved
@@ -288,7 +290,7 @@
         implMethod := implClass compiledMethodAt:selector.
         clsName := implClass name.
         clsName := self asLink:clsName to:(self actionToBrowseClass:implClass selector:selector).
-        info := '%1 » %2' bindWith:clsName "allBold" with:selectorString.
+        info := '%1 » %2' bindWith:clsName "allBold" with:selectorString.
         info := self asLink:info to:(action1 := self actionToBrowseClass:implClass selector:selector info:nil).
         
         redefiningClasses size ~~ 0 ifTrue:[
@@ -2545,12 +2547,14 @@
 
 infoStringForClasses:aCollectionOfClasses withPrefix:prefix
     "get a nice user readable list for some classes.
-     Up to 4 are named, otherwise the count is presented.
-     The prefix can be sth like ' other', ' sub', ' super',
-     ' implementing' etc. Or it can be an empty string.
-     To be shown in the info line at the bottom."
-
-    |nClassNames sortedByName classNames link1 link2 link3 link4|
+     Up to 4 are listed by name, otherwise the count is presented.
+     The prefix can be sth like 'other ', 'sub', 'super',
+     'implementing ' etc. 
+     Or it can be an empty string.
+     The returned string is meant to be shown in the info line at the bottom."
+
+    |nClassNames sortedByName classNames 
+     commonSuperClass link1 link2 link3 link4|
 
     aCollectionOfClasses isEmpty ifTrue:[
         ^ 'No %1classes' bindWith:prefix.
@@ -2589,12 +2593,32 @@
                         with:link4.
         ].
     ].
+    commonSuperClass := Class commonSuperclassOf:aCollectionOfClasses.
+    (aCollectionOfClasses includes:commonSuperClass) ifTrue:[
+        ^ self
+            asLink:('%1 and %2 additional %3classes' 
+                        bindWith:commonSuperClass theNonMetaclass name
+                        with:(nClassNames - 1)
+                        with:prefix)
+            info:'Browse classes' 
+            to:(self actionToBrowseClasses:aCollectionOfClasses)        
+    ].    
+    
     ^ self
         asLink:('%1 %2classes' bindWith:nClassNames printString with:prefix)
         info:'Browse classes' 
         to:(self actionToBrowseClasses:aCollectionOfClasses)        
 
+    "
+     self infoStringForClasses:{ Array } withPrefix:'sub'
+     self infoStringForClasses:{ Array . Point } withPrefix:'sub'
+     self infoStringForClasses:{ Array . Point . Integer . Float} withPrefix:'sub'
+     self infoStringForClasses:{ Array . Point . Integer . Float . Fraction} withPrefix:'sub'
+     self infoStringForClasses:{ Number . Integer . Float . Fraction . SmallInteger} withPrefix:'sub'
+    "
+
     "Modified: / 27-07-2006 / 10:09:02 / cg"
+    "Modified: / 27-03-2019 / 10:42:24 / Claus Gittinger"
 !
 
 infoStringForClasses:aCollectionOfClasses withPrefix:prefix actionGenerator:actionGeneratorOrNil
@@ -2783,7 +2807,7 @@
                         to:(self actionToOpenMethodFinderFor:sel)) 
             with:(self 
                     asLink:inheritedClass name "allBold" 
-                    info:('Browse %1 » %2' bindWith:inheritedClass name with:sel)
+                    info:('Browse %1 » %2' bindWith:inheritedClass name with:sel)
                     to:(self actionToBrowseClass:inheritedClass selector:sel)).
     ].