695 |
695 |
696 buildFromClass:aClass |
696 buildFromClass:aClass |
697 "reads the help dictionary from aClass and find remaining classes |
697 "reads the help dictionary from aClass and find remaining classes |
698 'between' aClass and ApplicationModel |
698 'between' aClass and ApplicationModel |
699 " |
699 " |
700 |lastContents root list resource| |
700 |lastContents root list resource helpSpecSelector| |
701 |
701 |
702 specSelector isNil ifTrue:[ specSelector := #helpSpec ]. |
702 helpSpecSelector := self specSelector. |
703 specClass := self getHelpSpecClassFromClass:aClass. |
703 specClass := self getHelpSpecClassFromClass:aClass. |
704 |
704 |
705 list := OrderedCollection new. |
705 list := OrderedCollection new. |
706 |
706 |
707 (specClass isClass and:[specClass isLoaded]) ifTrue:[ |
707 (specClass isClass and:[specClass isLoaded]) ifTrue:[ |
708 lastContents := nil. |
708 lastContents := nil. |
709 resource := specClass name, ' ', specSelector. |
709 resource := specClass name, ' ', helpSpecSelector. |
710 self addToHistory:(Association key:resource value:#'loadFromMessage:'). |
710 self addToHistory:(Association key:resource value:#'loadFromMessage:'). |
711 |
711 |
712 specClass withAllSuperclasses reverse do:[:aClass| |value name| |
712 specClass withAllSuperclasses reverse do:[:aClass| |value name| |
713 lastContents isNil ifTrue:[ |
713 lastContents isNil ifTrue:[ |
714 aClass == ApplicationModel ifTrue:[ |
714 aClass == ApplicationModel ifTrue:[ |
715 lastContents := IdentityDictionary new |
715 lastContents := IdentityDictionary new |
716 ]. |
716 ]. |
717 ] ifFalse:[ |
717 ] ifFalse:[ |
718 root := ClassItem onClass:aClass. |
718 root := ClassItem onClass:aClass. |
719 |
719 |
720 (aClass class includesSelector:specSelector) ifTrue:[ |
720 (aClass class includesSelector:helpSpecSelector) ifTrue:[ |
721 value := aClass perform:specSelector. |
721 value := aClass perform:helpSpecSelector. |
722 |
722 |
723 value keysAndValuesDo:[:k :v| |cval| |
723 value keysAndValuesDo:[:k :v| |cval| |
724 cval := lastContents at:k ifAbsent:self. |
724 cval := lastContents at:k ifAbsent:self. |
725 cval = v ifFalse:[ root add:(KeyItem helpKey:k helpText:v) ]. |
725 cval = v ifFalse:[ root add:(KeyItem helpKey:k helpText:v) ]. |
726 ]. |
726 ]. |
1121 |
1121 |
1122 doLoad |
1122 doLoad |
1123 "opens a Resource Selection Browser in order to get a resource message |
1123 "opens a Resource Selection Browser in order to get a resource message |
1124 " |
1124 " |
1125 self loadFromMessage: |
1125 self loadFromMessage: |
1126 (ResourceSelectionBrowser |
1126 (ResourceSelectionBrowser |
1127 request: 'Load Help Spec From Class' |
1127 request: 'Load Help Spec From Class' |
1128 onSuperclass: nil |
1128 onSuperclass: nil |
1129 andClass: specClass |
1129 andClass: specClass |
1130 andSelector: specSelector ? #help |
1130 andSelector: (self specSelector) |
1131 withResourceTypes: (Array with: #help)). |
1131 withResourceTypes: (Array with: #help)). |
1132 |
1132 |
1133 self updateInfoLabel |
1133 self updateInfoLabel |
1134 ! |
1134 ! |
1135 |
1135 |
1136 doNew |
1136 doNew |
1151 (specClass isSubclassOf:ApplicationModel) ifFalse:[ |
1151 (specClass isSubclassOf:ApplicationModel) ifFalse:[ |
1152 self information:(resources string:'Cannot save help into none Application class'). |
1152 self information:(resources string:'Cannot save help into none Application class'). |
1153 ^ nil |
1153 ^ nil |
1154 ]. |
1154 ]. |
1155 |
1155 |
1156 classItemList do:[:aClassItem| aClassItem createHelpMethodNamed:specSelector ]. |
1156 classItemList do:[:aClassItem| |
|
1157 aClassItem createHelpMethodNamed:(self specSelector) |
|
1158 ]. |
1157 ! |
1159 ! |
1158 |
1160 |
1159 openDocumentation |
1161 openDocumentation |
1160 "opens the documentation file of the Help Tool |
1162 "opens the documentation file of the Help Tool |
1161 " |
1163 " |
1380 " |
1382 " |
1381 ^ helpText |
1383 ^ helpText |
1382 ! |
1384 ! |
1383 |
1385 |
1384 helpText:aText |
1386 helpText:aText |
1385 "set the contents assigned to the helpKey; if the cxontents changed, |
1387 "set the contents assigned to the helpKey; if the contents changes, |
1386 a notification is raised. |
1388 a notification is raised. |
1387 " |
1389 " |
1388 |text| |
1390 |text| |
1389 |
1391 |
1390 text := self formatText:aText. |
1392 text := self formatText:aText. |
1391 |
1393 |
1392 text ~= helpText ifTrue:[ |
1394 text ~= helpText ifTrue:[ |
1393 helpText := text. |
1395 helpText := text. |
1394 |
1396 |
1395 (modified or:[parent isNil]) ifFalse:[ |
1397 (modified or:[parent isNil]) ifFalse:[ |
1396 parent helpTextChangedFor:self. |
1398 parent helpTextChangedFor:self. |
1397 ] |
1399 ] |
1398 ]. |
1400 ]. |
1399 ! ! |
1401 ! ! |
1400 |
1402 |
1401 !UIHelpTool::KeyItem methodsFor:'displaying'! |
1403 !UIHelpTool::KeyItem methodsFor:'displaying'! |
1402 |
1404 |