UIHelpTool.st
author Claus Gittinger <cg@exept.de>
Tue, 14 May 2019 09:46:21 +0200
changeset 3663 9d49ecf8661a
parent 3560 8e0d01180c6e
permissions -rw-r--r--
#UI_ENHANCEMENT by cg
class: TabListEditor class
changed:
#canvasSpec
#menu
#windowSpec
cg@3560
     1
"{ Encoding: utf8 }"
cg@3560
     2
cg@156
     3
"
cg@156
     4
 COPYRIGHT (c) 1995 by eXept Software AG
ca@1669
     5
	      All Rights Reserved
cg@156
     6
cg@156
     7
 This software is furnished under a license and may be used
cg@156
     8
 only in accordance with the terms of that license and with the
cg@156
     9
 inclusion of the above copyright notice.   This software may not
cg@156
    10
 be provided or otherwise made available to, or used by, any
cg@156
    11
 other person.  No title to or ownership of the software is
cg@156
    12
 hereby transferred.
cg@156
    13
"
cg@1554
    14
"{ Package: 'stx:libtool2' }"
cg@1554
    15
cg@3199
    16
"{ NameSpace: Smalltalk }"
cg@3199
    17
sv@1772
    18
ResourceSpecEditor subclass:#UIHelpTool
sv@1772
    19
	instanceVariableNames:'classItemList classItemModel keyItemModel helpTextView
sv@1772
    20
		modifiedHolder contentsModifiedChannel editModel'
ca@148
    21
	classVariableNames:''
ca@148
    22
	poolDictionaries:''
ca@148
    23
	category:'Interface-UIPainter'
ca@148
    24
!
ca@148
    25
ca@1669
    26
HierarchicalItem subclass:#ClassItem
ca@1669
    27
	instanceVariableNames:'theClass list modified'
ca@1669
    28
	classVariableNames:''
ca@1669
    29
	poolDictionaries:''
ca@1669
    30
	privateIn:UIHelpTool
ca@1669
    31
!
ca@1669
    32
ca@1669
    33
HierarchicalItem subclass:#KeyItem
cg@1681
    34
	instanceVariableNames:'helpKey helpText flyByText modified icon'
ca@1669
    35
	classVariableNames:''
ca@1669
    36
	poolDictionaries:''
ca@1669
    37
	privateIn:UIHelpTool
ca@1669
    38
!
ca@1669
    39
ca@148
    40
!UIHelpTool class methodsFor:'documentation'!
ca@148
    41
cg@156
    42
copyright
cg@156
    43
"
cg@156
    44
 COPYRIGHT (c) 1995 by eXept Software AG
ca@1669
    45
	      All Rights Reserved
cg@156
    46
cg@156
    47
 This software is furnished under a license and may be used
cg@156
    48
 only in accordance with the terms of that license and with the
cg@156
    49
 inclusion of the above copyright notice.   This software may not
cg@156
    50
 be provided or otherwise made available to, or used by, any
cg@156
    51
 other person.  No title to or ownership of the software is
cg@156
    52
 hereby transferred.
cg@156
    53
"
cg@156
    54
!
cg@156
    55
ca@148
    56
documentation
ca@148
    57
"
tz@779
    58
    The Help Tool allows you to define help dictionaries for the widgets in
tz@761
    59
    window applications. The tool are able to run stand alone or in other master 
tz@740
    60
    applications like the GUI Painter and the Menu Editor.
tz@740
    61
    If the application responds to the selector #showHelp:aHelpText for:aView,
tz@740
    62
    this selector is called by the widget's view when the mouse cursor moves over. 
tz@740
    63
    If the application does not responds to that selector, and the activeHelp mode
tz@740
    64
    is enabled, an active help bubble is shown at the widget's view.
cg@156
    65
tz@779
    66
    [instance variables:]
ca@1669
    67
	specClass       <Symbol>        class implementing the help spec
ca@1669
    68
	specSelector    <Symbol>        selector returning the help spec
ca@1669
    69
	classItemList                   the list of classItems
ca@1669
    70
	classItemModel                  keeps the selected class
ca@1669
    71
	keyItemModel                    keeps the selected helpKey
ca@1669
    72
	modifiedHolder  <ValueHolder>   true if the editField or contents changed
ca@1669
    73
	editModel                       keeps the current helpKey
ca@1669
    74
	helpTextView                    the view which shows the helpText
ca@1669
    75
	contentsModifiedChannel         true if the helpText is modified
tz@779
    76
cg@156
    77
    [author:]
ca@1669
    78
	Claus Atzkern, eXept Software AG
ca@1669
    79
	Thomas Zwick,  eXept Software AG
ca@148
    80
"
ca@148
    81
! !
ca@148
    82
ca@286
    83
!UIHelpTool class methodsFor:'instance creation'!
ca@286
    84
cg@832
    85
open
cg@833
    86
    ^ self openOnClass:nil.
cg@832
    87
!
cg@832
    88
ca@286
    89
openOnClass:aClass
ca@1669
    90
    "opens a Help Tool on aClass
ca@1669
    91
    "
ca@1646
    92
    ^ self openOnClass:aClass andSelector:#helpSpec
tz@750
    93
! !
tz@750
    94
ca@286
    95
!UIHelpTool class methodsFor:'constants'!
ca@286
    96
ca@286
    97
label
ca@1669
    98
    "returns the label; used if embedded as sub canvas in the GUI Painter or Menu Editor
ca@1669
    99
    "
tz@696
   100
    ^'Help'
ca@286
   101
! !
ca@286
   102
sv@1772
   103
!UIHelpTool class methodsFor:'defaults'!
sv@1772
   104
sv@1772
   105
resourceType
sv@1772
   106
    "get the type of the resource of the method generated by the UIHelpTool"
sv@1772
   107
sv@1772
   108
    ^ #help
sv@1772
   109
! !
sv@1772
   110
ca@151
   111
!UIHelpTool class methodsFor:'help specs'!
ca@151
   112
cg@3521
   113
helpSpec
tz@740
   114
    "This resource specification was automatically generated
tz@740
   115
     by the UIHelpTool of ST/X."
tz@740
   116
tz@740
   117
    "Do not manually edit this!! If it is corrupted,
tz@740
   118
     the UIHelpTool may not be able to read the specification."
ca@292
   119
ca@172
   120
    "
tz@740
   121
     UIHelpTool openOnClass:UIHelpTool    
ca@292
   122
    "
ca@292
   123
tz@740
   124
    <resource: #help>
tz@740
   125
cg@3521
   126
    ^ super helpSpec addPairsFrom:#(
ca@151
   127
tz@696
   128
#addHelpTextKey
cg@1340
   129
'Adds the key to the help spec.'
tz@696
   130
tz@696
   131
#currentHelpTexts
tz@696
   132
'Selected help text key.'
tz@696
   133
tz@696
   134
#deleteHelpTextKey
cg@1340
   135
'Deletes the key from the help spec.'
cg@1340
   136
tz@750
   137
#fileLoad
tz@750
   138
'Opens a dialog for selecting and loading a help spec from a class.'
tz@750
   139
tz@750
   140
#fileSave
cg@1340
   141
'Saves the current help spec.'
cg@1340
   142
cg@1340
   143
#fileUpdate
cg@1340
   144
'Reload the help spec.'
tz@696
   145
tz@696
   146
#helpTextView
sv@1622
   147
'Shows the help text. Menu action ''Accept'' commits changes'
tz@696
   148
ca@1646
   149
#listOfClasses
cg@1340
   150
'Classes where help specs can be/are implemented.'
tz@696
   151
tz@696
   152
#listOfHelpTexts
cg@1340
   153
'List of help text keys.'
tz@696
   154
tz@696
   155
#removeHelpTextKey
cg@1340
   156
'Removes the help message from the widget.'
ca@151
   157
ca@1646
   158
#updateHelpTextKey
ca@1646
   159
'Refetch the help spec.'
ca@1646
   160
ca@172
   161
)
ca@151
   162
! !
ca@151
   163
ca@148
   164
!UIHelpTool class methodsFor:'interface specs'!
ca@148
   165
cg@1982
   166
innerSpec
tz@740
   167
    "This resource specification was automatically generated
tz@740
   168
     by the UIPainter of ST/X."
ca@148
   169
tz@740
   170
    "Do not manually edit this!! If it is corrupted,
tz@740
   171
     the UIPainter may not be able to read the specification."
ca@148
   172
ca@148
   173
    "
cg@1982
   174
     UIPainter new openOnClass:UIHelpTool andSelector:#innerSpec
cg@1982
   175
     UIHelpTool new openInterface:#innerSpec
ca@148
   176
    "
ca@148
   177
ca@148
   178
    <resource: #canvas>
ca@148
   179
ca@1302
   180
    ^ 
sv@1737
   181
     #(FullSpec
cg@1982
   182
        name: innerSpec
sv@1737
   183
        window: 
sv@1737
   184
       (WindowSpec
sv@1737
   185
          label: 'UIHelpTool'
sv@1737
   186
          name: 'UIHelpTool'
sv@1737
   187
          min: (Point 10 10)
cg@1973
   188
          bounds: (Rectangle 0 0 461 293)
sv@1737
   189
        )
sv@1737
   190
        component: 
