ResourcePack.st
changeset 6174 982b8576dfbe
parent 6113 798f118104a7
child 6219 7e760ee68af9
equal deleted inserted replaced
6173:124dbde3be9e 6174:982b8576dfbe
  1092 
  1092 
  1093     |template|
  1093     |template|
  1094 
  1094 
  1095     template := self at:s ifAbsent:s.
  1095     template := self at:s ifAbsent:s.
  1096     ^ template withCRs expandPlaceholdersWith:argArray.
  1096     ^ template withCRs expandPlaceholdersWith:argArray.
       
  1097 !
       
  1098 
       
  1099 whichPackIncludesKey:aKey
       
  1100     "for debugging: return the pack (alogn the super-pack chain), which
       
  1101      has a translation for a string"
       
  1102 
       
  1103     |val pack projectPack alreadySearched|
       
  1104 
       
  1105     aKey isNil ifTrue:[ ^ nil ].
       
  1106 
       
  1107     val := self localAt:aKey.
       
  1108     val notNil ifTrue:[^ self].
       
  1109 
       
  1110     (projectPack := self projectPack) notNil ifTrue:[
       
  1111         val := projectPack localAt:aKey.
       
  1112         val notNil ifTrue:[^ projectPack].
       
  1113     ].
       
  1114     alreadySearched := Set new.
       
  1115     projectPack notNil ifTrue:[ alreadySearched add:projectPack ].
       
  1116 
       
  1117     pack := self superPack.
       
  1118     [ pack notNil ] whileTrue:[
       
  1119         val := pack localAt:aKey.
       
  1120         val notNil ifTrue:[^ pack].
       
  1121 
       
  1122         (projectPack := pack projectPack) notNil ifTrue:[
       
  1123             (alreadySearched includes:projectPack) ifFalse:[
       
  1124                 val := projectPack localAt:aKey.
       
  1125                 val notNil ifTrue:[^ projectPack].
       
  1126                 alreadySearched add:projectPack.
       
  1127             ].
       
  1128         ].
       
  1129         pack := pack superPack
       
  1130     ].
       
  1131 
       
  1132     alreadySearched copy do:[:projectPack |
       
  1133         |p|
       
  1134 
       
  1135         p := projectPack superPack.
       
  1136         [p notNil and:[(alreadySearched includes:p) not]] whileTrue:[
       
  1137             val := p localAt:aKey.
       
  1138             val notNil ifTrue:[^ p].
       
  1139             alreadySearched add:p.
       
  1140             p := p superPack.
       
  1141         ].
       
  1142     ].
       
  1143 
       
  1144     ^ nil
  1097 ! !
  1145 ! !
  1098 
  1146 
  1099 !ResourcePack methodsFor:'accessing-internals'!
  1147 !ResourcePack methodsFor:'accessing-internals'!
  1100 
  1148 
  1101 name:aKey
  1149 name:aKey
  1419 ! !
  1467 ! !
  1420 
  1468 
  1421 !ResourcePack class methodsFor:'documentation'!
  1469 !ResourcePack class methodsFor:'documentation'!
  1422 
  1470 
  1423 version
  1471 version
  1424     ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.153 2013-08-10 11:24:20 stefan Exp $'
  1472     ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.154 2013-12-13 09:38:16 cg Exp $'
  1425 !
  1473 !
  1426 
  1474 
  1427 version_CVS
  1475 version_CVS
  1428     ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.153 2013-08-10 11:24:20 stefan Exp $'
  1476     ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.154 2013-12-13 09:38:16 cg Exp $'
  1429 ! !
  1477 ! !
  1430 
  1478 
  1431 
  1479 
  1432 ResourcePack initialize!
  1480 ResourcePack initialize!