Package java.util

Examples of java.util.PropertyResourceBundle


                mappingsURL = null;
                String message = "Unable to find " + mappingsURL + " Defaulting to a blank string."; //$NON-NLS-1$
                this.getLog().log(new Status(IStatus.ERROR, ID, 0, message, e));
            }
        }
        PropertyResourceBundle bundle = null;
        if (mappingsURL != null) {
            InputStream is = null;
            try {
                is = mappingsURL.openStream();
                bundle = new PropertyResourceBundle(is);
            } catch (IOException e) {
                bundle = null;
                String message = "Unable to parse version from about.mappings file. Defaulting to a blank string."; //$NON-NLS-1$
                this.getLog().log(new Status(IStatus.ERROR, ID, 0, message, e));
            } finally {
                try {
                    if (is != null)
                        is.close();
                } catch (IOException e) {
                }
            }
        }

        if (bundle != null) {
            this.version = bundle.getString(UDIG_VERSION_KEY);
        }
    }
View Full Code Here


 
  @Override
  protected <T> PropertyResourceBundle getPropertiesForLocale(final Class<T> targetInterface)
  {
    Locale userLocale = LocaleResolverInitializer.getLocaleResolver().getUserLocale();
    PropertyResourceBundle properties = null;
    if (!localeMessages.containsKey(userLocale))
    {
      propertiesLock.lock();
      try
      {
View Full Code Here

   * @param name
   * @return
   */
  protected String getMessageFromProperties(Object[] args, String name)
  {
    PropertyResourceBundle properties = getPropertiesForLocale(targetInterface);
    String message = null;
    if (properties != null)
    {
      message = MessageFormat.format(properties.getString(name),args);
      if (this.isCacheable)
      {
        resolvedConstants.put(name, message);
      }
    }
View Full Code Here

   * @param locale
   * @return
   */
  protected static PropertyResourceBundle loadProperties (Class<?> targetInterface, final Locale locale)
  {
    PropertyResourceBundle properties = null;
    try
    {
      properties = (PropertyResourceBundle) PropertyResourceBundle.getBundle(targetInterface.getSimpleName(), locale);
    }
    catch (Throwable e)
    {
      try
      {
        String resourceName = "/"+targetInterface.getName().replaceAll("\\.", "/") + ".properties";
        InputStream input = targetInterface.getClassLoader().getResourceAsStream(resourceName);
        if (input != null)
        {
          properties = new PropertyResourceBundle(input);
        }
      }
      catch (IOException e1)
      {
        throw new MessageException(e.getMessage(), e);
View Full Code Here

        log.debug("checking " + url.getFile() + " for configured types ...");

        inputStream = url.openStream();

        final ResourceBundle props = new PropertyResourceBundle(inputStream);
        if (props != null) {

          for (final Object o : props.keySet()) {
            final String key = (String) o;

            frameworkProps.put(key, props.getString(key));

            if (key.equals(CONFIG_ERRAI_SERIALIZABLE_TYPE)) {
              for (final String s : props.getString(key).split(" ")) {
                try {
                  exposedClasses.add(MetaClassFactory.get(s.trim()));
                  explicitTypes.add(s.trim());
                }
                catch (Exception e) {
                  throw new RuntimeException("could not find class defined in ErraiApp.properties for serialization: " + s, e);
                }
              }

              continue;
            }

            if (key.equals(CONFIG_ERRAI_NONSERIALIZABLE_TYPE)) {
              for (final String s : props.getString(key).split(" ")) {
                try {
                  nonportableClasses.add(MetaClassFactory.get(s.trim()));
                }
                catch (Exception e) {
                  throw new RuntimeException("could not find class defined in ErraiApp.properties as nonserializable: " + s, e);
                }
              }

              continue;
            }

            if (key.equals(CONFIG_ERRAI_MAPPING_ALIASES)) {
              for (final String s : props.getString(key).split(" ")) {
                try {
                  final String[] mapping = s.split("->");

                  if (mapping.length != 2) {
                    throw new RuntimeException("syntax error: mapping for marshalling alias: " + s);
View Full Code Here

                        // for this component is successful, the ResourceBundle is wrapped in a Map<String, String> and
                        // returned.
                        try
                        {
                            _resourceBundleMap
                                    = new BundleMap(new PropertyResourceBundle(bundleResource.getInputStream()));
                        }
                        catch (IOException e1)
                        {
                            // Nothing happens, then resourceBundleMap is set as empty map
                        }
View Full Code Here

      ResourceBundle.getBundle("org.openscience.jmol.app.jmolpanel.Properties.Jmol", locale);

    try {
      String t = "/org/openscience/jmol/app/jmolpanel/Properties/Jmol-resources.properties";
      generalResourceBundle =
        new PropertyResourceBundle(getClass().getResourceAsStream(t));
    } catch (IOException ex) {
      throw new RuntimeException(ex.toString());
    }
  }
View Full Code Here

      if (is instanceof ReadStream) {
        Path path = ((ReadStream) is).getPath();
        Environment.addDependency(path.createDepend());
      }

      ResourceBundle bundle = new PropertyResourceBundle(is);

      is.close();

      return bundle;
    } catch (Exception e) {
View Full Code Here

            super.putValue(key, newValue);
            if (CODE_KEY.equals(key)) {
                init();
            } else if (PROP_KEY.equals(key)) {
                try {
                    setResourceBundle(new PropertyResourceBundle(new FileReader((String)newValue)));
                } catch (IOException ex) {
                    trace("I/O error: %s", getStackTrace(ex));
                }
            } else if (TEXT_KEY.equals(key)) {
                if (newValue != null) {
View Full Code Here

          String translations= element.getAttribute(TRANSLATIONS);
          if (translations != null) {
            URL bundleURL= FileLocator.find(plugin, Path.fromOSString(translations), null);
            if (bundleURL != null) {
              bundleStream= bundleURL.openStream();
              bundle= new PropertyResourceBundle(bundleStream);
            }
          }

          stream= new BufferedInputStream(url.openStream());
          TemplateReaderWriter reader= new TemplateReaderWriter();
View Full Code Here

TOP

Related Classes of java.util.PropertyResourceBundle

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.