Tools__Inspector2.st
branchjv
changeset 17139 bbe5b1ec2b88
parent 17137 2c2f7c9fc909
parent 17125 279b7a2a1241
child 17140 c2a83a451e3b
equal deleted inserted replaced
17138:72bf03c1ff80 17139:bbe5b1ec2b88
   830     "Modified: / 26-10-2013 / 00:34:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   830     "Modified: / 26-10-2013 / 00:34:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
   831 !
   831 !
   832 
   832 
   833 currentObjectIsFilename
   833 currentObjectIsFilename
   834     ^ BlockValue
   834     ^ BlockValue
   835         with:[:o | o isFilename ]
   835         with:[:o | o isProtoObject not and:[o isFilename] ]
   836         argument:self currentObjectHolder
   836         argument:self currentObjectHolder
   837 
   837 
   838     "Created: / 19-08-2011 / 08:56:27 / cg"
   838     "Created: / 19-08-2011 / 08:56:27 / cg"
   839 !
   839 !
   840 
   840 
   841 currentObjectIsImage
   841 currentObjectIsImage
   842     ^ BlockValue
   842     ^ BlockValue
   843         with:[:o | o isImage ]
   843         with:[:o | o isProtoObject not and:[o isImage] ]
   844         argument:self currentObjectHolder
   844         argument:self currentObjectHolder
   845 
   845 
   846     "Created: / 15-01-2012 / 10:06:28 / cg"
   846     "Created: / 15-01-2012 / 10:06:28 / cg"
   847 !
   847 !
   848 
   848 
  1045     "Created: / 26-10-2013 / 00:40:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1045     "Created: / 26-10-2013 / 00:40:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1046 !
  1046 !
  1047 
  1047 
  1048 updateOperationsMenu
  1048 updateOperationsMenu
  1049     |items|
  1049     |items|
  1050     
  1050 
  1051     items := currentObjectHolder value inspectorExtraMenuOperations.
  1051     currentObjectHolder value isProtoObject ifFalse:[
       
  1052         items := currentObjectHolder value inspectorExtraMenuOperations.
       
  1053     ].
  1052     self operationsMenuEnabledHolder value:(items notEmptyOrNil).
  1054     self operationsMenuEnabledHolder value:(items notEmptyOrNil).
  1053 ! !
  1055 ! !
  1054 
  1056 
  1055 !Inspector2 methodsFor:'configuration'!
  1057 !Inspector2 methodsFor:'configuration'!
  1056 
  1058 
  1486 initializeTab: selector
  1488 initializeTab: selector
  1487     "Initializes an extra tab specified by given selector"
  1489     "Initializes an extra tab specified by given selector"
  1488 
  1490 
  1489     | tab |
  1491     | tab |
  1490 
  1492 
  1491     [ 
  1493     [
  1492         tab := theObject perform:selector 
  1494         selector == #inspector2TabForBasicInspect ifTrue:[
       
  1495             "kludge for ProtoObject, which does not implement this selector
       
  1496              nor #perform:"
       
  1497             tab := Tools::Inspector2Tab new
       
  1498                         priority: 90;
       
  1499                         label:'Basic';
       
  1500                         view: (InspectorView new inspect:self);
       
  1501                         yourself
       
  1502         ] ifFalse:[
       
  1503             tab := theObject perform:selector.
       
  1504         ].
  1493     ] on: Error do:[:ex|
  1505     ] on: Error do:[:ex|
  1494         "/ for debugging:  
  1506         "/ for debugging:  
  1495         "/ ex reject.
  1507         "/ ex reject.
  1496         Logger error:'inspector setup: %1' with:ex description.    
  1508         Logger error:'inspector setup: %1' with:ex description.    
  1497         tab := Tools::Inspector2Tab new
  1509         tab := Tools::Inspector2Tab new
  1515     | selectors |
  1527     | selectors |
  1516 
  1528 
  1517     tabs := OrderedCollection new.        
  1529     tabs := OrderedCollection new.        
  1518 
  1530 
  1519     "/ Old style - tabs are specified by method #inspector2Tabs
  1531     "/ Old style - tabs are specified by method #inspector2Tabs
  1520     selectors := (theObject inspector2Tabs ? #(inspector2TabCommon)) asSet.
  1532     (theObject isProtoObject or:[theObject isNil]) ifTrue:[
       
  1533         "kludge for ProtoObject, which does not implement this selector
       
  1534          nor #perform: -- see #initializeTab:"
       
  1535         selectors := #(inspector2TabForBasicInspect).
       
  1536     ] ifFalse:[
       
  1537         selectors := theObject inspector2Tabs.
       
  1538     ].
       
  1539     selectors := selectors asSet.
  1521 
  1540 
  1522     "/ New style - tab are defined by methods with <inspector2Tab> annotation
  1541     "/ New style - tab are defined by methods with <inspector2Tab> annotation
  1523     theObject class withAllSuperclassesDo:[:eachClass| 
  1542     theObject class withAllSuperclassesDo:[:eachClass| 
  1524         eachClass selectorsAndMethodsDo:[:eachSelector :method |
  1543         eachClass selectorsAndMethodsDo:[:eachSelector :method |
  1525             (selectors includes: eachSelector) ifFalse:[
  1544             (selectors includes: eachSelector) ifFalse:[