sv@1737
   191
       (SpecCollection
sv@1737
   192
          collection: (
sv@1737
   193
           (VariableVerticalPanelSpec
sv@1737
   194
              name: 'PanelVrt'
sv@1737
   195
              layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 0 1.0)
sv@1737
   196
              component: 
sv@1737
   197
             (SpecCollection
sv@1737
   198
                collection: (
sv@1737
   199
                 (VariableHorizontalPanelSpec
sv@1737
   200
                    name: 'PanelHrz'
sv@1737
   201
                    component: 
sv@1737
   202
                   (SpecCollection
sv@1737
   203
                      collection: (
sv@1737
   204
                       (HierarchicalListViewSpec
sv@1737
   205
                          name: 'keyItemModel'
sv@1737
   206
                          model: keyItemModel
sv@1737
   207
                          menu: keyItemMenu
sv@1737
   208
                          hasHorizontalScrollBar: true
sv@1737
   209
                          hasVerticalScrollBar: true
sv@1737
   210
                          miniScrollerHorizontal: true
sv@1737
   211
                          miniScrollerVertical: false
sv@1737
   212
                          listModel: keyItemListHolder
sv@1737
   213
                          useIndex: false
sv@1737
   214
                          highlightMode: label
sv@1737
   215
                          showLines: false
sv@1737
   216
                          showIndicators: false
sv@1737
   217
                          showLeftIndicators: false
sv@1737
   218
                          useDefaultIcons: false
sv@1737
   219
                          autoScrollHorizontal: false
sv@1737
   220
                        )
sv@1737
   221
                       (ViewSpec
sv@1737
   222
                          name: 'classItemList'
sv@1737
   223
                          component: 
sv@1737
   224
                         (SpecCollection
sv@1737
   225
                            collection: (
sv@1737
   226
                             (InputFieldSpec
sv@1737
   227
                                name: 'editModel'
sv@1737
   228
                                layout: (LayoutFrame 0 0.0 2 0 -1 1.0 25 0)
sv@1737
   229
                                activeHelpKey: currentHelpTexts
sv@1737
   230
                                model: editModel
sv@1737
   231
                                immediateAccept: true
sv@1737
   232
                                acceptOnReturn: false
sv@1737
   233
                                acceptOnTab: false
sv@1737
   234
                                acceptOnLostFocus: false
sv@1737
   235
                                acceptOnPointerLeave: false
sv@1737
   236
                              )
sv@1737
   237
                             (SelectionInListModelViewSpec
sv@1737
   238
                                name: 'classItemModel'
sv@1737
   239
                                layout: (LayoutFrame 0 0.0 27 0.0 0 1.0 0 1.0)
sv@1737
   240
                                model: classItemModel
sv@1737
   241
                                hasHorizontalScrollBar: true
sv@1737
   242
                                hasVerticalScrollBar: true
sv@1737
   243
                                miniScrollerHorizontal: true
sv@1737
   244
                                miniScrollerVertical: true
sv@1737
   245
                                autoHideScrollBars: false
sv@1737
   246
                                listModel: classItemListHolder
sv@1737
   247
                                useIndex: false
sv@1737
   248
                                highlightMode: label
sv@1737
   249
                              )
sv@1737
   250
                             )
ca@1646
   251
                           
sv@1737
   252
                          )
sv@1737
   253
                        )
sv@1737
   254
                       )
ca@1646
   255
                     
sv@1737
   256
                    )
sv@1737
   257
                    handles: (Any 0.607375 1.0)
sv@1737
   258
                  )
sv@1737
   259
                 (ArbitraryComponentSpec
sv@1737
   260
                    name: 'helpTextView'
sv@1737
   261
                    hasHorizontalScrollBar: true
sv@1737
   262
                    hasVerticalScrollBar: true
sv@1737
   263
                    miniScrollerHorizontal: true
sv@1737
   264
                    miniScrollerVertical: true
sv@1737
   265
                    hasBorder: false
sv@1737
   266
                    component: helpTextView
sv@1737
   267
                  )
sv@1737
   268
                 )
ca@1302
   269
               
sv@1737
   270
              )
sv@1737
   271
              handles: (Any 0.679181 1.0)
sv@1737
   272
            )
sv@1737
   273
           )
ca@1302
   274
         
sv@1737
   275
        )
ca@148
   276
      )
tz@696
   277
!
tz@696
   278
cg@1982
   279
windowSpec
tz@740
   280
    "This resource specification was automatically generated
tz@740
   281
     by the UIPainter of ST/X."
tz@696
   282
tz@740
   283
    "Do not manually edit this!! If it is corrupted,
tz@740
   284
     the UIPainter may not be able to read the specification."
tz@696
   285
tz@696
   286
    "
cg@1982
   287
     UIPainter new openOnClass:UIHelpTool andSelector:#windowSpec
cg@1982
   288
     UIHelpTool new openInterface:#windowSpec
cg@1982
   289
     UIHelpTool open
tz@696
   290
    "
tz@696
   291
tz@696
   292
    <resource: #canvas>
tz@696
   293
ca@1646
   294
    ^ 
cg@3291
   295
    #(FullSpec
cg@3291
   296
       name: windowSpec
cg@3291
   297
       window: 
cg@3291
   298
      (WindowSpec
cg@3291
   299
         label: 'Help Tool'
cg@3291
   300
         name: 'Help Tool'
cg@3291
   301
         min: (Point 300 300)
cg@3291
   302
         bounds: (Rectangle 0 0 498 429)
cg@3291
   303
         menu: menu
cg@3291
   304
       )
cg@3291
   305
       component: 
cg@3291
   306
      (SpecCollection
cg@3291
   307
         collection: (
cg@3291
   308
          (ViewSpec
cg@3291
   309
             name: 'mainPanel'
cg@3291
   310
             layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -24 1.0)
cg@3291
   311
             component: 
cg@3291
   312
            (SpecCollection
cg@3291
   313
               collection: (
cg@3291
   314
                (UISubSpecification
cg@3291
   315
                   name: 'innerSpec'
cg@3291
   316
                   layout: (LayoutFrame 0 0.0 0 0.0 0 1.0 -24 1.0)
cg@3291
   317
                   minorKey: innerSpec
cg@2002
   318
                 )
cg@3291
   319
                (UISubSpecification
cg@3291
   320
                   name: 'windowSpecForCommit'
cg@3291
   321
                   layout: (LayoutFrame 0 0.0 -30 1.0 0 1.0 0 1.0)
cg@3291
   322
                   majorKey: ToolApplicationModel
cg@3291
   323
                   minorKey: windowSpecForCommit
cg@3291
   324
                 )
cg@3291
   325
                )
cg@3291
   326
              
cg@3291
   327
             )
sv@1737
   328
           )
cg@3291
   329
          (UISubSpecification
cg@3291
   330
             name: 'infoBarSubSpec'
cg@3291
   331
             layout: (LayoutFrame 0 0 -24 1 0 1 0 1)
cg@3291
   332
             majorKey: ToolApplicationModel
cg@3291
   333
             minorKey: windowSpecForInfoBar
cg@3291
   334
           )
cg@3291
   335
          )
cg@3291
   336
        
cg@3291
   337
       )
cg@3291
   338
     )
tz@696
   339
! !
tz@696
   340
tz@696
   341
!UIHelpTool class methodsFor:'menu specs'!
tz@696
   342
ca@1646
   343
helpTextMenu
ca@1646
   344
    "This resource specification was automatically generated
ca@1646
   345
     by the MenuEditor of ST/X."
ca@1646
   346
ca@1646
   347
    "Do not manually edit this!! If it is corrupted,
ca@1646
   348
     the MenuEditor may not be able to read the specification."
ca@1646
   349
cg@3560
   350
ca@1646
   351
    "
ca@1646
   352
     MenuEditor new openOnClass:UIHelpTool andSelector:#helpTextMenu
ca@1646
   353
     (Menu new fromLiteralArrayEncoding:(UIHelpTool helpTextMenu)) startUp
ca@1646
   354
    "
ca@1646
   355
ca@1646
   356
    <resource: #menu>
ca@1646
   357
ca@1646
   358
    ^ 
cg@3560
   359
     #(Menu
cg@3560
   360
        (
cg@3560
   361
         (MenuItem
cg@3560
   362
            activeHelpKey: commitOK
cg@3560
   363
            enabled: contentsModifiedChannel
cg@3560
   364
            label: 'Accept'
cg@3560
   365
            itemValue: accept
cg@3560
   366
          )
cg@3560
   367
         (MenuItem
cg@3560
   368
            activeHelpKey: commitCancel
cg@3560
   369
            enabled: contentsModifiedChannel
cg@3560
   370
            label: 'Cancel'
cg@3560
   371
            itemValue: cancel
cg@3560
   372
          )
cg@3560
   373
         )
cg@3560
   374
        nil
cg@3560
   375
        nil
ca@1669
   376
      )
ca@1669
   377
!
ca@1669
   378
ca@1669
   379
keyItemMenu
ca@1669
   380
    "This resource specification was automatically generated
ca@1669
   381
     by the MenuEditor of ST/X."
ca@1669
   382
ca@1669
   383
    "Do not manually edit this!! If it is corrupted,
ca@1669
   384
     the MenuEditor may not be able to read the specification."
ca@1669
   385
cg@3560
   386
ca@1669
   387
    "
ca@1669
   388
     MenuEditor new openOnClass:UIHelpTool andSelector:#keyItemMenu
ca@1669
   389
     (Menu new fromLiteralArrayEncoding:(UIHelpTool keyItemMenu)) startUp
ca@1669
   390
    "
ca@1669
   391
ca@1669
   392
    <resource: #menu>
ca@1669
   393
ca@1669
   394
    ^ 
cg@3560
   395
     #(Menu
cg@3560
   396
        (
cg@3560
   397
         (MenuItem
cg@3560
   398
            activeHelpKey: deleteHelpTextKey
cg@3560
   399
            enabled: hasKeyItemSelectedHolder
cg@3560
   400
            label: 'Delete Key'
cg@3560
   401
            itemValue: doDelete
cg@3560
   402
          )
cg@3560
   403
         (MenuItem
cg@3560
   404
            label: '-'
cg@3560
   405
          )
cg@3560
   406
         (MenuItem
cg@3560
   407
            activeHelpKey: extractHelpTextKeys
cg@3560
   408
            label: 'Extract used Keys from Application'
cg@3560
   409
            itemValue: doExtractUsedKeys
cg@3560
   410
            enabled: hasSpecClassDefined
cg@3560
   411
          )
cg@3560
   412
         )
