mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Try to find a resource bundle in IdeaPluginDescriptor if it is not defined in ConfigurableEP
GitOrigin-RevId: 33e3b79a3c08409d743309103314dfdc8c3adb35
This commit is contained in:
committed by
intellij-monorepo-bot
parent
eb46c7b72b
commit
148e8f6aff
@@ -3,6 +3,7 @@ package com.intellij.openapi.options;
|
||||
|
||||
import com.intellij.AbstractBundle;
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.extensions.AbstractExtensionPointBean;
|
||||
@@ -59,8 +60,8 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
|
||||
public String getDisplayName() {
|
||||
if (displayName == null) {
|
||||
if (bundle != null) {
|
||||
ResourceBundle resourceBundle = AbstractBundle.getResourceBundle(bundle, myPluginDescriptor.getPluginClassLoader());
|
||||
ResourceBundle resourceBundle = findBundle();
|
||||
if (resourceBundle != null) {
|
||||
displayName = CommonBundle.message(resourceBundle, key);
|
||||
}
|
||||
else {
|
||||
@@ -74,10 +75,21 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
|
||||
/**
|
||||
* @return a resource bundle using the specified base name or {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
public ResourceBundle findBundle() {
|
||||
return bundle == null ? null : AbstractBundle.getResourceBundle(bundle, myPluginDescriptor != null
|
||||
? myPluginDescriptor.getPluginClassLoader()
|
||||
: getClass().getClassLoader());
|
||||
String pathToBundle = findPathToBundle();
|
||||
if (pathToBundle == null) return null; // a path to bundle is not specified or cannot be found
|
||||
ClassLoader loader = myPluginDescriptor == null ? null : myPluginDescriptor.getPluginClassLoader();
|
||||
return AbstractBundle.getResourceBundle(pathToBundle, loader != null ? loader : getClass().getClassLoader());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String findPathToBundle() {
|
||||
if (bundle == null && myPluginDescriptor instanceof IdeaPluginDescriptor) {
|
||||
IdeaPluginDescriptor descriptor = (IdeaPluginDescriptor)myPluginDescriptor;
|
||||
return descriptor.getResourceBundleBaseName(); // can be unspecified
|
||||
}
|
||||
return bundle;
|
||||
}
|
||||
|
||||
@Property(surroundWithTag = false)
|
||||
|
||||
Reference in New Issue
Block a user