Package org.apache.flex.compiler.filespecs

Examples of org.apache.flex.compiler.filespecs.IFileSpecification


     */
    public String readExternalFile(IMXMLTagAttributeData sourceAttribute,
                                   String resolvedSourcePath)
    {
        final IFileSpecificationGetter fileSpecGetter = getFileSpecificationGetter();
        IFileSpecification sourceFileSpec =
                fileSpecGetter.getFileSpecification(resolvedSourcePath);
        Reader sourceFileReader;
        try
        {
            sourceFileReader = sourceFileSpec.createReader();
        }
        catch (FileNotFoundException e)
        {
            ICompilerProblem problem =
                    new MXMLInvalidSourceAttributeProblem(sourceAttribute, resolvedSourcePath);
View Full Code Here


            addProblem(problem);
            return null;
        }

        Workspace workspace = getWorkspace();
        IFileSpecification sourceFileSpec =
                workspace.getFileSpecification(resolvedSourcePath);
        IMXMLDataManager mxmlDataManager = workspace.getMXMLDataManager();

        return mxmlDataManager.get(sourceFileSpec);
    }
View Full Code Here

    private CSSCompilationSession cssCompilationSession;

    void initialize(MXMLTreeBuilder builder)
    {
        IFileSpecification fileSpec = builder.getFileSpecification();

        project = builder.getProject();
        qname = builder.getQName();
        fileScope = builder.getFileScope();

        // When parsing the MXML for AST construction, ad-hoc IncludeHandler are created in
        // order to please the MXML lexer and to keep the AST node offsets in-sync with
        // the scope tree node offsets. As a result, the MXML AST nodes does not have a
        // usable OffsetLookup after tree building. That's why we need to provide the real
        // OffsetLookup from the scope building.
        final OffsetLookup offsetLookup = fileScope.getOffsetLookup();
        assert offsetLookup != null : "Expected offset lookup on MXMLFileScope.";
        this.offsetLookup = offsetLookup;

        setLocation(builder);

        // Add implicit import nodes for ActionScript.
        for (String importStr : ASFileScope.getImplicitImportsForAS())
        {
            ImportNode implicitImportNode = new MXMLImplicitImportNode(project, importStr);
            addImportNode(implicitImportNode);
        }

        // Add implicit import nodes for MXML.
        for (IImportNode implicitImportNode : project.getImplicitImportNodesForMXML(builder.getMXMLDialect()))
        {
            addImportNode(implicitImportNode);
        }

        includeTreeLastModified = fileSpec.getLastModified();

        processUnits(builder);
    }
