Tools__ViewTreeApplication.st
changeset 2888 9adfb8a84696
parent 2779 10fef360ad85
child 2978 a952dfdb1b6a
     1.1 --- a/Tools__ViewTreeApplication.st	Fri Apr 27 15:21:01 2012 +0200
     1.2 +++ b/Tools__ViewTreeApplication.st	Sat Apr 28 21:19:51 2012 +0200
     1.3 @@ -511,6 +511,8 @@
     1.4          nil
     1.5          nil
     1.6        )
     1.7 +
     1.8 +    "Modified: / 27-04-2012 / 14:13:17 / cg"
     1.9  !
    1.10  
    1.11  middleButtonMenu
    1.12 @@ -1367,13 +1369,15 @@
    1.13      ].
    1.14      list add:(MenuDesc separator).
    1.15  
    1.16 -    (view respondsTo:#'model:') ifTrue:[
    1.17 +    (view respondsTo:#'model') ifTrue:[
    1.18          inst := view model.
    1.19  
    1.20 -        inst isNil ifTrue:[ label := value := nil ]
    1.21 -                  ifFalse:[ label := inst displayString.
    1.22 -                            value := [ view model inspect ].
    1.23 -                          ].
    1.24 +        inst isNil 
    1.25 +            ifTrue:[ label := value := nil ]
    1.26 +            ifFalse:[ label := inst displayString.
    1.27 +                      label := label,(self aspectLabelFor:inst inApplicationOf:view).  
    1.28 +                      value := [ view model inspect ].
    1.29 +                    ].
    1.30  
    1.31          list add:(MenuDesc title:'model' value:label action:value).
    1.32  
    1.33 @@ -1392,13 +1396,14 @@
    1.34  
    1.35          inst isNil ifTrue:[ label := value := nil ]
    1.36                    ifFalse:[ label := inst displayString.
    1.37 +                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
    1.38                              value := [ view enableChannel inspect ].
    1.39                            ].
    1.40  
    1.41          list add:(MenuDesc title:'enableChannel' value:label action:value).
    1.42      ].
    1.43  
    1.44 -    #( #action #pressaAction #releaseAction ) do:[:actionSelector |
    1.45 +    #( #action #pressAction #releaseAction ) do:[:actionSelector |
    1.46          (view respondsTo:actionSelector) ifTrue:[
    1.47              inst := view perform:actionSelector.
    1.48  
    1.49 @@ -1419,6 +1424,7 @@
    1.50  
    1.51          inst isNil ifTrue:[ label := value := nil ]
    1.52                    ifFalse:[ label := inst class printString.
    1.53 +                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
    1.54                              value := [ view listHolder inspect ].
    1.55                            ].
    1.56          list add:(MenuDesc title:'listHolder' value:label action:value).
    1.57 @@ -1429,6 +1435,7 @@
    1.58  
    1.59          inst isNil ifTrue:[ label := value := nil ]
    1.60                    ifFalse:[ label := '%1 [%2]' bindWith:(inst class printString) with:(inst size).
    1.61 +                            label := label,(self aspectLabelFor:inst inApplicationOf:view).  
    1.62                              value := [ view list inspect ].
    1.63                            ].
    1.64  
    1.65 @@ -1436,9 +1443,9 @@
    1.66      ].
    1.67  
    1.68      list last isSeparator ifTrue:[ list removeLast ].
    1.69 -  ^ MenuDesc buildFromList:list onGC:aMenu
    1.70 -
    1.71 -    "Modified: / 11-05-2010 / 12:53:24 / cg"
    1.72 +    ^ MenuDesc buildFromList:list onGC:aMenu
    1.73 +
    1.74 +    "Modified: / 27-04-2012 / 14:22:34 / cg"
    1.75  !
    1.76  
    1.77  submenuVisibility:aMenu
    1.78 @@ -1477,6 +1484,24 @@
    1.79  
    1.80  !ViewTreeInspectorApplication methodsFor:'private'!
    1.81  
    1.82 +aspectLabelFor:aModel inApplicationOf:aView
    1.83 +    |app|
    1.84 +
    1.85 +    aModel isNil ifTrue:[^ ''].
    1.86 +    aView isNil ifTrue:[^ ''].
    1.87 +    (app := aView application) isNil ifTrue:[^ ''].
    1.88 +    app builder bindings keysAndValuesDo:[:aspect :value |
    1.89 +        value == aModel ifTrue:[^ ' [aspect: ',aspect,']'].
    1.90 +    ].
    1.91 +    app class allInstVarNames do:[:nm | 
    1.92 +        (app instVarNamed:nm) == aModel ifTrue:[^ ' [instvar: ',nm,']']
    1.93 +    ].
    1.94 +
    1.95 +    ^ ''
    1.96 +
    1.97 +    "Created: / 27-04-2012 / 14:22:09 / cg"
    1.98 +!
    1.99 +
   1.100  selectFocusView
   1.101      |rootView focusView|
   1.102