NotNull, dispose
[fedora-idea.git] / platform / lang-impl / src / com / intellij / lang / LangBundle.java
blob3dc2b2aecbf6881106da617f10cda674c925fc87
1 /*
2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.intellij.lang;
19 import com.intellij.CommonBundle;
20 import org.jetbrains.annotations.NonNls;
21 import org.jetbrains.annotations.PropertyKey;
23 import java.lang.ref.Reference;
24 import java.lang.ref.SoftReference;
25 import java.util.ResourceBundle;
27 /**
28 * Created by IntelliJ IDEA.
29 * User: yole
30 * Date: 12.09.2005
31 * Time: 18:03:21
32 * To change this template use File | Settings | File Templates.
34 public class LangBundle {
35 private static Reference<ResourceBundle> ourBundle;
37 @NonNls private static final String BUNDLE = "messages.LangBundle";
39 private LangBundle() {
42 public static String message(@PropertyKey(resourceBundle = BUNDLE)String key, Object... params) {
43 return CommonBundle.message(getBundle(), key, params);
46 private static ResourceBundle getBundle() {
47 ResourceBundle bundle = null;
48 if (ourBundle != null) bundle = ourBundle.get();
49 if (bundle == null) {
50 bundle = ResourceBundle.getBundle(BUNDLE);
51 ourBundle = new SoftReference<ResourceBundle>(bundle);
53 return bundle;