mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
rest bundle
GitOrigin-RevId: 1e2017f3b1e6ca2e8320eec404797955627ea5ce
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4235731d82
commit
ef0bfae0bf
@@ -15,40 +15,19 @@
|
||||
*/
|
||||
package com.jetbrains.rest;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import com.intellij.DynamicBundle;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.PropertyKey;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.util.ResourceBundle;
|
||||
public class RestBundle extends DynamicBundle {
|
||||
@NonNls private static final String BUNDLE = "com.jetbrains.rest.RestBundle";
|
||||
private static final RestBundle INSTANCE = new RestBundle();
|
||||
|
||||
// A copy of Ruby's.
|
||||
|
||||
/**
|
||||
* User : catherine
|
||||
*/
|
||||
public class RestBundle {
|
||||
private RestBundle() { super(BUNDLE); }
|
||||
|
||||
@NotNull
|
||||
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
|
||||
return CommonBundle.message(getBundle(), key, params);
|
||||
return INSTANCE.getMessage(key, params);
|
||||
}
|
||||
|
||||
private static Reference<ResourceBundle> ourBundle;
|
||||
@NonNls
|
||||
private static final String BUNDLE = "com.jetbrains.rest.RestBundle";
|
||||
|
||||
private RestBundle() {
|
||||
}
|
||||
|
||||
// Cached loading
|
||||
private static ResourceBundle getBundle() {
|
||||
ResourceBundle bundle = SoftReference.dereference(ourBundle);
|
||||
if (bundle == null) {
|
||||
bundle = ResourceBundle.getBundle(BUNDLE);
|
||||
ourBundle = new SoftReference<>(bundle);
|
||||
}
|
||||
return bundle;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user