class: Tools::ViewTreeInspectorApplication
authorClaus Gittinger <cg@exept.de>
Fri, 28 Nov 2014 12:30:07 +0100
changeset 3167 95025cd0fbce
parent 3166 71dab9730c88
child 3168 894c517d8696
class: Tools::ViewTreeInspectorApplication added: #objectToInspectOrBrowse: changed: #doBrowse: #doInspect:
Tools__ViewTreeApplication.st
--- a/Tools__ViewTreeApplication.st	Thu Nov 27 21:12:25 2014 +0100
+++ b/Tools__ViewTreeApplication.st	Fri Nov 28 12:30:07 2014 +0100
@@ -1927,24 +1927,10 @@
         #application    browse application class
         #controller     browse controller class
     "
-    |view inst|
-
-    view := self selectedView.
-    view isNil ifTrue:[^ self].
-
-             what == #view        ifTrue:[ inst := view ]
-    ifFalse:[what == #model       ifTrue:[ inst := view model ]
-    ifFalse:[what == #application ifTrue:[ inst := view application ]
-    ifFalse:[what == #controller  ifTrue:[ inst := view controller ]
-    ifFalse:[what == #sensor      ifTrue:[ inst := view sensor ]
-    ifFalse:[what == #group       ifTrue:[ inst := view windowGroup ]
-    ifFalse:[
-        ^ self
-    ]]]]]].
-
-    inst notNil ifTrue:[
-        inst class browserClass openInClass:(inst class) selector:nil
-    ].
+    |inst|
+
+    (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
+    inst class browserClass openInClass:(inst class) selector:nil
 
     "Modified: / 28-08-2013 / 23:57:42 / cg"
 !
@@ -2018,19 +2004,11 @@
         #controller     inspect controller
         #process        inspect application's process
     "
+
     |inst|
 
-    inst := self selectedView.
-    inst isNil ifTrue:[^ self].
-
-             what == #group       ifTrue:[ inst := inst windowGroup ]
-    ifFalse:[what == #model       ifTrue:[ inst := inst model ]
-    ifFalse:[what == #application ifTrue:[ inst := inst application ]
-    ifFalse:[what == #controller  ifTrue:[ inst := inst controller  ]
-    ifFalse:[what == #process     ifTrue:[ inst := inst windowGroup process  ]
-    ifFalse:[what == #sensor      ifTrue:[ inst := inst sensor  ]]]]]].
-
-    inst notNil ifTrue:[ inst inspect ].
+    (inst := self objectToInspectOrBrowse:what) isNil ifTrue:[^ self].
+    inst inspect.
 
     "Modified: / 28-08-2013 / 23:58:27 / cg"
 !
@@ -2143,6 +2121,35 @@
     self setRootItem:nil.
 !
 
+objectToInspectOrBrowse:what
+    "return one of:
+        #view           inspect class
+        #group          inspect windowGroup
+        #model          inspect model
+        #application    inspect application
+        #controller     inspect controller
+        #process        inspect application's process
+    "
+    |view inst|
+
+    view := self selectedView.
+    view isNil ifTrue:[^ nil].
+
+             what == #group       ifTrue:[ inst := view windowGroup ]
+    ifFalse:[what == #model       ifTrue:[ inst := view model ]
+    ifFalse:[what == #application ifTrue:[ inst := view application ]
+    ifFalse:[what == #controller  ifTrue:[ inst := view controller  ]
+    ifFalse:[what == #process     ifTrue:[ inst := view windowGroup process  ]
+    ifFalse:[what == #sensor      ifTrue:[ inst := view sensor  ]]]]]].
+
+    (inst isNil and:[what == #application]) ifTrue:[
+        inst := view topView
+    ].
+    ^ inst
+
+    "Modified: / 28-08-2013 / 23:58:27 / cg"
+!
+
 openDocumentation
     HTMLDocumentView openFullOnDocumentationFile:'tools/misc/TOP.html#VIEWTREEINSPECTOR'
 !