Package flash.localization

Examples of flash.localization.LocalizationManager


  /**
   *
   */
    public static final LocalizationManager setupLocalizationManager()
    {
        LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();

        if (l10n == null)
        {
            // set up for localizing messages
            l10n = new LocalizationManager();
            l10n.addLocalizer(new ResourceBundleLocalizer());
            ThreadLocalToolkit.setLocalizationManager(l10n);
        }

        return l10n;
    }
View Full Code Here


    }

  static final LocalizationManager setupLocalizationManager()
  {
        // set up for localizing messages
    LocalizationManager l10n = new LocalizationManager();
    l10n.addLocalizer(new ResourceBundleLocalizer());
    ThreadLocalToolkit.setLocalizationManager(l10n);
   
    return l10n;
  }
View Full Code Here

                                                                        stringDependencyTypes,
                                                                        true);
        Set<Vertex<String, SwcExternalScriptInfo>> cycles = info.detectCycles();
        if (cycles.size() > 0)
        {
            LocalizationManager i10n = ThreadLocalToolkit.getLocalizationManager();
            if (i10n == null)
            {
                OEMUtil.setupLocalizationManager();
                i10n = ThreadLocalToolkit.getLocalizationManager();
            }
           
            String message = i10n.getLocalizedTextString(new CircularLibraryDependencyException(null, null));
            throw new CircularLibraryDependencyException(message,
                            SwcDependencyUtil.SetOfVertexToString(cycles));
        }
       
        return info.getSwcDependencyOrder();
View Full Code Here

                                                                        stringDependencyTypes,
                                                                        minimizeDependencySet);
        Set<Vertex<String, SwcExternalScriptInfo>> cycles = info.detectCycles();
        if (cycles.size() > 0)
        {
            LocalizationManager i10n = ThreadLocalToolkit.getLocalizationManager();
            if (i10n == null)
            {
                OEMUtil.setupLocalizationManager();
                i10n = ThreadLocalToolkit.getLocalizationManager();
            }
           
            String message = i10n.getLocalizedTextString(new CircularLibraryDependencyException(null, null));
            throw new CircularLibraryDependencyException(message,
                            SwcDependencyUtil.SetOfVertexToString(cycles));
        }

        VirtualFile virtualLibrary = new LocalFile(targetLibrary);
View Full Code Here

                }
            }
        }
        catch (IOException ioException)
        {
          LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();
            throw new ConfigurationException(l10n.getLocalizedTextString(new FailedToLoadLicenseFile(fileName)));
        }
        finally
        {
            if (in != null)
            {
View Full Code Here

        String s;
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));

        CompilerAPI.useAS3();

        LocalizationManager localizationManager = new LocalizationManager();
        localizationManager.addLocalizer( new ResourceBundleLocalizer() );
        ThreadLocalToolkit.setLocalizationManager( localizationManager );

        intro();
        prompt();
        while ((s = r.readLine()) != null)
