ResourceSelectionBrowser.st
author tz
Thu, 29 Jan 1998 15:29:00 +0100
changeset 517 91ff807d8a23
parent 504 1ff52096d1d3
child 523 eec155f1b037
permissions -rw-r--r--
set resource selection after opening
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
425
cf47d420764a initial checkin
tz
parents:
diff changeset
     1
"
504
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
     2
 COPYRIGHT (c) 1997 by eXept Software AG
425
cf47d420764a initial checkin
tz
parents:
diff changeset
     3
              All Rights Reserved
cf47d420764a initial checkin
tz
parents:
diff changeset
     4
cf47d420764a initial checkin
tz
parents:
diff changeset
     5
 This software is furnished under a license and may be used
cf47d420764a initial checkin
tz
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
cf47d420764a initial checkin
tz
parents:
diff changeset
     7
 inclusion of the above copyright notice. This software may not
cf47d420764a initial checkin
tz
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
cf47d420764a initial checkin
tz
parents:
diff changeset
     9
 other person. No title to or ownership of the software is
cf47d420764a initial checkin
tz
parents:
diff changeset
    10
 hereby transferred.
cf47d420764a initial checkin
tz
parents:
diff changeset
    11
"
cf47d420764a initial checkin
tz
parents:
diff changeset
    12
cf47d420764a initial checkin
tz
parents:
diff changeset
    13
cf47d420764a initial checkin
tz
parents:
diff changeset
    14
SelectionBrowser subclass:#ResourceSelectionBrowser
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
    15
	instanceVariableNames:'resourceMethod resourceClass resourceSuperclass resourceTypes
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
    16
		allClasses'
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    17
	classVariableNames:''
cf47d420764a initial checkin
tz
parents:
diff changeset
    18
	poolDictionaries:''
cf47d420764a initial checkin
tz
parents:
diff changeset
    19
	category:'Interface-Advanced-Tools'
cf47d420764a initial checkin
tz
parents:
diff changeset
    20
!
cf47d420764a initial checkin
tz
parents:
diff changeset
    21
cf47d420764a initial checkin
tz
parents:
diff changeset
    22
!ResourceSelectionBrowser class methodsFor:'documentation'!
cf47d420764a initial checkin
tz
parents:
diff changeset
    23
cf47d420764a initial checkin
tz
parents:
diff changeset
    24
copyright
cf47d420764a initial checkin
tz
parents:
diff changeset
    25
"
504
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    26
 COPYRIGHT (c) 1997 by eXept Software AG
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    27
              All Rights Reserved
cf47d420764a initial checkin
tz
parents:
diff changeset
    28
cf47d420764a initial checkin
tz
parents:
diff changeset
    29
 This software is furnished under a license and may be used
cf47d420764a initial checkin
tz
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
cf47d420764a initial checkin
tz
parents:
diff changeset
    31
 inclusion of the above copyright notice. This software may not
cf47d420764a initial checkin
tz
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
cf47d420764a initial checkin
tz
parents:
diff changeset
    33
 other person. No title to or ownership of the software is
cf47d420764a initial checkin
tz
parents:
diff changeset
    34
 hereby transferred.
cf47d420764a initial checkin
tz
parents:
diff changeset
    35
"
cf47d420764a initial checkin
tz
parents:
diff changeset
    36
cf47d420764a initial checkin
tz
parents:
diff changeset
    37
!
cf47d420764a initial checkin
tz
parents:
diff changeset
    38
cf47d420764a initial checkin
tz
parents:
diff changeset
    39
documentation
cf47d420764a initial checkin
tz
parents:
diff changeset
    40
"
504
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    41
    [start with:]
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    42
        ResourceSelectionBrowser open
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    43
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    44
    [author:]
1ff52096d1d3 copyright changed
tz
parents: 481
diff changeset
    45
        Thomas Zwick
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    46
"
cf47d420764a initial checkin
tz
parents:
diff changeset
    47
!
cf47d420764a initial checkin
tz
parents:
diff changeset
    48
