#helpTextFor:at: - also show component's name
authorClaus Gittinger <cg@exept.de>
Mon, 02 Nov 2009 14:29:14 +0100
changeset 2700 bad11f9b735f
parent 2699 22dd96b4e37f
child 2701 5abe05ebb370
#helpTextFor:at: - also show component's name
FlyByWindowInformation.st
--- a/FlyByWindowInformation.st	Mon Nov 02 13:59:43 2009 +0100
+++ b/FlyByWindowInformation.st	Mon Nov 02 14:29:14 2009 +0100
@@ -143,7 +143,34 @@
     lastApplication := aView application.
 
     ^ String streamContents:[:s |
-        |topViewToInspect applicationToInspect masterApplicationToInspect modelToInspect|
+        |topViewToInspect applicationToInspect masterApplicationToInspect modelToInspect
+         genComponentNameForApplication|
+
+        genComponentNameForApplication := [:app :s |
+                (app notNil 
+                and:[ app builder notNil ]) ifTrue:[
+                    |components v|
+
+                    components := app builder namedComponents.
+
+                    v := aView.
+                    [   (components includes:v) not
+                        and:[v container notNil]
+                    ] whileTrue:[
+                        v := v container.
+                    ].
+                    (components includes:v) ifTrue:[
+                        |k|
+
+                        k := components keyAtValue:v.
+                        v == aView ifTrue:[
+                            s nextPutLine:('   Component: ' , k).
+                        ] ifFalse:[
+                            s nextPutLine:('   Subview of Component: ' , k).
+                        ].
+                    ].
+                ].
+            ].
 
         aView topView ~~ aView ifTrue:[
             topViewToInspect := aView topView.
@@ -151,6 +178,9 @@
         lastApplication notNil ifTrue:[
             applicationToInspect := lastApplication.
             masterApplicationToInspect := lastApplication masterApplication.
+            masterApplicationToInspect == applicationToInspect ifTrue:[
+                masterApplicationToInspect := nil
+            ].
         ].
         aView model notNil ifTrue:[
             modelToInspect := aView model.
@@ -167,38 +197,16 @@
         topViewToInspect notNil ifTrue:[
             s nextPutLine:('Topview: ' , topViewToInspect class name).
         ].
+        masterApplicationToInspect notNil ifTrue:[
+            s nextPutLine:('Masterapplication: ' , masterApplicationToInspect class name).
+            genComponentNameForApplication value:masterApplicationToInspect value:s.
+        ].
         applicationToInspect notNil ifTrue:[
             s nextPutLine:('Application: ' , applicationToInspect class name).
-        ].
-        masterApplicationToInspect notNil ifTrue:[
-            s nextPutLine:('Masterapplication: ' , masterApplicationToInspect class name).
+            genComponentNameForApplication value:applicationToInspect value:s.
         ].
 
         "/ identity it as component
-        masterApplicationToInspect "applicationToInspect" notNil ifTrue:[
-            masterApplicationToInspect "applicationToInspect" builder notNil ifTrue:[
-                |components v|
-
-                components := masterApplicationToInspect "applicationToInspect" builder namedComponents.
-
-                v := aView.
-                [   (components includes:v) not
-                    and:[v container notNil]
-                ] whileTrue:[
-                    v := v container.
-                ].
-                (components includes:v) ifTrue:[
-                    |k|
-
-                    k := components keyAtValue:v.
-                    v == aView ifTrue:[
-                        s nextPutLine:('Component: ' , k).
-                    ] ifFalse:[
-                        s nextPutLine:('Subview of Component: ' , k).
-                    ].
-                ].
-            ]
-        ].
 
         s cr.
         s nextPutLine:'Press:'.
@@ -234,7 +242,7 @@
 
 initiateHelpFor:aView at:aPointOrNil
 finished == true ifTrue:[self halt].
-    self initiateHelpFor:aView at:aPointOrNil now:true
+    super initiateHelpFor:aView at:aPointOrNil 
 !
 
 initiateHelpFor:aView at:aPointOrNil now:showItNow