UIHelpTool.st
changeset 335 9f048ededd7d
parent 331 aa1663b8c2ab
child 339 121b64d9b39a
equal deleted inserted replaced
334:3f632e9711e8 335:9f048ededd7d
   274               )
   274               )
   275           )
   275           )
   276       )
   276       )
   277 ! !
   277 ! !
   278 
   278 
   279 !UIHelpTool class methodsFor:'misc'!
       
   280 
       
   281 applicationClassAssociatedWith:aClass
       
   282     "get application class keeping the associated help text or nil
       
   283     "
       
   284     |cls|
       
   285 
       
   286     cls := self resolveName:aClass.
       
   287 
       
   288     (cls notNil and:[cls includesBehavior:UISpecification]) ifTrue:[
       
   289         ^ UISpecificationTool
       
   290     ].
       
   291   ^ cls
       
   292 
       
   293 ! !
       
   294 
       
   295 !UIHelpTool methodsFor:'accessing'!
   279 !UIHelpTool methodsFor:'accessing'!
   296 
   280 
   297 dictionary
   281 dictionary
   298     "return the value of the instance variable 'dictionary' (automatically generated)"
   282     "return the value of the instance variable 'dictionary' (automatically generated)"
   299 
   283 
   327 helpSpecFrom:aClass
   311 helpSpecFrom:aClass
   328     "read help text from an application associated with the class
   312     "read help text from an application associated with the class
   329     "
   313     "
   330     |help|
   314     |help|
   331 
   315 
   332     specClass := self class applicationClassAssociatedWith:aClass.
   316     specClass := self applicationClassAssociatedWith:aClass.
   333 
   317 
   334     (specClass respondsTo:#helpSpec) ifTrue:[
   318     (specClass respondsTo:#helpSpec) ifTrue:[
   335         help := specClass helpSpec
   319         help := specClass helpSpec
   336     ] ifFalse:[
   320     ] ifFalse:[
   337         specClass := nil
   321         specClass := nil
   381 installHelpSpecInto:aClass
   365 installHelpSpecInto:aClass
   382     "install help text
   366     "install help text
   383     "
   367     "
   384     |cls src|
   368     |cls src|
   385 
   369 
   386     cls := self class applicationClassAssociatedWith:aClass.
   370     cls := self applicationClassAssociatedWith:aClass.
   387 
   371 
   388     cls isNil ifTrue:[
   372     cls isNil ifTrue:[
   389         ^ self information:'no application class defined'.
   373         ^ self information:'no application class defined'.
   390     ].
   374     ].
   391     dictionary isEmpty ifTrue:[
   375     dictionary isEmpty ifTrue:[
   493                 maxCharsPerLine := nil
   477                 maxCharsPerLine := nil
   494             ]
   478             ]
   495         ].
   479         ].
   496     ].
   480     ].
   497     ^ view
   481     ^ view
       
   482 ! !
       
   483 
       
   484 !UIHelpTool methodsFor:'queries'!
       
   485 
       
   486 applicationClassAssociatedWith:aClass
       
   487     "get application class keeping the associated help text or nil
       
   488     "
       
   489     |cls|
       
   490 
       
   491     cls := self resolveName:aClass.
       
   492 
       
   493     (cls notNil and:[cls includesBehavior:UISpecification]) ifTrue:[
       
   494         ^ UISpecificationTool
       
   495     ].
       
   496   ^ cls
       
   497 
       
   498 
   498 ! !
   499 ! !
   499 
   500 
   500 !UIHelpTool methodsFor:'selection'!
   501 !UIHelpTool methodsFor:'selection'!
   501 
   502 
   502 listSelection
   503 listSelection
   563                 addOkButton; 
   564                 addOkButton; 
   564                 open
   565                 open
   565             ) accepted.
   566             ) accepted.
   566 
   567 
   567         accepted ifFalse:[^ self].
   568         accepted ifFalse:[^ self].
   568         cls := self class applicationClassAssociatedWith:cls value.
   569         cls := self applicationClassAssociatedWith:cls value.
   569 
   570 
   570         cls notNil ifTrue:[
   571         cls notNil ifTrue:[
   571             ^ self helpSpecFrom:cls
   572             ^ self helpSpecFrom:cls
   572         ].
   573         ].
   573         self warn:'no such class'.
   574         self warn:'no such class'.