added update function; changed layout
authorClaus Gittinger <cg@exept.de>
Wed, 09 Feb 2000 16:46:51 +0100
changeset 1340 4276358d937b
parent 1339 b989732e3610
child 1341 83fe4fae7c10
added update function; changed layout
UIHelpTool.st
--- a/UIHelpTool.st	Wed Feb 09 16:46:09 2000 +0100
+++ b/UIHelpTool.st	Wed Feb 09 16:46:51 2000 +0100
@@ -131,31 +131,37 @@
     ^super helpSpec addPairsFrom:#(
 
 #addHelpTextKey
-'Adds the help text key to the help spec.'
+'Adds the key to the help spec.'
 
 #currentHelpTexts
 'Selected help text key.'
 
 #deleteHelpTextKey
-'Deletes the help text key from the help spec.'
+'Deletes the key from the help spec.'
+
+#updateHelpTextKey
+'Refetch the help spec.'
 
 #fileLoad
 'Opens a dialog for selecting and loading a help spec from a class.'
 
 #fileSave
-'Saves current help spec.'
+'Saves the current help spec.'
+
+#fileUpdate
+'Reload the help spec.'
 
 #helpTextView
 'Shows the help text.'
 
 #listOfHelpSpecClasses
-'List of the classes where help specs can be/are implemented.'
+'Classes where help specs can be/are implemented.'
 
 #listOfHelpTexts
-'List of the help text keys.'
+'List of help text keys.'
 
 #removeHelpTextKey
-'Removes the help text key from the widget.'
+'Removes the help message from the widget.'
 
 )
 ! !
@@ -186,7 +192,7 @@
           #name: 'Help Tool'
           #min: #(#Point 10 10)
           #max: #(#Point 1160 870)
-          #bounds: #(#Rectangle 93 147 379 418)
+          #bounds: #(#Rectangle 218 175 504 446)
         )
         #component: 
        #(#SpecCollection
@@ -197,115 +203,118 @@
               #component: 
              #(#SpecCollection
                 #collection: #(
-                 #(#VariableHorizontalPanelSpec
-                    #name: 'VariableHorizontalPanel'
+                 #(#ViewSpec
+                    #name: 'Box1'
                     #component: 
                    #(#SpecCollection
                       #collection: #(
-                       #(#SequenceViewSpec
-                          #name: 'listOfHelpKeysView'
-                          #activeHelpKey: #listOfHelpTexts
-                          #tabable: true
-                          #model: #listModel
-                          #hasHorizontalScrollBar: true
-                          #hasVerticalScrollBar: true
-                          #miniScrollerHorizontal: true
-                          #useIndex: false
-                          #sequenceList: #listChannel
-                        )
-                       #(#ViewSpec
-                          #name: 'Box'
+                       #(#HorizontalPanelViewSpec
+                          #name: 'HorizontalPanel1'
+                          #layout: #(#LayoutFrame 0 0 0 0 0 1 25 0)
+                          #horizontalLayout: #fit
+                          #verticalLayout: #fit
+                          #horizontalSpace: 3
+                          #verticalSpace: 3
                           #component: 
                          #(#SpecCollection
                             #collection: #(
