org.eclipse.core.runtime.Platform.getResourceBundle()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中org.eclipse.core.runtime.Platform.getResourceBundle()方法的一些代码示例,展示了Platform.getResourceBundle()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getResourceBundle()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getResourceBundle

Platform.getResourceBundle介绍

[英]Returns the given bundle's resource bundle for the current locale.

This resource bundle is typically stored as the plugin.properties file in the plug-in itself, and contains any translatable strings used in the plug-in manifest file (plugin.xml).

This mechanism is intended only for externalizing strings found in the plug-in manifest file. Using this method for externalizing strings in your code may result in degraded memory performance.
[中]返回当前区域设置的给定绑定的资源绑定。
此资源包通常存储为插件。属性文件,并包含插件清单文件(plugin.xml)中使用的任何可翻译字符串。
此机制仅用于外部化插件清单文件中的字符串。使用此方法在代码中外部化字符串可能会导致内存性能下降。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

/**
 * This gets the string resource and does one substitution.
 */
public String getString(String key, Object s1) {
 return MessageFormat.format(Platform.getResourceBundle(getBundle()).getString(key), new Object[]{s1});
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.compare

/**
 * Returns this plug-in's resource bundle.
 *
 * @return the plugin's resource bundle
 */
public ResourceBundle getResourceBundle() {
  if (fResourceBundle == null)
    fResourceBundle= Platform.getResourceBundle(getBundle());
  return fResourceBundle;
}

代码示例来源:origin: org.eclipse/org.eclipse.compare

/**
 * Returns this plug-in's resource bundle.
 *
 * @return the plugin's resource bundle
 */
public ResourceBundle getResourceBundle() {
  if (fResourceBundle == null)
    fResourceBundle= Platform.getResourceBundle(getBundle());
  return fResourceBundle;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

/**
 * Returns the plugin's resource bundle,
 */
public ResourceBundle getResourceBundle() {
  try {
    if (resourceBundle == null)
      // resourceBundle = ResourceBundle.getBundle("org.eclipse.wst.xsd.ui.internal.editor.EditorPluginResources");
  resourceBundle = Platform.getResourceBundle(getBundle());
  } catch (MissingResourceException x) {
    resourceBundle = null;
  }
  return resourceBundle;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.pagedesigner

/**
 * Returns the plugin's descriptor's resource bundle,
 */
public ResourceBundle getPluginDecriptorBundle() {
  return Platform.getResourceBundle(getDefault().getBundle());
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.common

public String getString(String key, boolean translate)
{
 ResourceBundle bundle = translate ? resourceBundle : untranslatedResourceBundle;
 if (bundle == null)
 {
  if (translate)
  {
    bundle = resourceBundle = Platform.getResourceBundle(getBundle());
  }
  else
  {
   String resourceName = getBaseURL().toString() + "plugin.properties";
   try
   {
    InputStream inputStream =  new URL(resourceName).openStream();
    bundle = untranslatedResourceBundle = new PropertyResourceBundle(inputStream);
    inputStream.close();
   }
   catch (IOException ioException)
   {
    throw new MissingResourceException("Missing properties: " + resourceName, getClass().getName(), "plugin.properties");
   }
  }
 }
 return bundle.getString(key);
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.common.ui

/**
 * Returns the plugin's resource bundle,
 */
public ResourceBundle getResourceBundle() {
  try {
    return Platform.getResourceBundle(plugin.getBundle());
  } catch (MissingResourceException x) {
    log(x);
  }
  return null;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

return source;
ResourceBundle resourceBundle = Platform.getResourceBundle(bundle);
if (resourceBundle == null)
  return source;

相关文章