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