Package org.apache.flex.compiler.filespecs

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


   
    private void addManifest(FlexProject project, String uri, String manifestFileName)
    {
        Document manifestDocument = null;
       
        IFileSpecification manifestFileSpec = project.getWorkspace().getFileSpecification(manifestFileName);
       
        try
        {
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setIgnoringElementContentWhitespace(true);
            documentBuilderFactory.setCoalescing(true);
            documentBuilderFactory.setIgnoringComments(true);
            manifestDocument = documentBuilderFactory.newDocumentBuilder().parse(new InputSource(manifestFileSpec.createReader()));
        }
        catch (Throwable e)
        {
            // TODO Report a problem.
        }
View Full Code Here


    {
        startProfile(Operation.GET_FILESCOPE);
        try
        {
            List<ICompilerProblem> noProblems = Collections.emptyList();
            IFileSpecification rootFileSpec = getRootFileSpecification();
            FXGFileScope fileScope = createFileScope();

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

                {
                    sb.append(symbol.getGeneratedSource());
                }
            }

            IFileSpecification virtualSymbolSource = new GeneratedSourceFileSpecfication(qname, sb.toString());
            fileNode = ASParser.parseFile(virtualSymbolSource, getProject().getWorkspace());
            fileNode.runPostProcess(EnumSet.of(PostProcessStep.POPULATE_SCOPE));

            projectScope.addScopeForCompilationUnit(this, fileNode.getFileScope());
           
View Full Code Here

            Reader sourceFileReader = null;
            try
            {
                Workspace workspace = project.getWorkspace();
               
                IFileSpecification sourceFileSpec = fileSpecGetter.getFileSpecification(sourcePath);
                sourceFileReader = sourceFileSpec.createReader();
                //TODO what do we do about errors that are encountered in the attached file?
                //is this even the correct approach?
                String scriptText = IOUtils.toString(sourceFileReader);
               
                // no need to pass in start offset because include handler will take care of it
View Full Code Here

                            mxmlTextData.getCompilableTextStart(),
                            mxmlTextData.getCompilableTextLine(),
                            mxmlTextData.getCompilableTextColumn(), problems);
                    if (metaTagNodes != null)
                    {
                        IFileSpecification containingFileSpec = fileScope.getWorkspace().getFileSpecification(fileScope.getContainingPath());
                        IMetaTag[] newMetaTags = metaTagNodes.buildMetaTags(containingFileSpec, currentClassDefinition);
                        if( newMetaTags != null )
                        {
                            IMetaTag[] oldMetaTags = currentClassDefinition.getAllMetaTags();
View Full Code Here

        {
            String sourcePath = MXMLNodeBase.resolveSourceAttributePath(null, sourceAttribute, null);
            Reader sourceFileReader = null;
            try
            {
                IFileSpecification sourceFileSpec = fileSpecGetter.getFileSpecification(sourcePath);
                sourceFileReader = sourceFileSpec.createReader();

                fileScope.addSourceDependency(sourcePath);
            }
            catch (FileNotFoundException e)
            {
View Full Code Here

        return result;
    }

    protected byte[] getABCBytes(Collection<ICompilerProblem> problems)
    {
        IFileSpecification rootSource = getRootFileSpecification();
        byte[] abcData = null;
        if (rootSource instanceof IBinaryFileSpecification)
        {
            IBinaryFileSpecification abcFileSpec = (IBinaryFileSpecification)rootSource;
            InputStream abcStream = null;
            try
            {
                abcStream = abcFileSpec.createInputStream();
                abcData = IOUtils.toByteArray(abcStream);
                assert abcData != null : "No ABC byte code.";
            }
            catch (Exception e)
            {
                final ICompilerProblem problem = new InternalCompilerProblem2(rootSource.getPath(), e, SUB_SYSTEM);
                problems.add(problem);
            }
            finally
            {
                if (abcStream != null)
                {
                    try
                    {
                        abcStream.close();
                    }
                    catch (IOException e)
                    {
                        final ICompilerProblem problem = new InternalCompilerProblem2(rootSource.getPath(), e, SUB_SYSTEM);
                        problems.add(problem);
                    }
                }
            }
        }
        else
        {
            final InvalidABCByteCodeProblem problem = new InvalidABCByteCodeProblem(rootSource.getPath());
            problems.add(problem);
        }

        return abcData;
    }
View Full Code Here

                        final String filenameTokenText = token.getText();
                        final String includeString = filenameTokenText.substring(1, filenameTokenText.length() - 1);

                        if (sourcePath == null)
                            throw new NullPointerException("Source file is needed for resolving included file path.");
                        IFileSpecification includedFileSpec = null;
                        //respond to problems from our file handler
                        includedFileSpec = includeHandler.getFileSpecificationForInclude(sourcePath, includeString);
                        //
                        if (includedFileSpec == null)
                        {
                            ICompilerProblem problem = new FileNotFoundProblem(token, filenameTokenText); //the text will be the path not found
                            problems.add(problem);
                            retVal = next();
                            return retVal;
                        }
                        if (includeHandler.isCyclicInclude(includedFileSpec.getPath()))
                        {
                            ICompilerProblem problem = new CyclicalIncludesProblem(token);
                            problems.add(problem);
                            retVal = next();
                            return retVal;
                        }
                        else
                        {
                            // Fork a tokenizer for the included file
                            try
                            {
                                forkIncludeTokenizer = createForIncludeFile(this, includedFileSpec, includeHandler);
                                retVal = forkIncludeTokenizer.next();
                            }
                            catch (FileNotFoundException fnfe)
                            {
                                includeHandler.handleFileNotFound(includedFileSpec);
                                ICompilerProblem problem = new FileNotFoundProblem(token, includedFileSpec.getPath());
                                problems.add(problem);
                                retVal = next();
                                return retVal;
                            }
                        }
View Full Code Here

    catch (IOException e1)
    {
      e1.printStackTrace();
    }

    IFileSpecification fileSpec = new FileSpecification(tempMXMLFile.getPath());
   
    Workspace workspace = new Workspace();
    IMXMLDataManager mxmlDataManager = workspace.getMXMLDataManager();
    IMXMLData mxmlData = mxmlDataManager.get(fileSpec);
    return mxmlData;
View Full Code Here

     * @return A {@link IFileSpecification} either provided by the workspace or
     * created if none exists. This method never returns null.
     */
    private final IFileSpecification getFileSpec(final String path)
    {
        IFileSpecification results = null;
        if (fileSpecGetter != null)
            results = fileSpecGetter.getFileSpecification(path);

        if (results == null)
            results = new FileSpecification(path);
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.