UIHelpTool.st
changeset 779 2ffa22f97d5d
parent 761 91e524583390
child 832 2c5b61b168e8
equal deleted inserted replaced
778:a4b931b2aff6 779:2ffa22f97d5d
    12 
    12 
    13 
    13 
    14 
    14 
    15 ToolApplicationModel subclass:#UIHelpTool
    15 ToolApplicationModel subclass:#UIHelpTool
    16 	instanceVariableNames:'specClass specSelector dictionary dictionaries listSelection
    16 	instanceVariableNames:'specClass specSelector dictionary dictionaries listSelection
    17 		modifiedHolder maxCharsPerLine modified'
    17 		maxCharsPerLine modifiedHolder modified'
    18 	classVariableNames:''
    18 	classVariableNames:''
    19 	poolDictionaries:''
    19 	poolDictionaries:''
    20 	category:'Interface-UIPainter'
    20 	category:'Interface-UIPainter'
    21 !
    21 !
    22 
    22 
    38 
    38 
    39 !
    39 !
    40 
    40 
    41 documentation
    41 documentation
    42 "
    42 "
    43     The UIHelpTool allows you to define help dictionaries for the widgets in
    43     The Help Tool allows you to define help dictionaries for the widgets in
    44     window applications. The tool are able to run stand alone or in other master 
    44     window applications. The tool are able to run stand alone or in other master 
    45     applications like the GUI Painter and the Menu Editor.
    45     applications like the GUI Painter and the Menu Editor.
    46     If the application responds to the selector #showHelp:aHelpText for:aView,
    46     If the application responds to the selector #showHelp:aHelpText for:aView,
    47     this selector is called by the widget's view when the mouse cursor moves over. 
    47     this selector is called by the widget's view when the mouse cursor moves over. 
    48     If the application does not responds to that selector, and the activeHelp mode
    48     If the application does not responds to that selector, and the activeHelp mode
    49     is enabled, an active help bubble is shown at the widget's view.
    49     is enabled, an active help bubble is shown at the widget's view.
    50 
    50 
       
    51     [instance variables:]
       
    52         specClass       <Symbol>        class implementing the help spec
       
    53         specSelector    <Symbol>        selector returning the help spec
       
    54         dictionary      <Dictionary>    dictionary containing pairs of help keys/texts
       
    55         dictionaries    <Dictionary>    dictionary containing pairs of help spec classes/help dictionaries
       
    56         listSelection   <String>        current selected help key
       
    57         maxCharsPerLine <Integer>       maximum number of allowed characters per text line
       
    58         modifiedHolder  <ValueHolder>   value holder for setting as modified
       
    59         modified        <Boolean>       flag whether the help spec was modified
       
    60 
    51     [author:]
    61     [author:]
    52         Claus Atzkern, eXept Software AG
    62         Claus Atzkern, eXept Software AG
    53         Thomas Zwick, eXept Software AG
    63         Thomas Zwick, eXept Software AG
    54 "
    64 "
    55 ! !
    65 ! !
    56 
    66 
    57 !UIHelpTool class methodsFor:'instance creation'!
    67 !UIHelpTool class methodsFor:'instance creation'!
    58 
    68 
    59 openOnClass:aClass
    69 openOnClass:aClass
       
    70     "opens a Help Tool on aClass"
       
    71 
    60     "
    72     "
    61      UIHelpTool openOnClass:self
    73      UIHelpTool openOnClass:self
    62     "
    74     "
    63 
    75 
    64     UIHelpTool new openOnClass:aClass
    76     UIHelpTool new openOnClass:aClass
    65 
    77 
    66 ! !
    78 ! !
    67 
    79 
    68 !UIHelpTool class methodsFor:'accessing'!
       
    69 
       
    70 resourceType
       
    71     "get the type of resource of the method generated by the Help Tool"
       
    72 
       
    73     ^#help
       
    74 
       
    75 
       
    76 ! !
       
    77 
       
    78 !UIHelpTool class methodsFor:'constants'!
    80 !UIHelpTool class methodsFor:'constants'!
    79 
    81 
    80 label
    82 label
       
    83     "returns the label; used if embedded as sub canvas in the GUI Painter or Menu Editor"
    81 
    84 
    82     ^'Help'
    85     ^'Help'
    83 ! !
    86 ! !
    84 
    87 
    85 !UIHelpTool class methodsFor:'help specs'!
    88 !UIHelpTool class methodsFor:'help specs'!
   432 ! !
   435 ! !
   433 
   436 
   434 !UIHelpTool methodsFor:'accessing'!
   437 !UIHelpTool methodsFor:'accessing'!
   435 
   438 
   436 dictionaries
   439 dictionaries
   437     "get the dictionary of the help dictionaries of the classes having help specs
   440     "returns the dictionary of the help dictionaries of the classes having help specs"
   438     "
   441 
   439     ^dictionaries
   442     ^dictionaries
   440 !
   443 !
   441 
   444 
   442 dictionaries:aDictionaryOfDictionaries
   445 dictionaries:aDictionaryOfDictionaries
   443     "set a dictionary of the help dictionaries of the classes having help specs
   446     "sets a dictionary of the help dictionaries of the classes having help specs"
   444     "
   447 
   445     (dictionaries := aDictionaryOfDictionaries) isNil ifTrue:[
   448     (dictionaries := aDictionaryOfDictionaries) isNil ifTrue:[
   446         dictionaries := Dictionary new.
   449         dictionaries := Dictionary new.
   447     ].
   450     ].
   448     self updateList.
   451     self updateList.
   449 !
   452 !
   450 
   453 
   451 dictionary
   454 dictionary
   452     "get the dictionary of the selected class
   455     "returns the dictionary of the selected class"
   453     "
   456 
   454     ^dictionary
   457     ^dictionary
   455 !
   458 !
   456 
   459 
   457 dictionary:aDictionary
   460 dictionary:aDictionary
   458     "set dictionary of the selected class
   461     "sets dictionary of the selected class"
   459     "
   462 
   460     (dictionary := aDictionary) isNil ifTrue:[
   463     (dictionary := aDictionary) isNil ifTrue:[
   461         dictionary := Dictionary new.
   464         dictionary := Dictionary new.
   462     ].
   465     ].
   463     self updateList
   466     self updateList
   464 !
   467 !
   465 
   468 
   466 helpKey
   469 helpKey
   467     "get the help key of selected help text
   470     "returns the help key of selected help text"
   468     "
   471 
   469     listSelection size ~~ 0 ifTrue:[
   472     listSelection size ~~ 0 ifTrue:[
   470         ^ listSelection asSymbol
   473         ^ listSelection asSymbol
   471     ].
   474     ].
   472     ^ nil
   475     ^ nil
   473 !
   476 !
   474 
   477 
   475 helpKey:aKey
   478 helpKey:aKey
   476     "set the help key into the selection channel in order to show the help text
   479     "sets the help key into the selection channel in order to show the help text"
   477     "
   480 
   478     |key|
   481     |key|
   479     aKey size ~~ 0 ifTrue:[
   482     aKey size ~~ 0 ifTrue:[
   480         key := aKey asString
   483         key := aKey asString
   481     ].
   484     ].
   482     self listModel value:key
   485     self listModel value:key
   483 
   486 
   484 !
   487 !
   485 
   488 
   486 modified
   489 modified
   487     "answer whether the help tool was modified
   490     "returns whether the help tool was modified"
   488     "
   491 
   489     ^modified
   492     ^modified
   490 !
   493 !
   491 
   494 
   492 modified: aBoolean
   495 modified: aBoolean
   493     "set the help tool as modified
   496     "sets the help tool as modified"
   494     "
   497 
   495     modified := aBoolean
   498     modified := aBoolean
   496 !
   499 !
   497 
   500 
   498 modifiedHolder:aValueHolder
   501 modifiedHolder:aValueHolder
   499     "set the value holder set to true in case of modifying attributes
   502     "sets the value holder to true in case of modifying attributes"
   500     "
   503 
   501     modifiedHolder notNil ifTrue:[
   504     modifiedHolder notNil ifTrue:[
   502         modifiedHolder removeDependent:self. 
   505         modifiedHolder removeDependent:self. 
   503     ].
   506     ].
   504 
   507 
   505     (modifiedHolder := aValueHolder) notNil ifTrue:[
   508     (modifiedHolder := aValueHolder) notNil ifTrue:[
   518 
   521 
   519 
   522 
   520 !
   523 !
   521 
   524 
   522 specClass
   525 specClass
   523     "get the class on which the help tool works
   526     "returns the class on which the help tool works"
   524     "
   527 
   525     ^specClass
   528     ^specClass
   526 ! !
   529 ! !
   527 
   530 
   528 !UIHelpTool methodsFor:'aspects'!
   531 !UIHelpTool methodsFor:'aspects'!
   529 
   532 
   530 listChannel
   533 listChannel
   531     "get the value holder of the help texts
   534     "returns the value holder of the help texts"
   532     "
   535 
   533     |holder|
   536     |holder|
   534     (holder := builder bindingAt:#listChannel) isNil ifTrue:[
   537     (holder := builder bindingAt:#listChannel) isNil ifTrue:[
   535         builder aspectAt:#listChannel put:(holder :=  OrderedCollection new asValue).
   538         builder aspectAt:#listChannel put:(holder :=  OrderedCollection new asValue).
   536     ].
   539     ].
   537     ^ holder
   540     ^ holder
   538 !
   541 !
   539 
   542 
   540 listModel
   543 listModel
   541     "get the value holder of the help key
   544     "returns the value holder of the help key"
   542     "
   545 
   543     |holder|
   546     |holder|
   544     (holder := builder bindingAt:#listModel) isNil ifTrue:[
   547     (holder := builder bindingAt:#listModel) isNil ifTrue:[
   545         holder := AspectAdaptor new subject:self; forAspect:#listSelection.
   548         holder := AspectAdaptor new subject:self; forAspect:#listSelection.
   546         builder aspectAt:#listModel put:holder.
   549         builder aspectAt:#listModel put:holder.
   547     ].
   550     ].
   548     ^ holder
   551     ^ holder
   549 !
   552 !
   550 
   553 
   551 listOfHelpSpecClasses
   554 listOfHelpSpecClasses
   552     "get the value holder of the specClass and its superclasses 
   555     "returns the value holder of the specClass and its superclasses 
   553      which are subclasses of ApplicationModel
   556      which are subclasses of ApplicationModel"
   554     "
   557 
   555     |holder|       
   558     |holder|       
   556     (holder := builder bindingAt:#listOfHelpSpecClasses) isNil ifTrue:[
   559     (holder := builder bindingAt:#listOfHelpSpecClasses) isNil ifTrue:[
   557         builder aspectAt:#listOfHelpSpecClasses put: (holder := List new)
   560         builder aspectAt:#listOfHelpSpecClasses put: (holder := List new)
   558     ].
   561     ].
   559     ^ holder
   562     ^ holder
   560 
   563 
   561 !
   564 !
   562 
   565 
   563 selectionOfHelpSpecClass
   566 selectionOfHelpSpecClass
   564     "get the value holder of the selected help spec class
   567     "returns the value holder of the selected help spec class"
   565     "
   568 
   566     |holder|
   569     |holder|
   567     (holder := builder bindingAt:#selectionOfHelpSpecClass) isNil ifTrue:[
   570     (holder := builder bindingAt:#selectionOfHelpSpecClass) isNil ifTrue:[
   568         builder aspectAt:#selectionOfHelpSpecClass put: (holder := ValueHolder new)
   571         builder aspectAt:#selectionOfHelpSpecClass put: (holder := ValueHolder new)
   569     ].
   572     ].
   570     ^ holder
   573     ^ holder
   572 ! !
   575 ! !
   573 
   576 
   574 !UIHelpTool methodsFor:'building'!
   577 !UIHelpTool methodsFor:'building'!
   575 
   578 
   576 buildFromClass:aClass
   579 buildFromClass:aClass
   577     "read the help dictionary from aClass and find remaining classes 
   580     "reads the help dictionary from aClass and find remaining classes 
   578      'between' aClass and ApplicationModel 
   581      'between' aClass and ApplicationModel" 
   579     "
   582 
   580     modified := false.
   583     modified := false.
   581     specClass notNil
   584     specClass notNil
   582     ifTrue:
   585     ifTrue:
   583     [   
   586     [   
   584         dictionary   := Dictionary new.
   587         dictionary   := Dictionary new.
   602 
   605 
   603     self updateList
   606     self updateList
   604 !
   607 !
   605 
   608 
   606 buildFromClass: aClass andSelector: aSelector
   609 buildFromClass: aClass andSelector: aSelector
       
   610     "sets aSelector and reads the help dictionary from aClass"
   607 
   611 
   608     specSelector := aSelector.
   612     specSelector := aSelector.
   609     self buildFromClass:aClass
   613     self buildFromClass:aClass
   610 
   614 
   611 ! !
   615 ! !
   612 
   616 
   613 !UIHelpTool methodsFor:'callbacks'!
   617 !UIHelpTool methodsFor:'callbacks'!
   614 
   618 
   615 helpSpecClassSelected
   619 helpSpecClassSelected
   616     "extract the help dictionary from the selected class and make it current
   620     "extracts the help dictionary from the selected class and make it current"
   617     "
   621 
   618     |clsName|
   622     |clsName|
   619 
   623 
   620     clsName := self selectionOfHelpSpecClass value.
   624     clsName := self selectionOfHelpSpecClass value.
   621 
   625 
   622     (dictionary := dictionaries at: clsName ifAbsent: nil) isNil
   626     (dictionary := dictionaries at: clsName ifAbsent: nil) isNil
   645 ! !
   649 ! !
   646 
   650 
   647 !UIHelpTool methodsFor:'help'!
   651 !UIHelpTool methodsFor:'help'!
   648 
   652 
   649 defaultInfoLabel
   653 defaultInfoLabel
   650     "get default label for the info bar"
   654     "returns the default label for the info bar"
   651 
   655 
   652     specClass isClass
   656     specClass isClass
   653     ifTrue:
   657     ifTrue:
   654     [
   658     [
   655         (specClass class implements: specSelector)
   659         (specClass class implements: specSelector)
   668 ! !
   672 ! !
   669 
   673 
   670 !UIHelpTool methodsFor:'private'!
   674 !UIHelpTool methodsFor:'private'!
   671 
   675 
   672 askForModification
   676 askForModification
   673     "ask for modification"
   677     "asks for modification"
   674 
   678 
   675     modified
   679     modified
   676     ifTrue:
   680     ifTrue:
   677     [
   681     [
   678         ((YesNoBox title: 'List was modified!!')        
   682         ((YesNoBox title: 'List was modified!!')        
   687 
   691 
   688 
   692 
   689 !
   693 !
   690 
   694 
   691 editTextView
   695 editTextView
   692     "get the editTextView or nil.
   696     "returns the editTextView or nil"
   693     "
   697 
   694     |view|
   698     |view|
   695 
   699 
   696     (view := builder componentAt:#helpTextView) notNil ifTrue:[
   700     (view := builder componentAt:#helpTextView) notNil ifTrue:[
   697         view := view scrolledView.
   701         view := view scrolledView.
   698 
   702 
   708     ].       
   712     ].       
   709     ^ view
   713     ^ view
   710 !
   714 !
   711 
   715 
   712 extractHelpSpecForClass: aClass
   716 extractHelpSpecForClass: aClass
   713     "extract the help dictionary of aClass, it current and return it
   717     "extracts the help dictionary of aClass, it current and return it"
   714     "
   718 
   715     |helpSpecSuperClass superHelpSpecKeys helpSpec|
   719     |helpSpecSuperClass superHelpSpecKeys helpSpec|
   716 
   720 
   717     ((aClass class implements: specSelector)
   721     ((aClass class implements: specSelector)
   718     and: [(helpSpecSuperClass := aClass allSuperclasses detect: [:cls| cls class implements: specSelector] ifNone: nil) notNil])
   722     and: [(helpSpecSuperClass := aClass allSuperclasses detect: [:cls| cls class implements: specSelector] ifNone: nil) notNil])
   719     ifTrue:
   723     ifTrue:
   728     ].
   732     ].
   729     ^dictionary := Dictionary new 
   733     ^dictionary := Dictionary new 
   730 !
   734 !
   731 
   735 
   732 findHelpSpecForKey: aHelpKey
   736 findHelpSpecForKey: aHelpKey
   733     "find the help spec class including aHelpKey in its help dictionary and make it current
   737     "finds the help spec class including aHelpKey in its help dictionary and make it current"
   734     "
   738 
   735     |dictTemp|
   739     |dictTemp|
   736 
   740 
   737     aHelpKey isNil ifTrue: [^nil].
   741     aHelpKey isNil ifTrue: [^nil].
   738     dictTemp := dictionary.
   742     dictTemp := dictionary.
   739     self listOfHelpSpecClasses value do:
   743     self listOfHelpSpecClasses value do:
   755 
   759 
   756 
   760 
   757 !
   761 !
   758 
   762 
   759 getHelpSpecClassFromClass:aClass
   763 getHelpSpecClassFromClass:aClass
   760     "get application class keeping the associated help text or nil
   764     "returns application class keeping the associated help text or nil"
   761     "
   765 
   762     |cls|
   766     |cls|
   763 
   767 
   764     ((cls := self resolveName:aClass) notNil and:[cls respondsTo: #helpSpecClass]) ifTrue:[
   768     ((cls := self resolveName:aClass) notNil and:[cls respondsTo: #helpSpecClass]) ifTrue:[
   765         ^cls helpSpecClass
   769         ^cls helpSpecClass
   766     ].
   770     ].
   779     ].
   783     ].
   780     ^helpText
   784     ^helpText
   781 !
   785 !
   782 
   786 
   783 installHelpSpecOnClass:aClass
   787 installHelpSpecOnClass:aClass
   784     "save the help dicts in aClass which is subclass of ApplicationModel"
   788     "saves the help dicts in aClass which is subclass of ApplicationModel"
   785 
   789 
   786     |cls src helpSpec|
   790     |cls src helpSpec|
   787 
   791 
   788     cls := self getHelpSpecClassFromClass: aClass.
   792     cls := self getHelpSpecClassFromClass: aClass.
   789 
   793 
   865         forClass:cls class 
   869         forClass:cls class 
   866         inCategory:'help specs'.
   870         inCategory:'help specs'.
   867 !
   871 !
   868 
   872 
   869 installHelpSpecsOnClass:aClass
   873 installHelpSpecsOnClass:aClass
   870     "save the help dicts on aClass and its superclasses which are subclasses of ApplicationModel
   874     "saves the help dicts on aClass and its superclasses which are subclasses of ApplicationModel"
   871     "
   875 
   872     |cls helpSpecClasses|
   876     |cls helpSpecClasses|
   873 
   877 
   874     cls := self getHelpSpecClassFromClass:aClass.
   878     cls := self getHelpSpecClassFromClass:aClass.
   875     cls isNil ifTrue: [^self information:'No application class defined!!'].
   879     cls isNil ifTrue: [^self information:'No application class defined!!'].
   876 
   880 
   893     modified := false.
   897     modified := false.
   894 
   898 
   895 !
   899 !
   896 
   900 
   897 resourceMessage: aString
   901 resourceMessage: aString
   898     "extract from aString the specClass and the specSelector"
   902     "extracts from aString the specClass and the specSelector"
   899 
   903 
   900     (aString notNil and: [self askForModification]) 
   904     (aString notNil and: [self askForModification]) 
   901     ifTrue:
   905     ifTrue:
   902     [            
   906     [            
   903         |msg cls sel|
   907         |msg cls sel|
   914     ^false
   918     ^false
   915 
   919 
   916 !
   920 !
   917 
   921 
   918 updateList
   922 updateList
   919     "update the list channel from dictionary
   923     "updates the list channel from dictionary"
   920     "
   924 
   921     self listChannel value: dictionary keys asSortedCollection
   925     self listChannel value: dictionary keys asSortedCollection
   922 ! !
   926 ! !
   923 
   927 
   924 !UIHelpTool methodsFor:'selection'!
   928 !UIHelpTool methodsFor:'selection'!
   925 
   929 
   926 listSelection
   930 listSelection
   927     "returns current selection
   931     "returns current selection"
   928     "
   932 
   929     ^ listSelection
   933     ^ listSelection
   930 !
   934 !
   931 
   935 
   932 listSelection:aSelection
   936 listSelection:aSelection
   933     "current selection changed
   937     "sets current selection"
   934     "
   938 
   935     |txt view sel|
   939     |txt view sel|
   936 
   940 
   937     aSelection isNil 
   941     aSelection isNil 
   938         ifTrue: [(builder componentAt: #listOfHelpKeysView) selection: nil]
   942         ifTrue: [(builder componentAt: #listOfHelpKeysView) selection: nil]
   939         ifFalse: [(dictionary includesKey: aSelection asSymbol) ifFalse: [self findHelpSpecForKey: aSelection]].
   943         ifFalse: [(dictionary includesKey: aSelection asSymbol) ifFalse: [self findHelpSpecForKey: aSelection]].
   974 ! !
   978 ! !
   975 
   979 
   976 !UIHelpTool methodsFor:'startup / release'!
   980 !UIHelpTool methodsFor:'startup / release'!
   977 
   981 
   978 closeRequest
   982 closeRequest
   979     "before closing the help tool, ask for permission
   983     "asks for permission before closing"
   980     "
   984 
   981     (self masterApplication isNil and:[self askForModification]) ifTrue:[super closeRequest]
   985     (self masterApplication isNil and:[self askForModification]) ifTrue:[super closeRequest]
   982 !
   986 !
   983 
   987 
   984 initialize
   988 initialize
   985     "initialize instance variables
   989     "initializes instance variables"
   986     "
   990 
   987     super initialize.
   991     super initialize.
   988 
   992 
   989     specSelector := #helpSpec.
   993     specSelector := #helpSpec.
   990     dictionary   := Dictionary new.
   994     dictionary   := Dictionary new.
   991     dictionaries := Dictionary new.
   995     dictionaries := Dictionary new.
   992     modified   := false.
   996     modified   := false.
   993 
   997 
   994 !
   998 !
   995 
   999 
   996 loadFromMessage:aString
  1000 loadFromMessage:aString
   997     "load a spec from class and selector"
  1001     "loads a help spec by evaluating aString"
   998 
  1002 
   999     (aString notNil and: [self askForModification]) 
  1003     (aString notNil and: [self askForModification]) 
  1000     ifTrue:
  1004     ifTrue:
  1001     [            
  1005     [            
  1002         |msg cls sel|
  1006         |msg cls sel|
  1013     ^false
  1017     ^false
  1014 
  1018 
  1015 !
  1019 !
  1016 
  1020 
  1017 openInterface:aSymbol
  1021 openInterface:aSymbol
  1018     "do not open as stand alone
  1022     "do not open as stand alone"
  1019     "
  1023 
  1020 
  1024 
  1021    
  1025    
  1022 !
  1026 !
  1023 
  1027 
  1024 openOnClass:aClass
  1028 openOnClass:aClass
  1025     "open the UIHelpTool on aClass
  1029     "opens the UIHelpTool on aClass"
  1026     "
       
  1027 
  1030 
  1028     super openInterface: #windowSpecForStandAlone.
  1031     super openInterface: #windowSpecForStandAlone.
  1029     self masterApplication isNil ifTrue: [(builder componentAt: #RemoveButton) beInvisible].
  1032     self masterApplication isNil ifTrue: [(builder componentAt: #RemoveButton) beInvisible].
  1030     builder window label: 'Help Tool'.
  1033     builder window label: 'Help Tool'.
  1031     self buildFromClass: aClass
  1034     self buildFromClass: aClass
  1032 ! !
  1035 ! !
  1033 
  1036 
  1034 !UIHelpTool methodsFor:'user actions'!
  1037 !UIHelpTool methodsFor:'user actions'!
  1035 
  1038 
  1036 accept
  1039 accept
  1037     "accept the help text
  1040     "accepts the help text"
  1038     "
  1041 
  1039     |view key txt list listChgd|   
  1042     |view key txt list listChgd|   
  1040 
  1043 
  1041     (listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[
  1044     (listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[
  1042         txt    := view contents asString.
  1045         txt    := view contents asString.
  1043         key    := listSelection asSymbol.
  1046         key    := listSelection asSymbol.
  1057         modifiedHolder notNil ifTrue: [modifiedHolder value:true]
  1060         modifiedHolder notNil ifTrue: [modifiedHolder value:true]
  1058     ]
  1061     ]
  1059 !
  1062 !
  1060 
  1063 
  1061 doAdd
  1064 doAdd
  1062     "add help key
  1065     "adds a help key"
  1063     "
  1066 
  1064     |helpKey|
  1067     |helpKey|
  1065     (helpKey := (builder componentAt: #helpKeyInputField asSymbol) contents) size > 0
  1068     (helpKey := (builder componentAt: #helpKeyInputField asSymbol) contents) size > 0
  1066     ifTrue:
  1069     ifTrue:
  1067     [
  1070     [
  1068         self listModel value: helpKey.
  1071         self listModel value: helpKey.
  1073         self warn: 'First define a help key!!'
  1076         self warn: 'First define a help key!!'
  1074     ]
  1077     ]
  1075 !
  1078 !
  1076 
  1079 
  1077 doDelete
  1080 doDelete
  1078     "delete selected help key
  1081     "deletes the selected help key"
  1079     "    
  1082 
  1080     listSelection notNil
  1083     listSelection notNil
  1081     ifTrue:
  1084     ifTrue:
  1082     [
  1085     [
  1083         dictionary removeKey: listSelection asSymbol ifAbsent: nil.
  1086         dictionary removeKey: listSelection asSymbol ifAbsent: nil.
  1084         self doRemove.
  1087         self doRemove.
  1091         self warn: 'First select a help key!!'
  1094         self warn: 'First select a help key!!'
  1092     ]
  1095     ]
  1093 !
  1096 !
  1094 
  1097 
  1095 doLoad
  1098 doLoad
  1096     "open a Resource Selection Browser in order to get a resource message"
  1099     "opens a Resource Selection Browser in order to get a resource message"
  1097 
  1100 
  1098     self loadFromMessage: 
  1101     self loadFromMessage: 
  1099         (ResourceSelectionBrowser
  1102         (ResourceSelectionBrowser
  1100             request: 'Load ', self class resourceType asUppercaseFirst, ' Spec From Class'
  1103             request: 'Load Help Spec From Class'
  1101             onSuperclass: nil
  1104             onSuperclass: nil
  1102             andClass: specClass
  1105             andClass: specClass
  1103             andSelector: specSelector ? self class resourceType
  1106             andSelector: specSelector ? #help
  1104             withResourceTypes: (Array with: self class resourceType))
  1107             withResourceTypes: (Array with: #help)).
       
  1108 
       
  1109     self updateInfoLabel
  1105 
  1110 
  1106 !
  1111 !
  1107 
  1112 
  1108 doNew
  1113 doNew
  1109     "reset the help tool
  1114     "resets the help tool"
  1110     "
  1115 
  1111     specClass := listSelection := nil.
  1116     specClass := listSelection := nil.
  1112     self dictionary: nil.
  1117     self dictionary: nil.
  1113     self dictionaries: nil.
  1118     self dictionaries: nil.
  1114     self listOfHelpSpecClasses removeAll.
  1119     self listOfHelpSpecClasses removeAll.
  1115     modified := false.
  1120     modified := false.
  1116 !
  1121 !
  1117 
  1122 
  1118 doReload
  1123 doReload
  1119     "reload the help dictionaries
  1124     "reloads the help dictionaries"
  1120     "
  1125 
  1121     |oldSel model|
  1126     |oldSel model|
  1122 
  1127 
  1123     model  := self listModel.
  1128     model  := self listModel.
  1124     oldSel := model value.
  1129     oldSel := model value.
  1125     model value:nil.
  1130     model value:nil.
  1128     modified := false.
  1133     modified := false.
  1129 
  1134 
  1130 !
  1135 !
  1131 
  1136 
  1132 doRemove
  1137 doRemove
  1133     "remove selected help key
  1138     "removes the selected help key"
  1134     "
  1139 
  1135     listSelection notNil
  1140     listSelection notNil
  1136     ifTrue:
  1141     ifTrue:
  1137     [
  1142     [
  1138         self listModel value: nil.
  1143         self listModel value: nil.
  1139         self updateList.
  1144         self updateList.
  1144         self warn: 'First select a help key!!'
  1149         self warn: 'First select a help key!!'
  1145     ]
  1150     ]
  1146 !
  1151 !
  1147 
  1152 
  1148 doSave
  1153 doSave
  1149     "save the help dictionaries
  1154     "saves the help dictionaries on specClass"
  1150     "
  1155 
  1151     self installHelpSpecsOnClass:specClass
  1156     self installHelpSpecsOnClass:specClass
  1152 ! !
  1157 ! !
  1153 
  1158 
  1154 !UIHelpTool class methodsFor:'documentation'!
  1159 !UIHelpTool class methodsFor:'documentation'!
  1155 
  1160