*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Mon, 18 Sep 2006 20:34:39 +0200
changeset 4619 f4fb56981bad
parent 4618 d07d2f6445b6
child 4620 a9d593b2a056
*** empty log message ***
ResourcePack.st
--- a/ResourcePack.st	Mon Sep 18 18:50:38 2006 +0200
+++ b/ResourcePack.st	Mon Sep 18 20:34:39 2006 +0200
@@ -201,7 +201,7 @@
     "get the full resource definitions for aClass (i.e. with super packs).
      Also leave the resulting pack in the cache for faster access next time."
 
-    ^ self for:aClass cached:true
+    ^ self for:aClass cached:false
 
     "
      ResourcePack for:TextView     
@@ -212,6 +212,8 @@
      ResourcePack for:NewLauncher 
      Workspace classResources
     "
+
+    "Modified: / 18-09-2006 / 19:02:57 / cg"
 !
 
 for:aClass cached:cached
@@ -242,7 +244,7 @@
     ] ifFalse:[
         pack := self fromFile:baseName.
     ].
-    aClass == Object ifFalse:[
+    aClass superclass notNil ifTrue:[
         pack superPack:(self for:(aClass superclass)).
     ].
     pack packsClassOrFileName:nm.
@@ -263,7 +265,7 @@
      Workspace classResources
     "
 
-    "Modified: / 18-09-2006 / 17:43:37 / cg"
+    "Modified: / 18-09-2006 / 19:07:23 / cg"
 !
 
 forPackage:package 
@@ -366,32 +368,39 @@
         idx := Packs size.
         Packs replaceFrom:1 to:idx-1 with:Packs startingAt:2.
     ].
-    Packs at:idx put:aPack
+    aPack at:'__language__' put:(Smalltalk language,'_',Smalltalk languageTerritory).
+    Packs at:idx put:aPack.
+
+    "Modified: / 18-09-2006 / 19:12:12 / cg"
 !
 
 searchCacheFor:aClassOrFileName
-    |sz "{ Class: SmallInteger }" |
+    |sz "{ Class: SmallInteger }" lang|
 
     Packs isNil ifTrue:[
         self initialize.
         ^ nil
     ].
 
+    lang := (Smalltalk language,'_',Smalltalk languageTerritory).
+
     sz := Packs size.
     1 to:sz do:[:idx |
         |aPack|
 
         aPack := Packs at:idx.
         (aPack notNil and:[aPack ~~ 0]) ifTrue:[
-            aClassOrFileName = aPack packsClassOrFileName ifTrue:[
-                "
-                 bring to front for LRU
-                "
-                idx ~~ 1 ifTrue:[
-                    Packs replaceFrom:2 to:idx with:Packs startingAt:1.
-                    Packs at:1 put:aPack.
-                ].
-                ^ aPack
+            (aPack at:'__language__' ifAbsent:nil) = lang ifTrue:[
+                aClassOrFileName = aPack packsClassOrFileName ifTrue:[
+                    "
+                     bring to front for LRU
+                    "
+                    idx ~~ 1 ifTrue:[
+                        Packs replaceFrom:2 to:idx with:Packs startingAt:1.
+                        Packs at:1 put:aPack.
+                    ].
+                    ^ aPack
+                ]
             ]
         ]
     ].
@@ -400,6 +409,8 @@
     "
      ResourcePack searchCacheFor:'TextView' 
     "
+
+    "Modified: / 18-09-2006 / 19:13:13 / cg"
 ! !
 
 !ResourcePack class methodsFor:'utilities'!
@@ -578,7 +589,7 @@
         ]
     ]
 
-    "Modified: / 05-07-2006 / 17:25:07 / cg"
+    "Modified: / 18-09-2006 / 20:33:49 / cg"
 ! !
 
 !ResourcePack methodsFor:'accessing'!
@@ -1170,6 +1181,7 @@
                                             ]
                                         ] ifFalse:[
                                             (lineString startsWith:'encoding') ifTrue:[
+decoder notNil ifTrue:[self halt:'oops - encoding change in file'].
                                                 encoding := self class extractEncodingFromLine:lineString.
                                                 decoder := CharacterEncoder encoderFor:encoding ifAbsent:nil.
                                             ]
@@ -1208,7 +1220,7 @@
     ^ ok
 
     "Modified: / 31-08-1995 / 02:33:45 / claus"
-    "Modified: / 18-09-2006 / 18:48:02 / cg"
+    "Modified: / 18-09-2006 / 20:35:37 / cg"
 ! !
 
 !ResourcePack methodsFor:'printing & storing'!
@@ -1225,7 +1237,7 @@
 !ResourcePack class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.114 2006-09-18 16:50:38 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.115 2006-09-18 18:34:39 cg Exp $'
 ! !
 
 ResourcePack initialize!