79 UIHelpTool openOnClass:UIHelpTool |
79 UIHelpTool openOnClass:UIHelpTool |
80 " |
80 " |
81 |
81 |
82 ^ super helpSpec addPairsFrom:#( |
82 ^ super helpSpec addPairsFrom:#( |
83 |
83 |
84 #activeHelpAccessKey |
84 #addHelpTextKey |
85 'This ID is used to access an active help text for the selected component' |
85 'Adds help text key.' |
|
86 |
|
87 #currentHelpTexts |
|
88 'Selected help text key.' |
|
89 |
|
90 #deleteHelpTextKey |
|
91 'Deletes the help text from the help spec.' |
|
92 |
|
93 #helpTextView |
|
94 'Shows the help text.' |
|
95 |
|
96 #listOfHelpSpecClasses |
|
97 'List of the classes where help specs can be/are implemented.' |
|
98 |
|
99 #listOfHelpTexts |
|
100 'List of the help text keys.' |
|
101 |
|
102 #removeHelpTextKey |
|
103 'Removes the help text key from the widget.' |
86 |
104 |
87 ) |
105 ) |
88 ! ! |
106 ! ! |
89 |
107 |
90 !UIHelpTool class methodsFor:'interface specs'! |
108 !UIHelpTool class methodsFor:'interface specs'! |
91 |
109 |
92 keyMenu |
110 windowSpec |
|
111 "this window spec was automatically generated by the ST/X UIPainter" |
|
112 |
|
113 "do not manually edit this - the painter/builder may not be able to |
|
114 handle the specification if its corrupted." |
|
115 |
|
116 " |
|
117 UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec |
|
118 UIHelpTool new openInterface:#windowSpec |
|
119 " |
|
120 "UIHelpTool open" |
|
121 |
|
122 <resource: #canvas> |
|
123 |
|
124 ^ |
|
125 |
|
126 #(#FullSpec |
|
127 #window: |
|
128 #(#WindowSpec |
|
129 #name: 'HelpTool' |
|
130 #layout: #(#LayoutFrame 59 0 376 0 344 0 646 0) |
|
131 #label: 'unnamed canvas' |
|
132 #min: #(#Point 10 10) |
|
133 #max: #(#Point 1160 870) |
|
134 #bounds: #(#Rectangle 59 376 345 647) |
|
135 #usePreferredExtent: false |
|
136 ) |
|
137 #component: |
|
138 #(#SpecCollection |
|
139 #collection: |
|
140 #( |
|
141 #(#SequenceViewSpec |
|
142 #name: 'listOfHelpKeysView' |
|
143 #layout: #(#LayoutFrame 3 0 2 0 -1 0.5 -1 0.5) |
|
144 #activeHelpKey: #listOfHelpTexts |
|
145 #tabable: true |
|
146 #model: #listModel |
|
147 #hasHorizontalScrollBar: true |
|
148 #hasVerticalScrollBar: true |
|
149 #useIndex: false |
|
150 #sequenceList: #listChannel |
|
151 ) |
|
152 #(#HorizontalPanelViewSpec |
|
153 #name: 'HorizontalPanelView' |
|
154 #layout: #(#LayoutFrame 1 0.5 2 0 -3 1 26 0) |
|
155 #component: |
|
156 #(#SpecCollection |
|
157 #collection: |
|
158 #( |
|
159 #(#ActionButtonSpec |
|
160 #name: 'AddButton' |
|
161 #activeHelpKey: #addHelpTextKey |
|
162 #label: 'Add' |
|
163 #model: #accept |
|
164 #extent: #(#Point 44 24) |
|
165 ) |
|
166 #(#ActionButtonSpec |
|
167 #name: 'RemoveButton' |
|
168 #activeHelpKey: #removeHelpTextKey |
|
169 #label: 'Remove' |
|
170 #model: #remove |
|
171 #extent: #(#Point 44 24) |
|
172 ) |
|
173 #(#ActionButtonSpec |
|
174 #name: 'DeleteButton' |
|
175 #activeHelpKey: #deleteHelpTextKey |
|
176 #label: 'Delete' |
|
177 #model: #delete |
|
178 #extent: #(#Point 45 24) |
|
179 ) |
|
180 ) |
|
181 ) |
|
182 #horizontalLayout: #fit |
|
183 #verticalLayout: #fit |
|
184 #horizontalSpace: 3 |
|
185 #verticalSpace: 3 |
|
186 ) |
|
187 #(#InputFieldSpec |
|
188 #name: 'helpKeyInputField' |
|
189 #layout: #(#LayoutFrame 1 0.5 29 0 -3 1 51 0) |
|
190 #activeHelpKey: #currentHelpTexts |
|
191 #model: #listModel |
|
192 ) |
|
193 #(#SequenceViewSpec |
|
194 #name: 'listOfHelpSpecClassesView' |
|
195 #layout: #(#LayoutFrame 1 0.5 53 0 -3 1 -1 0.5) |
|
196 #activeHelpKey: #listOfHelpSpecClasses |
|
197 #model: #selectionOfHelpSpecClass |
|
198 #hasHorizontalScrollBar: true |
|
199 #hasVerticalScrollBar: true |
|
200 #valueChangeSelector: #helpSpecClassSelected |
|
201 #useIndex: false |
|
202 #sequenceList: #listOfHelpSpecClasses |
|
203 ) |
|
204 #(#TextEditorSpec |
|
205 #name: 'helpTextView' |
|
206 #layout: #(#LayoutFrame 3 0.0 1 0.5 -1 1.0 -3 1.0) |
|
207 #activeHelpKey: #helpTextView |
|
208 #hasHorizontalScrollBar: true |
|
209 #hasVerticalScrollBar: true |
|
210 #miniScrollerHorizontal: true |
|
211 #miniScrollerVertical: true |
|
212 ) |
|
213 ) |
|
214 ) |
|
215 ) |
|
216 ! |
|
217 |
|
218 windowSpecForStandAlone |
|
219 "this window spec was automatically generated by the ST/X UIPainter" |
|
220 |
|
221 "do not manually edit this - the painter/builder may not be able to |
|
222 handle the specification if its corrupted." |
|
223 |
|
224 " |
|
225 UIPainter new openOnClass:UIHelpTool andSelector:#windowSpecForStandAlone |
|
226 UIHelpTool new openInterface:#windowSpecForStandAlone |
|
227 " |
|
228 |
|
229 <resource: #canvas> |
|
230 |
|
231 ^ |
|
232 |
|
233 #(#FullSpec |
|
234 #window: |
|
235 #(#WindowSpec |
|
236 #name: 'Help Tool' |
|
237 #layout: #(#LayoutFrame 195 0 352 0 694 0 751 0) |
|
238 #label: 'Help Tool' |
|
239 #min: #(#Point 10 10) |
|
240 #max: #(#Point 1160 870) |
|
241 #bounds: #(#Rectangle 195 352 695 752) |
|
242 #menu: #menu |
|
243 #usePreferredExtent: false |
|
244 ) |
|
245 #component: |
|
246 #(#SpecCollection |
|
247 #collection: |
|
248 #( |
|
249 #(#UISubSpecification |
|
250 #name: 'UISubSpecification1' |
|
251 #layout: #(#LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0) |
|
252 #minorKey: #windowSpec |
|
253 ) |
|
254 ) |
|
255 ) |
|
256 ) |
|
257 ! ! |
|
258 |
|
259 !UIHelpTool class methodsFor:'menu specs'! |
|
260 |
|
261 menu |
93 "this window spec was automatically generated by the ST/X MenuEditor" |
262 "this window spec was automatically generated by the ST/X MenuEditor" |
94 |
263 |
95 "do not manually edit this - the builder may not be able to |
264 "do not manually edit this - the builder may not be able to |
96 handle the specification if its corrupted." |
265 handle the specification if its corrupted." |
97 |
266 |
98 " |
267 " |
99 MenuEditor new openOnClass:UIHelpTool andSelector:#keyMenu |
268 MenuEditor new openOnClass:UIHelpTool andSelector:#menu |
100 (Menu new fromLiteralArrayEncoding:(UIHelpTool keyMenu)) startUp |
269 (Menu new fromLiteralArrayEncoding:(UIHelpTool menu)) startUp |
101 " |
270 " |
102 |
271 |
103 <resource: #menu> |
272 <resource: #menu> |
104 |
273 |
105 ^ |
274 ^ |
106 |
275 |
107 #(#Menu |
276 #(#Menu |
108 |
277 |
109 #( |
278 #( |
110 #(#MenuItem |
279 #(#MenuItem |
111 #'label:' 'save as ...' |
280 #label: 'File' |
112 #'value:' #saveAs |
281 #submenu: |
113 ) |
|
114 #(#MenuItem |
|
115 #'label:' '-' |
|
116 ) |
|
117 #(#MenuItem |
|
118 #'label:' 'remove' |
|
119 #'value:' #removeKey |
|
120 ) |
|
121 ) nil |
|
122 nil |
|
123 ) |
|
124 |
|
125 "Created: / 27.10.1997 / 00:55:20 / cg" |
|
126 ! |
|
127 |
|
128 menuPanelStandAlone |
|
129 "this window spec was automatically generated by the ST/X MenuEditor" |
|
130 |
|
131 "do not manually edit this - the builder may not be able to |
|
132 handle the specification if its corrupted." |
|
133 |
|
134 " |
|
135 MenuEditor new openOnClass:UIHelpTool andSelector:#menuPanelStandAlone |
|
136 (Menu new fromLiteralArrayEncoding:(UIHelpTool menuPanelStandAlone)) startUp |
|
137 " |
|
138 |
|
139 <resource: #menu> |
|
140 |
|
141 ^ |
|
142 |
|
143 #(#Menu |
|
144 |
|
145 #( |
|
146 #(#MenuItem |
|
147 #'label:' 'file' |
|
148 #'submenu:' |
|
149 #(#Menu |
282 #(#Menu |
150 |
283 |
151 #( |
284 #( |
152 #(#MenuItem |
285 #(#MenuItem |
153 #'label:' 'reload' |
286 #label: 'Reload' |
154 #'value:' #doReload |
287 #value: #doReload |
155 ) |
288 ) |
156 #(#MenuItem |
289 #(#MenuItem |
157 #'label:' '-' |
290 #label: '-' |
158 ) |
291 ) |
159 #(#MenuItem |
292 #(#MenuItem |
160 #'label:' 'quit' |
293 #label: 'Save' |
161 #'value:' #closeRequest |
294 #value: #doInstallHelpSpec |
162 ) |
|
163 ) nil |
|
164 nil |
|
165 ) |
|
166 ) |
|
167 #(#MenuItem |
|
168 #'label:' 'code' |
|
169 #'submenu:' |
|
170 #(#Menu |
|
171 |
|
172 #( |
|
173 #(#MenuItem |
|
174 #'label:' 'class' |
|
175 #'value:' #doFromClass |
|
176 ) |
295 ) |
177 #(#MenuItem |
296 #(#MenuItem |
178 #'label:' '-' |
297 #label: '-' |
179 ) |
298 ) |
180 #(#MenuItem |
299 #(#MenuItem |
181 #'label:' 'install help spec.' |
300 #label: 'Define Class...' |
182 #'value:' #doInstallHelpSpec |
301 #value: #doFromClass |
|
302 ) |
|
303 #(#MenuItem |
|
304 #label: '-' |
|
305 ) |
|
306 #(#MenuItem |
|
307 #label: 'Exit' |
|
308 #value: #closeRequest |
183 ) |
309 ) |
184 ) nil |
310 ) nil |
185 nil |
311 nil |
186 ) |
312 ) |
187 ) |
313 ) |
188 ) nil |
314 ) nil |
189 nil |
315 nil |
190 ) |
316 ) |
191 ! |
|
192 |
|
193 standAloneSpec |
|
194 "this window spec was automatically generated by the ST/X UIPainter" |
|
195 |
|
196 "do not manually edit this - the painter/builder may not be able to |
|
197 handle the specification if its corrupted." |
|
198 |
|
199 " |
|
200 UIPainter new openOnClass:UIHelpTool andSelector:#standAloneSpec |
|
201 UIHelpTool new openInterface:#standAloneSpec |
|
202 " |
|
203 |
|
204 <resource: #canvas> |
|
205 |
|
206 ^ |
|
207 |
|
208 #(#FullSpec |
|
209 #'window:' |
|
210 #(#WindowSpec |
|
211 #'name:' 'HelpTool' |
|
212 #'layout:' #(#LayoutFrame 219 0 193 0 814 0 690 0) |
|
213 #'label:' 'HelpTool' |
|
214 #'min:' #(#Point 10 10) |
|
215 #'max:' #(#Point 1160 870) |
|
216 #'bounds:' #(#Rectangle 219 193 815 691) |
|
217 #'usePreferredExtent:' false |
|
218 ) |
|
219 #'component:' |
|
220 #(#SpecCollection |
|
221 #'collection:' |
|
222 #( |
|
223 #(#MenuPanelSpec |
|
224 #'name:' 'menuPanelStandAlone' |
|
225 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 25 0) |
|
226 #'menu:' #menuPanelStandAlone |
|
227 ) |
|
228 #(#VariableHorizontalPanelSpec |
|
229 #'name:' 'variableHorizontalPanel1' |
|
230 #'layout:' #(#LayoutFrame 0 0.0 25 0.0 0 1.0 0 1.0) |
|
231 #'component:' |
|
232 #(#SpecCollection |
|
233 #'collection:' |
|
234 #( |
|
235 #(#TextEditorSpec |
|
236 #'name:' 'textView' |
|
237 #'hasHorizontalScrollBar:' true |
|
238 #'hasVerticalScrollBar:' true |
|
239 #'miniScrollerHorizontal:' true |
|
240 #'miniScrollerVertical:' true |
|
241 ) |
|
242 #(#SequenceViewSpec |
|
243 #'name:' 'selectionList' |
|
244 #'model:' #listModel |
|
245 #'menu:' #keyMenu |
|
246 #'hasHorizontalScrollBar:' true |
|
247 #'hasVerticalScrollBar:' true |
|
248 #'miniScrollerHorizontal:' true |
|
249 #'miniScrollerVertical:' true |
|
250 #'useIndex:' false |
|
251 #'sequenceList:' #listChannel |
|
252 ) |
|
253 ) |
|
254 ) |
|
255 #'handles:' #(#Any 0.647651 1.0) |
|
256 ) |
|
257 ) |
|
258 ) |
|
259 ) |
|
260 ! |
|
261 |
|
262 windowSpec |
|
263 "this window spec was automatically generated by the ST/X UIPainter" |
|
264 |
|
265 "do not manually edit this - the painter/builder may not be able to |
|
266 handle the specification if its corrupted." |
|
267 |
|
268 " |
|
269 UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec |
|
270 UIHelpTool new openInterface:#windowSpec |
|
271 " |
|
272 "UIHelpTool open" |
|
273 |
|
274 <resource: #canvas> |
|
275 |
|
276 ^ |
|
277 |
|
278 #(#FullSpec |
|
279 #'window:' |
|
280 #(#WindowSpec |
|
281 #'name:' 'HelpTool' |
|
282 #'layout:' #(#LayoutFrame 199 0 167 0 484 0 437 0) |
|
283 #'label:' 'unnamed canvas' |
|
284 #'min:' #(#Point 10 10) |
|
285 #'max:' #(#Point 1160 870) |
|
286 #'bounds:' #(#Rectangle 199 167 485 438) |
|
287 ) |
|
288 #'component:' |
|
289 #(#SpecCollection |
|
290 #'collection:' |
|
291 #( |
|
292 #(#LabelSpec |
|
293 #'name:' 'keyLabel' |
|
294 #'layout:' #(#AlignmentOrigin 3 0.0 42 0.0 0 1) |
|
295 #'label:' 'Key:' |
|
296 #'adjust:' #left |
|
297 #'resizeForLabel:' true |
|
298 ) |
|
299 #(#ComboBoxSpec |
|
300 #'name:' 'comboBox' |
|
301 #'layout:' #(#LayoutFrame 48 0 22 0 -3 1.0 44 0) |
|
302 #'activeHelpKey:' #activeHelpAccessKey |
|
303 #'tabable:' true |
|
304 #'model:' #listModel |
|
305 #'type:' #symbolOrNil |
|
306 #'comboList:' #listChannel |
|
307 ) |
|
308 #(#TextEditorSpec |
|
309 #'name:' 'textView' |
|
310 #'layout:' #(#LayoutFrame 3 0.0 45 0.0 -3 1.0 -3 1.0) |
|
311 #'hasHorizontalScrollBar:' true |
|
312 #'hasVerticalScrollBar:' true |
|
313 #'miniScrollerHorizontal:' true |
|
314 #'miniScrollerVertical:' true |
|
315 ) |
|
316 ) |
|
317 ) |
|
318 ) |
|
319 ! ! |
317 ! ! |
320 |
318 |
321 !UIHelpTool methodsFor:'accessing'! |
319 !UIHelpTool methodsFor:'accessing'! |
322 |
320 |
323 dictionary |
321 dictionary |
387 ] |
396 ] |
388 ] |
397 ] |
389 ] |
398 ] |
390 |
399 |
391 |
400 |
392 ! |
|
393 |
|
394 updateList |
|
395 "update list from dictionary |
|
396 " |
|
397 self listChannel value:(dictionary keys asSortedCollection) |
|
398 ! ! |
|
399 |
|
400 !UIHelpTool methodsFor:'accessing menu'! |
|
401 |
|
402 keyMenu |
|
403 "this window spec was automatically generated by the UI Builder" |
|
404 |
|
405 ^ self class keyMenu |
|
406 |
|
407 "Created: / 27.10.1997 / 00:55:20 / cg" |
|
408 ! ! |
401 ! ! |
409 |
402 |
410 !UIHelpTool methodsFor:'actions'! |
403 !UIHelpTool methodsFor:'actions'! |
411 |
404 |
412 accept |
405 accept |
413 "accept the text |
406 "accept the text |
414 " |
407 " |
415 |view key txt list listChgd| |
408 |view key txt list listChgd| |
416 |
409 |
417 (listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[ |
410 (listSelection size == 0 or:[(view := self editTextView) isNil]) ifFalse:[ |
418 txt := view contents asString. |
411 txt := view contents asString. |
419 key := listSelection asSymbol. |
412 key := listSelection asSymbol. |
420 list := self listChannel value. |
413 list := self listChannel value. |
421 |
414 |
422 (listChgd := (dictionary at:key ifAbsent:nil) isNil) ifTrue:[ |
415 (listChgd := (dictionary at:key ifAbsent:nil) isNil) ifTrue:[ |
423 list add:key. |
416 list add:key. |
424 ]. |
417 ]. |
425 dictionary at:key put:txt. |
418 dictionary at:key put:txt. |
|
419 |
|
420 listChgd ifTrue:[ |
|
421 self updateList. |
|
422 (builder componentAt: #listOfHelpKeysView) selection: (list indexOf: key). |
|
423 ]. |
|
424 |
426 isModified := true. |
425 isModified := true. |
427 |
|
428 listChgd ifTrue:[ |
|
429 self updateList |
|
430 ]. |
|
431 modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
426 modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
432 ] |
427 ] |
433 ! |
428 ! |
434 |
429 |
|
430 delete |
|
431 "delete selected help key |
|
432 " |
|
433 listSelection notNil |
|
434 ifTrue: |
|
435 [ |
|
436 dictionary removeKey: listSelection asSymbol ifAbsent: nil. |
|
437 self remove. |
|
438 |
|
439 self updateList. |
|
440 |
|
441 isModified := true. |
|
442 modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
|
443 ] |
|
444 ! |
|
445 |
|
446 helpSpecClassSelected |
|
447 |
|
448 |clsName| |
|
449 clsName := self selectionOfHelpSpecClass value. |
|
450 (dictionary := dictionaries at: clsName ifAbsent: nil) isNil |
|
451 ifTrue: |
|
452 [ |
|
453 dictionary := dictionaries at: clsName put: (self extractHelpSpecForClass: (Smalltalk at: clsName)) |
|
454 ]. |
|
455 |
|
456 self updateList. |
|
457 listSelection notNil |
|
458 ifTrue: [(dictionary keys includes: listSelection asSymbol) |
|
459 ifTrue: [(builder componentAt: #listOfHelpKeysView) selection: |
|
460 (self listChannel value indexOf: (builder componentAt: #helpKeyInputField) contents)] |
|
461 ifFalse: [(builder componentAt: #listOfHelpKeysView) selection: nil]]. |
|
462 self editTextView contents: '' |
|
463 ! |
|
464 |
435 installHelpSpecInto:aClass |
465 installHelpSpecInto:aClass |
436 "install help text |
466 "install help text |
437 " |
467 " |
438 |cls src superHelpSpecKeys helpSpec| |
468 |cls src superHelpSpecKeys helpSpec mayRemoveHelpSpecSelector| |
439 |
469 |
440 cls := self applicationClassAssociatedWith:aClass. |
470 cls := self applicationClassAssociatedWith:aClass. |
441 |
471 |
442 cls isNil ifTrue:[ |
472 cls isNil ifTrue:[ |
443 ^ self information:'No application class defined!!'. |
473 ^ self information:'No application class defined!!'. |
444 ]. |
474 ]. |
|
475 |
|
476 aClass == cls name |
|
477 ifTrue: [cls allSuperclasses value do: [:c| self installHelpSpecInto:c]. isModified := true]. |
|
478 |
445 isModified not ifTrue:[ |
479 isModified not ifTrue:[ |
446 ^nil |
480 ^nil |
447 ]. |
481 ]. |
448 |
482 |
449 superHelpSpecKeys := cls superclass helpSpec keys. |
483 (cls superclass respondsTo: #helpSpec) |
450 |
484 ifTrue: [superHelpSpecKeys := cls superclass helpSpec keys. mayRemoveHelpSpecSelector := true] |
451 helpSpec := IdentityDictionary new. |
485 ifFalse: [superHelpSpecKeys := IdentityDictionary new. mayRemoveHelpSpecSelector := false]. |
452 dictionary associationsDo: |
486 |
453 [:asso| |
487 helpSpec := dictionaries at: cls name ifAbsent: [^nil]. |
454 (superHelpSpecKeys includes: asso key) ifFalse: [helpSpec at: asso key put: asso value] |
|
455 ]. |
|
456 helpSpec isEmpty ifTrue:[ |
488 helpSpec isEmpty ifTrue:[ |
|
489 mayRemoveHelpSpecSelector ifTrue: [cls class removeSelector: #helpSpec]. |
457 ^nil |
490 ^nil |
458 ]. |
491 ]. |
459 |
492 |
460 src := '' writeStream. |
493 src := '' writeStream. |
461 |
494 |
493 forClass:cls class |
526 forClass:cls class |
494 inCategory:'help specs'. |
527 inCategory:'help specs'. |
495 |
528 |
496 isModified := false. |
529 isModified := false. |
497 |
530 |
|
531 ! |
|
532 |
|
533 remove |
|
534 "remove selected help key |
|
535 " |
|
536 |
|
537 self listModel value: nil. |
|
538 |
|
539 self updateList. |
|
540 |
|
541 modifiedHolder notNil ifTrue: [modifiedHolder value:true] |
498 ! ! |
542 ! ! |
499 |
543 |
500 !UIHelpTool methodsFor:'aspects'! |
544 !UIHelpTool methodsFor:'aspects'! |
501 |
545 |
502 listChannel |
546 listChannel |
503 "automatically generated by UIPainter ..." |
|
504 |
547 |
505 |holder| |
548 |holder| |
506 |
549 |
507 (holder := builder bindingAt:#listChannel) isNil ifTrue:[ |
550 (holder := builder bindingAt:#listChannel) isNil ifTrue:[ |
508 builder aspectAt:#listChannel put:(holder := OrderedCollection new asValue). |
551 builder aspectAt:#listChannel put:(holder := OrderedCollection new asValue). |
509 ]. |
552 ]. |
510 ^ holder |
553 ^ holder |
511 |
|
512 "Modified: / 27.10.1997 / 01:50:33 / cg" |
|
513 ! |
554 ! |
514 |
555 |
515 listModel |
556 listModel |
516 "automatically generated by UIPainter ..." |
|
517 |
557 |
518 |holder| |
558 |holder| |
519 |
559 |
520 (holder := builder bindingAt:#listModel) isNil ifTrue:[ |
560 (holder := builder bindingAt:#listModel) isNil ifTrue:[ |
521 holder := AspectAdaptor new subject:self; forAspect:#listSelection. |
561 holder := AspectAdaptor new subject:self; forAspect:#listSelection. |
522 builder aspectAt:#listModel put:holder. |
562 builder aspectAt:#listModel put:holder. |
523 ]. |
563 ]. |
524 ^ holder |
564 ^ holder |
|
565 ! |
|
566 |
|
567 listOfHelpSpecClasses |
|
568 |
|
569 |holder| |
|
570 (holder := builder bindingAt:#listOfHelpSpecClasses) isNil ifTrue:[ |
|
571 builder aspectAt:#listOfHelpSpecClasses put: (holder := List new) |
|
572 ]. |
|
573 ^ holder |
|
574 |
|
575 ! |
|
576 |
|
577 selectionOfHelpSpecClass |
|
578 |
|
579 |holder| |
|
580 (holder := builder bindingAt:#selectionOfHelpSpecClass) isNil ifTrue:[ |
|
581 builder aspectAt:#selectionOfHelpSpecClass put: (holder := ValueHolder new) |
|
582 ]. |
|
583 ^ holder |
|
584 |
525 ! ! |
585 ! ! |
526 |
586 |
527 !UIHelpTool methodsFor:'initialization'! |
587 !UIHelpTool methodsFor:'initialization'! |
528 |
588 |
529 initialize |
589 initialize |
530 "setup instance attributes |
590 "setup instance attributes |
531 " |
591 " |
532 super initialize. |
592 super initialize. |
533 dictionary := IdentityDictionary new. |
593 dictionary := IdentityDictionary new. |
|
594 dictionaries := IdentityDictionary new. |
534 isModified := false. |
595 isModified := false. |
535 |
596 |
536 ! ! |
|
537 |
|
538 !UIHelpTool methodsFor:'menu actions'! |
|
539 |
|
540 removeKey |
|
541 |k sym| |
|
542 |
|
543 k := Dialog request:'name of key to remove:' initialAnswer:listSelection. |
|
544 k size > 0 ifTrue:[ |
|
545 ((dictionary includesKey:k) |
|
546 or:[(sym := k asSymbolIfInterned) notNil |
|
547 and:[dictionary includesKey:sym]]) |
|
548 ifFalse:[ |
|
549 ^ self warn:'key is not present.'. |
|
550 ]. |
|
551 sym notNil ifTrue:[ |
|
552 dictionary removeKey:sym ifAbsent:nil. |
|
553 ]. |
|
554 dictionary removeKey:k ifAbsent:nil. |
|
555 isModified := true. |
|
556 self updateList |
|
557 ]. |
|
558 |
|
559 "Created: / 27.10.1997 / 01:48:48 / cg" |
|
560 "Modified: / 27.10.1997 / 02:25:30 / cg" |
|
561 ! |
|
562 |
|
563 saveAs |
|
564 |key new| |
|
565 |
|
566 key := Dialog request:'save under key:' initialAnswer:(listSelection ? ''). |
|
567 key := key withoutSeparators. |
|
568 |
|
569 key size ~~ 0 ifTrue:[ |
|
570 key := key asSymbol. |
|
571 new := (dictionary at:key ifAbsent:nil) isNil. |
|
572 |
|
573 dictionary at:key put:(self editTextView contents asString). |
|
574 |
|
575 new ifTrue:[ |
|
576 self updateList |
|
577 ]. |
|
578 isModified := true. |
|
579 self listModel value:key. |
|
580 ]. |
|
581 ! ! |
597 ! ! |
582 |
598 |
583 !UIHelpTool methodsFor:'private'! |
599 !UIHelpTool methodsFor:'private'! |
584 |
600 |
585 editTextView |
601 editTextView |
586 "get the editTextView or nil. |
602 "get the editTextView or nil. |
587 " |
603 " |
588 |view| |
604 |view| |
589 |
605 |
590 (view := builder componentAt:#textView) notNil ifTrue:[ |
606 (view := builder componentAt:#helpTextView) notNil ifTrue:[ |
591 view := view scrolledView. |
607 view := view scrolledView. |
592 |
608 |
593 view acceptAction isNil ifTrue:[ |
609 view acceptAction isNil ifTrue:[ |
594 view acceptAction:[:aList| self accept ]. |
610 view acceptAction:[:aList| self accept ]. |
595 ]. |
611 ]. |