more bundles

GitOrigin-RevId: 345a735e92f8eabe5ba6afce218aa1b3a6abc677
This commit is contained in:
Sergey Ignatov
2019-12-19 17:02:07 +00:00
committed by intellij-monorepo-bot
parent 2c9efdd5c7
commit 8279d3a809
3 changed files with 23 additions and 76 deletions
@@ -15,33 +15,19 @@
*/
package com.intellij.lang.ant;
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 AntBundle extends DynamicBundle {
@NonNls protected static final String BUNDLE = "messages.AntBundle";
private static final AntBundle INSTANCE = new AntBundle();
public class AntBundle {
public static String message(@NotNull @PropertyKey(resourceBundle = PATH_TO_BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private AntBundle() { super(BUNDLE); }
private static Reference<ResourceBundle> ourBundle;
@NonNls
protected static final String PATH_TO_BUNDLE = "messages.AntBundle";
private AntBundle() {
}
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);
}
}
@@ -15,43 +15,19 @@
*/
package com.intellij.lang.ant.resources;
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 AntActionsBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "com.intellij.lang.ant.resources.AntActionsBundle";
private static final AntActionsBundle INSTANCE = new AntActionsBundle();
public final class AntActionsBundle {
private AntActionsBundle() { super(BUNDLE); }
public static String message(@NotNull @PropertyKey(resourceBundle = IDEA_ACTIONS_BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private static Reference<ResourceBundle> ourBundle;
@NonNls private static final String IDEA_ACTIONS_BUNDLE = "com.intellij.lang.ant.resources.AntActionsBundle";
private AntActionsBundle() {
}
@SuppressWarnings({"UnresolvedPropertyKey"})
public static String actionText(@NonNls String actionId) {
return message("action." + actionId + ".text");
}
@SuppressWarnings({"UnresolvedPropertyKey"})
public static String actionDescription(@NonNls String actionId) {
return message("action." + actionId + ".description");
}
private static ResourceBundle getBundle() {
ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
if (bundle == null) {
bundle = ResourceBundle.getBundle(IDEA_ACTIONS_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,34 +15,19 @@
*/
package org.jetbrains.idea.eclipse;
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 EclipseBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "EclipseBundle";
private static final EclipseBundle INSTANCE = new EclipseBundle();
public class EclipseBundle {
private EclipseBundle() { super(BUNDLE); }
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
private static Reference<ResourceBundle> ourBundle;
@NonNls
private static final String BUNDLE = "EclipseBundle";
private EclipseBundle() {
}
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;
return INSTANCE.getMessage(key, params);
}
}