private static String getDictionaryEntry(String dictionaryName, String key) { try { Dictionary dic = Dictionary.getDictionary(dictionaryName); if (dic != null) { return dic.get(key); } return null; } catch (Exception e) { return null; } }
private String getString(String key) { try { return _dictionary.get(key); } catch (MissingResourceException e) { return null; } }
/** * @return null if no bundle, ???key??? if bundle is missing a key */ public String getLocalizedKey( String key ) { if ( mDictionaryName == null ) { return null; } try { if ( mDictionary == null ) { mDictionary = Dictionary.getDictionary( mDictionaryName ); } return mDictionary.get( key ); } catch ( MissingResourceException e ) { return StringUtils.RESOURCE_KEY_NOT_FOUND_PREFIX + key + StringUtils.RESOURCE_KEY_NOT_FOUND_SUFFIX; } }
/** * @return the git commit id of the loaded version */ public static String getCommitId() { return DICTIONARY.get("commitId"); }
/** * To be used in Sonar extensions only, else use constructors. */ public static Sonar getInstance() { if (instance == null) { Dictionary dic = Dictionary.getDictionary("config"); instance = new Sonar(dic.get("sonar_url")); } return instance; }
/** * @return the display name of the loaded version (e.g. "2.5.6") */ public static String getVersion() { return DICTIONARY.get("version"); }
public static String getAppTitle() { return DICTIONARY.get("title"); }
/** * Returns the string value associated with the given key. * <p> * If the {@code Dictionary} doesn't contain the value associated with given key, then return the fallback value. If * the fallback value isn't defined for given key, then return empty string. * * @param key * The key * @return The message, either from the {@code Dictionary} or the fallback value. */ protected String getString(final DynamicMessageKey key) { try { if (dictionary != null) { return dictionary.get(key.getValue()); } } catch (MissingResourceException mre) { // Do nothing, the key doesn't exist. } String fallback = fallbackValues.get(key); if (fallback == null) { // Use empty string for missing fallback value. fallback = ""; //$NON-NLS-1$ } return fallback; }