# HG changeset patch # User Claus Gittinger # Date 893249638 -7200 # Node ID 460dc3bb9cf9709dabacbf7d56db1cf5b8132a9f # Parent 50231f23e1497b07adee2a0344cafbe868d2ef7e dont send 'Smalltalk at:nil' diff -r 50231f23e149 -r 460dc3bb9cf9 ResourceSelectionBrowser.st --- a/ResourceSelectionBrowser.st Wed Apr 22 13:46:48 1998 +0200 +++ b/ResourceSelectionBrowser.st Wed Apr 22 14:53:58 1998 +0200 @@ -111,11 +111,9 @@ treeViewContents "returns the default contents of the root of the class tree list" - ^Smalltalk at: #Object - + ^ Object - - + "Modified: / 22.4.1998 / 14:44:11 / cg" ! treeViewIcon @@ -497,9 +495,14 @@ treeViewContents "returns the contents of the root of the class tree list" - ^(Smalltalk at: resourceSuperclass) ? self class treeViewContents + |cls| + resourceSuperclass notNil ifTrue:[ + cls := Smalltalk at: resourceSuperclass. + ]. + ^ cls ? self class treeViewContents + "Modified: / 22.4.1998 / 14:43:19 / cg" ! validateDoubleClick: aTreeItem @@ -603,21 +606,26 @@ openOnSuperclass: aSuperclassOrSymbol andClass: aClassOrSymbol andSelector: aSelector withResourceTypes: aResourceTypes "opens a ResourceSelectionBrowser on - aSuperclassOrSymbol, - and aClassOrSymbol, - and aSelector, - with allowed aResourceTypes" + aSuperclassOrSymbol, + and aClassOrSymbol, + and aSelector, + with allowed aResourceTypes" |clsName| resourceMethod := aSelector. resourceTypes := aResourceTypes. resourceSuperclass := aSuperclassOrSymbol isClass ifTrue: [aSuperclassOrSymbol name] ifFalse: [aSuperclassOrSymbol]. - resourceClass := aClassOrSymbol isClass - ifTrue: [aClassOrSymbol name] - ifFalse: [(Smalltalk at: aClassOrSymbol) notNil - ifTrue: [aClassOrSymbol] - ifFalse: [nil]]. + resourceClass := nil. + + aClassOrSymbol isClass + ifTrue: [resourceClass := aClassOrSymbol name] + ifFalse: [ + aClassOrSymbol notNil ifTrue:[ + (Smalltalk at: aClassOrSymbol) notNil + ifTrue: [resourceClass := aClassOrSymbol] + ] + ]. self valueOfResourceSelector value:(aSelector ? ''). self open. @@ -628,9 +636,11 @@ ((Smalltalk at: clsName) isClass and: [accept value]) ifTrue: [ - ^clsName, ' ', self valueOfResourceSelector value + ^clsName, ' ', self valueOfResourceSelector value ]. ^nil + + "Modified: / 22.4.1998 / 14:51:03 / cg" ! ! !ResourceSelectionBrowser methodsFor:'startup / release'! @@ -655,15 +665,20 @@ allClasses := self treeViewContents withAllSubclasses reject: [:cls| cls isPrivate]. classSelection := resourceClass. - (Smalltalk at: classSelection) isNil + + (classSelection isNil or:[Smalltalk at: classSelection]) isNil ifTrue: [classSelection := self class lastSelection]. - (Smalltalk at: classSelection) isNil + (classSelection isNil or:[Smalltalk at: classSelection]) isNil ifTrue: [classSelection := self treeViewContents]. + classSelectionBlock := [:clsPattern| - |foundClass classes| - ((foundClass := Smalltalk at: clsPattern printString asSymbol) isClass not or: - [foundClass name ~= clsPattern]) + |foundClass classes| + + clsPattern notNil ifTrue:[ + foundClass := Smalltalk at:(clsPattern printString asSymbol). + ]. + (foundClass isClass not or:[foundClass name ~= clsPattern]) ifTrue: [ classes := allClasses select: [:cls| cls name size >= clsPattern size]. @@ -709,6 +724,7 @@ ^super postBuildWith:aBuilder + "Modified: / 22.4.1998 / 14:48:22 / cg" ! ! !ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'!