675 list contents: (specClass withAllSuperclasses reverse collect: [:cls| cls name]). |
675 list contents: (specClass withAllSuperclasses reverse collect: [:cls| cls name]). |
676 (list includes: #ApplicationModel) |
676 (list includes: #ApplicationModel) |
677 ifTrue: [list removeAll: (ApplicationModel withAllSuperclasses collect: [:cls| cls name])]. |
677 ifTrue: [list removeAll: (ApplicationModel withAllSuperclasses collect: [:cls| cls name])]. |
678 self selectionOfHelpSpecClass value: specClass name. |
678 self selectionOfHelpSpecClass value: specClass name. |
679 |
679 |
680 listOfHelpSpecClassesView := builder componentAt: #listOfHelpSpecClassesView. |
680 listOfHelpSpecClassesView := self componentAt: #listOfHelpSpecClassesView. |
681 listOfHelpSpecClassesView notNil ifTrue:[ |
681 listOfHelpSpecClassesView notNil ifTrue:[ |
682 listOfHelpSpecClassesView selection: |
682 listOfHelpSpecClassesView selection: |
683 (list value indexOf: specClass name). |
683 (list value indexOf: specClass name). |
684 ]. |
684 ]. |
685 self helpSpecClassSelected. |
685 self helpSpecClassSelected. |
691 !UIHelpTool methodsFor:'callbacks'! |
691 !UIHelpTool methodsFor:'callbacks'! |
692 |
692 |
693 helpSpecClassSelected |
693 helpSpecClassSelected |
694 "extracts the help dictionary from the selected class and make it current" |
694 "extracts the help dictionary from the selected class and make it current" |
695 |
695 |
696 |clsName| |
696 |clsName listOfHelpKeysView newSelection| |
697 |
697 |
698 clsName := self selectionOfHelpSpecClass value. |
698 clsName := self selectionOfHelpSpecClass value. |
699 |
699 |
700 (dictionary := dictionaries at: clsName ifAbsent: nil) isNil |
700 dictionary := self dictionaryForClassNamed:clsName. |
701 ifTrue: |
|
702 [ |
|
703 dictionary := dictionaries at: clsName put: (self extractHelpSpecForClass: (Smalltalk at: clsName)) |
|
704 ]. |
|
705 |
701 |
706 self updateList. |
702 self updateList. |
707 |
703 |
708 listSelection notNil |
704 listSelection notNil ifTrue: [ |
709 ifTrue: |
705 listOfHelpKeysView := self componentAt: #listOfHelpKeysView. |
710 [ |
706 |
711 (dictionary keys includes: listSelection asSymbol) |
707 (dictionary keys includes: listSelection asSymbol) |
712 ifTrue: [(builder componentAt: #listOfHelpKeysView) selection: |
708 ifTrue: [ |
713 (self listChannel value indexOf: (builder componentAt: #helpKeyInputField) contents)] |
709 newSelection := |
714 ifFalse: [(builder componentAt: #listOfHelpKeysView) selection: nil]. |
710 (self listChannel value indexOf: (self componentAt: #helpKeyInputField) contents) |
715 ]. |
711 ] ifFalse: [ |
716 listSelection notNil |
712 newSelection := nil |
717 ifTrue: |
713 ]. |
718 [ |
714 |
|
715 listOfHelpKeysView selection:newSelection. |
|
716 ]. |
|
717 listSelection notNil ifTrue: [ |
719 self editTextView contents: (dictionary at: listSelection asSymbol ifAbsent: '') |
718 self editTextView contents: (dictionary at: listSelection asSymbol ifAbsent: '') |
720 ] |
719 ] |
721 |
|
722 |
|
723 ! ! |
720 ! ! |
724 |
721 |
725 !UIHelpTool methodsFor:'help'! |
722 !UIHelpTool methodsFor:'help'! |
726 |
723 |
727 defaultInfoLabel |
724 defaultInfoLabel |
767 |
764 |
768 |
765 |
769 |
766 |
770 ! |
767 ! |
771 |
768 |
|
769 dictionaryForClassNamed:clsName |
|
770 |dictionary| |
|
771 |
|
772 dictionary := dictionaries at:clsName ifAbsent:nil. |
|
773 dictionary isNil ifTrue: [ |
|
774 dictionary := dictionaries at:clsName put:(self extractHelpSpecForClass: (Smalltalk at:clsName)) |
|
775 ]. |
|
776 ^ dictionary |
|
777 ! |
|
778 |
772 editTextView |
779 editTextView |
773 "returns the editTextView or nil" |
780 "returns the editTextView or nil" |
774 |
781 |
775 |view| |
782 |view| |
776 |
783 |
777 (view := builder componentAt:#helpTextView) notNil ifTrue:[ |
784 (view := self componentAt:#helpTextView) notNil ifTrue:[ |
778 view := view scrolledView. |
785 view := view scrolledView. |
779 |
786 |
780 view acceptAction isNil ifTrue:[ |
787 view acceptAction isNil ifTrue:[ |
781 view acceptAction:[:aList| self accept ]. |
788 view acceptAction:[:aList| self accept ]. |
782 ]. |
789 ]. |
818 aHelpKey isNil ifTrue: [^nil]. |
825 aHelpKey isNil ifTrue: [^nil]. |
819 |
826 |
820 dictTemp := dictionary. |
827 dictTemp := dictionary. |
821 listOfHelpSpecClasses := self listOfHelpSpecClasses. |
828 listOfHelpSpecClasses := self listOfHelpSpecClasses. |
822 listOfHelpSpecClasses value do:[:clsName| |
829 listOfHelpSpecClasses value do:[:clsName| |
823 (dictionary := dictionaries at: clsName ifAbsent: nil) isNil ifTrue:[ |
830 dictionary := self dictionaryForClassNamed:clsName. |
824 dictionary := dictionaries at: clsName put: (self extractHelpSpecForClass: (Smalltalk at: clsName)) |
|
825 ]. |
|
826 (dictionary includesKey: aHelpKey asSymbol) ifTrue:[ |
831 (dictionary includesKey: aHelpKey asSymbol) ifTrue:[ |
827 self updateList. |
832 self updateList. |
828 ^(builder componentAt: #listOfHelpSpecClassesView) selection: |
833 ^(self componentAt: #listOfHelpSpecClassesView) selection: |
829 (listOfHelpSpecClasses value indexOf: clsName). |
834 (listOfHelpSpecClasses value indexOf: clsName). |
830 ] |
835 ] |
831 ]. |
836 ]. |
832 dictionary := dictTemp |
837 dictionary := dictTemp |
833 |
|
834 |
|
835 ! |
838 ! |
836 |
839 |
837 getHelpSpecClassFromClass:aClass |
840 getHelpSpecClassFromClass:aClass |
838 "returns application class keeping the associated help text or nil" |
841 "returns application class keeping the associated help text or nil" |
839 |
842 |
1109 ! |
1111 ! |
1110 |
1112 |
1111 openOnClass:aClass |
1113 openOnClass:aClass |
1112 "opens the UIHelpTool on aClass" |
1114 "opens the UIHelpTool on aClass" |
1113 |
1115 |
1114 super openInterface: #windowSpecForStandAlone. |
1116 self openOnClass:aClass andSelector:nil |
1115 self masterApplication isNil ifTrue: [(builder componentAt: #RemoveButton) beInvisible]. |
1117 |
1116 builder window label: 'Help Tool'. |
1118 " |
1117 self buildFromClass: aClass |
1119 self openOnClass:NewLauncher |
|
1120 " |
1118 ! |
1121 ! |
1119 |
1122 |
1120 openOnClass:aClass andSelector: aSelector |
1123 openOnClass:aClass andSelector: aSelector |
1121 "opens the UIHelpTool on aClass and aSelector" |
1124 "opens the UIHelpTool on aClass and aSelector" |
1122 |
1125 |
1123 super openInterface: #windowSpecForStandAlone. |
1126 super openInterface: #windowSpecForStandAlone. |
1124 self masterApplication isNil ifTrue: [(builder componentAt: #RemoveButton) beInvisible]. |
1127 |
|
1128 self masterApplication isNil ifTrue: [(self componentAt: #RemoveButton) beInvisible]. |
1125 builder window label: 'Help Tool'. |
1129 builder window label: 'Help Tool'. |
1126 self buildFromClass: aClass andSelector: aSelector |
1130 self buildFromClass:aClass andSelector:aSelector |
1127 ! ! |
1131 ! ! |
1128 |
1132 |
1129 !UIHelpTool methodsFor:'user actions'! |
1133 !UIHelpTool methodsFor:'user actions'! |
1130 |
1134 |
1131 accept |
1135 accept |