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