cg@3560
   413
        nil
cg@3560
   414
        nil
ca@1646
   415
      )
cg@3560
   416
cg@3560
   417
    "Modified: / 24-05-2018 / 15:52:24 / Claus Gittinger"
ca@1646
   418
!
ca@1646
   419
ca@1646
   420
listOfKeysMenu
ca@1646
   421
    "This resource specification was automatically generated
ca@1646
   422
     by the MenuEditor of ST/X."
ca@1646
   423
ca@1646
   424
    "Do not manually edit this!! If it is corrupted,
ca@1646
   425
     the MenuEditor may not be able to read the specification."
ca@1646
   426
cg@3560
   427
ca@1646
   428
    "
ca@1646
   429
     MenuEditor new openOnClass:UIHelpTool andSelector:#listOfKeysMenu
ca@1646
   430
     (Menu new fromLiteralArrayEncoding:(UIHelpTool listOfKeysMenu)) startUp
ca@1646
   431
    "
ca@1646
   432
ca@1646
   433
    <resource: #menu>
ca@1646
   434
ca@1646
   435
    ^ 
cg@3560
   436
     #(Menu
cg@3560
   437
        (
cg@3560
   438
         (MenuItem
cg@3560
   439
            activeHelpKey: deleteHelpTextKey
cg@3560
   440
            label: 'Delete'
cg@3560
   441
            itemValue: doDelete
cg@3560
   442
          )
cg@3560
   443
         )
cg@3560
   444
        nil
cg@3560
   445
        nil
ca@1646
   446
      )
ca@1646
   447
!
ca@1646
   448
tz@696
   449
menu
tz@740
   450
    "This resource specification was automatically generated
tz@740
   451
     by the MenuEditor of ST/X."
tz@696
   452
tz@740
   453
    "Do not manually edit this!! If it is corrupted,
tz@740
   454
     the MenuEditor may not be able to read the specification."
tz@696
   455
tz@696
   456
    "
tz@696
   457
     MenuEditor new openOnClass:UIHelpTool andSelector:#menu
tz@696
   458
     (Menu new fromLiteralArrayEncoding:(UIHelpTool menu)) startUp
tz@696
   459
    "
tz@696
   460
tz@696
   461
    <resource: #menu>
tz@696
   462
ca@1646
   463
    ^ 
ca@1775
   464
     #(Menu
ca@1775
   465
        (
ca@1775
   466
         (MenuItem
ca@1775
   467
            label: 'File'
ca@1775
   468
            translateLabel: true
ca@1775
   469
            submenu: 
ca@1775
   470
           (Menu
ca@1775
   471
              (
ca@1775
   472
               (MenuItem
cg@1973
   473
                  label: 'New'
cg@1973
   474
                  itemValue: doNew
cg@1973
   475
                  translateLabel: true
cg@1973
   476
                )
cg@1973
   477
               (MenuItem
cg@1973
   478
                  label: '-'
cg@1973
   479
                )
cg@1973
   480
               (MenuItem
ca@1775
   481
                  activeHelpKey: fileLoad
ca@1775
   482
                  label: 'Load...'
ca@1775
   483
                  itemValue: doLoad
ca@1775
   484
                  translateLabel: true
ca@1775
   485
                )
ca@1775
   486
               (MenuItem
ca@1775
   487
                  activeHelpKey: fileSave
ca@1775
   488
                  label: 'Save'
ca@1775
   489
                  itemValue: doSave
ca@1775
   490
                  translateLabel: true
ca@1775
   491
                )
ca@1775
   492
               (MenuItem
ca@1775
   493
                  label: '-'
cg@1982
   494
                  isVisible: isStandAlone
ca@1775
   495
                )
ca@1775
   496
               (MenuItem
ca@1775
   497
                  activeHelpKey: fileExit
ca@1775
   498
                  label: 'Exit'
ca@1775
   499
                  itemValue: closeRequest
ca@1775
   500
                  translateLabel: true
cg@1982
   501
                  isVisible: isStandAlone
ca@1775
   502
                )
ca@1775
   503
               )
ca@1775
   504
              nil
ca@1775
   505
              nil
ca@1775
   506
            )
ca@1775
   507
          )
ca@1775
   508
         (MenuItem
ca@1775
   509
            label: 'Edit'
ca@1775
   510
            translateLabel: true
ca@1775
   511
            submenuChannel: keyItemMenu
ca@1775
   512
            keepLinkedMenu: true
ca@1775
   513
          )
ca@1775
   514
         (MenuItem
cg@1973
   515
            label: 'History'
cg@1973
   516
            translateLabel: true
cg@1982
   517
            isVisible: isStandAlone
cg@1973
   518
            submenuChannel: menuHistory
cg@1973
   519
          )
cg@1973
   520
         (MenuItem
cg@2665
   521
            label: 'MENU_Help'
ca@1775
   522
            translateLabel: true
cg@2127
   523
            startGroup: conditionalRight
ca@1775
   524
            submenuChannel: menuHelp
ca@1775
   525
          )
ca@1775
   526
         )
ca@1775
   527
        nil
ca@1775
   528
        nil
tz@696
   529
      )
ca@148
   530
! !
ca@148
   531
ca@148
   532
!UIHelpTool methodsFor:'accessing'!
ca@148
   533
cg@3362
   534
alternativeSpecSelectors
cg@3362
   535
    "returns a set of alternative spec method selectors of the resource spec"
cg@3362
   536
cg@3521
   537
    ^ #( helpPairs helpSpec "flyByHelpSpec" tooltipSpec )
cg@3392
   538
cg@3392
   539
    "Modified: / 03-02-2017 / 13:05:02 / cg"
cg@3362
   540
!
cg@3362
   541
ca@1669
   542
helpKey
cg@3291
   543
    "returns the helpKey (symbol) or nil
ca@1669
   544
    "
ca@1669
   545
    |key|
tz@779
   546
ca@1669
   547
    key := editModel value.
tz@710
   548
ca@1669
   549
    key size ~~ 0 ifTrue:[
cg@3291
   550
        key := key withoutSeparators.
cg@3291
   551
        key notEmpty ifTrue:[ ^ key asSymbol ]
ca@286
   552
    ].
ca@286
   553
    ^ nil
ca@286
   554
!
ca@286
   555
ca@286
   556
helpKey:aKey
ca@1669
   557
    "change the helpKey without any change notification (modifiedHolder).
ca@1669
   558
    "
ca@286
   559
    |key|
ca@1646
   560
ca@1669
   561
    self withoutModifyDo:[
cg@3030
   562
        aKey size ~~ 0 ifTrue:[
cg@3030
   563
            key := aKey withoutSeparators asNilIfEmpty.
cg@3030
   564
        ] ifFalse:[
cg@3030
   565
            key := nil
cg@3030
   566
        ].
cg@3030
   567
        editModel value:key.
ca@286
   568
    ].
ca@1646
   569
    self cancel.
ca@151
   570
!
ca@151
   571
tz@740
   572
modified
cg@2020
   573
    "true if any items are added, deleted or modified
cg@2020
   574
    "
cg@2020
   575
    classItemList do:[:aClassItem|
cg@2020
   576
	aClassItem modified ifTrue:[^ true].
cg@2020
   577
    ].
cg@2020
   578
    ^ false
tz@700
   579
!
tz@700
   580
ca@1669
   581
modified:aBoolean
ca@1669
   582
    "true if any items are added, deleted or modified
ca@1646
   583
    "
ca@1669
   584
    classItemList do:[:aClassItem| aClassItem modified:aBoolean ].
ca@1669
   585
!
ca@1669
   586
ca@1669
   587
modifiedHolder
ca@1669
   588
    "boolean holder which is set to true if the helpKey or contents changed
ca@1669
   589
    "
ca@1669
   590
    ^ modifiedHolder
tz@700
   591
!
tz@700
   592
ca@286
   593
modifiedHolder:aValueHolder
ca@1669
   594
    "boolean holder which is set to true if the helpKey or contents changed
ca@1669
   595
    "
ca@286
   596
    modifiedHolder notNil ifTrue:[
ca@1669
   597
	modifiedHolder removeDependent:self. 
ca@286
   598
    ].
ca@1646
   599
    modifiedHolder := aValueHolder.
ca@148
   600
ca@1646
   601
    modifiedHolder notNil ifTrue:[
ca@1669
   602
	modifiedHolder addDependent:self.
ca@1669
   603
    ].
ca@1604
   604
!
ca@1604
   605
tz@715
   606
specClass
ca@1669
   607
    "returns the class on which the help tool works on
ca@1646
   608
    "
ca@1646
   609
    ^ specClass
ca@1646
   610
!
tz@779
   611
ca@1646
   612
specSelector
cg@1681
   613
    "returns the selector of the edited helpSpec method
ca@1646
   614
    "
cg@1681
   615
    ^ specSelector ? #helpSpec
cg@354
   616
! !
cg@354
   617
ca@148
   618
!UIHelpTool methodsFor:'aspects'!
ca@148
   619
ca@1669
   620
classItemListHolder
ca@1669
   621
    "returns the holder which keeps the class items
ca@1669
   622
    "
ca@1669
   623
    |holder|
ca@1669
   624
ca@1669
   625
    holder := builder bindingAt:#classItemListHolder.
ca@1669
   626
