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