From da81ff49374d76a5ed3f16c1cf9389ca9bffdbef Mon Sep 17 00:00:00 2001 From: Sergey Ignatov Date: Wed, 18 Dec 2019 13:07:11 +0300 Subject: [PATCH] more dynamic bundles GitOrigin-RevId: 287684f806e29937f08580dfe89f478f170fb32b --- .../application/ApplicationBundle.java | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/platform/platform-api/src/com/intellij/openapi/application/ApplicationBundle.java b/platform/platform-api/src/com/intellij/openapi/application/ApplicationBundle.java index 6f120c3f954a..53d24f0d2a87 100644 --- a/platform/platform-api/src/com/intellij/openapi/application/ApplicationBundle.java +++ b/platform/platform-api/src/com/intellij/openapi/application/ApplicationBundle.java @@ -15,36 +15,24 @@ */ package com.intellij.openapi.application; -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; - /** * Provides access to localized properties of the IntelliJ Platform. */ -public class ApplicationBundle { - - public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) { - return CommonBundle.message(getBundle(), key, params); - } - - private static Reference ourBundle; +public class ApplicationBundle extends DynamicBundle { @NonNls public static final String BUNDLE = "messages.ApplicationBundle"; + private static final ApplicationBundle INSTANCE = new ApplicationBundle(); private ApplicationBundle() { + 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); } }