Tools__ViewTreeApplication.st
changeset 2888 9adfb8a84696
parent 2779 10fef360ad85
child 2978 a952dfdb1b6a
--- a/Tools__ViewTreeApplication.st	Fri Apr 27 15:21:01 2012 +0200
+++ b/Tools__ViewTreeApplication.st	Sat Apr 28 21:19:51 2012 +0200
@@ -511,6 +511,8 @@
         nil
         nil
       )
+
+    "Modified: / 27-04-2012 / 14:13:17 / cg"
 !
 
 middleButtonMenu
@@ -1367,13 +1369,15 @@
     ].
     list add:(MenuDesc separator).
 
-    (view respondsTo:#'model:') ifTrue:[
+    (view respondsTo:#'model') ifTrue:[
         inst := view model.
 
-        inst isNil ifTrue:[ label := value := nil ]
-                  ifFalse:[ label := inst displayString.
-                            value := [ view model inspect ].
-                          ].
+        inst isNil 
+            ifTrue:[ label := value := nil ]
+            ifFalse:[ label := inst displayString.
+                      label := label,(self aspectLabelFor:inst inApplicationOf:view).  
+                      value := [ view model inspect ].
+                    ].
 
         list add:(MenuDesc title:'model' value:label action:value).
 
@@ -1392,13 +1396,14 @@
 
         inst isNil ifTrue:[ label := value := nil ]
                   ifFalse:[ label := inst displayString.
+                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
                             value := [ view enableChannel inspect ].
                           ].
 
         list add:(MenuDesc title:'enableChannel' value:label action:value).
     ].
 
-    #( #action #pressaAction #releaseAction ) do:[:actionSelector |
+    #( #action #pressAction #releaseAction ) do:[:actionSelector |
         (view respondsTo:actionSelector) ifTrue:[
             inst := view perform:actionSelector.
 
@@ -1419,6 +1424,7 @@
 
         inst isNil ifTrue:[ label := value := nil ]
                   ifFalse:[ label := inst class printString.
+                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
                             value := [ view listHolder inspect ].
                           ].
         list add:(MenuDesc title:'listHolder' value:label action:value).
@@ -1429,6 +1435,7 @@
 
         inst isNil ifTrue:[ label := value := nil ]
                   ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
+                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
                             value := [ view list inspect ].
                           ].
 
@@ -1436,9 +1443,9 @@
     ].
 
     list last isSeparator ifTrue:[ list removeLast ].
-  ^ MenuDesc buildFromList:list onGC:aMenu
-
-    "Modified: / 11-05-2010 / 12:53:24 / cg"
+    ^ MenuDesc buildFromList:list onGC:aMenu
+
+    "Modified: / 27-04-2012 / 14:22:34 / cg"
 !
 
 submenuVisibility:aMenu
@@ -1477,6 +1484,24 @@
 
 !ViewTreeInspectorApplication methodsFor:'private'!
 
+aspectLabelFor:aModel inApplicationOf:aView
+    |app|
+
+    aModel isNil ifTrue:[^ ''].
+    aView isNil ifTrue:[^ ''].
+    (app := aView application) isNil ifTrue:[^ ''].
+    app builder bindings keysAndValuesDo:[:aspect :value |
+        value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
+    ].
+    app class allInstVarNames do:[:nm | 
+        (app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
+    ].
+
+    ^ ''
+
+    "Created: / 27-04-2012 / 14:22:09 / cg"
+!
+
 selectFocusView
     |rootView focusView|