PageRenderTime 123ms CodeModel.GetById 60ms app.highlight 4ms RepoModel.GetById 57ms app.codeStats 1ms

/src/org/bitbucket/connectors/jetbrains/ui/BitbucketBundle.java

https://bitbucket.org/atlassian/jetbrains-bitbucket-connector/
Java | 34 lines | 23 code | 7 blank | 4 comment | 4 complexity | dd33b7649da0bba9a5ed8f06311e4d26 MD5 | raw file
 1package org.bitbucket.connectors.jetbrains.ui;
 2
 3import com.intellij.CommonBundle;
 4import com.intellij.reference.SoftReference;
 5
 6import java.lang.ref.Reference;
 7import java.util.ResourceBundle;
 8
 9/**
10 * @author Alexei Orischenko
11 *         Date: Jan 6, 2010
12 */
13public class BitbucketBundle {
14    private static Reference<ResourceBundle> myBundle;
15
16    private static final String BUNDLE = BitbucketBundle.class.getPackage().getName() + ".Messages";
17
18    public static String message(String key, Object... params) {
19        return CommonBundle.message(getBundle(), key, params);
20    }
21
22    private static ResourceBundle getBundle() {
23        ResourceBundle bundle = null;
24        if (myBundle != null) {
25            bundle = myBundle.get();
26        }
27        if (bundle == null) {
28            bundle = ResourceBundle.getBundle(BUNDLE);
29            myBundle = new SoftReference<ResourceBundle>(bundle);
30        }
31        return bundle;
32    }
33
34}