cf47d420764a initial checkin
tz
parents:
diff changeset
    49
history
cf47d420764a initial checkin
tz
parents:
diff changeset
    50
    "Created: / 10.1.1998 / 10:59:18 / tz"
cf47d420764a initial checkin
tz
parents:
diff changeset
    51
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
    52
cf47d420764a initial checkin
tz
parents:
diff changeset
    53
!ResourceSelectionBrowser class methodsFor:'instance creation'!
cf47d420764a initial checkin
tz
parents:
diff changeset
    54
cf47d420764a initial checkin
tz
parents:
diff changeset
    55
request: aTitle onSuperclass: aSuperclass andClass: aClass andSelector: aSelector withResourceTypes: aResourceTypes
cf47d420764a initial checkin
tz
parents:
diff changeset
    56
cf47d420764a initial checkin
tz
parents:
diff changeset
    57
    "self
cf47d420764a initial checkin
tz
parents:
diff changeset
    58
        request: 'Select A Resource Selector'
cf47d420764a initial checkin
tz
parents:
diff changeset
    59
        onSuperclass: #ApplicationModel 
cf47d420764a initial checkin
tz
parents:
diff changeset
    60
        andClass: #ToolApplicationModel 
cf47d420764a initial checkin
tz
parents:
diff changeset
    61
        andSelector: #saveIcon 
517
91ff807d8a23 set resource selection after opening
tz
parents: 504
diff changeset
    62
        withResourceTypes: #(image) 
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    63
    "
cf47d420764a initial checkin
tz
parents:
diff changeset
    64
cf47d420764a initial checkin
tz
parents:
diff changeset
    65
    ^self new
cf47d420764a initial checkin
tz
parents:
diff changeset
    66
        title: aTitle;
cf47d420764a initial checkin
tz
parents:
diff changeset
    67
        openOnSuperclass: aSuperclass
cf47d420764a initial checkin
tz
parents:
diff changeset
    68
        andClass: aClass
cf47d420764a initial checkin
tz
parents:
diff changeset
    69
        andSelector: aSelector
cf47d420764a initial checkin
tz
parents:
diff changeset
    70
        withResourceTypes: aResourceTypes
cf47d420764a initial checkin
tz
parents:
diff changeset
    71
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
    72
cf47d420764a initial checkin
tz
parents:
diff changeset
    73
!ResourceSelectionBrowser class methodsFor:'interface specs'!
cf47d420764a initial checkin
tz
parents:
diff changeset
    74
cf47d420764a initial checkin
tz
parents:
diff changeset
    75
windowSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
    76
    "this window spec was automatically generated by the ST/X UIPainter"
cf47d420764a initial checkin
tz
parents:
diff changeset
    77
cf47d420764a initial checkin
tz
parents:
diff changeset
    78
    "do not manually edit this - the painter/builder may not be able to
cf47d420764a initial checkin
tz
parents:
diff changeset
    79
     handle the specification if its corrupted."
cf47d420764a initial checkin
tz
parents:
diff changeset
    80
cf47d420764a initial checkin
tz
parents:
diff changeset
    81
    "
cf47d420764a initial checkin
tz
parents:
diff changeset
    82
     UIPainter new openOnClass:ResourceSelectionBrowser andSelector:#windowSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
    83
     ResourceSelectionBrowser new openInterface:#windowSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
    84
    "
cf47d420764a initial checkin
tz
parents:
diff changeset
    85
    "ResourceSelectionBrowser open"
cf47d420764a initial checkin
tz
parents:
diff changeset
    86
cf47d420764a initial checkin
tz
parents:
diff changeset
    87
    <resource: #canvas>
cf47d420764a initial checkin
tz
parents:
diff changeset
    88
cf47d420764a initial checkin
tz
parents:
diff changeset
    89
    ^
468
bb4e776b9210 levels changed
tz
parents: 467
diff changeset
    90
     
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    91
       #(#FullSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
    92
          #'window:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
    93
           #(#WindowSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
    94
              #'name:' 'Resource Browser'
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
    95
              #'layout:' #(#LayoutFrame 315 0 311 0 726 0 610 0)
