当前位置: 首页>>代码示例>>Java>>正文


Java AbstractBundle.getResourceBundle方法代码示例

本文整理汇总了Java中com.intellij.AbstractBundle.getResourceBundle方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractBundle.getResourceBundle方法的具体用法?Java AbstractBundle.getResourceBundle怎么用?Java AbstractBundle.getResourceBundle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.AbstractBundle的用法示例。


在下文中一共展示了AbstractBundle.getResourceBundle方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCategories

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
@Nullable
public String[] getCategories() {
  if (categoryKey != null) {
    final String baseName = bundleName != null ? bundleName : ((IdeaPluginDescriptor)myPluginDescriptor).getResourceBundleBaseName();
    if (baseName == null) {
      LOG.error("No resource bundle specified for "+myPluginDescriptor);
    }
    final ResourceBundle bundle = AbstractBundle.getResourceBundle(baseName, myPluginDescriptor.getPluginClassLoader());

    final String[] keys = categoryKey.split("/");
    if (keys.length > 1) {
      return ContainerUtil.map2Array(keys, String.class, new Function<String, String>() {
        @Override
        public String fun(final String s) {
          return CommonBundle.message(bundle, s);
        }
      });
    }

    category = CommonBundle.message(bundle, categoryKey);
  }
  if (category == null) return null;
  return category.split("/");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IntentionActionBean.java

示例2: compute

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
@Override
protected String compute() {
  if (name != null) {
    return name;
  }
  if (resourceKey != null) {
    String bundleName = resourceBundle;
    if (bundleName == null && myPluginDescriptor != null) {
      bundleName = ((IdeaPluginDescriptor) myPluginDescriptor).getResourceBundleBaseName();
    }
    if (bundleName != null) {
      ResourceBundle bundle = AbstractBundle.getResourceBundle(bundleName, getLoaderForClass());
      return bundle.getString(resourceKey);
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TypeNameEP.java

示例3: computeDescription

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
private String computeDescription() {
  ResourceBundle bundle = null;
  if (myResourceBundleBaseName != null) {
    try {
      bundle = AbstractBundle.getResourceBundle(myResourceBundleBaseName, getPluginClassLoader());
    }
    catch (MissingResourceException e) {
      LOG.info("Cannot find plugin " + myId + " resource-bundle: " + myResourceBundleBaseName);
    }
  }

  if (bundle == null) {
    return myDescriptionChildText;
  }

  return CommonBundle.messageOrDefault(bundle, createDescriptionKey(myId), myDescriptionChildText == null ? "" : myDescriptionChildText);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:IdeaPluginDescriptorImpl.java

示例4: getComponentPresentableName

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
@Nonnull
private static String getComponentPresentableName(@Nonnull State state, @Nonnull Class<?> aClass, @Nullable PluginDescriptor pluginDescriptor) {
  String defaultName = state.name();
  String resourceBundleName;
  if (pluginDescriptor != null && pluginDescriptor instanceof IdeaPluginDescriptor && !PluginManagerCore.CORE_PLUGIN.equals(pluginDescriptor.getPluginId())) {
    resourceBundleName = ((IdeaPluginDescriptor)pluginDescriptor).getResourceBundleBaseName();
  }
  else {
    resourceBundleName = OptionsBundle.PATH_TO_BUNDLE;
  }

  if (resourceBundleName == null) {
    return defaultName;
  }

  ClassLoader classLoader = pluginDescriptor == null ? null : pluginDescriptor.getPluginClassLoader();
  classLoader = classLoader == null ? aClass.getClassLoader() : classLoader;
  if (classLoader != null) {
    ResourceBundle bundle = AbstractBundle.getResourceBundle(resourceBundleName, classLoader);
    if (bundle != null) {
      return CommonBundle.messageOrDefault(bundle, "exportable." + defaultName + ".presentable.name", defaultName);
    }
  }
  return defaultName;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:ExportSettingsAction.java

示例5: getLocalizedString

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
@Nullable
private String getLocalizedString(String bundleName, String key) {
  final String baseName = bundleName != null ? bundleName : bundle == null ? ((IdeaPluginDescriptor)myPluginDescriptor).getResourceBundleBaseName() : bundle;
  if (baseName == null || key == null) {
    if (bundleName != null) {
      LOG.warn(implementationClass);
    }
    return null;
  }
  final ResourceBundle resourceBundle = AbstractBundle.getResourceBundle(baseName, myPluginDescriptor.getPluginClassLoader());
  return CommonBundle.message(resourceBundle, key);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:InspectionEP.java

示例6: getActionsResourceBundle

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
@Nullable
private static ResourceBundle getActionsResourceBundle(ClassLoader loader, IdeaPluginDescriptor plugin) {
  @NonNls final String resBundleName = plugin != null && !"com.intellij".equals(plugin.getPluginId().getIdString())
                                       ? plugin.getResourceBundleBaseName() : ACTIONS_BUNDLE;
  ResourceBundle bundle = null;
  if (resBundleName != null) {
    bundle = AbstractBundle.getResourceBundle(resBundleName, loader);
  }
  return bundle;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ActionManagerImpl.java

示例7: getLocalizedString

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
@Nullable
private String getLocalizedString(String bundleName, @NotNull String key) {
  final String baseName = bundleName != null ? bundleName : bundle == null ? ((IdeaPluginDescriptor)myPluginDescriptor).getResourceBundleBaseName() : bundle;
  if (baseName == null) {
    return null;
  }
  final ResourceBundle resourceBundle = AbstractBundle.getResourceBundle(baseName, myPluginDescriptor.getPluginClassLoader());
  return CommonBundle.message(resourceBundle, key);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:InspectionEP.java

示例8: getActionsResourceBundle

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
@Nullable
private static ResourceBundle getActionsResourceBundle(ClassLoader loader, IdeaPluginDescriptor plugin) {
  @NonNls final String resBundleName = plugin != null && !plugin.getPluginId().getIdString().equals("com.intellij") ? plugin.getResourceBundleBaseName() : ACTIONS_BUNDLE;
  ResourceBundle bundle = null;
  if (resBundleName != null) {
    bundle = AbstractBundle.getResourceBundle(resBundleName, loader);
  }
  return bundle;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:ActionManagerImpl.java

示例9: getActionsResourceBundle

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
@Nullable
private static ResourceBundle getActionsResourceBundle(ClassLoader loader, IdeaPluginDescriptor plugin) {
  @NonNls final String resBundleName =
          plugin != null && !plugin.getPluginId().equals(PluginManagerCore.CORE_PLUGIN) ? plugin.getResourceBundleBaseName() : ACTIONS_BUNDLE;
  ResourceBundle bundle = null;
  if (resBundleName != null) {
    bundle = AbstractBundle.getResourceBundle(resBundleName, loader);
  }
  return bundle;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:11,代码来源:ActionManagerImpl.java

示例10: getDisplayName

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
public String getDisplayName() {
  if (displayName != null) return displayName;
  LOG.assertTrue(bundle != null, "Bundle missed for " + instanceClass);
  final ResourceBundle resourceBundle = AbstractBundle.getResourceBundle(bundle, myPluginDescriptor.getPluginClassLoader());
  return displayName = CommonBundle.message(resourceBundle, key);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ConfigurableEP.java

示例11: findBundle

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
/**
 * @return a resource bundle using the specified base name or {@code null}
 */
public ResourceBundle findBundle() {
  return bundle == null ? null : AbstractBundle.getResourceBundle(bundle, myPluginDescriptor != null
                                                                          ? myPluginDescriptor.getPluginClassLoader()
                                                                          : getClass().getClassLoader());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ConfigurableEP.java

示例12: readTemplateFromElement

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
static TemplateImpl readTemplateFromElement(final String groupName, @NotNull Element element, @NotNull ClassLoader classLoader) {
  String name = element.getAttributeValue(NAME);
  String value = element.getAttributeValue(VALUE);
  String description;
  String resourceBundle = element.getAttributeValue(RESOURCE_BUNDLE);
  String key = element.getAttributeValue(KEY);
  String id = element.getAttributeValue(ID);
  if (resourceBundle != null && key != null) {
    ResourceBundle bundle = AbstractBundle.getResourceBundle(resourceBundle, classLoader);
    description = bundle.getString(key);
  }
  else {
    description = element.getAttributeValue(DESCRIPTION);
  }
  String shortcut = element.getAttributeValue(SHORTCUT);
  TemplateImpl template = createTemplate(name, value, groupName, description, shortcut, id);

  template.setToReformat(Boolean.parseBoolean(element.getAttributeValue(TO_REFORMAT)));
  template.setToShortenLongNames(Boolean.parseBoolean(element.getAttributeValue(TO_SHORTEN_FQ_NAMES)));
  template.setDeactivated(Boolean.parseBoolean(element.getAttributeValue(DEACTIVATED)));

  String useStaticImport = element.getAttributeValue(USE_STATIC_IMPORT);
  if (useStaticImport != null) {
    template.setValue(TemplateImpl.Property.USE_STATIC_IMPORT_IF_POSSIBLE, Boolean.parseBoolean(useStaticImport));
  }

  for (Element e : element.getChildren(VARIABLE)) {
    String variableName = e.getAttributeValue(NAME);
    String expression = e.getAttributeValue(EXPRESSION);
    String defaultValue = e.getAttributeValue(DEFAULT_VALUE);
    boolean isAlwaysStopAt = Boolean.parseBoolean(e.getAttributeValue(ALWAYS_STOP_AT));
    template.addVariable(variableName, expression, defaultValue, isAlwaysStopAt);
  }

  Element context = element.getChild(CONTEXT);
  if (context != null) {
    template.getTemplateContext().readTemplateContext(context);
  }

  return template;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:TemplateSettings.java

示例13: readTemplateFromElement

import com.intellij.AbstractBundle; //导入方法依赖的package包/类
private TemplateImpl readTemplateFromElement(final boolean isDefault,
                                             final String groupName,
                                             final Element element,
                                             ClassLoader classLoader) throws InvalidDataException {
  String name = element.getAttributeValue(NAME);
  String value = element.getAttributeValue(VALUE);
  String description;
  String resourceBundle = element.getAttributeValue(RESOURCE_BUNDLE);
  String key = element.getAttributeValue(KEY);
  String id = element.getAttributeValue(ID);
  if (resourceBundle != null && key != null) {
    if (classLoader == null) {
      classLoader = getClass().getClassLoader();
    }
    ResourceBundle bundle = AbstractBundle.getResourceBundle(resourceBundle, classLoader);
    description = bundle.getString(key);
  }
  else {
    description = element.getAttributeValue(DESCRIPTION);
  }
  String shortcut = element.getAttributeValue(SHORTCUT);
  TemplateImpl template = addTemplate(name, value, groupName, description, shortcut, isDefault, id);

  template.setToReformat(Boolean.parseBoolean(element.getAttributeValue(TO_REFORMAT)));
  template.setToShortenLongNames(Boolean.parseBoolean(element.getAttributeValue(TO_SHORTEN_FQ_NAMES)));
  template.setDeactivated(Boolean.parseBoolean(element.getAttributeValue(DEACTIVATED)));

  String useStaticImport = element.getAttributeValue(USE_STATIC_IMPORT);
  if (useStaticImport != null) {
    template.setValue(TemplateImpl.Property.USE_STATIC_IMPORT_IF_POSSIBLE, Boolean.parseBoolean(useStaticImport));
  }

  for (final Object o : element.getChildren(VARIABLE)) {
    Element e = (Element)o;
    String variableName = e.getAttributeValue(NAME);
    String expression = e.getAttributeValue(EXPRESSION);
    String defaultValue = e.getAttributeValue(DEFAULT_VALUE);
    boolean isAlwaysStopAt = Boolean.parseBoolean(e.getAttributeValue(ALWAYS_STOP_AT));
    template.addVariable(variableName, expression, defaultValue, isAlwaysStopAt);
  }

  Element context = element.getChild(CONTEXT);
  if (context != null) {
    template.getTemplateContext().readTemplateContext(context);
  }

  return template;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:49,代码来源:TemplateSettings.java


注:本文中的com.intellij.AbstractBundle.getResourceBundle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。