diff --git a/tools/unicodetools/com/ibm/rbm/RBImporter.java b/tools/unicodetools/com/ibm/rbm/RBImporter.java index f72ea21da2..46e6534e0c 100644 --- a/tools/unicodetools/com/ibm/rbm/RBImporter.java +++ b/tools/unicodetools/com/ibm/rbm/RBImporter.java @@ -124,21 +124,15 @@ public class RBImporter extends JDialog { BundleGroup group = null; BundleGroup backup_group = null; - if (group_name == null) group_name = getDefaultGroup(); - if (encoding == null) return; + if (group_name == null) + group_name = getDefaultGroup(); + if (encoding == null) + return; // Get the bundle to which we will be adding this resource - if (rbm.hasResource(encoding)) { - Vector bv = rbm.getBundles(); - for (int i = 0; i < bv.size(); i++) { - Bundle tempb = (Bundle)bv.elementAt(i); - if (tempb.encoding.equals(encoding)) { - bundle = tempb; - break; - } - } - } + bundle = rbm.getBundle(encoding); // Skip this import if the bundle is non-existent (Should have been resolved if wanted) - if (bundle == null) return; + if (bundle == null) + return; // Find the group in the bundle, Ungrouped if non-existent Vector gv = bundle.getGroupsAsVector(); for (int i=0; i < gv.size(); i++) { diff --git a/tools/unicodetools/com/ibm/rbm/RBManager.java b/tools/unicodetools/com/ibm/rbm/RBManager.java index 0fd2dbc537..c3324f9aee 100644 --- a/tools/unicodetools/com/ibm/rbm/RBManager.java +++ b/tools/unicodetools/com/ibm/rbm/RBManager.java @@ -557,18 +557,20 @@ public class RBManager { * @param groupComment An optional comment to be added to the group, can be null * @return An error response. If the creation was successful true is returned, if there was an error false is returned. */ - public boolean createGroup(String groupName, String groupComment) { - if (groupName == null || groupName.equals("")) return false; + if (groupName == null || groupName.equals("")) + return false; // Check to see if the group exists Bundle mainBundle = (Bundle)bundles.firstElement(); - if (mainBundle.hasGroup(groupName)) return false; + if (mainBundle.hasGroup(groupName)) + return false; // Create the group for (int i=0; i < bundles.size(); i++) { Bundle bundle = (Bundle)bundles.elementAt(i); BundleGroup bg = new BundleGroup(bundle, groupName); - if (groupComment != null) bg.setComment(groupComment); + if (groupComment != null) + bg.setComment(groupComment); bundle.addBundleGroup(bg); } return true; @@ -849,6 +851,24 @@ public class RBManager { return bundles; } + /** + * Return a bundle from a locale + * @return The requested resource bundle + */ + public Bundle getBundle(String locale) { + Bundle bundle = null; + if (hasResource(locale)) { + for (int i = 0; i < bundles.size(); i++) { + Bundle tempb = (Bundle)bundles.elementAt(i); + if (tempb.encoding.equals(locale)) { + bundle = tempb; + break; + } + } + } + return bundle; + } + /** * Returns the name of the file that is the base class file for the resource bundle. */