#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Thu, 26 Jan 2017 09:31:42 +0100
changeset 4100 2cb9290bd5dc
parent 4097 6066489e5789
child 4101 dfb2a46bb26a
#UI_ENHANCEMENT by cg class: Explainer changed: #explainSelector:inClass:short:
Explainer.st
--- a/Explainer.st	Tue Jan 24 00:41:11 2017 +0100
+++ b/Explainer.st	Thu Jan 26 09:31:42 2017 +0100
@@ -1433,11 +1433,27 @@
             commonSuperClass isNil ifTrue:[
                 commonSuperClass := Behavior commonSuperclassOf:listOfImplementingClasses.
             ] .
-            (listOfImplementingClasses includes:commonSuperClass) ifTrue:[
-                (commonSuperClass implements:selector) ifTrue:[
-                    classProvidingComment := commonSuperClass
-                ] ifFalse:[
+
+            ((listOfImplementingClasses includes:commonSuperClass) 
+              and:[ (commonSuperClass implements:selector) ]
+            ) ifTrue:[
+                classProvidingComment := commonSuperClass
+            ] ifFalse:[
+                "/ avoid some obvious misleading pathes...
+                classProvidingComment := { Number . Collection . Stream . View } 
+                                            detect:[:cls | (listOfImplementingClasses includes:cls)
+                                                           or:[cls canUnderstand:selector]  ]
+                                            ifNone:nil.
+                classProvidingComment notNil ifTrue:[
+                    classProvidingComment := classProvidingComment whichClassImplements:selector.
+                ] ifFalse:[    
                     classProvidingComment := firstImplementingClass.
+                    [ 
+                        classProvidingComment superclass notNil
+                        and:[ classProvidingComment superclass implements:selector ]
+                    ] whileTrue:[
+                        classProvidingComment := classProvidingComment superclass
+                    ].
                 ].
             ].
         ].
@@ -1465,11 +1481,10 @@
                     cm := self fetchDescriptionOfMethod:(classProvidingComment compiledMethodAt:selector).
                 ]
             ].    
-            cm notNil ifTrue:[
-                cm := (' %1 says:\' withCRs bindWith:(self asClassLink:classProvidingComment name)),cm
-            ].
         ].
         cm notNil ifTrue:[
+            cm := (' %1 says:\' withCRs bindWith:(self asClassLink:classProvidingComment name)),cm.
+            
             "/ msg := msg,(msg last isSeparator ifTrue:[''] ifFalse:[' ']),cm
             msg := msg,(Character cr),cm
         ].