View Full Code Here

    private static Map<String, Target> targets;
    private static Map<String, Process> processes;

    private static void process(String s)
    {
        LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();

        if (s.startsWith("mxmlc"))
        {
            StringTokenizer t = new StringTokenizer(s.substring("mxmlc".length()).trim(), " ");
            String[] args = new String[t.countTokens()];
            for (int i = 0; t.hasMoreTokens(); i++)
            {
                args[i] = t.nextToken();
            }

            if (args.length == 1)
            {
                try
                {
                    int id = Integer.parseInt(args[0]);
                    Target target = targets.get("" + id);
                    if (target == null)
                    {
                        ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new TargetNotFound("" + id)));
                    }
                    else
                    {
                        mxmlc(target.args, id);
                    }
                }
                catch (NumberFormatException ex)
                {
                    ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new AssignTargetID(counter)));
                    mxmlc(args, counter++);
                }
            }
            else
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new AssignTargetID(counter)));
                mxmlc(args, counter++);
            }
        }
        else if (s.startsWith("compc"))
        {
            StringTokenizer t = new StringTokenizer(s.substring("compc".length()).trim(), " ");
            String[] args = new String[t.countTokens()];
            for (int i = 0; t.hasMoreTokens(); i++)
            {
                args[i] = t.nextToken();
            }

            if (args.length == 1)
            {
                try
                {
                    int id = Integer.parseInt(args[0]);
                    Target target = targets.get("" + id);
                    if (target == null)
                    {
                        ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new TargetNotFound("" + id)));
                    }
                    else
                    {
                        compc(target.args, id);
                    }
                }
                catch (NumberFormatException ex)
                {
                    ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new AssignTargetID(counter)));
                    compc(args, counter++);
                }
            }
            else
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new AssignTargetID(counter)));
                compc(args, counter++);
            }
        }
        else if (s.startsWith("compile"))
        {
            String id = s.substring("compile".length()).trim();
            if (targets.containsKey(id))
            {
                compile(id);
                if (ThreadLocalToolkit.errorCount() == 0)
                {
                    link(id);
                }
            }
            else
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new TargetNotFound(id)));
            }
        }
        else if (s.startsWith("clear"))
        {
            String id = s.substring("clear".length()).trim();
            if (id.length() == 0)
            {
                HashSet<String> keys = new HashSet<String>(targets.keySet());
                for (Iterator<String> i = keys.iterator(); i.hasNext();)
                {
                    clear(i.next());
                }
            }
            else if (targets.containsKey(id))
            {
                clear(id);
            }
            else
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new TargetNotFound(id)));
            }
        }
        else if (s.startsWith("info"))
        {
            String id = s.substring("info".length()).trim();
            if (id.length() == 0)
            {
                HashSet<String> keys = new HashSet<String>(targets.keySet());
                for (Iterator<String> i = keys.iterator(); i.hasNext();)
                {
                    info(i.next());
                }
            }
            else if (targets.containsKey(id))
            {
                info(id);
            }
            else
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new TargetNotFound(id)));
            }
        }
        else if (s.startsWith("touch"))
        {
            String args = s.substring("touch".length()).trim();
View Full Code Here

        }
    }

    private static void compile_compc(SwcTarget s)
    {
        LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();
        Benchmark benchmark = null;

        try
        {
            // setup the path resolver
            CompilerAPI.usePathResolver();

            // process configuration
            ConfigurationBuffer cfgbuf = new ConfigurationBuffer(CompcConfiguration.class, CompcConfiguration.getAliases());
            cfgbuf.setDefaultVar("include-classes");
            DefaultsConfigurator.loadCompcDefaults( cfgbuf );
            CompcConfiguration configuration = (CompcConfiguration) Mxmlc.processConfiguration(
                ThreadLocalToolkit.getLocalizationManager(), "compc", s.args, cfgbuf, CompcConfiguration.class, "include-classes");

            CompilerAPI.setupHeadless(configuration);

            if (configuration.benchmark())
            {
                benchmark = CompilerAPI.runBenchmark();
                benchmark.startTime(Benchmark.PRECOMPILE);
            }
            else
            {
                CompilerAPI.disableBenchmark();
            }

            s.sourcePath.clearCache();
            s.bundlePath.clearCache();
            s.resources.refresh();

            // C: We don't really need to parse the manifest files again.
            CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration();
            // note: if Configuration is ever shared with other parts of the system, then this part will need
            // to change, since we're setting a compc-specific setting below
            compilerConfig.setMetadataExport(true);

            NameMappings mappings = CompilerAPI.getNameMappings(configuration);

            Transcoder[] transcoders = WebTierAPI.getTranscoders( configuration );
            SubCompiler[] compilers = WebTierAPI.getCompilers(compilerConfig, mappings, transcoders);

            if (benchmark != null)
            {
                benchmark.benchmark(l10n.getLocalizedTextString(new InitialSetup()));
            }

            // load SWCs
            CompilerSwcContext swcContext = new CompilerSwcContext(true);
            // for compc the theme and include-libraries values have been purposely not passed in below.
            // This is done because the theme attribute doesn't make sense and the include-libraries value
            // actually causes issues when the default value is used with external libraries.
            // FIXME: why don't we just get rid of these values from the configurator for compc?  That's a problem
            // for include-libraries at least, since this value appears in flex-config.xml
            swcContext.load( compilerConfig.getLibraryPath(),
                             compilerConfig.getExternalLibraryPath(),
                             null,
                             null,
                             mappings,
                             I18nUtils.getTranslationFormat(compilerConfig),
                             s.swcCache );
            configuration.addExterns( swcContext.getExterns() );

            // recompile or incrementally compile...
            boolean recompile = false;
            int newChecksum = cfgbuf.checksum_ts() + swcContext.checksum();

            if (newChecksum != s.checksum)
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new DetectConfigurationChange()));
                s.checksum = newChecksum;
                s.resources = new ResourceContainer();
                recompile = true;
            }

            // validate CompilationUnits in FileSpec and SourcePath
            if (recompile || CompilerAPI.validateCompilationUnits(s.fileSpec, s.sourceList, s.sourcePath, s.bundlePath, s.resources,
                                                                  swcContext, s.classes, s.perCompileData, configuration) > 0)
            {
                Map licenseMap = configuration.getLicensesConfiguration().getLicenseMap();

                // create a symbol table
                SymbolTable symbolTable = new SymbolTable(configuration, s.perCompileData);
                s.configuration = configuration;

                Map<String, Source> classes = new HashMap<String, Source>();
                s.nsComponents = SwcAPI.setupNamespaceComponents(configuration, mappings, s.sourcePath, s.sourceList, classes);
                SwcAPI.setupClasses(configuration, s.sourcePath, s.sourceList, classes);
                // Only updated the SwcTarget's classes if
                // setupNamespaceComponents() and setupClasses() are
                // successful.
                s.classes = classes;

                Map<String, VirtualFile> rbFiles = new HashMap<String, VirtualFile>();

                if (benchmark != null)
                {
                    benchmark.stopTime(Benchmark.PRECOMPILE, false);
                }

                List<CompilationUnit> units = CompilerAPI.compile(s.fileSpec, s.sourceList, s.classes.values(),
                                                                  s.sourcePath, s.resources, s.bundlePath, swcContext,
                                                                  symbolTable, mappings, configuration, compilers,
                                                                  new CompcPreLink(rbFiles, configuration.getIncludeResourceBundles(),
                                                                      false),
                                                                  licenseMap, new ArrayList<Source>());

                if (benchmark != null)
                {
                    benchmark.startTime(Benchmark.POSTCOMPILE);
                }

                s.units = units;
                s.rbFiles = rbFiles;
                s.sourcePath.clearCache();
                s.bundlePath.clearCache();
                s.resources.refresh();
            }
            else
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new NoChange()));
            }
        }
        catch (ConfigurationException ex)
        {
            Compc.displayStartMessage();
View Full Code Here

        }
    }

    private static void compile_mxmlc(Target s)
    {
        LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();
        Benchmark benchmark = null;

        try
        {
            // setup the path resolver
            CompilerAPI.usePathResolver();

            // process configuration
            ConfigurationBuffer cfgbuf = new ConfigurationBuffer(CommandLineConfiguration.class, Configuration.getAliases());
            cfgbuf.setDefaultVar(Mxmlc.FILE_SPECS);
            DefaultsConfigurator.loadDefaults( cfgbuf );
            CommandLineConfiguration configuration = (CommandLineConfiguration) Mxmlc.processConfiguration(
                ThreadLocalToolkit.getLocalizationManager(), "mxmlc", s.args, cfgbuf, CommandLineConfiguration.class, Mxmlc.FILE_SPECS);

            CompilerAPI.setupHeadless(configuration);

            if (configuration.benchmark())
            {
                benchmark = CompilerAPI.runBenchmark();
                benchmark.startTime(Benchmark.PRECOMPILE);
            }
            else
            {
                CompilerAPI.disableBenchmark();
            }

            s.sourcePath.clearCache();
            s.bundlePath.clearCache();
            s.resources.refresh();

            // C: We don't really need to parse the manifest files again.
            CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration();
            NameMappings mappings = CompilerAPI.getNameMappings(configuration);

            Transcoder[] transcoders = WebTierAPI.getTranscoders( configuration );
            SubCompiler[] compilers = WebTierAPI.getCompilers(compilerConfig, mappings, transcoders);

            if (benchmark != null)
            {
                benchmark.benchmark(l10n.getLocalizedTextString(new InitialSetup()));
            }

            CompilerSwcContext swcContext = new CompilerSwcContext(true);
            swcContext.load( compilerConfig.getLibraryPath(),
                             Configuration.getAllExcludedLibraries(compilerConfig, configuration),
                             compilerConfig.getThemeFiles(),
                             compilerConfig.getIncludeLibraries(),
                             mappings,
                             I18nUtils.getTranslationFormat(compilerConfig),
                             s.swcCache );
            configuration.addExterns( swcContext.getExterns() );
            configuration.addIncludes( swcContext.getIncludes() );
            configuration.getCompilerConfiguration().addThemeCssFiles( swcContext.getThemeStyleSheets() );

            // recompile or incrementally compile...
            boolean recompile = false;
            int newChecksum = cfgbuf.checksum_ts() + swcContext.checksum();

            if (newChecksum != s.checksum)
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new DetectConfigurationChange()));
                s.checksum = newChecksum;
                s.resources = new ResourceContainer();
                recompile = true;
            }

            // validate CompilationUnits in FileSpec and SourcePath
            if (recompile || CompilerAPI.validateCompilationUnits(s.fileSpec, s.sourceList, s.sourcePath, s.bundlePath, s.resources,
                                                                  swcContext, s.perCompileData,
                                                                  configuration) > 0)
            {
                Map licenseMap = configuration.getLicensesConfiguration().getLicenseMap();

                // create a symbol table
                SymbolTable symbolTable = new SymbolTable(configuration, s.perCompileData);
                s.configuration = configuration;

                VirtualFile projector = configuration.getProjector();

                if (benchmark != null)
                {
                    benchmark.stopTime(Benchmark.PRECOMPILE, false);
                }

                if (projector != null && projector.getName().endsWith("avmplus.exe"))
                {
                    s.units = CompilerAPI.compile(s.fileSpec, s.sourceList, null, s.sourcePath, s.resources, s.bundlePath,
                                                  swcContext, symbolTable, mappings, configuration, compilers,
                                                  null, licenseMap, new ArrayList<Source>());
                }
                else
                {
                    s.units = CompilerAPI.compile(s.fileSpec, s.sourceList, null, s.sourcePath, s.resources, s.bundlePath,
                                                  swcContext, symbolTable, mappings, configuration, compilers,
                                                  new PreLink(), licenseMap, new ArrayList<Source>());
                }

                if (benchmark != null)
                {
                    benchmark.startTime(Benchmark.POSTCOMPILE);
                }

                s.sourcePath.clearCache();
                s.bundlePath.clearCache();
                s.resources.refresh();
            }
            else
            {
                ThreadLocalToolkit.logInfo(l10n.getLocalizedTextString(new NoChange()));
            }
        }
        catch (ConfigurationException ex)
        {
            Mxmlc.processConfigurationException(ex, "mxmlc");
View Full Code Here

        }
    }

    private static void mxmlc(String[] args, int id)
    {
        LocalizationManager l10n = ThreadLocalToolkit.getLocalizationManager();
        Benchmark benchmark = null;
        OutputStream swfOut = null;
        Target s = new Target();
        s.id = id;

        try
        {
            // setup the path resolver
            CompilerAPI.usePathResolver();

            // process configuration
            ConfigurationBuffer cfgbuf = new ConfigurationBuffer(CommandLineConfiguration.class, Configuration.getAliases());
            cfgbuf.setDefaultVar(Mxmlc.FILE_SPECS);
            DefaultsConfigurator.loadDefaults( cfgbuf );
            CommandLineConfiguration configuration = (CommandLineConfiguration) Mxmlc.processConfiguration(
                ThreadLocalToolkit.getLocalizationManager(), "mxmlc", args, cfgbuf, CommandLineConfiguration.class, Mxmlc.FILE_SPECS);
            s.configuration = configuration;

            CompilerAPI.setupHeadless(configuration);

            if (configuration.benchmark())
            {
                benchmark = CompilerAPI.runBenchmark();
                benchmark.startTime(Benchmark.PRECOMPILE);
            }
            else
            {
                CompilerAPI.disableBenchmark();
            }

            String target = configuration.getTargetFile();
            targets.put("" + id, s);
            s.args = args;

            // make sure targetFile abstract pathname is an absolute path...
            VirtualFile targetFile = CompilerAPI.getVirtualFile(target);
            WebTierAPI.checkSupportedTargetMimeType(targetFile);
            List<VirtualFile> virtualFileList = CompilerAPI.getVirtualFileList(configuration.getFileList());

            CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration();
            NameMappings mappings = CompilerAPI.getNameMappings(configuration);

            Transcoder[] transcoders = WebTierAPI.getTranscoders( configuration );
            SubCompiler[] compilers = WebTierAPI.getCompilers(compilerConfig, mappings, transcoders);

            // construct the SWF file name...
            VirtualFile projector = configuration.getProjector();

            if (projector != null && projector.getName().endsWith("avmplus.exe"))
            {
                // output .exe
                s.outputName = configuration.getOutput();
                if (s.outputName == null)
                {
                    s.outputName = targetFile.getName();
                    s.outputName = s.outputName.substring(0, s.outputName.lastIndexOf('.')) + ".exe";
                }
            }
            else
            {
                // output SWF
                s.outputName = configuration.getOutput();
                if (s.outputName == null)
                {
                    s.outputName = targetFile.getName();
                    if (projector != null)
                    {
                        s.outputName = s.outputName.substring(0, s.outputName.lastIndexOf('.')) + ".exe";
                    }
                    else
                    {
                        s.outputName = s.outputName.substring(0, s.outputName.lastIndexOf('.')) + ".swf";
                    }
                }
            }

            VirtualFile[] asClasspath = compilerConfig.getSourcePath();

            // create a FileSpec...
            s.fileSpec = new FileSpec(Collections.<VirtualFile>emptyList(), WebTierAPI.getFileSpecMimeTypes());

            // create a SourceList
            s.sourceList = new SourceList(virtualFileList, asClasspath, targetFile, WebTierAPI.getSourcePathMimeTypes());

            // create a SourcePath...
            s.sourcePath = new SourcePath(asClasspath, targetFile, WebTierAPI.getSourcePathMimeTypes(),
                                          compilerConfig.allowSourcePathOverlap());

            // create a ResourceContainer...
            s.resources = new ResourceContainer();

            // create a ResourceBundlePath...
            s.bundlePath = new ResourceBundlePath(configuration.getCompilerConfiguration(), targetFile);

            if (benchmark != null)
            {
                benchmark.benchmark(l10n.getLocalizedTextString(new InitialSetup()));
            }

            // load SWCs
            s.swcCache = new SwcCache();
           
View Full Code Here

TOP

Related Classes of flash.localization.LocalizationManager

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.