checkin from browser
authortz
Fri, 09 Jan 1998 17:31:58 +0100
changeset 399 0822ecf56bf2
parent 398 155310ec83aa
child 400 228524287573
checkin from browser
ResourceRetriever.st
--- a/ResourceRetriever.st	Fri Jan 09 17:07:47 1998 +0100
+++ b/ResourceRetriever.st	Fri Jan 09 17:31:58 1998 +0100
@@ -20,6 +20,15 @@
 	category:'Interface-Support-UI'
 !
 
+ResourceRetriever class instanceVariableNames:'LabelResources'
+
+"
+ The following class instance variables are inherited by this class:
+
+	Object - 
+"
+!
+
 !ResourceRetriever class methodsFor:'documentation'!
 
 copyright
@@ -67,6 +76,55 @@
 
 ! !
 
+!ResourceRetriever class methodsFor:'accessing resource'!
+
+findResourceLabel: label in: aResourceOwner
+    "look for a string 
+        in aResourceOwner, 
+        in class of aResourceOwner,
+        in resources of class of aResourceOwner,
+        and finally in my label resources
+    "
+
+    aResourceOwner isNil ifTrue: [^label].
+
+    label isSymbol
+    ifTrue:
+    [
+        (aResourceOwner respondsTo: label)
+        ifTrue:
+        [           
+            ^aResourceOwner perform: label
+        ].
+
+        (aResourceOwner isClass not and: [aResourceOwner class respondsTo: label])
+        ifTrue:
+        [            
+            ^aResourceOwner perform: label
+        ].
+    ].
+
+    ((aResourceOwner isKindOf: ApplicationModel) or: 
+    [aResourceOwner isKindOf: SimpleView]) 
+    ifTrue:
+    [
+        ^aResourceOwner resources string: label
+    ].
+
+    ^self labelResources string:label
+  
+!
+
+labelResources
+    "if not already loaded, get the common label resourcePack
+     and return it"
+
+    LabelResources isNil ifTrue:[
+        LabelResources := ResourcePack for:self.
+    ].
+    ^ LabelResources
+! !
+
 !ResourceRetriever methodsFor:'accessing'!
 
 className