UIHelpTool.st
changeset 3402 f5ef58c6082b
parent 3397 1009583a873c
child 3499 8808fb1f10b3
equal deleted inserted replaced
3401:9f2865200e2f 3402:f5ef58c6082b
   728 
   728 
   729     helpSpecSelector := self specSelector.
   729     helpSpecSelector := self specSelector.
   730     specClass := self getHelpSpecClassFromClass:aClass.
   730     specClass := self getHelpSpecClassFromClass:aClass.
   731 
   731 
   732     aClass notNil ifTrue:[
   732     aClass notNil ifTrue:[
   733         (aClass theMetaclass implements:helpSpecSelector) ifFalse:[
   733         ((aClass theMetaclass implements:helpSpecSelector)
   734             alternativeSelector := (self alternativeSpecSelectors ? #()) detect:[:sel | aClass theMetaclass implements:sel] ifNone:nil.
   734         and:[(aClass theMetaclass compiledMethodAt:helpSpecSelector) hasResource:#help]) ifFalse:[
       
   735             alternativeSelector := (self alternativeSpecSelectors ? #()) 
       
   736                                         detect:[:sel | 
       
   737                                             (aClass theMetaclass implements:sel)
       
   738                                             and:[(aClass theMetaclass compiledMethodAt:sel) hasResource:#help]
       
   739                                         ] 
       
   740                                         ifNone:nil.
   735             alternativeSelector notNil ifTrue:[
   741             alternativeSelector notNil ifTrue:[
   736                 helpSpecSelector := specSelector := alternativeSelector.
   742                 helpSpecSelector := specSelector := alternativeSelector.
   737                 specClass := aClass.
   743                 specClass := aClass.
   738             ].
   744             ].
   739         ].
   745         ].
   789     self withoutModifyDo:[
   795     self withoutModifyDo:[
   790         classItemList contents:list.
   796         classItemList contents:list.
   791         self updateIcons.
   797         self updateIcons.
   792         classItemModel value:(list last)
   798         classItemModel value:(list last)
   793     ].
   799     ].
       
   800 
       
   801     "Modified: / 13-02-2017 / 17:47:02 / cg"
   794 !
   802 !
   795 
   803 
   796 loadFromClass:aClass andSelector:aSelector
   804 loadFromClass:aClass andSelector:aSelector
   797     "reads the help dictionary from aClass"
   805     "reads the help dictionary from aClass"
   798 
   806 
  1199 ! !
  1207 ! !
  1200 
  1208 
  1201 !UIHelpTool::ClassItem methodsFor:'code generation'!
  1209 !UIHelpTool::ClassItem methodsFor:'code generation'!
  1202 
  1210 
  1203 createHelpMethodNamed:aMethodName
  1211 createHelpMethodNamed:aMethodName
       
  1212     "cg: special case for helpPairs.
       
  1213      this returns a plain array, not invoking super"
       
  1214      
  1204     |stream|
  1215     |stream|
  1205 
  1216 
  1206     modified ifFalse:[
  1217     modified ifFalse:[
  1207         ^ self
  1218         ^ self
  1208     ].
  1219     ].
  1212             ^ self
  1223             ^ self
  1213         ].
  1224         ].
  1214     ].
  1225     ].
  1215     stream := '' writeStream.
  1226     stream := '' writeStream.
  1216 
  1227 
  1217     stream nextPutAll:
  1228     aMethodName = 'helpPairs' ifTrue:[
  1218         aMethodName, '\' withCRs,
  1229         stream nextPutAll:
  1219         (ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs,
  1230             aMethodName, '\' withCRs,
       
  1231             (ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs,
  1220     '\\' withCRs,
  1232     '\\' withCRs,
  1221     '    "\' withCRs,
  1233     '    "\' withCRs,
  1222     '     UIHelpTool openOnClass:', theClass name asString ,'
  1234     '     UIHelpTool openOnClass:', theClass name asString ,'
  1223     "
  1235     "
  1224 
  1236 
  1225     <resource: #help>
  1237     <resource: #help>
  1226 
  1238 
       
  1239     ^ #(
       
  1240 
       
  1241 '.
       
  1242     ] ifFalse:[    
       
  1243         stream nextPutAll:
       
  1244             aMethodName, '\' withCRs,
       
  1245             (ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs,
       
  1246     '\\' withCRs,
       
  1247     '    "\' withCRs,
       
  1248     '     UIHelpTool openOnClass:', theClass name asString ,'
       
  1249     "
       
  1250 
       
  1251     <resource: #help>
       
  1252 
  1227     ^ super ', aMethodName, ' addPairsFrom:#(
  1253     ^ super ', aMethodName, ' addPairsFrom:#(
  1228 
  1254 
  1229 '.
  1255 '.
  1230 
  1256     ].
       
  1257     
  1231     self do:[:aKeyItem| |helpText|
  1258     self do:[:aKeyItem| |helpText|
  1232         helpText := aKeyItem helpText.
  1259         helpText := aKeyItem helpText.
  1233         helpText isNil ifTrue:[ helpText := '' ].
  1260         helpText isNil ifTrue:[ helpText := '' ].
  1234 
  1261 
  1235         stream nextPutLine:(aKeyItem helpKey storeString).
  1262         stream nextPutLine:(aKeyItem helpKey storeString).
  1241         compile:(stream contents)
  1268         compile:(stream contents)
  1242         forClass:theClass class
  1269         forClass:theClass class
  1243         inCategory:'help specs'.
  1270         inCategory:'help specs'.
  1244 
  1271 
  1245     self modified:false.
  1272     self modified:false.
       
  1273 
       
  1274     "Modified: / 13-02-2017 / 17:51:53 / cg"
  1246 ! !
  1275 ! !
  1247 
  1276 
  1248 !UIHelpTool::ClassItem methodsFor:'displaying'!
  1277 !UIHelpTool::ClassItem methodsFor:'displaying'!
  1249 
  1278 
  1250 icon
  1279 icon