/** * Retrieves the (cached) resource bundle for the specified object, * localized in the default locale if indicated. * * @param eObject * The object for which to retrieve the resource bundle. * @param localize * Whether to retrieve the resource bundle based on (the default) * locale. * @return The resource bundle for the object (in the default locale). */ protected static ResourceBundle getResourceBundle(EObject eObject, boolean localize) { return getResourceBundle(eObject, localize ? Locale.getDefault() : null); }
/** * Retrieves the (cached) resource bundle for the specified object, * localized in the default locale if indicated. * * @param eObject * The object for which to retrieve the resource bundle. * @param localize * Whether to retrieve the resource bundle based on (the default) * locale. * @return The resource bundle for the object (in the default locale). */ protected static ResourceBundle getResourceBundle(EObject eObject, boolean localize) { return getResourceBundle(eObject, localize ? Locale.getDefault() : null); }
/** * Retrieves a string for the specified object, localized if indicated. * * @param eObject * The object for which to retrieve a (localized) string. * @param key * The key in the resource bundle. * @param defaultString * The string to return if no string for the given key can be * found. * @param localize * Whether the string should be localized. * @return The (localized) string. */ protected static String getString(EObject eObject, String key, String defaultString, boolean localize) { String string = defaultString; if (eObject != null) { try { ResourceBundle resourceBundle = getResourceBundle(eObject, localize); if (resourceBundle != null) { string = resourceBundle.getString(key); } } catch (MissingResourceException mre) { // ignore } } return string; }
/** * Retrieves a string for the specified object, localized if indicated. * * @param eObject * The object for which to retrieve a (localized) string. * @param key * The key in the resource bundle. * @param defaultString * The string to return if no string for the given key can be * found. * @param localize * Whether the string should be localized. * @return The (localized) string. */ protected static String getString(EObject eObject, String key, String defaultString, boolean localize) { String string = defaultString; if (eObject != null) { try { ResourceBundle resourceBundle = getResourceBundle(eObject, localize); if (resourceBundle != null) { string = resourceBundle.getString(key); } } catch (MissingResourceException mre) { // ignore } } return string; }