View Full Code Here

    @Override
    public synchronized IFileSpecification getFileSpecification(String path)
    {
        assert (path.equals(FilenameNormalization.normalize(path))) : "Path not normalized";

        IFileSpecification fileSpec = pathToFileSpecMap.get(path);
        if (fileSpec == null)
        {
            fileSpec = new FileSpecification(path);
            pathToFileSpecMap.put(path, fileSpec);
        }
View Full Code Here

     * @return The most recent {@link IBinaryFileSpecification} given to the workspace
     * for a specified path.
     */
    public synchronized IBinaryFileSpecification getLatestBinaryFileSpecification(String path)
    {
        IFileSpecification fileSpec = getFileSpecification(path);

        IBinaryFileSpecification binaryFileSpec = null;
        if (fileSpec instanceof IBinaryFileSpecification)
        {
            binaryFileSpec = (IBinaryFileSpecification)fileSpec;
View Full Code Here

            //  This may also be null (or assert if it's feeling moody),
            //  in which case the file name remains null and file/line
            //  processing noops.
            try
            {
                IFileSpecification fs = iNode.getFileSpecification();
                if ( fs != null)
                    file_name = fs.getPath();
            }
            catch (Throwable no_fs)
            {
                //  No file specification available, probably
                //  because this node is some kind of syntho.
View Full Code Here

            if (sourcePath != null)
            {
                FlexProject project = builder.getProject();
                Workspace workspace = builder.getWorkspace();
                Collection<ICompilerProblem> problems = builder.getProblems();
                IFileSpecification sourceFileSpec = workspace.getFileSpecification(sourcePath);
                String scriptText = builder.readExternalFile(attribute, sourcePath);

                if (scriptText != null)
                {
                    final IncludeHandler includeHandler = new IncludeHandler(builder.getFileSpecificationGetter());
                    includeHandler.setProjectAndCompilationUnit(project, builder.getCompilationUnit());
                    includeHandler.enterFile(sourcePath);
                    final MXMLFileScope fileScope = builder.getFileScope();
                    final OffsetLookup offsetLookup = fileScope.getOffsetLookup();
                    assert offsetLookup != null : "Expected OffsetLookup on FileScope.";
                    final int[] absoluteOffset = offsetLookup.getAbsoluteOffset(sourcePath, 0);

                    final ScopedBlockNode fragment = ASParser.parseFragment2(
                            scriptText,
                            sourceFileSpec.getPath(),
                            absoluteOffset[0],
                            0,
                            0,
                            problems,
                            workspace,
View Full Code Here

        ArrayList<MXMLUnitData> units = new ArrayList<MXMLUnitData>(tokens.size() / 6);
        nsMap = new HashMap<IMXMLTagData, PrefixMap>();
        MXMLUnitData unit = null;
        MXMLToken currentComment = null;
        FastStack<Integer> depth = new FastStack<Integer>(tokens.size() / 8);
        IFileSpecification spec = new FileSpecification(data.getPath() != null ? data.getPath() : "");
        depth.setStackDecorator(new IFastStackDecorator<Integer>() {
            @Override
            public Integer decorate(Integer e)
            {
                if (e == null)
View Full Code Here

        // Eventually all transcoders should be updated to go directly to ABC
        if (transcoder instanceof SkinTranscoder)
        {
            List<IASScope> scopeList = null;
            List<ICompilerProblem> problems = new LinkedList<ICompilerProblem>();
            IFileSpecification rootSource = getRootFileSpecification();
            try
            {
                IABCBytesRequestResult abcResult = getABCBytesRequest().get();

                startProfile(Operation.GET_FILESCOPE);

                String path = rootSource.getPath();
                ABCScopeBuilder abcScopeBuilder = new ABCScopeBuilder(
                        getProject().getWorkspace(),
                        abcResult.getABCBytes(),
                        path,
                        ASFileScopeProvider.getInstance());
                scopeList = abcScopeBuilder.build();
                if (scopeList.isEmpty())
                {
                    problems.add(new NoScopesInABCCompilationUnitProblem(path));
                }
                for (IASScope scope : scopeList)
                    markClassAsEmbed((ASFileScope)scope);

                return new ABCFileScopeRequestResult(problems, scopeList);
            }
            catch (Exception e)
            {
                ICompilerProblem problem = new InvalidABCByteCodeProblem(rootSource.getPath());
                problems.add(problem);
                return new ABCFileScopeRequestResult(problems, Collections.<IASScope> emptyList());
            }
            finally
            {
View Full Code Here

            MXMLFileScope fileScope = scopeBuilder.build();
            final ImmutableList<OffsetCue> offsetCueList = scopeBuilder.getIncludeHandler().getOffsetCueList();
            final OffsetLookup offsetLookup = new OffsetLookup(offsetCueList);
            fileScope.setOffsetLookup(offsetLookup);
            final Collection<ICompilerProblem> problemCollection = scopeBuilder.getProblems();
            final IFileSpecification rootFileSpec = getRootFileSpecification();

            getProject().getWorkspace().addIncludedFilesToCompilationUnit(this, fileScope.getSourceDependencies());

            return new ASFileScopeRequestResult(getDefinitionPromises(), getDefinitionPriority(), problemCollection, fileScope, rootFileSpec);
        }
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.filespecs.IFileSpecification

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.