more bundles

GitOrigin-RevId: 43153b989b5ef5fbf36fbbc4e4aed28d9cf7199f
This commit is contained in:
Sergey Ignatov
2019-12-19 13:32:33 +00:00
committed by intellij-monorepo-bot
parent fdd69d0e2f
commit c46a6e5cec
5 changed files with 38 additions and 114 deletions
@@ -15,36 +15,19 @@
*/
package org.intellij.images;
import com.intellij.CommonBundle;
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.lang.ref.SoftReference;
import java.util.ResourceBundle;
/**
* @author max
*/
public class ImagesBundle {
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private static Reference<ResourceBundle> ourBundle;
public class ImagesBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "org.intellij.images.ImagesBundle";
private static final ImagesBundle INSTANCE = new ImagesBundle();
private ImagesBundle() {
}
private ImagesBundle() { super(BUNDLE); }
private static ResourceBundle getBundle() {
ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
if (bundle == null) {
bundle = ResourceBundle.getBundle(BUNDLE);
ourBundle = new SoftReference<>(bundle);
}
return bundle;
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return INSTANCE.getMessage(key, params);
}
}
}
@@ -15,33 +15,19 @@
*/
package com.intellij.openapi.project;
import com.intellij.CommonBundle;
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.lang.ref.SoftReference;
import java.util.ResourceBundle;
public class ProjectBundle {
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private static Reference<ResourceBundle> ourBundle;
public class ProjectBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.ProjectBundle";
private static final ProjectBundle INSTANCE = new ProjectBundle();
private ProjectBundle() {
}
private ProjectBundle() { super(BUNDLE); }
private static ResourceBundle getBundle() {
ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
if (bundle == null) {
bundle = ResourceBundle.getBundle(BUNDLE);
ourBundle = new SoftReference<>(bundle);
}
return bundle;
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return INSTANCE.getMessage(key, params);
}
}
@@ -15,36 +15,19 @@
*/
package com.intellij.execution.testframework.sm;
import com.intellij.CommonBundle;
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.lang.ref.SoftReference;
import java.util.ResourceBundle;
/**
* @author Roman Chernyatchik
*/
public class SMTestsRunnerBundle {
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private static Reference<ResourceBundle> ourBundle;
public class SMTestsRunnerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.SMTestsRunnerBundle";
private static final SMTestsRunnerBundle INSTANCE = new SMTestsRunnerBundle();
private SMTestsRunnerBundle() {
}
private SMTestsRunnerBundle() { super(BUNDLE); }
private static ResourceBundle getBundle() {
ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
if (bundle == null) {
bundle = ResourceBundle.getBundle(BUNDLE);
ourBundle = new SoftReference<>(bundle);
}
return bundle;
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return INSTANCE.getMessage(key, params);
}
}
}
@@ -1,32 +1,18 @@
package com.intellij.structuralsearch;
import com.intellij.CommonBundle;
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.lang.ref.SoftReference;
import java.util.ResourceBundle;
public class SSRBundle {
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private static Reference<ResourceBundle> ourBundle;
public class SSRBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.SSRBundle";
private static final SSRBundle INSTANCE = new SSRBundle();
private SSRBundle() {
}
private SSRBundle() { super(BUNDLE); }
private static ResourceBundle getBundle() {
ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
if (bundle == null) {
bundle = ResourceBundle.getBundle(BUNDLE);
ourBundle = new SoftReference<>(bundle);
}
return bundle;
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return INSTANCE.getMessage(key, params);
}
}
@@ -15,33 +15,19 @@
*/
package com.intellij.lang.properties;
import com.intellij.CommonBundle;
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.lang.ref.SoftReference;
import java.util.ResourceBundle;
public class PropertiesBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.PropertiesBundle";
private static final PropertiesBundle INSTANCE = new PropertiesBundle();
public class PropertiesBundle {
private PropertiesBundle() { super(BUNDLE); }
public static String message(@NotNull @PropertyKey(resourceBundle = PATH_TO_BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private static Reference<ResourceBundle> ourBundle;
@NonNls protected static final String PATH_TO_BUNDLE = "messages.PropertiesBundle";
private PropertiesBundle() {
}
private static ResourceBundle getBundle() {
ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
if (bundle == null) {
bundle = ResourceBundle.getBundle(PATH_TO_BUNDLE);
ourBundle = new SoftReference<>(bundle);
}
return bundle;
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return INSTANCE.getMessage(key, params);
}
}