#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Fri, 14 Sep 2018 18:31:47 +0200
changeset 18380 609fd4a3ebe8
parent 18379 9c6c8385e05e
child 18381 4cdb2e523391
#FEATURE by cg class: Tools::Inspector2::NavigationState comment/format in: #initializeTab: changed: #initializeTabs avoid adding the same tab twice
Tools__Inspector2.st
--- a/Tools__Inspector2.st	Fri Sep 14 17:05:37 2018 +0200
+++ b/Tools__Inspector2.st	Fri Sep 14 18:31:47 2018 +0200
@@ -1642,8 +1642,7 @@
 
     [
         (selector == #inspector2TabForBasicInspect and:[theObject isProtoObject]) ifTrue:[
-            "kludge for ProtoObject, which does neither implement this selector
-             nor #perform:"
+            "kludge for ProtoObject, which does neither implement this selector nor #perform:"
             tab := Tools::Inspector2Tab new
                         priority: 90;
                         label:'Basic';
@@ -1670,6 +1669,7 @@
 
     "Created: / 03-02-2015 / 11:03:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 11-02-2017 / 10:16:42 / cg"
+    "Modified (format): / 14-09-2018 / 18:29:39 / Claus Gittinger"
 !
 
 initializeTabs
@@ -1677,9 +1677,9 @@
 
     tabs := OrderedCollection new.        
 
-    "/ Old style - tabs are specified by method #inspector2Tabs
+    "/ Old style - tabs are specified by the #inspector2Tabs method
     (theObject isProtoObject or:[theObject isNil or:[theObject isStructure]]) ifTrue:[
-        "kludge for ProtoObject and Structure, which does not implement this selector
+        "kludge for ProtoObject and Structure, which do not implement this selector
          nor #perform: -- see #initializeTab:"
         selectors := #(inspector2TabForBasicInspect).
     ] ifFalse:[
@@ -1687,12 +1687,14 @@
     ].
     selectors := selectors asSet.
 
-    "/ New style - tab are defined by methods with <inspector2Tab> annotation
+    "/ New style - tabs are defined by methods with <inspector2Tab> annotation
     theObject class withAllSuperclassesDo:[:eachClass| 
         eachClass selectorsAndMethodsDo:[:eachSelector :method |
             (selectors includes: eachSelector) ifFalse:[
-                (method hasAnnotation: #inspector2Tab) ifTrue:[ 
-                    selectors add: eachSelector.
+                (method hasAnnotation: #inspector2Tab) ifTrue:[
+                    (selectors includes:eachSelector) ifFalse:[
+                        selectors add: eachSelector.
+                    ].
                 ].
             ].
         ].
@@ -1700,11 +1702,13 @@
 
     selectors do:[:eachSelector| self initializeTab: eachSelector ].
 
+    "/ the above has filled the tabs instVar as side effect
     tabs := tabs sort:[: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>"
+    "Modified: / 14-09-2018 / 18:31:20 / Claus Gittinger"
 !
 
 refreshTabs