92 ^ |
92 ^ |
93 |
93 |
94 #(#FullSpec |
94 #(#FullSpec |
95 #'window:' |
95 #'window:' |
96 #(#WindowSpec |
96 #(#WindowSpec |
97 #'name:' 'Resource Browser' |
97 #'name:' 'Resource Selection Browser' |
98 #'layout:' #(#LayoutFrame 252 0 290 0 851 0 639 0) |
98 #'layout:' #(#LayoutFrame 69 0 395 0 668 0 744 0) |
99 #'label:' 'Resource Browser' |
99 #'label:' 'Resource Selection Browser' |
100 #'min:' #(#Point 400 300) |
100 #'min:' #(#Point 400 300) |
101 #'max:' #(#Point 1152 864) |
101 #'max:' #(#Point 1152 864) |
102 #'bounds:' #(#Rectangle 252 290 852 640) |
102 #'bounds:' #(#Rectangle 69 395 669 745) |
103 #'usePreferredExtent:' false |
103 #'usePreferredExtent:' false |
104 ) |
104 ) |
105 #'component:' |
105 #'component:' |
106 #(#SpecCollection |
106 #(#SpecCollection |
107 #'collection:' |
107 #'collection:' |
124 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -22 1.0) |
124 #'layout:' #(#LayoutFrame 0 0.0 0 0.0 0 1.0 -22 1.0) |
125 #'model:' #selectionOfClass |
125 #'model:' #selectionOfClass |
126 #'hasHorizontalScrollBar:' true |
126 #'hasHorizontalScrollBar:' true |
127 #'hasVerticalScrollBar:' true |
127 #'hasVerticalScrollBar:' true |
128 #'miniScrollerHorizontal:' true |
128 #'miniScrollerHorizontal:' true |
129 #'showRoot:' false |
|
130 #'showDirectoryIndicatorForRoot:' false |
129 #'showDirectoryIndicatorForRoot:' false |
131 #'showDirectoryIndicator:' true |
130 #'showDirectoryIndicator:' true |
132 #'valueChangeSelector:' #'classSelected:' |
131 #'valueChangeSelector:' #'classSelected:' |
133 #'hierarchicalList:' #listOfClasses |
132 #'hierarchicalList:' #listOfClasses |
|
133 #'contentsSelector:' #treeViewContents |
|
134 #'labelSelector:' #treeViewLabel |
|
135 #'childrenSelector:' #treeViewChildren |
|
136 #'iconSelector:' #treeViewIcon |
134 ) |
137 ) |
135 #(#InputFieldSpec |
138 #(#InputFieldSpec |
136 #'name:' 'classNameInputField' |
139 #'name:' 'classNameInputField' |
137 #'layout:' #(#LayoutFrame 2 0.0 -22 1 -1 1.0 0 1) |
140 #'layout:' #(#LayoutFrame 2 0.0 -22 1 -1 1.0 0 1) |
138 #'model:' #valueOfClassName |
141 #'model:' #valueOfClassName |
201 ) |
204 ) |
202 ) |
205 ) |
203 ) |
206 ) |
204 ! ! |
207 ! ! |
205 |
208 |
|
209 !ResourceSelectionBrowser class methodsFor:'resources'! |
|
210 |
|
211 iconClass |
|
212 "Generated by the Image Editor" |
|
213 " |
|
214 ImageEditor openOnClass:self andSelector:#iconClass |
|
215 " |
|
216 |
|
217 <resource: #image> |
|
218 |
|
219 ^Icon |
|
220 constantNamed:#'ResourceSelectionBrowser iconClass' |
|
221 ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 21 85 85 85 5 26 170 170 170 0 26 170 170 170 0 26 170 170 170 0 26 170 170 170 0 26 170 170 170 0 26 170 170 170 0 26 170 170 170 12 26 170 170 170 5 26 170 170 170 0 26 170 170 170 0 26 170 170 170 0 26 170 170 170 0 0 0 0 0 0 0 0 0 0 0]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color grey:66.9978); add:(Color red:100.0 green:0.0 blue:0.0); yourself)); mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[127 255 128 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 127 255 128]) ; yourself); yourself]! |
|
222 |
|
223 iconHidingSubclasses |
|
224 "Generated by the Image Editor" |
|
225 " |
|
226 ImageEditor openOnClass:self andSelector:#iconHidingSubclasses |
|
227 " |
|
228 |
|
229 <resource: #image> |
|
230 |
|
231 ^Icon |
|
232 constantNamed:#'ResourceSelectionBrowser iconHidingSubclasses' |
|
233 ifAbsentPut:[(Depth4Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 1 17 17 17 17 17 17 17 48 1 51 51 51 51 51 51 51 32 1 48 0 0 0 51 51 51 32 1 48 68 68 64 51 51 51 32 1 48 0 0 0 51 51 51 32 1 51 50 51 51 51 51 51 32 1 51 50 51 0 0 0 3 32 1 51 50 34 2 34 34 3 32 1 51 50 51 0 0 0 3 32 1 51 50 51 51 51 51 51 32 1 51 50 51 0 0 0 3 32 1 51 50 34 2 34 34 3 32 1 51 51 51 0 0 0 3 32 3 34 34 34 34 34 34 34 32 0 0 0 0 0 0 0 0 0]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); yourself)); mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[127 255 128 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 127 255 128]) ; yourself); yourself]! |
|
234 |
|
235 iconShowingSubclasses |
|
236 "Generated by the Image Editor" |
|
237 " |
|
238 ImageEditor openOnClass:self andSelector:#iconShowingSubclasses |
|
239 " |
|
240 |
|
241 <resource: #image> |
|
242 |
|
243 ^Icon |
|
244 constantNamed:#'ResourceSelectionBrowser iconShowingSubclasses' |
|
245 ifAbsentPut:[(Depth4Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(#[0 0 0 0 0 0 0 0 0 1 17 17 17 17 17 17 17 48 1 51 51 51 51 51 51 51 32 1 48 0 0 0 51 51 51 32 1 48 68 68 64 51 51 51 32 1 48 0 0 0 51 51 51 32 1 51 50 51 51 51 51 51 32 1 51 50 51 0 0 0 3 32 1 51 50 34 5 85 85 3 32 1 51 50 51 0 0 0 3 32 1 51 50 51 51 51 51 51 32 1 51 50 51 0 0 0 3 32 1 51 50 34 8 136 136 3 32 1 51 51 51 0 0 0 3 32 3 34 34 34 34 34 34 34 32 0 0 0 0 0 0 0 0 0]) ; colorMap:((OrderedCollection new add:(Color black); add:(Color white); add:(Color grey:49.9962); add:(Color grey:66.9978); add:(Color red:100.0 green:0.0 blue:0.0); add:(Color red:0.0 green:100.0 blue:0.0); add:(Color red:0.0 green:0.0 blue:100.0); add:(Color red:0.0 green:100.0 blue:100.0); add:(Color red:100.0 green:100.0 blue:0.0); add:(Color red:100.0 green:0.0 blue:100.0); add:(Color red:49.9962 green:0.0 blue:0.0); add:(Color red:0.0 green:49.9962 blue:0.0); add:(Color red:0.0 green:0.0 blue:49.9962); add:(Color red:0.0 green:49.9962 blue:49.9962); add:(Color red:49.9962 green:49.9962 blue:0.0); add:(Color red:49.9962 green:0.0 blue:49.9962); yourself)); mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(#[127 255 128 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 255 255 192 127 255 128]) ; yourself); yourself]! ! |
|
246 |
206 !ResourceSelectionBrowser methodsFor:'accessing - views'! |
247 !ResourceSelectionBrowser methodsFor:'accessing - views'! |
207 |
248 |
208 classNameInputField |
249 classNameInputField |
209 |
250 |
210 ^builder componentAt: #classNameInputField |
251 ^builder componentAt: #classNameInputField |
275 builder aspectAt:#valueOfSelector put:(holder := '' asValue). |
312 builder aspectAt:#valueOfSelector put:(holder := '' asValue). |
276 ]. |
313 ]. |
277 ^ holder |
314 ^ holder |
278 ! ! |
315 ! ! |
279 |
316 |
280 !ResourceSelectionBrowser methodsFor:'callbacks'! |
317 !ResourceSelectionBrowser methodsFor:'callbacks - tree view'! |
|
318 |
|
319 treeViewChildren |
|
320 |
|
321 ^[:aTreeItem| aTreeItem contents subclasses asSortedCollection: [:i1 :i2| i1 name < i2 name]] |
|
322 |
|
323 |
|
324 ! |
|
325 |
|
326 treeViewContents |
|
327 |
|
328 ^Smalltalk at: resourceSuperclass ? #Object |
|
329 |
|
330 |
|
331 ! |
|
332 |
|
333 treeViewIcon |
|
334 |
|
335 ^[:aTreeItem| |
|
336 aTreeItem contents subclasses notEmpty |
|
337 ifTrue: |
|
338 [ |
|
339 aTreeItem hide |
|
340 ifTrue: [self class iconHidingSubclasses] |
|
341 ifFalse: [self class iconShowingSubclasses]] |
|
342 ifFalse: |
|
343 [ |
|
344 self class iconClass |
|
345 ] |
|
346 ] |
|
347 |
|
348 |
|
349 ! |
|
350 |
|
351 treeViewLabel |
|
352 |
|
353 ^[:aTreeItem|aTreeItem contents name] |
|
354 |
|
355 |
|
356 ! ! |
|
357 |
|
358 !ResourceSelectionBrowser methodsFor:'callbacks - user'! |
281 |
359 |
282 classSelected: anIndex |
360 classSelected: anIndex |
283 |
361 |
284 self selectionOfClass value isNil ifTrue: [^nil]. |
362 self selectionOfClass value isNil ifTrue: [^nil]. |
285 self withWaitCursorDo: |
363 self withWaitCursorDo: |
313 |
391 |
314 !ResourceSelectionBrowser methodsFor:'instance creation'! |
392 !ResourceSelectionBrowser methodsFor:'instance creation'! |
315 |
393 |
316 openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes |
394 openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes |
317 |
395 |
318 |cls sel| |
396 |cls| |
319 resourceMethod := aSelector. |
397 resourceMethod := aSelector. |
320 resourceTypes := aResourceTypes. |
398 resourceTypes := aResourceTypes. |
321 resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
399 resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. |
322 resourceClass := aClassOrSymbol isClass ifTrue: [aClassOrSymbol name] ifFalse: [aClassOrSymbol]. |
400 resourceClass := aClassOrSymbol isClass ifTrue: [aClassOrSymbol name] ifFalse: [aClassOrSymbol]. |
323 self valueOfSelector value:(aSelector ? ''). |
401 self valueOfSelector value:(aSelector ? ''). |
324 |
402 |
325 self open. |
403 self open. |
326 |
404 |
327 (self selectionOfClass value notNil |
405 (self selectionOfClass value notNil and: |
328 and:[(cls := Smalltalk at: self selectionOfClass value name) isClass |
406 [(cls := Smalltalk at: self selectionOfClass value name) isClass and: |
329 and:[accept value]] |
407 [accept value]]) |
330 ) ifTrue:[ |
408 ifTrue: |
|
409 [ |
331 ^cls name, ' ', self valueOfSelector value |
410 ^cls name, ' ', self valueOfSelector value |
332 ]. |
411 ]. |
333 ^nil |
412 ^nil |
334 ! ! |
413 ! ! |
335 |
414 |
371 withAllSuperclasses reverse collect: [:cls| cls name asString]); |
450 withAllSuperclasses reverse collect: [:cls| cls name asString]); |
372 selectedNodeExpand: true |
451 selectedNodeExpand: true |
373 ]. |
452 ]. |
374 self valueOfClassName value: clsPattern |
453 self valueOfClassName value: clsPattern |
375 ]. |
454 ]. |
376 classSelectionBlock value: classSelection. |
455 |
377 self valueOfClassName value: classSelection. |
456 self valueOfClassName value: classSelection. |
378 self selectionOfResource value: (self listOfResources detect: [:m| m selector == resourceMethod] ifNone: nil). |
457 self selectionOfResource value: (self listOfResources detect: [:m| m selector == resourceMethod] ifNone: nil). |
379 self classNameInputField entryCompletionBlock: |
458 self classNameInputField entryCompletionBlock: |
380 [:value| |
459 [:value| |
381 |what| |
460 |what| |
382 what := Smalltalk classnameCompletion: value withoutSpaces. |
461 what := Smalltalk classnameCompletion: value withoutSpaces. |
383 self classNameInputField contents:what first. |
462 self classNameInputField contents:what first. |
384 (what at:2) size ~~ 1 ifTrue:[Display beep]. |
463 (what at:2) size ~~ 1 ifTrue:[Display beep]. |
385 classSelectionBlock value: self classNameInputField contents |
464 classSelectionBlock value: self classNameInputField contents |
386 ]. |
465 ]. |
387 |
466 self listOfClassesView validateDoubleClickBlock: [:aTreeItem | aTreeItem contents ~~ self treeViewContents]. |
388 self listOfClassesView selectedNodeExpand: true. |
467 self listOfClassesView selectedNodeExpand: true. |
|
468 |
|
469 [classSelectionBlock value: classSelection] forkAt: 4. |
389 |
470 |
390 ^super postBuildWith:aBuilder |
471 ^super postBuildWith:aBuilder |
391 |
472 |
392 ! ! |
473 ! ! |
393 |
474 |