-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use old way to do
ApplicationInsightsBundle
so both stable
and `e…
…ap` can compile. Revert this once stable is 2020.1
- Loading branch information
Showing
1 changed file
with
19 additions
and
15 deletions.
There are no files selected for viewing
34 changes: 19 additions & 15 deletions
34
src/main/java/fr/socolin/applicationinsights/ApplicationInsightsBundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,34 @@ | ||
package fr.socolin.applicationinsights; | ||
|
||
import com.intellij.DynamicBundle; | ||
import com.intellij.CommonBundle; | ||
import org.jetbrains.annotations.NonNls; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.PropertyKey; | ||
|
||
import java.util.function.Supplier; | ||
import java.lang.ref.Reference; | ||
import java.lang.ref.SoftReference; | ||
import java.util.ResourceBundle; | ||
|
||
public class ApplicationInsightsBundle extends DynamicBundle { | ||
@NonNls | ||
private static final String BUNDLE = "messages.ApplicationInsightsBundle"; | ||
private static final ApplicationInsightsBundle INSTANCE = new ApplicationInsightsBundle(); | ||
|
||
private ApplicationInsightsBundle() { | ||
super(BUNDLE); | ||
} | ||
public class ApplicationInsightsBundle { | ||
|
||
@NotNull | ||
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { | ||
return INSTANCE.getMessage(key, params); | ||
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) { | ||
return CommonBundle.message(getBundle(), key, params); | ||
} | ||
|
||
@NonNls | ||
public static final String BUNDLE = "messages.ApplicationInsightsBundle"; | ||
private static Reference<ResourceBundle> ourBundle; | ||
|
||
@NotNull | ||
public static Supplier<String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) { | ||
return INSTANCE.getLazyMessage(key, params); | ||
private ApplicationInsightsBundle() { | ||
} | ||
|
||
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; | ||
} | ||
} |