Package org.apache.flex.compiler.internal.projects

Examples of org.apache.flex.compiler.internal.projects.FlexProject


           
            // Kick off code generation to add all the dependencies found by code generation.
            getABCBytesRequest().get();

            //Add dependency to 'mx.resources.ResourceBundle' since we want it to be picked up.
            FlexProject project = getFlexProject();
            IResolvedQualifiersReference resourceBundleClassRef = ReferenceFactory.packageQualifiedReference(
                    getProject().getWorkspace(), project.getResourceBundleClass());
            resourceBundleClassRef.resolve(project, this, DependencyType.INHERITANCE);

            return new IOutgoingDependenciesRequestResult()
            {
                @Override
View Full Code Here


    private void generateABCForBundle(final ABCEmitter emitter, final ResourceBundleFileNode fileNode,
            final String qualifiedClassName, final String bundleName, final String locale,
            final Collection<ICompilerProblem> problems)
    {

        FlexProject project = getFlexProject();

        //this class extends "mx.resources.ResourceBundle"
        IResolvedQualifiersReference resourceBundleReference = ReferenceFactory.packageQualifiedReference(
                project.getWorkspace(), project.getResourceBundleClass());

        //Create constructor instruction list
        InstructionList constructorInstructionList = new InstructionList();
        constructorInstructionList.addInstruction(ABCConstants.OP_getlocal0);
        constructorInstructionList.addInstruction(ABCConstants.OP_pushstring, locale);
        constructorInstructionList.addInstruction(ABCConstants.OP_pushstring, bundleName);
        constructorInstructionList.addInstruction(ABCConstants.OP_constructsuper, 2);
        constructorInstructionList.addInstruction(ABCConstants.OP_returnvoid);

       
        IResolvedQualifiersReference mainClassRef = ReferenceFactory.packageQualifiedReference(
                project.getWorkspace(), qualifiedClassName);
       
        ClassGeneratorHelper classGen = new ClassGeneratorHelper(project, emitter,
                mainClassRef.getMName(),
                (ClassDefinition)resourceBundleReference.resolve(project),
                Collections.<Name> emptyList(), Collections.<Name> emptyList(),
                constructorInstructionList, true);

        //Create method body for getContents
        InstructionList bodyInstructionList = new InstructionList();
        bodyInstructionList.addInstruction(ABCConstants.OP_getlocal0);
        bodyInstructionList.addInstruction(ABCConstants.OP_pushscope);

        //Create key value pair entries "key":"value"
        int entryCount = 0;
        for (int i = 0; i < fileNode.getChildCount(); i++)
        {
            IASNode node = fileNode.getChild(i);
            if (node instanceof ResourceBundleEntryNode)
            {
                entryCount++;
                ResourceBundleEntryNode entryNode = (ResourceBundleEntryNode)node;

                //push key
                bodyInstructionList.addInstruction(ABCConstants.OP_pushstring, entryNode.getKeyNode().getValue());

                //push value
                ExpressionNodeBase valueNode = entryNode.getValueNode();
                switch (valueNode.getNodeID())
                {

                    case LiteralStringID:
                        bodyInstructionList.addInstruction(ABCConstants.OP_pushstring,
                                ((LiteralNode)valueNode).getValue());
                        break;

                    case ClassReferenceID:
                        ClassReferenceNode crn = (ClassReferenceNode)valueNode;
                        if (crn.getName() != null)
                        {

                            IResolvedQualifiersReference refClass = ReferenceFactory.packageQualifiedReference(project.getWorkspace(), crn.getName());

                            if (refClass.resolve(project, crn.getASScope(), DependencyType.EXPRESSION, true) == null)
                            {
                                ICompilerProblem problem = new UnresolvedClassReferenceProblem(crn, crn.getName());
                                problems.add(problem);
                            }
                        }
                        String className = crn.getName();
                        if(className == null)
                        {
                            bodyInstructionList.addInstruction(ABCConstants.OP_pushnull);
                        }
                        else
                        {
                            IResolvedQualifiersReference classRef = ReferenceFactory.packageQualifiedReference(
                                    project.getWorkspace(), className);

                            bodyInstructionList.addInstruction(ABCConstants.OP_getlex, classRef.getMName());
                        }
                       
                        break;

                    case EmbedID:
                        EmbedNode embedNode = (EmbedNode)valueNode;
                        try
                        {
                            String name = embedNode.getName(project, problems);
                            IResolvedQualifiersReference embedClassRef = ReferenceFactory.packageQualifiedReference(
                                    project.getWorkspace(), name);
                            bodyInstructionList.addInstruction(ABCConstants.OP_getlex, embedClassRef.getMName());
                        }
                        catch (InterruptedException ex)
                        {
                            problems.add(new CodegenInternalProblem(embedNode, ex));
View Full Code Here

        Map<String, ICompilationUnit> compilationUnits = new HashMap<String, ICompilationUnit>();
       
        if (project instanceof FlexProject)
        {
            final String normalizedBundleName = QNameNormalization.normalize(bundleName);
            final FlexProject flexProject = (FlexProject)project;
            final ASProjectScope scope = flexProject.getScope();
            final Collection<String> locales = flexProject.getLocales();
           
            if(locales.size() == 0)
            {
                //If the project's locale is empty, then don't try to resolve this
                //node because the referenced bundle won't go into swf or swc anyways.
View Full Code Here

            if (configuration == null)
                return false;
           
            if (project instanceof FlexProject)
            {
                FlexProject flexProject = (FlexProject)project;
   
                FlexProjectConfigurator.configure(flexProject, configuration);
                setupCompatibilityVersion(flexProject);
                setupConfigVariables(flexProject);
                setupLocaleSettings(flexProject);
View Full Code Here

            return null;

        if (!(project instanceof FlexProject))
            return null;

        FlexProject flexProject = (FlexProject)project;
        IClassDefinition decoratedClass = (IClassDefinition)decoratedDefinition;
        return flexProject.resolveEvent(decoratedClass, event);
    }
View Full Code Here

    }

    public SWCDepends()
    {
        workspace = new Workspace();
        project = new FlexProject(workspace);
        problems = new ProblemQuery();
    }
View Full Code Here

    protected IABCBytesRequestResult handleABCBytesRequest() throws InterruptedException
    {
        final StyleModuleSemanticRequestResult semanticResult = (StyleModuleSemanticRequestResult) getOutgoingDependenciesRequest().get();
        final ABCEmitter emitter = new ABCEmitter();
        emitter.visit(ABCConstants.VERSION_ABC_MAJOR_FP10, ABCConstants.VERSION_ABC_MINOR_FP10);
        final FlexProject project = (FlexProject)getProject();
        final List<ICompilerProblem> problems = new ArrayList<ICompilerProblem>();
        byte[] bytes = null;
        try
        {
            // TODO: Generate class names from CSS file name after the CSS module runtime code is finalized.
View Full Code Here

        final StyleModuleSyntaxTreeRequestResult syntaxResult = (StyleModuleSyntaxTreeRequestResult)getSyntaxTreeRequest().get();
        final Collection<ICompilerProblem> cssSemanticProblems = new ArrayList<ICompilerProblem>();
        final CSSCompilationSession session = new CSSCompilationSession();
        if (syntaxResult.cssDocument != null)
        {
            final FlexProject flexProject = (FlexProject)getProject();
            updateStyleCompilationUnitDependencies(
                    session,
                    flexProject,
                    ImmutableList.<ICSSDocument> of(syntaxResult.cssDocument),
                    cssSemanticProblems);
View Full Code Here

    /**
     * Create a new FlexProject with a new Workspace
     */
    public static IFlexProject createSimpleFlexProject()
    {
        return new FlexProject( new Workspace());
    }
View Full Code Here

        return new FlexProject( new Workspace());
    }
   
    public static IFlexProject createFlexProject(IWorkspace workspace, IASDocBundleDelegate asDocBundleDelegate)
    {
        return new FlexProject( (Workspace)workspace,  asDocBundleDelegate);
    }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.internal.projects.FlexProject

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.