Inspector2 refactoring: do add some tabs automagically and unconditionally.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 03 Feb 2015 12:20:17 +0100
changeset 15178 8cf5ae14559b
parent 15177 28ce238b8a47
child 15179 71d64c95b397
Inspector2 refactoring: do add some tabs automagically and unconditionally. Let all tabs be defined by the object itself.
Tools__Inspector2.st
--- a/Tools__Inspector2.st	Tue Feb 03 12:18:00 2015 +0100
+++ b/Tools__Inspector2.st	Tue Feb 03 12:20:17 2015 +0100
@@ -1078,6 +1078,7 @@
     #todo
 ! !
 
+
 !Inspector2 methodsFor:'hooks'!
 
 postBuildEvaluationLanguageCombo: aComboBoxView
@@ -1314,11 +1315,11 @@
 !Inspector2::NavigationState class methodsFor:'documentation'!
 
 version
-    ^'$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.58 2014-12-23 14:56:09 cg Exp $'
+    ^'$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.59 2015-02-03 11:20:17 vrany Exp $'
 !
 
 version_SVN
-    ^'$Id: Tools__Inspector2.st,v 1.58 2014-12-23 14:56:09 cg Exp $'
+    ^'$Id: Tools__Inspector2.st,v 1.59 2015-02-03 11:20:17 vrany Exp $'
 ! !
 
 !Inspector2::NavigationState methodsFor:'accessing'!
@@ -1441,69 +1442,7 @@
 
 !Inspector2::NavigationState methodsFor:'initialization'!
 
-initializeClassBrowserTab
-    |spec makeView view|
-
-
-    "/ spec := #singleClassBrowserSpec.
-    spec := #multipleClassBrowserSpec.
-
-    makeView := [
-        |browser cls canvas|
-
-        cls := theObject class theNonMetaclass.
-        view isNil ifTrue:[
-            browser := Tools::NewSystemBrowser new.
-            browser isEmbeddedBrowser:true.
-            browser createBuilder.
-            browser navigationState canvasType:spec.
-            browser browserCanvasType:spec.
-            canvas := browser browserCanvas value.
-            canvas builder:(browser builder).
-            browser navigationState canvas:canvas.
-            "/ browser switchToClassHierarchyView.
-            "/ browser showInheritedMethods.
-            browser classListGenerator value:(cls withAllSuperclasses).
-            browser sortByNameAndInheritance value:true.
-            browser selectClass: cls.
-            browser selectProtocol: (Tools::BrowserList nameListEntryForALL).  
-
-            view := ApplicationSubView new client: browser spec: spec.
-        ].
-        view
-    ].
-
-    tabs add:
-        (Tools::Inspector2Tab new
-            priority: 0;
-            label:'Class';
-            viewHolder: makeView)
-
-    "Created: / 22-07-2011 / 18:48:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 13-06-2012 / 14:58:01 / cg"
-    "Modified: / 09-04-2014 / 08:51:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-initializeCommonTabs
-
-    "Unfinished code"
-"/    JV@2012-04-20: Don't add class tab, only takes time and nobody uses it anyway
-"/   cg: who says this: I use it all the time!!
-    self initializeClassBrowserTab
-
-"/    tabs add:
-"/        (Tools::Inspector2Tab new
-"/            priority: 50;
-"/            label:'Object';
-"/            view: ((theObject inspectorClass new inspect:theObject)
-"/                        yourself))
-
-    "Created: / 16-01-2008 / 16:56:48 / janfrog"
-    "Modified: / 17-02-2008 / 10:29:54 / janfrog"
-    "Modified (comment): / 20-04-2012 / 20:23:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-initializeExtraTab: selector
+initializeTab: selector
     "Initializes a extra tab specified by given selector"
 
     | tab |
@@ -1524,50 +1463,37 @@
         tabs add: tab
     ]
 
-    "Created: / 11-04-2014 / 19:58:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 03-02-2015 / 11:03:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-initializeExtraTabs
+initializeTabs
 
     | selectors class |
 
-    selectors := Set new.
+    tabs := OrderedCollection new.        
+    selectors := theObject inspector2Tabs asSet.
 
     "/ Old style - tabs are specified by method #inspector2Tabs
-    theObject inspector2Tabs do: [:selector| 
-        self initializeExtraTab: selector.
-        selectors add: selector.
-    ].
+    selectors do: [:selector| self initializeTab: selector ].
 
     "/ New style - tab are defined by method with annotation
     class := theObject class.
     [ class notNil ] whileTrue:[ 
         class selectorsAndMethodsDo: [ :selector :method |
-            (selectors includes: selector) not ifTrue:[
+            (selectors includes: selector) ifFalse:[
                 (method hasAnnotation: #inspector2Tab) ifTrue:[ 
-                    self initializeExtraTab: selector.  
+                    selectors add: selector.
+                    self initializeTab: selector.  
                 ].
             ].
         ].
         class := class superclass.
     ].
-
-    "Created: / 16-01-2008 / 17:25:24 / janfrog"
-    "Modified: / 17-02-2008 / 10:30:43 / janfrog"
-    "Modified: / 07-11-2008 / 08:40:35 / Jan Vrany <vranyj1@fel.cvut.cz>"
-    "Modified (format): / 21-08-2011 / 08:01:34 / cg"
-    "Modified: / 12-05-2014 / 15:36:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-initializeTabs
-
-    tabs := OrderedCollection new.
-    self initializeCommonTabs.
-    self initializeExtraTabs.
     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"
+    "Modified: / 03-02-2015 / 11:06:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 refreshTabs
@@ -1580,19 +1506,19 @@
 !Inspector2 class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.58 2014-12-23 14:56:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.59 2015-02-03 11:20:17 vrany Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.58 2014-12-23 14:56:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.59 2015-02-03 11:20:17 vrany Exp $'
 !
 
 version_CVS_jvrany
-    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.58 2014-12-23 14:56:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/Tools__Inspector2.st,v 1.59 2015-02-03 11:20:17 vrany Exp $'
 !
 
 version_SVN
-    ^ '$Id: Tools__Inspector2.st,v 1.58 2014-12-23 14:56:09 cg Exp $'
+    ^ '$Id: Tools__Inspector2.st,v 1.59 2015-02-03 11:20:17 vrany Exp $'
 ! !