425
cf47d420764a initial checkin
tz
parents:
diff changeset
    96
              #'label:' 'Resource Browser'
cf47d420764a initial checkin
tz
parents:
diff changeset
    97
              #'min:' #(#Point 400 300)
cf47d420764a initial checkin
tz
parents:
diff changeset
    98
              #'max:' #(#Point 1152 864)
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
    99
              #'bounds:' #(#Rectangle 315 311 727 611)
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   100
              #'usePreferredExtent:' false
cf47d420764a initial checkin
tz
parents:
diff changeset
   101
          )
cf47d420764a initial checkin
tz
parents:
diff changeset
   102
          #'component:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   103
           #(#SpecCollection
cf47d420764a initial checkin
tz
parents:
diff changeset
   104
              #'collection:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   105
               #(
cf47d420764a initial checkin
tz
parents:
diff changeset
   106
                 #(#VariableHorizontalPanelSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   107
                    #'name:' 'variableHorizontalPanel'
cf47d420764a initial checkin
tz
parents:
diff changeset
   108
                    #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -40 1.0)
cf47d420764a initial checkin
tz
parents:
diff changeset
   109
                    #'component:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   110
                     #(#SpecCollection
cf47d420764a initial checkin
tz
parents:
diff changeset
   111
                        #'collection:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   112
                         #(
cf47d420764a initial checkin
tz
parents:
diff changeset
   113
                           #(#ViewSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   114
                              #'name:' 'view1'
cf47d420764a initial checkin
tz
parents:
diff changeset
   115
                              #'component:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   116
                               #(#SpecCollection
cf47d420764a initial checkin
tz
parents:
diff changeset
   117
                                  #'collection:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   118
                                   #(
cf47d420764a initial checkin
tz
parents:
diff changeset
   119
                                     #(#SelectionInTreeViewSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   120
                                        #'name:' 'listOfClassesView'
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   121
                                        #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -22 1.0)
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   122
                                        #'model:' #selectionOfClass
cf47d420764a initial checkin
tz
parents:
diff changeset
   123
                                        #'hasHorizontalScrollBar:' true
cf47d420764a initial checkin
tz
parents:
diff changeset
   124
                                        #'hasVerticalScrollBar:' true
cf47d420764a initial checkin
tz
parents:
diff changeset
   125
                                        #'miniScrollerHorizontal:' true
cf47d420764a initial checkin
tz
parents:
diff changeset
   126
                                        #'showRoot:' false
468
bb4e776b9210 levels changed
tz
parents: 467
diff changeset
   127
                                        #'showDirectoryIndicatorForRoot:' false
bb4e776b9210 levels changed
tz
parents: 467
diff changeset
   128
                                        #'showDirectoryIndicator:' true
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   129
                                        #'valueChangeSelector:' #'classSelected:'
cf47d420764a initial checkin
tz
parents:
diff changeset
   130
                                        #'hierarchicalList:' #listOfClasses
cf47d420764a initial checkin
tz
parents:
diff changeset
   131
                                    )
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   132
                                     #(#InputFieldSpec
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   133
                                        #'name:' 'classNameInputField'
472
e86278147361 layout changed
tz
parents: 471
diff changeset
   134
                                        #'layout:' #(#LayoutFrame 0 0.0 -22 1 -1 1.0 0 1)
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   135
                                        #'model:' #valueOfClassName
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   136
                                    )
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   137
                                  )
cf47d420764a initial checkin
tz
parents:
diff changeset
   138
                              )
cf47d420764a initial checkin
tz
parents:
diff changeset
   139
                          )
cf47d420764a initial checkin
tz
parents:
diff changeset
   140
                           #(#ViewSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   141
                              #'name:' 'view2'
cf47d420764a initial checkin
tz
parents:
diff changeset
   142
                              #'component:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   143
                               #(#SpecCollection
cf47d420764a initial checkin
tz
parents:
diff changeset
   144
                                  #'collection:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   145
                                   #(
