Tools__Inspector2.st
changeset 18380 609fd4a3ebe8
parent 18296 afeed2a68bd5
child 18464 74893c113f66
equal deleted inserted replaced
18379:9c6c8385e05e 18380:609fd4a3ebe8
  1640 
  1640 
  1641     | tab |
  1641     | tab |
  1642 
  1642 
  1643     [
  1643     [
  1644         (selector == #inspector2TabForBasicInspect and:[theObject isProtoObject]) ifTrue:[
  1644         (selector == #inspector2TabForBasicInspect and:[theObject isProtoObject]) ifTrue:[
  1645             "kludge for ProtoObject, which does neither implement this selector
  1645             "kludge for ProtoObject, which does neither implement this selector nor #perform:"
  1646              nor #perform:"
       
  1647             tab := Tools::Inspector2Tab new
  1646             tab := Tools::Inspector2Tab new
  1648                         priority: 90;
  1647                         priority: 90;
  1649                         label:'Basic';
  1648                         label:'Basic';
  1650                         view: (InspectorView new inspect:theObject);
  1649                         view: (InspectorView new inspect:theObject);
  1651                         yourself
  1650                         yourself
  1668         tab inspector:inspector.
  1667         tab inspector:inspector.
  1669     ]
  1668     ]
  1670 
  1669 
  1671     "Created: / 03-02-2015 / 11:03:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1670     "Created: / 03-02-2015 / 11:03:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1672     "Modified: / 11-02-2017 / 10:16:42 / cg"
  1671     "Modified: / 11-02-2017 / 10:16:42 / cg"
       
  1672     "Modified (format): / 14-09-2018 / 18:29:39 / Claus Gittinger"
  1673 !
  1673 !
  1674 
  1674 
  1675 initializeTabs
  1675 initializeTabs
  1676     | selectors |
  1676     | selectors |
  1677 
  1677 
  1678     tabs := OrderedCollection new.        
  1678     tabs := OrderedCollection new.        
  1679 
  1679 
  1680     "/ Old style - tabs are specified by method #inspector2Tabs
  1680     "/ Old style - tabs are specified by the #inspector2Tabs method
  1681     (theObject isProtoObject or:[theObject isNil or:[theObject isStructure]]) ifTrue:[
  1681     (theObject isProtoObject or:[theObject isNil or:[theObject isStructure]]) ifTrue:[
  1682         "kludge for ProtoObject and Structure, which does not implement this selector
  1682         "kludge for ProtoObject and Structure, which do not implement this selector
  1683          nor #perform: -- see #initializeTab:"
  1683          nor #perform: -- see #initializeTab:"
  1684         selectors := #(inspector2TabForBasicInspect).
  1684         selectors := #(inspector2TabForBasicInspect).
  1685     ] ifFalse:[
  1685     ] ifFalse:[
  1686         selectors := theObject inspector2Tabs.
  1686         selectors := theObject inspector2Tabs.
  1687     ].
  1687     ].
  1688     selectors := selectors asSet.
  1688     selectors := selectors asSet.
  1689 
  1689 
  1690     "/ New style - tab are defined by methods with <inspector2Tab> annotation
  1690     "/ New style - tabs are defined by methods with <inspector2Tab> annotation
  1691     theObject class withAllSuperclassesDo:[:eachClass| 
  1691     theObject class withAllSuperclassesDo:[:eachClass| 
  1692         eachClass selectorsAndMethodsDo:[:eachSelector :method |
  1692         eachClass selectorsAndMethodsDo:[:eachSelector :method |
  1693             (selectors includes: eachSelector) ifFalse:[
  1693             (selectors includes: eachSelector) ifFalse:[
  1694                 (method hasAnnotation: #inspector2Tab) ifTrue:[ 
  1694                 (method hasAnnotation: #inspector2Tab) ifTrue:[
  1695                     selectors add: eachSelector.
  1695                     (selectors includes:eachSelector) ifFalse:[
       
  1696                         selectors add: eachSelector.
       
  1697                     ].
  1696                 ].
  1698                 ].
  1697             ].
  1699             ].
  1698         ].
  1700         ].
  1699     ].
  1701     ].
  1700 
  1702 
  1701     selectors do:[:eachSelector| self initializeTab: eachSelector ].
  1703     selectors do:[:eachSelector| self initializeTab: eachSelector ].
  1702 
  1704 
       
  1705     "/ the above has filled the tabs instVar as side effect
  1703     tabs := tabs sort:[:a :b| a priority > b priority].
  1706     tabs := tabs sort:[:a :b| a priority > b priority].
  1704 
  1707 
  1705     "Created: / 16-01-2008 / 16:54:28 / janfrog"
  1708     "Created: / 16-01-2008 / 16:54:28 / janfrog"
  1706     "Modified: / 17-02-2008 / 10:08:04 / janfrog"
  1709     "Modified: / 17-02-2008 / 10:08:04 / janfrog"
  1707     "Modified: / 03-02-2015 / 11:06:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1710     "Modified: / 03-02-2015 / 11:06:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1711     "Modified: / 14-09-2018 / 18:31:20 / Claus Gittinger"
  1708 !
  1712 !
  1709 
  1713 
  1710 refreshTabs
  1714 refreshTabs
  1711     self initializeTabs.
  1715     self initializeTabs.
  1712 
  1716