Tools__ViewTreeApplication.st
changeset 3167 95025cd0fbce
parent 3141 c3fb91a71410
child 3168 894c517d8696
     1.1 --- a/Tools__ViewTreeApplication.st	Thu Nov 27 21:12:25 2014 +0100
     1.2 +++ b/Tools__ViewTreeApplication.st	Fri Nov 28 12:30:07 2014 +0100
     1.3 @@ -1927,24 +1927,10 @@
     1.4          #application    browse application class
     1.5          #controller     browse controller class
     1.6      "
     1.7 -    |view inst|
     1.8 -
     1.9 -    view := self selectedView.
    1.10 -    view isNil ifTrue:[^ self].
    1.11 -
    1.12 -             what == #view        ifTrue:[ inst := view ]
    1.13 -    ifFalse:[what == #model       ifTrue:[ inst := view model ]
    1.14 -    ifFalse:[what == #application ifTrue:[ inst := view application ]
    1.15 -    ifFalse:[what == #controller  ifTrue:[ inst := view controller ]
    1.16 -    ifFalse:[what == #sensor      ifTrue:[ inst := view sensor ]
    1.17 -    ifFalse:[what == #group       ifTrue:[ inst := view windowGroup ]
    1.18 -    ifFalse:[
    1.19 -        ^ self
    1.20 -    ]]]]]].
    1.21 -
    1.22 -    inst notNil ifTrue:[
    1.23 -        inst class browserClass openInClass:(inst class) selector:nil
    1.24 -    ].
    1.25 +    |inst|
    1.26 +
    1.27 +    (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
    1.28 +    inst class browserClass openInClass:(inst class) selector:nil
    1.29  
    1.30      "Modified: / 28-08-2013 / 23:57:42 / cg"
    1.31  !
    1.32 @@ -2018,19 +2004,11 @@
    1.33          #controller     inspect controller
    1.34          #process        inspect application's process
    1.35      "
    1.36 +
    1.37      |inst|
    1.38  
    1.39 -    inst := self selectedView.
    1.40 -    inst isNil ifTrue:[^ self].
    1.41 -
    1.42 -             what == #group       ifTrue:[ inst := inst windowGroup ]
    1.43 -    ifFalse:[what == #model       ifTrue:[ inst := inst model ]
    1.44 -    ifFalse:[what == #application ifTrue:[ inst := inst application ]
    1.45 -    ifFalse:[what == #controller  ifTrue:[ inst := inst controller  ]
    1.46 -    ifFalse:[what == #process     ifTrue:[ inst := inst windowGroup process  ]
    1.47 -    ifFalse:[what == #sensor      ifTrue:[ inst := inst sensor  ]]]]]].
    1.48 -
    1.49 -    inst notNil ifTrue:[ inst inspect ].
    1.50 +    (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
    1.51 +    inst inspect.
    1.52  
    1.53      "Modified: / 28-08-2013 / 23:58:27 / cg"
    1.54  !
    1.55 @@ -2143,6 +2121,35 @@
    1.56      self setRootItem:nil.
    1.57  !
    1.58  
    1.59 +objectToInspectOrBrowse:what
    1.60 +    "return one of:
    1.61 +        #view           inspect class
    1.62 +        #group          inspect windowGroup
    1.63 +        #model          inspect model
    1.64 +        #application    inspect application
    1.65 +        #controller     inspect controller
    1.66 +        #process        inspect application's process
    1.67 +    "
    1.68 +    |view inst|
    1.69 +
    1.70 +    view := self selectedView.
    1.71 +    view isNil ifTrue:[^ nil].
    1.72 +
    1.73 +             what == #group       ifTrue:[ inst := view windowGroup ]
    1.74 +    ifFalse:[what == #model       ifTrue:[ inst := view model ]
    1.75 +    ifFalse:[what == #application ifTrue:[ inst := view application ]
    1.76 +    ifFalse:[what == #controller  ifTrue:[ inst := view controller  ]
    1.77 +    ifFalse:[what == #process     ifTrue:[ inst := view windowGroup process  ]
    1.78 +    ifFalse:[what == #sensor      ifTrue:[ inst := view sensor  ]]]]]].
    1.79 +
    1.80 +    (inst isNil and:[what == #application]) ifTrue:[
    1.81 +        inst := view topView
    1.82 +    ].
    1.83 +    ^ inst
    1.84 +
    1.85 +    "Modified: / 28-08-2013 / 23:58:27 / cg"
    1.86 +!
    1.87 +
    1.88  openDocumentation
    1.89      HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#VIEWTREEINSPECTOR'
    1.90  !