cf47d420764a initial checkin
tz
parents:
diff changeset
   146
                                     #(#DataSetSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   147
                                        #'name:' 'resourcesDataSetView'
cf47d420764a initial checkin
tz
parents:
diff changeset
   148
                                        #'layout:' #(#LayoutFrame 2 0.0 0 0.0 2 1.0 -22 1.0)
cf47d420764a initial checkin
tz
parents:
diff changeset
   149
                                        #'model:' #selectionOfResource
cf47d420764a initial checkin
tz
parents:
diff changeset
   150
                                        #'hasHorizontalScrollBar:' true
cf47d420764a initial checkin
tz
parents:
diff changeset
   151
                                        #'hasVerticalScrollBar:' true
cf47d420764a initial checkin
tz
parents:
diff changeset
   152
                                        #'miniScrollerHorizontal:' true
cf47d420764a initial checkin
tz
parents:
diff changeset
   153
                                        #'dataList:' #listOfResources
cf47d420764a initial checkin
tz
parents:
diff changeset
   154
                                        #'useIndex:' false
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   155
                                        #'has3Dsepartors:' true
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   156
                                        #'doubleClickSelector:' #resourceDoubleClicked
cf47d420764a initial checkin
tz
parents:
diff changeset
   157
                                        #'valueChangeSelector:' #resourceSelected
cf47d420764a initial checkin
tz
parents:
diff changeset
   158
                                        #'verticalSpacing:' 1
cf47d420764a initial checkin
tz
parents:
diff changeset
   159
                                        #'columns:' 
cf47d420764a initial checkin
tz
parents:
diff changeset
   160
                                         #(
cf47d420764a initial checkin
tz
parents:
diff changeset
   161
                                           #(#DataSetColumnSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   162
                                              #'width:' 20
cf47d420764a initial checkin
tz
parents:
diff changeset
   163
                                              #'printSelector:' #'iconOn:'
cf47d420764a initial checkin
tz
parents:
diff changeset
   164
                                              #'canSelect:' false
cf47d420764a initial checkin
tz
parents:
diff changeset
   165
                                          )
cf47d420764a initial checkin
tz
parents:
diff changeset
   166
                                           #(#DataSetColumnSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   167
                                              #'label:' 'Selector'
cf47d420764a initial checkin
tz
parents:
diff changeset
   168
                                              #'model:' #selector
cf47d420764a initial checkin
tz
parents:
diff changeset
   169
                                              #'canSelect:' false
cf47d420764a initial checkin
tz
parents:
diff changeset
   170
                                          )
cf47d420764a initial checkin
tz
parents:
diff changeset
   171
                                           #(#DataSetColumnSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   172
                                              #'label:' 'Resource'
cf47d420764a initial checkin
tz
parents:
diff changeset
   173
                                              #'model:' #resourceType
cf47d420764a initial checkin
tz
parents:
diff changeset
   174
                                              #'canSelect:' false
cf47d420764a initial checkin
tz
parents:
diff changeset
   175
                                          )
cf47d420764a initial checkin
tz
parents:
diff changeset
   176
                                        )
cf47d420764a initial checkin
tz
parents:
diff changeset
   177
                                    )
cf47d420764a initial checkin
tz
parents:
diff changeset
   178
                                     #(#InputFieldSpec
cf47d420764a initial checkin
tz
parents:
diff changeset
   179
                                        #'name:' 'selectorInputField'
cf47d420764a initial checkin
tz
parents:
diff changeset
   180
                                        #'layout:' #(#LayoutFrame 2 0.0 -22 1 2 1.0 0 1)
cf47d420764a initial checkin
tz
parents:
diff changeset
   181
                                        #'model:' #valueOfSelector
cf47d420764a initial checkin
tz
parents:
diff changeset
   182
                                    )
cf47d420764a initial checkin
tz
parents:
diff changeset
   183
                                  )
cf47d420764a initial checkin
tz
parents:
diff changeset
   184
                              )
cf47d420764a initial checkin
tz
parents:
diff changeset
   185
                          )
