* @return null if the data can't be found -- defaulting happens
* above here.
*/
protected void setForBundleCreation(Class requestor, String field,
int type, String defaultString) {
ResourceBundle bundle = null;
Package pckg = requestor.getPackage();
String bString = (pckg == null ? ""
: (requestor.getPackage().getName() + "."))
+ ResourceFileNamePrefix;
String propertyFileNameKey = null;
Properties propertyFileProperties = null;
// OK, first see what the property file should be.
StringBuffer sbuf = new StringBuffer(bString.replace('.', '/'));
// Scope the desired resource bundle property file if the
// default isn't wanted.
if (!Debug.debugging(DEBUG_CREATE_DEFAULT)) {
sbuf.append("_" + loc.toString());
}
sbuf.append(".properties");
propertyFileNameKey = sbuf.toString().intern();
// See if we already have a properties file with the key-value
// pairs for this particular resource bundle.
propertyFileProperties = (Properties) getCreateHash().get(propertyFileNameKey);
// If not, create it.
if (propertyFileProperties == null) {
propertyFileProperties = new Properties();
getCreateHash().put(propertyFileNameKey, propertyFileProperties);
}
try {
bundle = ResourceBundle.getBundle(bString, loc);
} catch (MissingResourceException e) {
}
String resourceKey = shortClassName(requestor) + "." + field;
switch (type) {
case TEXT:
// Do nothing.
break;
case TITLE:
resourceKey += ".title";
break;
case TOOLTIP:
resourceKey += ".tooltip";
break;
case MNEMONIC:
resourceKey += ".mnemonic";
break;
}
try {
if (bundle != null) {
String resourceValue = bundle.getString(resourceKey);
propertyFileProperties.put(resourceKey, resourceValue);
} else {
propertyFileProperties.put(resourceKey, defaultString);
}
} catch (MissingResourceException e) {