ca@1669
   627
    holder isNil ifTrue:[
ca@1669
   628
	holder := nil asValue.
ca@1669
   629
	holder value:classItemList.
ca@1669
   630
	builder aspectAt:#classItemListHolder put:holder.
ca@1669
   631
    ].
ca@1669
   632
    ^ holder
ca@1669
   633
!
ca@1669
   634
ca@1669
   635
classItemModel
ca@1669
   636
    "returns the holder which keeps the current selected class
ca@1669
   637
    "
ca@1669
   638
    ^ classItemModel
ca@1669
   639
!
ca@1669
   640
ca@1646
   641
contentsModifiedChannel
ca@1669
   642
    "boolean holder, which is set to true if the contents assigned to the
ca@1669
   643
     helpKey changed
ca@1646
   644
    "
ca@1646
   645
    ^ contentsModifiedChannel
ca@148
   646
!
ca@148
   647
ca@1646
   648
editModel
ca@1669
   649
    "string holder, which keeps the current editing helpKey as string
ca@1646
   650
    "
ca@1669
   651
    ^ editModel.
tz@696
   652
!
tz@696
   653
cg@1989
   654
enablingCommitButtonsHolder
cg@1989
   655
    "returns the enabling of the commit of this tool as value holder"
cg@1989
   656
cg@1989
   657
    masterApplication notNil ifTrue:[
cg@1989
   658
        ^ masterApplication enablingCommitButtonsHolder
cg@1989
   659
    ].
cg@1989
   660
    ^ contentsModifiedChannel
cg@1989
   661
!
cg@1989
   662
cg@3560
   663
hasKeyItemSelectedHolder
cg@3560
   664
    ^ BlockValue 
cg@3560
   665
        with:[:m | m notNil]
cg@3560
   666
        argument:self keyItemModel
cg@3560
   667
cg@3560
   668
    "Created: / 24-05-2018 / 15:48:51 / Claus Gittinger"
cg@3560
   669
!
cg@3560
   670
cg@3560
   671
hasSpecClassDefined
cg@3560
   672
    ^ [ specClass notNil ]
cg@3560
   673
cg@3560
   674
    "Created: / 24-05-2018 / 15:52:09 / Claus Gittinger"
cg@3560
   675
!
cg@3560
   676
ca@1669
   677
helpTextView
cg@3291
   678
    "the editView which shows the current help contents assigned to the key
ca@1646
   679
    "
ca@1669
   680
    ^ helpTextView
tz@696
   681
!
tz@696
   682
cg@1989
   683
infoLabelHolder
cg@1989
   684
    "returns the info label as value holder"
cg@1989
   685
cg@1989
   686
    masterApplication notNil ifTrue:[
sv@3542
   687
        builder aspectAt:#useAlienInfoLabel put:true.
cg@1989
   688
        ^ masterApplication infoLabelHolder
cg@1989
   689
    ].
cg@1989
   690
    ^ super infoLabelHolder
cg@1989
   691
!
cg@1989
   692
ca@1669
   693
keyItemListHolder
ca@1669
   694
    "holder, which keeps the current hierarchical list
ca@1669
   695
     assigned to the selected class item
ca@1646
   696
    "
ca@1669
   697
    |holder|
ca@1669
   698
ca@1669
   699
    holder := builder bindingAt:#keyItemListHolder.
ca@1669
   700
ca@1669
   701
    holder isNil ifTrue:[
ca@1669
   702
	holder := nil asValue.
ca@1669
   703
	holder value:(classItemList last list).
ca@1669
   704
	builder aspectAt:#keyItemListHolder put:holder.
ca@1669
   705
    ].
ca@1669
   706
    ^ holder
ca@1646
   707
!
tz@779
   708
ca@1669
   709
keyItemModel
ca@1669
   710
    "model which keeps the current selected helpKey or nil
ca@1646
   711
    "
ca@1669
   712
    ^ keyItemModel.
ca@148
   713
! !
ca@148
   714
tz@750
   715
!UIHelpTool methodsFor:'building'!
tz@750
   716
cg@3499
   717
buildAndMergeFromClass:aClassOrClassName
ca@1669
   718
     "setup a new specClass, merge the current items into
ca@1669
   719
     "
cg@3499
   720
     |root mergeItems aClass|
ca@1663
   721
cg@3499
   722
     (aClass := aClassOrClassName) isBehavior ifFalse:[
cg@3499
   723
         aClass := Smalltalk classNamed:aClassOrClassName
cg@3499
   724
     ].
cg@3499
   725
     
ca@1669
   726
     root := classItemList first.
ca@1663
   727
ca@1669
   728
     root isUnspecified ifTrue:[ mergeItems := root children ]
cg@1973
   729
                       ifFalse:[ mergeItems := nil ].
ca@1663
   730
cg@1973
   731
     self loadFromClass:aClass.
ca@1669
   732
ca@1669
   733
     mergeItems size ~~ 0 ifTrue:[
cg@1973
   734
        root := classItemList first.
ca@1669
   735
cg@1973
   736
        mergeItems do:[:anItem| |item hkey|
cg@1973
   737
            hkey := anItem helpKey.
cg@1973
   738
            item := root detectItemWithKey:hkey.
ca@1669
   739
cg@1973
   740
            item isNil ifTrue:[
cg@1973
   741
                item := KeyItem helpKey:hkey helpText:(anItem helpText).
cg@1973
   742
                root add:item sortBlock:[:a :b| a label < b label ].
cg@1973
   743
            ] ifFalse:[
cg@1973
   744
                item helpText:(anItem helpText).
cg@1973
   745
            ]
cg@1973
   746
        ]
ca@1663
   747
    ].
cg@3499
   748
cg@3499
   749
    "Modified: / 01-11-2017 / 21:23:22 / cg"
ca@1663
   750
!
ca@1663
   751
cg@1973
   752
loadFromClass:aClass
tz@779
   753
    "reads the help dictionary from aClass and find remaining classes 
ca@1669
   754
     'between' aClass and ApplicationModel
ca@1669
   755
    " 
cg@3362
   756
    |lastContents root list helpSpecSelector alternativeSelector|
tz@779
   757
cg@2934
   758
    (specClass notNil and:[specClass == aClass]) ifTrue:[
cg@2934
   759
        ^ self.
cg@2934
   760
    ].
cg@2934
   761
cg@1681
   762
    helpSpecSelector := self specSelector.
ca@1646
   763
    specClass := self getHelpSpecClassFromClass:aClass.
ca@1646
   764