cf47d420764a initial checkin
tz
parents:
diff changeset
   186
                        )
cf47d420764a initial checkin
tz
parents:
diff changeset
   187
                    )
cf47d420764a initial checkin
tz
parents:
diff changeset
   188
                    #'handles:' #(#Any 0.5 1.0)
cf47d420764a initial checkin
tz
parents:
diff changeset
   189
                )
436
07be1c96bb58 *** empty log message ***
tz
parents: 435
diff changeset
   190
                 #(#UISubSpecification
07be1c96bb58 *** empty log message ***
tz
parents: 435
diff changeset
   191
                    #'name:' 'SubSpecification'
07be1c96bb58 *** empty log message ***
tz
parents: 435
diff changeset
   192
                    #'layout:' #(#LayoutFrame 2 0.0 -32 1 -2 1.0 -8 1.0)
07be1c96bb58 *** empty log message ***
tz
parents: 435
diff changeset
   193
                    #'majorKey:' #ToolApplicationModel
07be1c96bb58 *** empty log message ***
tz
parents: 435
diff changeset
   194
                    #'minorKey:' #windowSpecForCommitWithoutChannels
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   195
                )
cf47d420764a initial checkin
tz
parents:
diff changeset
   196
              )
cf47d420764a initial checkin
tz
parents:
diff changeset
   197
          )
cf47d420764a initial checkin
tz
parents:
diff changeset
   198
      )
cf47d420764a initial checkin
tz
parents:
diff changeset
   199
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   200
cf47d420764a initial checkin
tz
parents:
diff changeset
   201
!ResourceSelectionBrowser methodsFor:'accessing - views'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   202
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   203
classNameInputField
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   204
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   205
    ^builder componentAt: #classNameInputField
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   206
!
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   207
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   208
listOfClassesView
cf47d420764a initial checkin
tz
parents:
diff changeset
   209
cf47d420764a initial checkin
tz
parents:
diff changeset
   210
    ^builder componentAt: #listOfClassesView
cf47d420764a initial checkin
tz
parents:
diff changeset
   211
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   212
cf47d420764a initial checkin
tz
parents:
diff changeset
   213
!ResourceSelectionBrowser methodsFor:'aspects'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   214
cf47d420764a initial checkin
tz
parents:
diff changeset
   215
listOfClasses
cf47d420764a initial checkin
tz
parents:
diff changeset
   216
cf47d420764a initial checkin
tz
parents:
diff changeset
   217
    |holder|
