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