dont send 'Smalltalk at:nil'
authorClaus Gittinger <cg@exept.de>
Wed, 22 Apr 1998 14:53:58 +0200
changeset 802 460dc3bb9cf9
parent 801 50231f23e149
child 803 19e0367ee9d6
dont send 'Smalltalk at:nil'
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'!