more dynamic bundles

GitOrigin-RevId: 25c80a7d911c36dbee7395c1110306dc421ac222
This commit is contained in:
Sergey Ignatov
2019-12-18 19:31:34 +00:00
committed by intellij-monorepo-bot
parent f6498b18d6
commit 3b0b8cc7fc
11 changed files with 86 additions and 278 deletions
@@ -15,42 +15,19 @@
*/
package com.intellij.openapi.compiler;
import com.intellij.CommonBundle;
import com.intellij.openapi.projectRoots.Sdk;
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 CompilerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.CompilerBundle";
private static final CompilerBundle INSTANCE = new CompilerBundle();
/**
* @author Eugene Zhuravlev
*/
public class CompilerBundle {
private CompilerBundle() { 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 = "messages.CompilerBundle";
private CompilerBundle() {
}
public static String jdkHomeNotFoundMessage(final Sdk jdk) {
return message("javac.error.jdk.home.missing", jdk.getName(), jdk.getHomePath());
}
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;
}
}
}
@@ -15,27 +15,22 @@
*/
package com.intellij.debugger;
import com.intellij.CommonBundle;
import com.intellij.DynamicBundle;
import com.intellij.execution.configurations.RemoteConnection;
import com.intellij.openapi.util.text.StringUtil;
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 DebuggerBundle {
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 DebuggerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.DebuggerBundle";
private static final DebuggerBundle INSTANCE = new DebuggerBundle();
private DebuggerBundle() {
private DebuggerBundle() { super(BUNDLE); }
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
return INSTANCE.getMessage(key, params);
}
public static String getAddressDisplayName(final RemoteConnection connection) {
@@ -46,13 +41,4 @@ public class DebuggerBundle {
public static String getTransportName(final RemoteConnection connection) {
return connection.isUseSockets() ? message("transport.name.socket") : message("transport.name.shared.memory");
}
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;
}
}
}
@@ -1,37 +1,19 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.daemon;
import com.intellij.CommonBundle;
import org.jetbrains.annotations.Nls;
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 QuickFixBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.QuickFixBundle";
private static final QuickFixBundle INSTANCE = new QuickFixBundle();
/**
* @author max
*/
public class QuickFixBundle {
private static Reference<ResourceBundle> ourBundle;
private QuickFixBundle() { super(BUNDLE); }
private static final String BUNDLE = "messages.QuickFixBundle";
private QuickFixBundle() { }
@Nls
@NotNull
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE)String key, @NotNull Object... params) {
return CommonBundle.message(getBundle(), key, params);
}
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;
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.codeInsight.completion;
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 CompletionBundle {
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 CompletionBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.CompletionBundle";
private static final CompletionBundle INSTANCE = new CompletionBundle();
private CompletionBundle() {
}
private CompletionBundle() { 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.javadoc;
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 yole
*/
public class JavadocBundle {
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 JavadocBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavadocBundle";
private static final JavadocBundle INSTANCE = new JavadocBundle();
private JavadocBundle() {
}
private JavadocBundle() { 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.core;
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 JavaCoreBundle {
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 JavaCoreBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.JavaCoreBundle";
private static final JavaCoreBundle INSTANCE = new JavaCoreBundle();
private JavaCoreBundle() {
}
private JavaCoreBundle() { 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,38 +1,19 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.siyeh;
import com.intellij.CommonBundle;
import org.jetbrains.annotations.Contract;
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 InspectionGadgetsBundle {
@NotNull
@Contract(pure = true)
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 InspectionGadgetsBundle extends DynamicBundle {
@NonNls public static final String BUNDLE = "com.siyeh.InspectionGadgetsBundle";
private static final InspectionGadgetsBundle INSTANCE = new InspectionGadgetsBundle();
private InspectionGadgetsBundle() {
}
private InspectionGadgetsBundle() { 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);
}
}
}
@@ -16,36 +16,18 @@
package org.jetbrains.plugins.groovy;
import com.intellij.CommonBundle;
import org.jetbrains.annotations.NonNls;
import com.intellij.DynamicBundle;
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 GroovyBundle extends DynamicBundle {
public static final String BUNDLE = "org.jetbrains.plugins.groovy.GroovyBundle";
private static final GroovyBundle INSTANCE = new GroovyBundle();
/**
* @author ilyas
*/
public class GroovyBundle {
private GroovyBundle() { 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
public static final String BUNDLE = "org.jetbrains.plugins.groovy.GroovyBundle";
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;
}
}
}
@@ -15,35 +15,19 @@
*/
package org.jetbrains.plugins.groovy.codeInspection;
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 GroovyInspectionBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle";
private static final GroovyInspectionBundle INSTANCE = new GroovyInspectionBundle();
/**
* @author ilyas
*/
public class GroovyInspectionBundle {
private GroovyInspectionBundle() { 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 = "org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle";
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);
}
}
@@ -16,35 +16,19 @@
package org.jetbrains.plugins.groovy.intentions;
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 GroovyIntentionsBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle";
private static final GroovyIntentionsBundle INSTANCE = new GroovyIntentionsBundle();
/**
* @author ilyas
*/
public class GroovyIntentionsBundle {
private GroovyIntentionsBundle() { 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 = "org.jetbrains.plugins.groovy.intentions.GroovyIntentionsBundle";
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;
}
}
}
@@ -15,36 +15,19 @@
*/
package com.intellij.uiDesigner;
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 yole
*/
public class UIDesignerBundle {
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 UIDesignerBundle extends DynamicBundle {
@NonNls private static final String BUNDLE = "messages.UIDesignerBundle";
private static final UIDesignerBundle INSTANCE = new UIDesignerBundle();
private UIDesignerBundle() {
}
private UIDesignerBundle() { 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);
}
}
}