Package com.google.gwt.i18n.rebind.format

Examples of com.google.gwt.i18n.rebind.format.MessageCatalogFormat


        // Since they want all locales, this is guaranteed to be one of them.
        found = true;
      }
      if (found) {
        for (String genClassName : generate.format()) {
          MessageCatalogFormat msgWriter = null;
          MessageCatalogFactory msgCatFactory = null;
          try {
            // TODO(jat): if GWT is ever modified to take a classpath for user
            // code as an option, we would need to use the user classloader here
            Class<?> clazz = Class.forName(genClassName, false,
View Full Code Here


        // Since they want all locales, this is guaranteed to be one of them.
        found = true;
      }
      if (found) {
        for (String genClassName : generate.format()) {
          MessageCatalogFormat msgWriter = null;
          try {
            Class<? extends MessageCatalogFormat> msgFormatClass = Class.forName(
                genClassName, false,
                MessageCatalogFormat.class.getClassLoader()).asSubclass(
                MessageCatalogFormat.class);
            msgWriter = msgFormatClass.newInstance();
          } catch (InstantiationException e) {
            logger.log(TreeLogger.ERROR, "Error instantiating @Generate class "
                + genClassName, e);
            seenError = true;
            continue;
          } catch (IllegalAccessException e) {
            logger.log(TreeLogger.ERROR, "@Generate class " + genClassName
                + " illegal access", e);
            seenError = true;
            continue;
          } catch (ClassNotFoundException e) {
            logger.log(TreeLogger.ERROR, "@Generate class " + genClassName
                + " not found");
            seenError = true;
            continue;
          }
          // Make generator-specific changes to a temporary copy of the path.
          String genPath = path;
          if (genLocales.length != 1) {
            // If the user explicitly specified only one locale, do not add the
            // locale.
            genPath += '_' + locale;
          }
          genPath += msgWriter.getExtension();
          OutputStream outStr = context.tryCreateResource(logger, genPath);
          if (outStr != null) {
            TreeLogger branch = logger.branch(TreeLogger.INFO, "Generating "
                + genPath + " from " + className + " for locale " + locale,
                null);
            PrintWriter out = null;
            try {
              out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                  outStr, "UTF-8")), false);
            } catch (UnsupportedEncodingException e) {
              throw error(logger, e.getMessage());
            }
            try {
              msgWriter.write(branch, locale, resourceList, out, targetClass);
              out.flush();
              context.commitResource(logger, outStr).setPrivate(true);
            } catch (UnableToCompleteException e) {
              // msgWriter should have already logged an error message.
              // Keep going for now so we can find other errors.
View Full Code Here

        // Since they want all locales, this is guaranteed to be one of them.
        found = true;
      }
      if (found) {
        for (String genClassName : generate.format()) {
          MessageCatalogFormat msgWriter = null;
          try {
            Class<? extends MessageCatalogFormat> msgFormatClass = Class.forName(
                genClassName, false,
                MessageCatalogFormat.class.getClassLoader()).asSubclass(
                MessageCatalogFormat.class);
            msgWriter = msgFormatClass.newInstance();
          } catch (InstantiationException e) {
            logger.log(TreeLogger.ERROR, "Error instantiating @Generate class "
                + genClassName, e);
            seenError = true;
            continue;
          } catch (IllegalAccessException e) {
            logger.log(TreeLogger.ERROR, "@Generate class " + genClassName
                + " illegal access", e);
            seenError = true;
            continue;
          } catch (ClassNotFoundException e) {
            logger.log(TreeLogger.ERROR, "@Generate class " + genClassName
                + " not found");
            seenError = true;
            continue;
          }
          // Make generator-specific changes to a temporary copy of the path.
          String genPath = path;
          if (genLocales.length != 1) {
            // If the user explicitly specified only one locale, do not add the
            // locale.
            genPath += '_' + locale;
          }
          genPath += msgWriter.getExtension();
          OutputStream outStr = context.tryCreateResource(logger, genPath);
          if (outStr != null) {
            TreeLogger branch = logger.branch(TreeLogger.INFO, "Generating "
                + genPath + " from " + className + " for locale " + locale,
                null);
            PrintWriter out = null;
            try {
              out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                  outStr, "UTF-8")), false);
            } catch (UnsupportedEncodingException e) {
              throw error(logger, e.getMessage());
            }
            try {
              msgWriter.write(branch, locale, resourceList, out, targetClass);
              out.flush();
              context.commitResource(logger, outStr).setPrivate(true);
            } catch (UnableToCompleteException e) {
              // msgWriter should have already logged an error message.
              // Keep going for now so we can find other errors.
View Full Code Here

        // Since they want all locales, this is guaranteed to be one of them.
        found = true;
      }
      if (found) {
        for (String genClassName : generate.format()) {
          MessageCatalogFormat msgWriter = null;
          try {
            Class<? extends MessageCatalogFormat> msgFormatClass = Class.forName(
                genClassName, false,
                MessageCatalogFormat.class.getClassLoader()).asSubclass(
                MessageCatalogFormat.class);
            msgWriter = msgFormatClass.newInstance();
          } catch (InstantiationException e) {
            logger.log(TreeLogger.ERROR, "Error instantiating @Generate class "
                + genClassName, e);
            seenError = true;
            continue;
          } catch (IllegalAccessException e) {
            logger.log(TreeLogger.ERROR, "@Generate class " + genClassName
                + " illegal access", e);
            seenError = true;
            continue;
          } catch (ClassNotFoundException e) {
            logger.log(TreeLogger.ERROR, "@Generate class " + genClassName
                + " not found");
            seenError = true;
            continue;
          }
          // Make generator-specific changes to a temporary copy of the path.
          String genPath = path;
          if (genLocales.length != 1) {
            // If the user explicitly specified only one locale, do not add the
            // locale.
            genPath += '_' + locale.toString();
          }
          genPath += msgWriter.getExtension();
          OutputStream outStr = context.tryCreateResource(logger, genPath);
          if (outStr != null) {
            TreeLogger branch = logger.branch(TreeLogger.INFO, "Generating "
                + genPath + " from " + className + " for locale " + locale,
                null);
            PrintWriter out = null;
            try {
              out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                  outStr, "UTF-8")), false);
            } catch (UnsupportedEncodingException e) {
              throw error(logger, e.getMessage());
            }
            try {
              // TODO(jat): change writer interface to use GwtLocale
              msgWriter.write(branch, locale.toString(), resourceList, out,
                  targetClass);
              out.flush();
              context.commitResource(logger, outStr).setPrivate(true);
            } catch (UnableToCompleteException e) {
              // msgWriter should have already logged an error message.
View Full Code Here

        // Since they want all locales, this is guaranteed to be one of them.
        found = true;
      }
      if (found) {
        for (String genClassName : generate.format()) {
          MessageCatalogFormat msgWriter = null;
          MessageCatalogFactory msgCatFactory = null;
          try {
            // TODO(jat): if GWT is ever modified to take a classpath for user
            // code as an option, we would need to use the user classloader here
            Class<?> clazz = Class.forName(genClassName, false,
View Full Code Here

        // Since they want all locales, this is guaranteed to be one of them.
        found = true;
      }
      if (found) {
        for (String genClassName : generate.format()) {
          MessageCatalogFormat msgWriter = null;
          MessageCatalogFactory msgCatFactory = null;
          try {
            // TODO(jat): if GWT is ever modified to take a classpath for user
            // code as an option, we would need to use the user classloader here
            Class<?> clazz = Class.forName(genClassName, false,
View Full Code Here

        // Since they want all locales, this is guaranteed to be one of them.
        found = true;
      }
      if (found) {
        for (String genClassName : generate.format()) {
          MessageCatalogFormat msgWriter = null;
          try {
            Class<? extends MessageCatalogFormat> msgFormatClass = Class.forName(
                genClassName, false,
                MessageCatalogFormat.class.getClassLoader()).asSubclass(
                MessageCatalogFormat.class);
            msgWriter = msgFormatClass.newInstance();
          } catch (InstantiationException e) {
            logger.log(TreeLogger.ERROR, "Error instantiating @Generate class "
                + genClassName, e);
            seenError = true;
            continue;
          } catch (IllegalAccessException e) {
            logger.log(TreeLogger.ERROR, "@Generate class " + genClassName
                + " illegal access", e);
            seenError = true;
            continue;
          } catch (ClassNotFoundException e) {
            logger.log(TreeLogger.ERROR, "@Generate class " + genClassName
                + " not found");
            seenError = true;
            continue;
          }
          // Make generator-specific changes to a temporary copy of the path.
          String genPath = path;
          if (genLocales.length != 1) {
            // If the user explicitly specified only one locale, do not add the
            // locale.
            genPath += '_' + locale.toString();
          }
          genPath += msgWriter.getExtension();
          OutputStream outStr = context.tryCreateResource(logger, genPath);
          if (outStr != null) {
            TreeLogger branch = logger.branch(TreeLogger.INFO, "Generating "
                + genPath + " from " + className + " for locale " + locale,
                null);
            PrintWriter out = null;
            try {
              out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(
                  outStr, "UTF-8")), false);
            } catch (UnsupportedEncodingException e) {
              throw error(logger, e.getMessage());
            }
            try {
              // TODO(jat): change writer interface to use GwtLocale
              msgWriter.write(branch, locale.toString(), resourceList, out,
                  targetClass);
              out.flush();
              context.commitResource(logger, outStr).setPrivate(true);
            } catch (UnableToCompleteException e) {
              // msgWriter should have already logged an error message.
View Full Code Here

TOP

Related Classes of com.google.gwt.i18n.rebind.format.MessageCatalogFormat

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.