cg@3362
   765
    aClass notNil ifTrue:[
cg@3402
   766
        ((aClass theMetaclass implements:helpSpecSelector)
cg@3402
   767
        and:[(aClass theMetaclass compiledMethodAt:helpSpecSelector) hasResource:#help]) ifFalse:[
cg@3402
   768
            alternativeSelector := (self alternativeSpecSelectors ? #()) 
cg@3402
   769
                                        detect:[:sel | 
cg@3402
   770
                                            (aClass theMetaclass implements:sel)
cg@3402
   771
                                            and:[(aClass theMetaclass compiledMethodAt:sel) hasResource:#help]
cg@3402
   772
                                        ] 
cg@3402
   773
                                        ifNone:nil.
cg@3362
   774
            alternativeSelector notNil ifTrue:[
cg@3362
   775
                helpSpecSelector := specSelector := alternativeSelector.
cg@3362
   776
                specClass := aClass.
cg@3362
   777
            ].
cg@3362
   778
        ].
cg@3362
   779
    ].
cg@3362
   780
    
ca@1669
   781
    list := OrderedCollection new.
ca@1669
   782
ca@1669
   783
    (specClass isClass and:[specClass isLoaded]) ifTrue:[
ca@1670
   784
        lastContents := nil.
cg@1973
   785
cg@1973
   786
        self addHistoryEntryForClass:specClass selector:helpSpecSelector.
ca@1669
   787
cg@3199
   788
        specClass withAllSuperclasses reverseDo:[:aClass| |value name|
ca@1670
   789
            lastContents isNil ifTrue:[
ca@1670
   790
                aClass == ApplicationModel ifTrue:[ 
ca@1670
   791
                    lastContents := IdentityDictionary new
ca@1670
   792
                ].
ca@1670
   793
            ] ifFalse:[
ca@1670
   794
                root := ClassItem onClass:aClass.
ca@1669
   795
cg@1973
   796
                (aClass respondsTo: helpSpecSelector) ifTrue:[ 
cg@1973
   797
                    value := aClass perform: helpSpecSelector.
cg@1973
   798
                ].
ca@1669
   799
cg@1973
   800
                value notNil ifTrue:[
cg@3010
   801
                    (value isDictionary) ifTrue:[
cg@2933
   802
                        value keysAndValuesDo:[:k :v| |cval|
cg@2933
   803
                            cval := lastContents at:k ifAbsent:self.
cg@2933
   804
                            cval = v ifFalse:[ root add:(KeyItem helpKey:k helpText:v) ].
cg@2933
   805
                        ].
cg@2933
   806
                        lastContents := value.
cg@2933
   807
                    ] ifFalse:[
cg@2933
   808
                        |dict|
cg@2933
   809
                        dict := Dictionary new.
cg@2933
   810
                        value pairWiseDo:[:k :v| |cval|
cg@2933
   811
                            cval := lastContents at:k ifAbsent:self.
cg@2933
   812
                            cval = v ifFalse:[ root add:(KeyItem helpKey:k helpText:v) ].
cg@2933
   813
                            dict at:k put:v.
cg@2933
   814
                        ].
cg@2933
   815
                        lastContents := dict.
ca@1670
   816
                    ].
ca@1670
   817
                ].
ca@1670
   818
                root sort:[:a :b| a label < b label ].
ca@1670
   819
                root modified:false.
ca@1670
   820
                list add:root.
ca@1670
   821
            ]
ca@1670
   822
        ]
ca@1669
   823
    ].
ca@1669
   824
    list isEmpty ifTrue:[
ca@1670
   825
        list add:(ClassItem onClass:nil)
ca@1646
   826
    ].
ca@1646
   827
ca@1669
   828
    self withoutModifyDo:[
ca@1670
   829
        classItemList contents:list.
ca@1670
   830
        self updateIcons.
ca@1670
   831
        classItemModel value:(list last)
ca@1646
   832
    ].
cg@3402
   833
cg@3402
   834
    "Modified: / 13-02-2017 / 17:47:02 / cg"
cg@1340
   835
!
cg@1340
   836
cg@1973
   837
loadFromClass:aClass andSelector:aSelector
cg@1973
   838
    "reads the help dictionary from aClass"
cg@1973
   839
cg@1973
   840
    self assert:(aClass isNil or:[aClass isClass]).
cg@1973
   841
cg@1340
   842
    specSelector := aSelector.
cg@1973
   843
    self loadFromClass:aClass
cg@1340
   844
!
cg@1340
   845
cg@1973
   846
loadFromHelpTool:aHelpTool
ca@1669
   847
    "build from another helpTool
ca@1669
   848
    "
ca@1669
   849
    specClass     := aHelpTool specClass.
ca@1669
   850
    specSelector  := aHelpTool specSelector.
ca@1669
   851
    classItemList := aHelpTool classItemListHolder value.
cg@1340
   852
ca@1669
   853
    self classItemListHolder value:classItemList.
cg@1340
   854
ca@1669
   855
    classItemModel triggerValue:(classItemList last).
ca@1646
   856
! !
ca@1646
   857
ca@1646
   858
!UIHelpTool methodsFor:'change & update'!
ca@1646
   859
ca@1646
   860
editModelChanged
ca@1669
   861
    "called if the editModel changed
cg@3560
   862
     cg: so does anyone think, that a comment like the above is useful?
cg@3560
   863
     this is called when the text in the edit field (which selects the current key)
cg@3560
   864
     is changed."
cg@3560
   865
     
ca@1646
   866
    |key|
ca@1646
   867
ca@1646
   868
    key := self helpKey.
ca@1646
   869
ca@1669
   870
    modifiedHolder notNil ifTrue:[
cg@1989
   871
        modifiedHolder value:true
ca@1669
   872
    ].
ca@1646
   873
ca@1669
   874
    contentsModifiedChannel value:false.
ca@1646
   875
ca@1646
   876
    key notNil ifTrue:[
cg@1989
   877
        keyItemModel value = key ifTrue:[^ self].
ca@1646
   878
cg@1989
   879
        classItemList reverseDo:[:root| |item|
cg@1989
   880
            item := root detectItemWithKey:key.
ca@1669
   881
cg@1989
   882
            item notNil ifTrue:[
cg@1989
   883
                classItemModel value:root.
cg@1989
   884
                keyItemModel   value:item.
cg@1989
   885
                ^ self.
cg@1989
   886
            ].
cg@1989
   887
        ].
ca@1669
   888
cg@1989
   889
        masterApplication isNil ifTrue:[
cg@1989
   890
            "entered a new helpKey
cg@1989
   891
            "
cg@1989
   892
            self enablingCommitButtonsHolder value:true.
cg@1989
   893
        ].
tz@750
   894
    ].
ca@1669
   895
    keyItemModel value:nil.
cg@3560
   896
cg@3560
   897
    "Modified (comment): / 24-05-2018 / 16:17:16 / Claus Gittinger"
ca@1646
   898
!
cg@963
   899
ca@1646
   900
update:something with:aParameter from:changedObject
ca@1669
   901
    "Invoked when an object that I depend upon sends a change notification.
ca@1669
   902
    "
ca@1669
   903
    |root item list|
cg@963
   904
ca@1669
   905
    changedObject == keyItemModel ifTrue:[
ca@1669
   906
	item := keyItemModel value.
ca@1669
   907
ca@1669
   908
	item notNil ifTrue:[
ca@1669
   909
	    editModel value:(item helpKey).
ca@1669
   910
	].
ca@1669
   911
	self cancel.
ca@1669
   912
	^ self
tz@750
   913
    ].
tz@750
   914
ca@1669
   915
    changedObject == classItemModel ifTrue:[
ca@1669
   916
	root := classItemModel value.
ca@1669
   917
ca@1669
   918
	root notNil ifTrue:[
ca@1669
   919
	    item := root detectItemWithKey:(self helpKey).
ca@1669
   920
	    list := root list.
ca@1669
   921
	] ifFalse:[
ca@1669
   922
	    list := item := nil.
ca@1669
   923
	].
ca@1669
   924
ca@1669
   925
	item notNil ifTrue:[
ca@1669
   926
	    keyItemModel value:nil withoutNotifying:self.
ca@1669
   927
	].
ca@1669
   928
	self keyItemListHolder value:list.
ca@1669
   929
	keyItemModel value:item.
ca@1669
   930
	^ self
ca@1646
   931
    ].
tz@750
   932
ca@1669
   933
    changedObject == editModel ifTrue:[
ca@1669
   934
	self editModelChanged.
ca@1669
   935
	^ self
ca@1646
   936
    ].
ca@148
   937
ca@1669
   938
    changedObject == contentsModifiedChannel ifTrue:[
ca@1669
   939
	modifiedHolder notNil ifTrue:[
ca@1669
   940
	    modifiedHolder value:true
ca@1669
   941
	].
ca@1669
   942
	^ self
ca@1646
   943
    ].
ca@1669
   944
    super update:something with:aParameter from:changedObject
ca@1669
   945
!
tz@779
   946
ca@1669
   947
withoutModifyDo:aBlock
ca@1669
   948
    "discard modifications; trigger not the modifiedHolder during
sv@1723
   949
     the action is active"
sv@1723
   950
ca@1669
   951
    |holder|
ca@286
   952
sv@1723
   953
    modifiedHolder isNil ifTrue:[
sv@1723
   954
        ^ aBlock value
sv@1723
   955
    ].
ca@1669
   956
    holder := modifiedHolder.
sv@1723
   957
    ^ aBlock ensure:[modifiedHolder := holder]
tz@750
   958
! !
tz@750
   959
ca@286
   960
!UIHelpTool methodsFor:'private'!
ca@286
   961
cg@1973
   962
getHelpSpecClassFromClass:aClass
cg@1973
   963
    |cls|
tz@696
   964
cg@1973
   965
    aClass isNil ifTrue:[^ nil].
tz@779
   966
cg@1973
   967
    cls := self resolveName:aClass.
cg@1973
   968
    cls isNil ifTrue:[ ^ nil ].
tz@696
   969
cg@1973
   970
    cls := cls perform:#helpSpecClass ifNotUnderstood:cls.
ca@1646
   971
cg@1973
   972
    (cls isBehavior and:[cls isLoaded]) ifTrue:[
cg@1973
   973
        ^ cls
tz@696
   974
    ].
ca@1669
   975
    ^ nil
tz@696
   976
!
tz@696
   977
cg@1973
   978
loadFromMessage:classAndSelector
ca@1669
   979
    "Set and rebuild the specClass and specSelector from a resource string.
ca@1669
   980
     On success true is returned otherwise false. If the current spec is
cg@1973
   981
     modified, a dialog is launched."
tz@761
   982
cg@1973
   983
    self askForModification ifFalse:[ ^ false].
cg@896
   984
cg@1973
   985
    classAndSelector notNil ifTrue:[
cg@1973
   986
        self loadFromClass:(classAndSelector methodClass) andSelector:(classAndSelector methodSelector).
cg@1973
   987
        ^ true
tz@740
   988
    ].
ca@1669
   989
    ^ false
ca@1670
   990
!
ca@1670
   991
ca@1670
   992
updateIcons
ca@1670
   993
    "update all icons (redefinitions below above or both)
ca@1670
   994
    "
ca@1670
   995
    |iconBelow iconAbove iconAboveAndBelow isBehind redefinedAbove redefinedBelow icon|
ca@1670
   996
ca@1670
   997
    "/ if only one class exists, its not possible to have redefinitions
ca@1670
   998
    classItemList size > 1 ifFalse:[ ^ self ].
ca@1670
   999
ca@1670
  1000
    iconBelow         := SystemBrowser medium_methodRedefinedBelowIcon.
ca@1670
  1001
    iconAbove         := SystemBrowser medium_methodInheritedFromAboveIcon.
ca@1670
  1002
    iconAboveAndBelow := SystemBrowser medium_methodInheritedFromAboveAndRedefinedBelowIcon.
ca@1670
  1003
ca@1670
  1004
    classItemList do:[:runClass|
ca@1670
  1005
        runClass do:[:aKeyItem|
ca@1670
  1006
            isBehind := redefinedBelow := redefinedAbove := false.
ca@1670
  1007
ca@1670
  1008
            classItemList do:[:testClass|
ca@1670
  1009
                testClass == runClass ifTrue:[
ca@1670
  1010
                    isBehind := true
ca@1670
  1011
                ] ifFalse:[
ca@1670
  1012
                    (testClass detectItemWithKey:(aKeyItem helpKey)) notNil ifTrue:[
ca@1670
  1013
                        isBehind ifTrue:[ redefinedBelow := true ]
ca@1670
  1014
                                ifFalse:[ redefinedAbove := true ].
ca@1670
  1015
                    ]
ca@1670
  1016
                ]
ca@1670
  1017
            ].
ca@1670
  1018
ca@1670
  1019
            redefinedBelow ifTrue:[
ca@1670
  1020
                redefinedAbove ifTrue:[ icon := iconAboveAndBelow ]
ca@1670
  1021
                              ifFalse:[ icon := iconBelow ]
ca@1670
  1022
            ] ifFalse:[
ca@1670
  1023
                redefinedAbove ifTrue:[ icon := iconAbove ]
ca@1670
  1024
                              ifFalse:[ icon := nil ]
ca@1670
  1025
            ].
ca@1670
  1026
            aKeyItem icon:icon.
ca@1670
  1027
        ]
ca@1670
  1028
    ].
ca@286
  1029
! !
ca@286
  1030
ca@1669
  1031
!UIHelpTool methodsFor:'startup & release'!
ca@369
  1032
ca@369
  1033
closeRequest
sv@1772
  1034
    "asks for permission before closing"
sv@1772
  1035
sv@1772
  1036
    masterApplication isNil ifTrue:[
sv@1772
  1037
        super closeRequest.
ca@1669
  1038
    ].
tz@740
  1039
!
tz@740
  1040
cg@2002
  1041
commonPostBuild
cg@2002
  1042
    "/ using masters infoHolder ?
sv@3542
  1043
    self useAlienInfoLabel ifTrue:[
cg@2002
  1044
        (builder componentAt:#mainPanel) layout bottomOffset:0.
cg@2002
  1045
        (builder componentAt:#infoBarSubSpec) beInvisible
cg@2002
  1046
    ]
sv@3537
  1047
sv@3537
  1048
    "Modified: / 20-02-2018 / 13:04:50 / stefan"
cg@2002
  1049
!
cg@2002
  1050
tz@740
  1051
initialize
ca@1669
  1052
    "setup default attributes
ca@1669
  1053
    "
ca@1669
  1054
    super initialize.
ca@1669
  1055
    self createBuilder.
tz@779
  1056
ca@1669
  1057
    specSelector   := #helpSpec.
tz@740
  1058
ca@1669
  1059
    classItemList  := List new.
ca@1669
  1060
ca@1669
  1061
    classItemModel := nil asValue.
ca@1669
  1062
    classItemModel addDependent:self.
ca@1669
  1063
ca@1669
  1064
    keyItemModel := nil asValue.
ca@1669
  1065
    keyItemModel addDependent:self.
ca@1669
  1066
ca@1669
  1067
    contentsModifiedChannel := false asValue.
ca@1669
  1068
    contentsModifiedChannel addDependent:self.
ca@1669
  1069
ca@1669
  1070
    helpTextView := EditTextView new.
ca@1669
  1071
    helpTextView acceptAction:[:dummy| self accept ].
ca@1669
  1072
    helpTextView modifiedChannel:contentsModifiedChannel.
tz@740
  1073
ca@1646
  1074
    editModel := nil asValue.
ca@1646
  1075
    editModel addDependent:self.
ca@1646
  1076
cg@1973
  1077
    self loadFromClass:nil.
tz@750
  1078
!
tz@750
  1079
tz@750
  1080
openOnClass:aClass
ca@1669
  1081
    "opens the UIHelpTool on aClass
ca@1669
  1082
    "
cg@1597
  1083
    self openOnClass:aClass andSelector:nil
tz@940
  1084
!
tz@940
  1085
tz@940
  1086
openOnClass:aClass andSelector: aSelector
tz@940
  1087
    "opens the UIHelpTool on aClass and aSelector"
tz@940
  1088
cg@1982
  1089
    self openInterface:#windowSpec "ForStandAlone".
cg@1597
  1090
cg@1973
  1091
    builder window label:'Help Tool'.
cg@1973
  1092
    self loadFromClass:aClass andSelector:aSelector
ca@369
  1093
! !
ca@369
  1094
tz@740
  1095
!UIHelpTool methodsFor:'user actions'!
ca@286
  1096
tz@722
  1097
accept
cg@3560
  1098
    "accepts the help text;
cg@3560
  1099
     take the contents of the helpTextView and store it under the current helpKey"
cg@3560
  1100
cg@3560
  1101
    |helpKey|
tz@779
  1102
ca@1669
  1103
    helpKey := self helpKey.
ca@1669
  1104
    helpKey isNil ifTrue:[^ self].
tz@722
  1105
cg@3560
  1106
    self store:(helpTextView contents) forKey:helpKey
tz@722
  1107
cg@3560
  1108
    "Modified: / 24-05-2018 / 16:31:25 / Claus Gittinger"
tz@722
  1109
!
tz@722
  1110
ca@1646
  1111
cancel
cg@2069
  1112
    "cancel modifications, reload helpText"
cg@2069
  1113
ca@1669
  1114
    |item contents modified|
tz@779
  1115
ca@1669
  1116
    item := keyItemModel value.
ca@1669
  1117
    modified := false.
cg@835
  1118
ca@1669
  1119
    item notNil ifTrue:[
cg@2069
  1120
        contents := item helpText.
ca@1669
  1121
    ] ifFalse:[
cg@2069
  1122
        contents := nil.
ca@1669
  1123
cg@2069
  1124
        modifiedHolder isNil ifTrue:[
cg@2069
  1125
            modified := self helpKey notNil
cg@2069
  1126
        ]
ca@1646
  1127
    ].
ca@1669
  1128
    helpTextView contents:contents.
ca@1669
  1129
    contentsModifiedChannel value:modified.
cg@2069
  1130
cg@2069
  1131
    "Modified: / 29-08-2006 / 10:20:37 / cg"
tz@722
  1132
!
tz@722
  1133
tz@750
  1134
doDelete
ca@1646
  1135
    "deletes the selected help key
ca@1646
  1136
    "
ca@1669
  1137
    |item|
tz@779
  1138
ca@1669
  1139
    item := keyItemModel value.
ca@1670
  1140
ca@1670
  1141
    item notNil ifTrue:[
ca@1670
  1142
        item remove.
ca@1670
  1143
        item icon notNil ifTrue:[ self updateIcons ].
ca@1670
  1144
    ].    
ca@1669
  1145
    editModel value:nil.
tz@722
  1146
!
tz@722
  1147
cg@3560
  1148
doExtractUsedKeys
cg@3560
  1149
    "goes through the classes menu- and interface specs,
cg@3560
  1150
     and extracts possible activeHelpKeys"
cg@3560
  1151
cg@3560
  1152
    |allHelpKeys existingKeys cls missingKeys|
cg@3560
  1153
cg@3560
  1154
    allHelpKeys := Set new.
cg@3560
  1155
    
cg@3560
  1156
    specClass theMetaclass methodsDo:[:mthd |
cg@3560
  1157
        |spec bodyNode retVal specArray menu| 
cg@3560
  1158
cg@3560
  1159
        (mthd hasMenuResource or:[mthd hasCanvasResource]) ifTrue:[
cg@3560
  1160
            bodyNode := mthd parseTree body.
cg@3560
  1161
            bodyNode lastIsReturn ifTrue:[
cg@3560
  1162
                (retVal := bodyNode statements last value) isLiteralArray ifTrue:[
cg@3560
  1163
                    specArray := retVal value.
cg@3560
  1164
                    spec := specArray decodeAsLiteralArray.
cg@3560
  1165
                    spec do:[:eachSpec |
cg@3560
  1166
                        |k|
cg@3560
  1167
cg@3560
  1168
                        (k := eachSpec activeHelpKey) notNil ifTrue:[
cg@3560
  1169
                            allHelpKeys add:k.
cg@3560
  1170
                        ].
cg@3560
  1171
                    ].
cg@3560
  1172
                ]
cg@3560
  1173
            ].
cg@3560
  1174
        ].    
cg@3560
  1175
    ].
cg@3560
  1176
cg@3560
  1177
    existingKeys := Set new.
cg@3560
  1178
    (cls := specClass theMetaclass whichClassImplements:self specSelector) notNil ifTrue:[
cg@3560
  1179
        |specThere|
cg@3560
  1180
        
cg@3560
  1181
        specThere := cls theNonMetaclass perform:self specSelector.
cg@3560
  1182
        specThere isDictionary ifFalse:[
cg@3560
  1183
            Transcript showCR:('oops - helpSpec from ',cls name,'>>',self specSelector,' is not a dictionary').
cg@3560
  1184
        ] ifTrue:[
cg@3560
  1185
            existingKeys addAll:(specThere keys).    
cg@3560
  1186
        ].
cg@3560
  1187
    ].
cg@3560
  1188
cg@3560
  1189
    missingKeys := OrderedCollection new.
cg@3560
  1190
    
cg@3560
  1191
    allHelpKeys do:[:each |
cg@3560
  1192
        (existingKeys includes:each) ifFalse:[
cg@3560
  1193
            missingKeys add:each.
cg@3560
  1194
        ].
cg@3560
  1195
    ].
cg@3560
  1196
    missingKeys do:[:eachKey |
cg@3560
  1197
        self store:'no tooltip yet' forKey:eachKey
cg@3560
  1198
    ].
cg@3560
  1199
cg@3560
  1200
    "Created: / 24-05-2018 / 16:00:08 / Claus Gittinger"
cg@3560
  1201
!
cg@3560
  1202
tz@750
  1203
doLoad
cg@1973
  1204
    "opens a Resource Selection Browser in order to get a resource message"
cg@1973
  1205
tz@750
  1206
    self loadFromMessage: 
cg@1681
  1207
        (ResourceSelectionBrowser
cg@1681
  1208
            request: 'Load Help Spec From Class'
cg@1681
  1209
            onSuperclass: nil
cg@1681
  1210
            andClass: specClass
cg@1681
  1211
            andSelector: (self specSelector)
cg@1681
  1212
            withResourceTypes: (Array with: #help)).
tz@779
  1213
tz@779
  1214
    self updateInfoLabel
tz@750
  1215
!
tz@750
  1216
tz@750
  1217
doNew
ca@1669
  1218
    "reset all to empty
ca@1669
  1219
    "
ca@1669
  1220
    contentsModifiedChannel value:false.
ca@1669
  1221
    self helpKey:nil.
cg@1973
  1222
    self loadFromClass:nil.
tz@750
  1223
!
tz@750
  1224
tz@722
  1225
doSave
cg@1973
  1226
    "save the help spec to the spec-class(es)"
cg@1973
  1227
ca@1669
  1228
    specClass isNil ifTrue:[
cg@3334
  1229
        self information:'No class specified !!'.
ca@1669
  1230
        ^ nil
ca@1669
  1231
    ].
cg@3560
  1232
    
cg@3560
  1233
    "/ cg: the following test is rubbish !!
cg@3560
  1234
    "/    (specClass isSubclassOf:ApplicationModel) ifFalse:[
cg@3560
  1235
    "/        self information:(resources string:'Cannot save help into non-Application class').
cg@3560
  1236
    "/        ^ nil
cg@3560
  1237
    "/    ].
tz@779
  1238
cg@2934
  1239
    classItemList do:[:aClassItem|
cg@2934
  1240
        aClassItem theClass isNil ifTrue:[
cg@2934
  1241
            aClassItem onClass:specClass
cg@2934
  1242
        ].
cg@1681
  1243
        aClassItem createHelpMethodNamed:(self specSelector) 
cg@1681
  1244
    ].
cg@3560
  1245
cg@3560
  1246
    "Modified (format): / 24-05-2018 / 16:25:31 / Claus Gittinger"
ca@1669
  1247
!
ca@1669
  1248
cg@2020
  1249
openDocumentation
cg@2020
  1250
    "opens the documentation file of the Help Tool
cg@2020
  1251
    "
cg@2020
  1252
    self openHTMLDocument: 'tools/uipainter/HelpTool.html'
cg@3560
  1253
!
cg@3560
  1254
cg@3560
  1255
store:helpText forKey:helpKey
cg@3560
  1256
    "store helpText under helpKey"
cg@3560
  1257
cg@3560
  1258
    |helpItem root|
cg@3560
  1259
cg@3560
  1260
    root := classItemModel value.
cg@3560
  1261
    root isNil ifTrue:[^ self].
cg@3560
  1262
cg@3560
  1263
    helpItem := root detectItemWithKey:helpKey.
cg@3560
  1264
cg@3560
  1265
    helpItem isNil ifTrue:[
cg@3560
  1266
        helpItem := KeyItem helpKey:helpKey helpText:helpText.
cg@3560
  1267
        root add:helpItem sortBlock:[:a :b| a label < b label ].
cg@3560
  1268
        self updateIcons.
cg@3560
  1269
    ] ifFalse:[
cg@3560
  1270
        helpItem helpText:(helpTextView contents).
cg@3560
  1271
    ].
cg@3560
  1272
cg@3560
  1273
    contentsModifiedChannel value:false.
cg@3560
  1274
    keyItemModel triggerValue:helpItem.
cg@3560
  1275
cg@3560
  1276
    "Created: / 24-05-2018 / 16:31:08 / Claus Gittinger"
cg@2020
  1277
! !
ca@1669
  1278
cg@2020
  1279
!UIHelpTool::ClassItem class methodsFor:'instance creation'!
cg@2020
  1280
cg@2020
  1281
onClass:aClass
cg@2020
  1282
    |root|
cg@2020
  1283
cg@2020
  1284
    root := self new.
cg@2020
  1285
    root onClass:aClass.
cg@2020
  1286
    ^ root
cg@2020
  1287
! !
cg@2020
  1288
cg@2020
  1289
!UIHelpTool::ClassItem methodsFor:'accessing'!
ca@1669
  1290
ca@1669
  1291
list
ca@1669
  1292
    "returns the hierarchical list assigned to the classItem; the
ca@1669
  1293
     list contains the keyItems
ca@1669
  1294
    "
ca@1669
  1295
    list isNil ifTrue:[
ca@1669
  1296
	list := HierarchicalList new.
ca@1669
  1297
	list showRoot:false.
ca@1669
  1298
	list root:self.
ca@1669
  1299
    ].
ca@1669
  1300
    ^ list
ca@1669
  1301
!
ca@1669
  1302
ca@1669
  1303
theClass
ca@1669
  1304
    "returns the class or nil if unspecified
ca@1669
  1305
    "
ca@1669
  1306
    ^ theClass
ca@1669
  1307
! !
ca@1669
  1308
cg@2020
  1309
!UIHelpTool::ClassItem methodsFor:'change & update'!
ca@1669
  1310
ca@1669
  1311
helpTextChangedFor:anItem
ca@1669
  1312
    "called if an helpKey changed its contents
ca@1669
  1313
    "
ca@1669
  1314
    self model notNil ifTrue:[
ca@1669
  1315
	self   modified:true.
ca@1669
  1316
	anItem modified:true.
ca@1669
  1317
    ].
ca@1669
  1318
! !
ca@1669
  1319
ca@1669
  1320
!UIHelpTool::ClassItem methodsFor:'code generation'!
ca@1669
  1321
ca@1669
  1322
createHelpMethodNamed:aMethodName
cg@3402
  1323
    "cg: special case for helpPairs.
cg@3402
  1324
     this returns a plain array, not invoking super"
cg@3402
  1325
     
ca@1669
  1326
    |stream|
ca@1669
  1327
cg@2934
  1328
    modified ifFalse:[
ca@1669
  1329
        ^ self
ca@1669
  1330
    ].
cg@2934
  1331
    theClass isNil ifTrue:[
cg@2934
  1332
        theClass := Dialog requestClass:'Save helpSpec in which class?' initialAnswer:''.
cg@2934
  1333
        theClass isNil ifTrue:[
cg@2934
  1334
            ^ self
cg@2934
  1335
        ].
cg@2934
  1336
    ].
ca@1669
  1337
    stream := '' writeStream.
ca@1669
  1338
cg@3402
  1339
    aMethodName = 'helpPairs' ifTrue:[
cg@3402
  1340
        stream nextPutAll:
cg@3402
  1341
            aMethodName, '\' withCRs,
cg@3402
  1342
            (ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs,
cg@3402
  1343
    '\\' withCRs,
cg@3402
  1344
    '    "\' withCRs,
cg@3402
  1345
    '     UIHelpTool openOnClass:', theClass name asString ,'
cg@3402
  1346
    "
cg@3402
  1347
cg@3402
  1348
    <resource: #help>
cg@3402
  1349
cg@3402
  1350
    ^ #(
cg@3402
  1351
cg@3402
  1352
'.
cg@3402
  1353
    ] ifFalse:[    
cg@3402
  1354
        stream nextPutAll:
cg@3402
  1355
            aMethodName, '\' withCRs,
cg@3402
  1356
            (ResourceSpecEditor codeGenerationCommentForClass:UIHelpTool) withCRs,
ca@1669
  1357
    '\\' withCRs,
ca@1669
  1358
    '    "\' withCRs,
mawalch@3318
  1359
    '     UIHelpTool openOnClass:', theClass name asString ,'
ca@1669
  1360
    "
ca@1669
  1361
ca@1669
  1362
    <resource: #help>
ca@1669
  1363
ca@1669
  1364
    ^ super ', aMethodName, ' addPairsFrom:#(
ca@1669
  1365
ca@1669
  1366
'.
cg@3402
  1367
    ].
cg@3402
  1368
    
ca@1669
  1369
    self do:[:aKeyItem| |helpText|
ca@1669
  1370
        helpText := aKeyItem helpText.
ca@1669
  1371
        helpText isNil ifTrue:[ helpText := '' ].
ca@1669
  1372
ca@1669
  1373
        stream nextPutLine:(aKeyItem helpKey storeString).
ca@1669
  1374
        stream nextPutLine:(helpText storeString); cr.
ca@1669
  1375
    ].
ca@1669
  1376
    stream nextPutLine:')'.
ca@1669
  1377
mawalch@3318
  1378
    Compiler
ca@1669
  1379
        compile:(stream contents)
mawalch@3318
  1380
        forClass:theClass class
ca@1669
  1381
        inCategory:'help specs'.
ca@1669
  1382
ca@1669
  1383
    self modified:false.
cg@3402
  1384
cg@3402
  1385
    "Modified: / 13-02-2017 / 17:51:53 / cg"
cg@2020
  1386
! !
ca@1669
  1387
cg@2020
  1388
!UIHelpTool::ClassItem methodsFor:'displaying'!
cg@2020
  1389
cg@2020
  1390
icon
cg@2020
  1391
    "returns the display icon (always nil)
cg@2020
  1392
    "
cg@2020
  1393
    ^ nil
cg@2020
  1394
!
cg@2020
  1395
cg@2020
  1396
label
cg@2020
  1397
    "returns the display label
cg@2020
  1398
    "
cg@2020
  1399
    |label|
cg@2020
  1400
cg@2020
  1401
    theClass notNil ifTrue:[ label := theClass name ]
cg@2020
  1402
		   ifFalse:[ label := '** not yet defined **' ].
cg@2020
  1403
cg@2020
  1404
    modified ifTrue:[
cg@2020
  1405
	label := Text string:label color:(Color red).
cg@2020
  1406
    ].
cg@2020
  1407
    ^ label
cg@2020
  1408
! !
cg@2020
  1409
cg@2020
  1410
!UIHelpTool::ClassItem methodsFor:'instance creation'!
ca@1669
  1411
ca@1669
  1412
initialize
cg@3397
  1413
    "setup defaults"
cg@3397
  1414
ca@1669
  1415
    super initialize.
ca@1669
  1416
ca@1669
  1417
    children   := OrderedCollection new.
ca@1669
  1418
    isExpanded := true.
ca@1669
  1419
    modified   := false.
cg@3397
  1420
cg@3397
  1421
    "Modified: / 08-02-2017 / 01:02:14 / cg"
ca@1669
  1422
!
ca@1669
  1423
ca@1669
  1424
onClass:aClass
ca@1669
  1425
    "the class the ys are assigned to; if the class is nil,
ca@1669
  1426
     the class is not yet specified.
ca@1669
  1427
    "
ca@1669
  1428
    theClass := aClass.
ca@1669
  1429
! !
ca@1669
  1430
ca@1669
  1431
!UIHelpTool::ClassItem methodsFor:'private'!
ca@1669
  1432
ca@1669
  1433
basicAdd:aChild sortBlock:aBlock
ca@1669
  1434
    "catch low-level add to update the modification flag
ca@1669
  1435
    "
ca@1669
  1436
    self   modified:true.
ca@1669
  1437
    aChild modified:true.
ca@1669
  1438
ca@1669
  1439
    ^ super basicAdd:aChild sortBlock:aBlock.
ca@1669
  1440
!
ca@1669
  1441
ca@1669
  1442
basicAddAll:aList beforeIndex:anIndex
ca@1669
  1443
    "catch low-level add to update the modification flag
ca@1669
  1444
    "
ca@1669
  1445
    self modified:true.
ca@1669
  1446
cg@2020
  1447
    aList do:[:el| el modified:true ].
cg@2020
  1448
    ^ super basicAddAll:aList beforeIndex:anIndex.
cg@2020
  1449
!
ca@1669
  1450
ca@1669
  1451
basicRemoveFromIndex:startIndex toIndex:stopIndex
ca@1669
  1452
    "catch low-level remove to update the modification flag
ca@1669
  1453
    "
ca@1669
  1454
    self isUnspecified ifFalse:[
ca@1669
  1455
	self modified:true.
ca@1669
  1456
    ].
ca@1669
  1457
    ^ super basicRemoveFromIndex:startIndex toIndex:stopIndex
ca@1669
  1458
! !
ca@1669
  1459
ca@1669
  1460
!UIHelpTool::ClassItem methodsFor:'queries'!
ca@1669
  1461
ca@1669
  1462
isUnspecified
ca@1669
  1463
    "true if the class is unspecified
ca@1669
  1464
    "
ca@1669
  1465
    ^ theClass isNil
ca@1669
  1466
!
ca@1669
  1467
ca@1669
  1468
modified
cg@2020
  1469
    "true, if any item is modified, created or deleted
cg@2020
  1470
    "
cg@2020
  1471
    ^ modified
cg@2020
  1472
!
ca@1669
  1473
ca@1669
  1474
modified:aBoolean
ca@1669
  1475
    "true, if any item is modified, created or deleted
ca@1669
  1476
    "
ca@1669
  1477
    modified ~~ aBoolean ifTrue:[
ca@1669
  1478
	modified := aBoolean.
ca@1669
  1479
ca@1669
  1480
	modified ifFalse:[
ca@1669
  1481
	    self do:[:el| el modified:false ].
ca@1669
  1482
	].
ca@1669
  1483
    ].
ca@1669
  1484
! !
ca@1669
  1485
ca@1669
  1486
!UIHelpTool::ClassItem methodsFor:'searching'!
ca@1669
  1487
ca@1669
  1488
detectItemWithKey:aKey
ca@1669
  1489
    "returns the item assigned to a helpKey or nil
ca@1669
  1490
    "
ca@1669
  1491
    |key|
ca@1669
  1492
cg@2037
  1493
    aKey isEmptyOrNil ifTrue:[ ^ nil ].
cg@2037
  1494
    key := aKey asSymbol.
ca@1669
  1495
cg@2037
  1496
    self do:[:anItem|
cg@2037
  1497
        anItem helpKey == key ifTrue:[ ^ anItem ].
ca@1669
  1498
    ].
cg@2020
  1499
    ^ nil
ca@1669
  1500
! !
ca@1669
  1501
cg@2020
  1502
!UIHelpTool::KeyItem class methodsFor:'instance creation'!
ca@1669
  1503
cg@2020
  1504
helpKey:aKey helpText:aText 
cg@2020
  1505
    |key|
ca@1669
  1506
cg@2020
  1507
    key := self new.
cg@2020
  1508
    key helpKey:aKey helpText:aText.
cg@2020
  1509
    ^ key
cg@2020
  1510
! !
cg@2020
  1511
cg@2020
  1512
!UIHelpTool::KeyItem methodsFor:'accessing'!
ca@1669
  1513
ca@1669
  1514
helpKey
cg@3291
  1515
    "returns the helpKey, a symbol"
cg@3291
  1516
ca@1669
  1517
    ^ helpKey
ca@1669
  1518
!
ca@1669
  1519
ca@1669
  1520
helpText
ca@1669
  1521
    "returns the contents assigned to the helpKey or nil
ca@1669
  1522
    "
ca@1669
  1523
    ^ helpText
ca@1669
  1524
!
ca@1669
  1525
ca@1669
  1526
helpText:aText
cg@1681
  1527
    "set the contents assigned to the helpKey; if the contents changes,
ca@1669
  1528
     a notification is raised.
ca@1669
  1529
    "
ca@1669
  1530
    |text|
ca@1669
  1531
ca@1669
  1532
    text := self formatText:aText.
ca@1669
  1533
ca@1669
  1534
    text ~= helpText ifTrue:[
cg@1681
  1535
        helpText := text.
ca@1669
  1536
cg@1681
  1537
        (modified or:[parent isNil]) ifFalse:[
cg@1681
  1538
            parent helpTextChangedFor:self.
cg@1681
  1539
        ]
ca@1669
  1540
    ].
ca@1669
  1541
! !
ca@1669
  1542
cg@2020
  1543
!UIHelpTool::KeyItem methodsFor:'displaying'!
cg@2020
  1544
cg@2020
  1545
icon
cg@2020
  1546
    "returns the display icon (always nil)
cg@2020
  1547
    "
cg@2020
  1548
    ^ icon
ca@1670
  1549
!
ca@1670
  1550
cg@2020
  1551
icon:anIcon
cg@2020
  1552
cg@2020
  1553
    icon ~= anIcon ifTrue:[
cg@2020
  1554
        icon := anIcon.
cg@2020
  1555
        self changed:#icon.
cg@2020
  1556
    ].
cg@2020
  1557
!
cg@2020
  1558
cg@2020
  1559
label
cg@2020
  1560
    "returns the display label
cg@2020
  1561
    "
cg@2020
  1562
    modified ifTrue:[
cg@2020
  1563
	^ Text string:helpKey color:(Color red)
cg@2020
  1564
    ].
cg@2020
  1565
    ^ helpKey
cg@2020
  1566
! !
cg@2020
  1567
cg@2020
  1568
!UIHelpTool::KeyItem methodsFor:'instance creation'!
cg@2020
  1569
ca@1669
  1570
helpKey:aKey helpText:aText
ca@1669
  1571
    "set the key and contents without a change notification
ca@1669
  1572
    "
ca@1669
  1573
    helpKey  := aKey asSymbol.
ca@1669
  1574
    helpText := self formatText:aText.
ca@1669
  1575
!
ca@1669
  1576
ca@1669
  1577
initialize
cg@3397
  1578
    "setup defaults"
cg@3397
  1579
ca@1669
  1580
    super initialize.
ca@1669
  1581
    children := #().
ca@1669
  1582
    modified := false.
cg@3397
  1583
cg@3397
  1584
    "Modified: / 08-02-2017 / 01:01:49 / cg"
ca@1669
  1585
! !
ca@1669
  1586
ca@1669
  1587
!UIHelpTool::KeyItem methodsFor:'private'!
ca@1669
  1588
ca@1669
  1589
formatText:aText
ca@1669
  1590
    "format the text, replace carriage return by spaces and compress spaces
ca@1669
  1591
    "
ca@1669
  1592
    |text result|
ca@1669
  1593
ca@1669
  1594
    aText size ~~ 0 ifTrue:[
ca@1669
  1595
	text := aText asString asCollectionOfWords.
ca@1669
  1596
ca@1669
  1597
	text notEmpty ifTrue:[
ca@1669
  1598
	    result := text first.
ca@1669
  1599
ca@1669
  1600
	    text from:2 do:[:t| result := result, ' ', t ].
cg@2020
  1601
	    ^ result
cg@2020
  1602
       ].
cg@2020
  1603
    ].
cg@2020
  1604
    ^ nil
cg@2020
  1605
! !
cg@2020
  1606
cg@2020
  1607
!UIHelpTool::KeyItem methodsFor:'queries'!
cg@2020
  1608
cg@2020
  1609
modified
cg@2020
  1610
    "returns true if the helpText is modified
cg@2020
  1611
    "
cg@2020
  1612
    ^ modified
cg@2020
  1613
!
ca@1669
  1614
ca@1669
  1615
modified:aBoolean
ca@1669
  1616
    "set the modification flag
ca@1669
  1617
    "
ca@1669
  1618
    aBoolean == modified ifFalse:[
ca@1669
  1619
	modified := aBoolean.
ca@1669
  1620
	self changed:#redraw.
ca@1669
  1621
    ].
ca@148
  1622
! !
ca@148
  1623
ca@148
  1624
!UIHelpTool class methodsFor:'documentation'!
ca@148
  1625
ca@148
  1626
version
ca@148
  1627
    ^ '$Header$'
cg@2665
  1628
!
cg@2665
  1629
cg@2665
  1630
version_CVS
cg@2665
  1631
    ^ '$Header$'
ca@148
  1632
! !
cg@3010
  1633