-                             #(#HorizontalPanelViewSpec
-                                #name: 'HorizontalPanel1'
-                                #layout: #(#LayoutFrame 0 0.0 2 0 0 1.0 26 0)
-                                #horizontalLayout: #fit
-                                #verticalLayout: #fit
-                                #horizontalSpace: 3
-                                #verticalSpace: 3
+                             #(#ActionButtonSpec
+                                #label: 'Add'
+                                #name: 'AddButton'
+                                #activeHelpKey: #addHelpTextKey
+                                #translateLabel: true
+                                #tabable: true
+                                #model: #doAdd
+                                #extent: #(#Point 69 25)
+                              )
+                             #(#ActionButtonSpec
+                                #label: 'Remove'
+                                #name: 'RemoveButton'
+                                #activeHelpKey: #removeHelpTextKey
+                                #translateLabel: true
+                                #tabable: true
+                                #model: #doRemove
+                                #extent: #(#Point 69 25)
+                              )
+                             #(#ActionButtonSpec
+                                #label: 'Update'
+                                #name: 'UpdateButton'
+                                #activeHelpKey: #updateHelpTextKey
+                                #translateLabel: true
+                                #tabable: true
+                                #model: #doUpdate
+                                #extent: #(#Point 69 25)
+                              )
+                             #(#ActionButtonSpec
+                                #label: 'Delete'
+                                #name: 'DeleteButton'
+                                #activeHelpKey: #deleteHelpTextKey
+                                #translateLabel: true
+                                #tabable: true
+                                #model: #doDelete
+                                #extent: #(#Point 70 25)
+                              )
+                             )
+                           
+                          )
+                        )
+                       #(#VariableHorizontalPanelSpec
+                          #name: 'VariableHorizontalPanel'
+                          #layout: #(#LayoutFrame 0 0 25 0 0 1 0 1)
+                          #component: 
+                         #(#SpecCollection
+                            #collection: #(
+                             #(#SequenceViewSpec
+                                #name: 'listOfHelpKeysView'
+                                #activeHelpKey: #listOfHelpTexts
+                                #tabable: true
+                                #model: #listModel
+                                #hasHorizontalScrollBar: true
+                                #hasVerticalScrollBar: true
+                                #miniScrollerHorizontal: true
+                                #useIndex: false
+                                #sequenceList: #listChannel
+                              )
+                             #(#ViewSpec
+                                #name: 'Box'
                                 #component: 
                                #(#SpecCollection
                                   #collection: #(
-                                   #(#ActionButtonSpec
-                                      #attributes: 
-                                     #(#tabable
-                                        true
-                                      )
-                                      #label: 'Add'
-                                      #name: 'AddButton'
-                                      #activeHelpKey: #addHelpTextKey
-                                      #translateLabel: true
+                                   #(#InputFieldSpec
+                                      #name: 'helpKeyInputField'
+                                      #layout: #(#LayoutFrame 2 0.0 2 0 -2 1.0 25 0)
+                                      #activeHelpKey: #currentHelpTexts
                                       #tabable: true
-                                      #model: #doAdd
-                                      #extent: #(#Point 44 24)
+                                      #model: #listModel
+                                      #immediateAccept: false
+                                      #acceptOnPointerLeave: false
                                     )
-                                   #(#ActionButtonSpec
-                                      #attributes: 
-                                     #(#tabable
-                                        true
-                                      )
-                                      #label: 'Remove'
-                                      #name: 'RemoveButton'
-                                      #activeHelpKey: #removeHelpTextKey
-                                      #translateLabel: true
+                                   #(#SequenceViewSpec
+                                      #name: 'listOfHelpSpecClassesView'
+                                      #layout: #(#LayoutFrame 0 0.0 27 0 0 1.0 0 1.0)
+                                      #activeHelpKey: #listOfHelpSpecClasses
                                       #tabable: true
-                                      #model: #doRemove
-                                      #extent: #(#Point 44 24)
-                                    )
-                                   #(#ActionButtonSpec
-                                      #attributes: 
-                                     #(#tabable
-                                        true
-                                      )
-                                      #label: 'Delete'
-                                      #name: 'DeleteButton'
-                                      #activeHelpKey: #deleteHelpTextKey
-                                      #translateLabel: true
-                                      #tabable: true
-                                      #model: #doDelete
-                                      #extent: #(#Point 44 24)
+                                      #model: #selectionOfHelpSpecClass
+                                      #hasHorizontalScrollBar: true
+                                      #hasVerticalScrollBar: true
+                                      #miniScrollerHorizontal: true
+                                      #miniScrollerVertical: true
+                                      #valueChangeSelector: #helpSpecClassSelected
+                                      #useIndex: false
+                                      #sequenceList: #listOfHelpSpecClasses
                                     )
                                    )
                                  
                                 )
                               )
