Configurable refactoring: add public method to find a resource bundle

This commit is contained in:
Sergey Malenkov
2015-04-06 20:26:13 +03:00
parent e9843187d3
commit 7a3777dcbc
3 changed files with 13 additions and 10 deletions
@@ -56,6 +56,13 @@ public class ConfigurableEP<T extends UnnamedConfigurable> extends AbstractExten
return displayName = CommonBundle.message(resourceBundle, key);
}
/**
* @return a resource bundle using the specified base name or {@code null}
*/
public ResourceBundle findBundle() {
return bundle == null ? null : AbstractBundle.getResourceBundle(bundle, myPluginDescriptor.getPluginClassLoader());
}
@Property(surroundWithTag = false)
@AbstractCollection(surroundWithTag = false)
public ConfigurableEP[] children;
@@ -15,7 +15,6 @@
*/
package com.intellij.openapi.options.newEditor;
import com.intellij.AbstractBundle;
import com.intellij.CommonBundle;
import com.intellij.internal.statistic.UsageTrigger;
import com.intellij.internal.statistic.beans.ConvertUsagesUtil;
@@ -287,9 +286,10 @@ class ConfigurableEditor extends AbstractEditor implements AnActionListener, AWT
try {
if (configurable instanceof ConfigurableWrapper) {
ConfigurableWrapper wrapper = (ConfigurableWrapper)configurable;
ConfigurableEP ep = wrapper.getExtensionPoint();
ResourceBundle bundle = AbstractBundle.getResourceBundle(ep.bundle, ep.getPluginDescriptor().getPluginClassLoader());
return CommonBundle.message(bundle, key);
ResourceBundle bundle = wrapper.getExtensionPoint().findBundle();
if (bundle != null) {
return CommonBundle.message(bundle, key);
}
}
return OptionsBundle.message(key);
}
@@ -15,7 +15,6 @@
*/
package com.intellij.openapi.options.newEditor;
import com.intellij.AbstractBundle;
import com.intellij.CommonBundle;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.internal.statistic.UsageTrigger;
@@ -39,7 +38,6 @@ import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.EdtRunnable;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.LightColors;
import com.intellij.ui.OnePixelSplitter;
import com.intellij.ui.ScrollPaneFactory;
@@ -1036,10 +1034,8 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
String key = configurable.getId() + ".settings.description";
if (configurable instanceof ConfigurableWrapper) {
ConfigurableWrapper wrapper = (ConfigurableWrapper) configurable;
ConfigurableEP ep = wrapper.getExtensionPoint();
final String bundle = ep.bundle;
if (StringUtil.isNotEmpty(bundle)) {
ResourceBundle resourceBundle = AbstractBundle.getResourceBundle(bundle, ep.getPluginDescriptor().getPluginClassLoader());
ResourceBundle resourceBundle = wrapper.getExtensionPoint().findBundle();
if (resourceBundle != null) {
return CommonBundle.message(resourceBundle, key);
}
}