#REFACTORING by stefan
class: Tools::Inspector2
Better integration of BridgeObjectInspectorView
--- a/Tools__Inspector2.st Fri Jun 03 16:00:31 2016 +0200
+++ b/Tools__Inspector2.st Fri Jun 03 16:01:16 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2006 by eXept Software AG
All Rights Reserved
@@ -1307,6 +1309,7 @@
"Modified: / 10-03-2015 / 09:46:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+
!Inspector2::NavigationState class methodsFor:'creating classes'!
for:anObject
@@ -1458,58 +1461,54 @@
!Inspector2::NavigationState methodsFor:'initialization'!
initializeTab: selector
- "Initializes a extra tab specified by given selector"
+ "Initializes an extra tab specified by given selector"
| tab |
- tab :=
- [ theObject perform: selector ]
- on: Error
- do:[:ex|
- "/ for debugging:
- "/ ex reject.
- Transcript show:'error in inspector setup: ',ex description.
- Tools::Inspector2Tab new
- application:application;
- label: selector;
- text:
- (ex description, Character cr, Character cr,
- ex suspendedContext fullPrintAllString)
- ].
- (tab notNil and:[tab isKindOf: Tools::Inspector2Tab]) ifTrue:[
+ [
+ tab := theObject perform:selector
+ ] on: Error do:[:ex|
+ "/ for debugging:
+ "/ ex reject.
+ Transcript show:'error in inspector setup: ', ex description.
+ tab := Tools::Inspector2Tab new
+ application:application;
+ label:selector;
+ text:(ex description, Character cr, Character cr,
+ ex suspendedContext fullPrintAllString)
+ ].
+
+ (tab isKindOf:Tools::Inspector2Tab) ifTrue:[
tabs add: tab.
- (tab view respondsTo:#sortOrderHolder) ifTrue:[
- tab view sortOrderHolder:(application sortOrderHolder)
- ].
+ tab
+ application:application;
+ setupView.
]
"Created: / 03-02-2015 / 11:03:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeTabs
-
- | selectors class |
+ | selectors |
tabs := OrderedCollection new.
- selectors := theObject inspector2Tabs asSet.
"/ Old style - tabs are specified by method #inspector2Tabs
- selectors do: [:selector| self initializeTab: selector ].
+ selectors := theObject inspector2Tabs asSet.
+ selectors do:[:eachSelector| self initializeTab: eachSelector ].
"/ New style - tab are defined by methods with <inspector2Tab> annotation
- class := theObject class.
- [ class notNil ] whileTrue:[
- class selectorsAndMethodsDo: [ :selector :method |
- (selectors includes: selector) ifFalse:[
+ theObject class withAllSuperclassesDo:[:eachClass|
+ eachClass selectorsAndMethodsDo:[:eachSelector :method |
+ (selectors includes: eachSelector) ifFalse:[
(method hasAnnotation: #inspector2Tab) ifTrue:[
- selectors add: selector.
- self initializeTab: selector.
+ selectors add: eachSelector.
+ self initializeTab: eachSelector.
].
].
].
- class := class superclass.
].
- tabs := tabs asSortedCollection:[:a :b|a priority > b priority].
+ tabs := tabs asSortedCollection:[:a :b| a priority > b priority].
"Created: / 16-01-2008 / 16:54:28 / janfrog"
"Modified: / 17-02-2008 / 10:08:04 / janfrog"