-                             #(#InputFieldSpec
-                                #attributes: 
-                               #(#tabable
-                                  true
-                                )
-                                #name: 'helpKeyInputField'
-                                #layout: #(#LayoutFrame 0 0.0 29 0 0 1.0 51 0)
-                                #activeHelpKey: #currentHelpTexts
-                                #tabable: true
-                                #model: #listModel
-                                #immediateAccept: false
-                                #acceptOnPointerLeave: false
-                              )
-                             #(#SequenceViewSpec
-                                #name: 'listOfHelpSpecClassesView'
-                                #layout: #(#LayoutFrame 0 0.0 54 0 0 1.0 0 1.0)
-                                #activeHelpKey: #listOfHelpSpecClasses
-                                #tabable: true
-                                #model: #selectionOfHelpSpecClass
-                                #hasHorizontalScrollBar: true
-                                #hasVerticalScrollBar: true
-                                #miniScrollerHorizontal: true
-                                #miniScrollerVertical: true
-                                #valueChangeSelector: #helpSpecClassSelected
-                                #useIndex: false
-                                #sequenceList: #listOfHelpSpecClasses
-                              )
                              )
                            
                           )
+                          #handles: #(#Any 0.5 1.0)
                         )
                        )
                      
                     )
-                    #handles: #(#Any 0.5 1.0)
                   )
                  #(#TextEditorSpec
                     #name: 'helpTextView'
@@ -410,6 +419,12 @@
                           #activeHelpKey: #fileLoad
                       )
                        #(#MenuItem
+                          #label: 'Update'
+                          #translateLabel: true
+                          #value: #doUpdate
+                          #activeHelpKey: #fileUpdate
+                      )
+                       #(#MenuItem
                           #label: '-'
                       )
                        #(#MenuItem
@@ -626,13 +641,29 @@
     |list listOfHelpSpecClassesView|
 
     modified := false.
-    specClass notNil
-    ifTrue:
-    [   
+    specClass  := self getHelpSpecClassFromClass:aClass.
+    self rebuild.
+!
+
+buildFromClass: aClass andSelector: aSelector
+    "sets aSelector and reads the help dictionary from aClass"
+
+    specSelector := aSelector.
+    self buildFromClass:aClass
+
+!
+
+rebuild
+    "reads the help dictionary from aClass and find remaining classes 
+     'between' aClass and ApplicationModel" 
+
+    |list listOfHelpSpecClassesView|
+
+    specClass notNil ifTrue:[   
         dictionary   := Dictionary new.
         dictionaries := Dictionary new.
     ].
-    specClass  := self getHelpSpecClassFromClass:aClass.
+
     (specClass isClass and: [specClass isLoaded])
     ifTrue: 
     [                                               
@@ -656,15 +687,6 @@
 
     self updateList
 
-    "Modified: / 21.8.1998 / 15:48:00 / cg"
-!
-
-buildFromClass: aClass andSelector: aSelector
-    "sets aSelector and reads the help dictionary from aClass"
-
-    specSelector := aSelector.
-    self buildFromClass:aClass
-
 ! !
 
 !UIHelpTool methodsFor:'callbacks'!
@@ -1046,7 +1068,9 @@
 closeRequest
     "asks for permission before closing"
 
-    (self masterApplication isNil and:[self askForModification]) ifTrue:[super closeRequest]
+    (self masterApplication isNil and:[self askForModification]) ifTrue:[
+        super closeRequest
+    ]
 !
 
 initialize
@@ -1233,6 +1257,18 @@
     "saves the help dictionaries on specClass"
 
     self installHelpSpecsOnClass:specClass
+!
+
+doUpdate
+    "reread the helpspecs and update my lists"
+
+    specClass isNil ifTrue:[
+        ^ self warn:'No spec loaded'.
+    ].
+
+    (self askForModification) ifTrue:[
+        self rebuild
+    ]
 ! !
 
 !UIHelpTool class methodsFor:'documentation'!