cf47d420764a initial checkin
tz
parents:
diff changeset
   218
    (holder := builder bindingAt:#listOfClasses) isNil ifTrue:[
cf47d420764a initial checkin
tz
parents:
diff changeset
   219
        builder aspectAt:#listOfClasses put:
cf47d420764a initial checkin
tz
parents:
diff changeset
   220
            (holder := 
471
855c13ba3901 default selection on Object
tz
parents: 468
diff changeset
   221
                (TreeItem name: (resourceSuperclass ? #Object))
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   222
                    children: (OrderedCollection with:
471
855c13ba3901 default selection on Object
tz
parents: 468
diff changeset
   223
                        (TreeItem newAsTreeFromSmalltalkClass: (Smalltalk at:(resourceSuperclass ? #Object)))))
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   224
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   225
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   226
cf47d420764a initial checkin
tz
parents:
diff changeset
   227
cf47d420764a initial checkin
tz
parents:
diff changeset
   228
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   229
cf47d420764a initial checkin
tz
parents:
diff changeset
   230
listOfResources
cf47d420764a initial checkin
tz
parents:
diff changeset
   231
cf47d420764a initial checkin
tz
parents:
diff changeset
   232
    |holder|
cf47d420764a initial checkin
tz
parents:
diff changeset
   233
    (holder := builder bindingAt:#listOfResources) isNil ifTrue:[
cf47d420764a initial checkin
tz
parents:
diff changeset
   234
        builder aspectAt:#listOfResources put:(holder :=  List new).
cf47d420764a initial checkin
tz
parents:
diff changeset
   235
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   236
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   237
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   238
cf47d420764a initial checkin
tz
parents:
diff changeset
   239
selectionOfClass
cf47d420764a initial checkin
tz
parents:
diff changeset
   240
cf47d420764a initial checkin
tz
parents:
diff changeset
   241
    |holder|
cf47d420764a initial checkin
tz
parents:
diff changeset
   242
    (holder := builder bindingAt:#selectionOfClass) isNil ifTrue:[
cf47d420764a initial checkin
tz
parents:
diff changeset
   243
        builder aspectAt:#selectionOfClass put:(holder :=  ValueHolder new).
cf47d420764a initial checkin
tz
parents:
diff changeset
   244
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   245
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   246
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   247
cf47d420764a initial checkin
tz
parents:
diff changeset
   248
selectionOfResource
cf47d420764a initial checkin
tz
parents:
diff changeset
   249
cf47d420764a initial checkin
tz
parents:
diff changeset
   250
    |holder|
cf47d420764a initial checkin
tz
parents:
diff changeset
   251
    (holder := builder bindingAt:#selectionOfResource) isNil ifTrue:[
cf47d420764a initial checkin
tz
parents:
diff changeset
   252
        builder aspectAt:#selectionOfResource put:(holder :=  '' asValue).
cf47d420764a initial checkin
tz
parents:
diff changeset
   253
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   254
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   255
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   256
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   257
valueOfClassName
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   258
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   259
    |holder|
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   260
    (holder := builder bindingAt:#valueOfClassName) isNil ifTrue:[
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   261
        builder aspectAt:#valueOfClassName put:(holder :=  '' asValue).
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   262
    ].
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   263
    ^ holder
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   264
!
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   265
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   266
valueOfSelector
cf47d420764a initial checkin
tz
parents:
diff changeset
   267
cf47d420764a initial checkin
tz
parents:
diff changeset
   268
    |holder|
cf47d420764a initial checkin
tz
parents:
diff changeset
   269
    (holder := builder bindingAt:#valueOfSelector) isNil ifTrue:[
cf47d420764a initial checkin
tz
parents:
diff changeset
   270
        builder aspectAt:#valueOfSelector put:(holder :=  '' asValue).
cf47d420764a initial checkin
tz
parents:
diff changeset
   271
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   272
    ^ holder
cf47d420764a initial checkin
tz
parents:
diff changeset
   273
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   274
cf47d420764a initial checkin
tz
parents:
diff changeset
   275
!ResourceSelectionBrowser methodsFor:'callbacks'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   276
cf47d420764a initial checkin
tz
parents:
diff changeset
   277
classSelected: anIndex
cf47d420764a initial checkin
tz
parents:
diff changeset
   278
    
cf47d420764a initial checkin
tz
parents:
diff changeset
   279
    self selectionOfClass value isNil ifTrue: [^nil].
cf47d420764a initial checkin
tz
parents:
diff changeset
   280
    self withWaitCursorDo:
cf47d420764a initial checkin
tz
parents:
diff changeset
   281
    [
cf47d420764a initial checkin
tz
parents:
diff changeset
   282
        |clsName|
517
91ff807d8a23 set resource selection after opening
tz
parents: 504
diff changeset
   283
        resourceTypes isNil ifTrue: [resourceTypes := Method resourceTypes].
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   284
        clsName := self listOfClassesView list at: anIndex.
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   285
        self valueOfClassName value: clsName.
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   286
        self class lastSelection: clsName.
cf47d420764a initial checkin
tz
parents:
diff changeset
   287
        self listOfResources contents:
cf47d420764a initial checkin
tz
parents:
diff changeset
   288
            ((Smalltalk at: clsName) 
cf47d420764a initial checkin
tz
parents:
diff changeset
   289
                class methodDictionary
cf47d420764a initial checkin
tz
parents:
diff changeset
   290
                asOrderedCollection select: 
517
91ff807d8a23 set resource selection after opening
tz
parents: 504
diff changeset
   291
                    [:m|m resources notNil and: [resourceTypes includes: m resourceType]]).
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   292
    ]
cf47d420764a initial checkin
tz
parents:
diff changeset
   293
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   294
cf47d420764a initial checkin
tz
parents:
diff changeset
   295
resourceDoubleClicked
cf47d420764a initial checkin
tz
parents:
diff changeset
   296
cf47d420764a initial checkin
tz
parents:
diff changeset
   297
    resourceMethod := self selectionOfResource value.
cf47d420764a initial checkin
tz
parents:
diff changeset
   298
    accept value: true.
cf47d420764a initial checkin
tz
parents:
diff changeset
   299
    self close
cf47d420764a initial checkin
tz
parents:
diff changeset
   300
!
cf47d420764a initial checkin
tz
parents:
diff changeset
   301
cf47d420764a initial checkin
tz
parents:
diff changeset
   302
resourceSelected
cf47d420764a initial checkin
tz
parents:
diff changeset
   303
cf47d420764a initial checkin
tz
parents:
diff changeset
   304
    resourceMethod := self selectionOfResource value.
cf47d420764a initial checkin
tz
parents:
diff changeset
   305
    self valueOfSelector value: self selectionOfResource value selector
cf47d420764a initial checkin
tz
parents:
diff changeset
   306
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   307
cf47d420764a initial checkin
tz
parents:
diff changeset
   308
!ResourceSelectionBrowser methodsFor:'initialization'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   309
cf47d420764a initial checkin
tz
parents:
diff changeset
   310
postBuildWith:aBuilder
cf47d420764a initial checkin
tz
parents:
diff changeset
   311
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   312
    |classSelection classSelectionBlock|
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   313
    allClasses := Smalltalk allClasses asArray.
517
91ff807d8a23 set resource selection after opening
tz
parents: 504
diff changeset
   314
    classSelection :=  resourceClass ? self class lastSelection ? #Object.
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   315
    classSelectionBlock := 
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   316
    [:clsPattern|                                  
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   317
        |foundClass classes|         
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   318
        ((foundClass := Smalltalk at: clsPattern asSymbol) isNil or:
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   319
        [foundClass name ~= clsPattern])
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   320
        ifTrue:
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   321
        [
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   322
            classes := allClasses select: [:cls| cls name size >= clsPattern size].
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   323
            1 to: clsPattern size do: 
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   324
            [:i|    
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   325
                 classes := classes select: [:cls| (cls name at: i) == (clsPattern at: i)].
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   326
            ].    
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   327
            foundClass := classes at: 1 ifAbsent: [nil] 
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   328
        ].
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   329
        foundClass notNil
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   330
        ifTrue:
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   331
        [
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   332
            self listOfClassesView selectFromListOfNames: (foundClass 
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   333
                withAllSuperclasses reverse collect: [:cls| cls name asString])
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   334
        ].
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   335
        self valueOfClassName value: clsPattern
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   336
    ].
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   337
    classSelectionBlock value: classSelection.
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   338
    self valueOfClassName value: classSelection.
517
91ff807d8a23 set resource selection after opening
tz
parents: 504
diff changeset
   339
    self selectionOfResource value: (self listOfResources detect: [:m| m who methodSelector == resourceMethod] ifNone: nil).
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   340
    self classNameInputField entryCompletionBlock:
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   341
    [:value|
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   342
        |what|
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   343
        what := Smalltalk classnameCompletion: value withoutSpaces.
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   344
        self classNameInputField contents:what first.
477
857d4289a2bd improved class name completion routine
tz
parents: 472
diff changeset
   345
        (what at:2) size ~~ 1 ifTrue:[Display beep].
467
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   346
        classSelectionBlock value: self classNameInputField contents
ddb605aaf94a class retrieval support added
tz
parents: 463
diff changeset
   347
    ].
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   348
    ^super postBuildWith:aBuilder
cf47d420764a initial checkin
tz
parents:
diff changeset
   349
cf47d420764a initial checkin
tz
parents:
diff changeset
   350
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   351
cf47d420764a initial checkin
tz
parents:
diff changeset
   352
!ResourceSelectionBrowser methodsFor:'instance creation'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   353
cf47d420764a initial checkin
tz
parents:
diff changeset
   354
openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes
cf47d420764a initial checkin
tz
parents:
diff changeset
   355
cf47d420764a initial checkin
tz
parents:
diff changeset
   356
    |cls sel|
517
91ff807d8a23 set resource selection after opening
tz
parents: 504
diff changeset
   357
    resourceMethod := aSelector.
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   358
    resourceTypes := aResourceTypes.
cf47d420764a initial checkin
tz
parents:
diff changeset
   359
    resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol].
cf47d420764a initial checkin
tz
parents:
diff changeset
   360
    resourceClass := aClassOrSymbol isClass ifTrue: [aClassOrSymbol name] ifFalse: [aClassOrSymbol].
481
e2e1ea013229 Take care of nil selectors in #openOnSuperClass:andClass:andSelector:
Stefan Vogel <sv@exept.de>
parents: 477
diff changeset
   361
    self valueOfSelector value:(aSelector ? '').
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   362
463
947f89198464 return complete message even if not implemented
tz
parents: 436
diff changeset
   363
    self open.
947f89198464 return complete message even if not implemented
tz
parents: 436
diff changeset
   364
481
e2e1ea013229 Take care of nil selectors in #openOnSuperClass:andClass:andSelector:
Stefan Vogel <sv@exept.de>
parents: 477
diff changeset
   365
    (self selectionOfClass value notNil 
e2e1ea013229 Take care of nil selectors in #openOnSuperClass:andClass:andSelector:
Stefan Vogel <sv@exept.de>
parents: 477
diff changeset
   366
     and:[(cls := Smalltalk at: self selectionOfClass value name) isClass 
e2e1ea013229 Take care of nil selectors in #openOnSuperClass:andClass:andSelector:
Stefan Vogel <sv@exept.de>
parents: 477
diff changeset
   367
          and:[accept value]]
e2e1ea013229 Take care of nil selectors in #openOnSuperClass:andClass:andSelector:
Stefan Vogel <sv@exept.de>
parents: 477
diff changeset
   368
    ) ifTrue:[
463
947f89198464 return complete message even if not implemented
tz
parents: 436
diff changeset
   369
        ^cls name, ' ', self valueOfSelector value
425
cf47d420764a initial checkin
tz
parents:
diff changeset
   370
    ].
cf47d420764a initial checkin
tz
parents:
diff changeset
   371
    ^nil
cf47d420764a initial checkin
tz
parents:
diff changeset
   372
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   373
cf47d420764a initial checkin
tz
parents:
diff changeset
   374
!ResourceSelectionBrowser methodsFor:'startup / release'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   375
cf47d420764a initial checkin
tz
parents:
diff changeset
   376
closeCancel
cf47d420764a initial checkin
tz
parents:
diff changeset
   377
cf47d420764a initial checkin
tz
parents:
diff changeset
   378
    resourceMethod := nil.
cf47d420764a initial checkin
tz
parents:
diff changeset
   379
    super closeCancel
cf47d420764a initial checkin
tz
parents:
diff changeset
   380
cf47d420764a initial checkin
tz
parents:
diff changeset
   381
cf47d420764a initial checkin
tz
parents:
diff changeset
   382
cf47d420764a initial checkin
tz
parents:
diff changeset
   383
! !
cf47d420764a initial checkin
tz
parents:
diff changeset
   384
cf47d420764a initial checkin
tz
parents:
diff changeset
   385
!ResourceSelectionBrowser class methodsFor:'documentation'!
cf47d420764a initial checkin
tz
parents:
diff changeset
   386
cf47d420764a initial checkin
tz
parents:
diff changeset
   387
version
cf47d420764a initial checkin
tz
parents:
diff changeset
   388
    ^ '$Header$'
cf47d420764a initial checkin
tz
parents:
diff changeset
   389
! !