Package org.apache.flex.compiler.units

Examples of org.apache.flex.compiler.units.ICompilationUnit


               
                //find the compilation units for this qualified name
                IDefinition def = scope.findDefinitionByName(qualifiedName);
                if(def != null)
                {
                    ICompilationUnit compUnit = scope.getCompilationUnitForDefinition(def);

                    if (isValidCompilationUnit(compUnit, project, bundleName))
                    {
                        compilationUnits.put(def.getQualifiedName(), compUnit);
                        unresolvedLocales.remove(locale);
                    }                
                }
            }
          
            if (unresolvedLocales.size() > 0 || locales.size() == 0)
            {
                //If we are at this point, it means that either project's locale is empty or
                //we could not resolve the resource bundle for some or all locales.
                //The last thing we can check is to see whether we can resolve it using the
                //pure bundle name (not the generated name that contains locale$..._properties)
                //This is also acceptable because "mx.managers.SystemManager" uses the same logic
                //to find a resource bundle. First, it searches for the generated class name and then the pure bundle name.
                IDefinition def = scope.findDefinitionByName(normalizedBundleName);
                if(def != null)
                {
                    ICompilationUnit compUnit = scope.getCompilationUnitForDefinition(def);

                    if (isValidCompilationUnit(compUnit, project, bundleName))
                    {
                        //This means we resolved the reference by using pure bundle name which will apply
                        //to all locales during runtime, therefore return from this method.
View Full Code Here


        CompilerProject project = getProject();

        for (IEmbedResolver embedNode : embedNodes)
        {
            ICompilationUnit cu = embedNode.resolveCompilationUnit(project);
            if (cu != null)
            {
                // if the cu has already been part of this CU, nothing to do
                if (!previousEmbedCompilationUnits.remove(cu))
                {
                    // this dependency targets the embedNode's (import etc) data qname
                    project.addDependency(this, cu, DependencyType.EXPRESSION, cu.getQualifiedNames().get(0));
                }

                embedCompilationUnits.add(cu);
            }           
        }
View Full Code Here

    public void resolveDependencies(Collection<ICompilerProblem> errors, ICompilerProject project) throws InterruptedException
    {
        if (project instanceof FlexProject)
        {
            //compilation unit of the file that has the metadata
            final ICompilationUnit refCompUnit = ((FlexProject)project).getScope().getCompilationUnitForScope(getDecoratedDefinition().getContainingScope());
            assert refCompUnit != null;

            ResourceBundleUtils.resolveDependencies(bundleName, refCompUnit, project, this, errors);
        }
    }
View Full Code Here

    }

    @Override
    public boolean isInProject(ICompilerProject project)
    {
        final ICompilationUnit compilationUnit = ((ASProjectScope)project.getScope()).getCompilationUnitForDefinition(this);
        if (compilationUnit != null)
        {
            if (compilationUnit.getProject() == project)
                return true;
            else
                return false;
        }
        if (AppliedVectorDefinition.isVectorScope(getContainingASScope()))
View Full Code Here

                if (!def.isImplicit())
                {
                    assert referencingCU != null;
                    assert def.getContainingScope() != null : "null containing scope: " + def.getBaseName();
                    assert (def.getContainingScope() instanceof ASFileScope) || (def.getContainingScope().getDefinition() instanceof PackageDefinition);
                    ICompilationUnit referencedCU = getCompilationUnitForScope(def.getContainingScope());
                    assert referencedCU != null;
                    project.addDependency(referencingCU, referencedCU, dt, def.getQualifiedName());
                }
            }
        }
View Full Code Here

            final String qname = getQualifiedName();

            try
            {
                ICompilationUnit compilationUnit = compilationUnitWeakRef.get();
                assert (compilationUnit != null);

                final IFileScopeRequestResult fileScopeRequestResult = compilationUnit.getFileScopeRequest().get();
                actualDefinition = fileScopeRequestResult.getMainDefinition(qname);
            }
            catch (InterruptedException e)
            {
                actualDefinition = null;
View Full Code Here

                WeakHashMap<ICompilationUnit, Object> collection = (WeakHashMap<ICompilationUnit, Object>)mapValue;
                List<ICompilationUnit> result = new ArrayList<ICompilationUnit>(collection.size());
                Iterator<Map.Entry<ICompilationUnit, Object>> iter = collection.entrySet().iterator();
                while (iter.hasNext())
                {
                    ICompilationUnit compilationUnit = iter.next().getKey();
                    // We are dealing with a WeakHashMap, here so it
                    // is possible that the CompilationUnit has been gc'd.
                    if (compilationUnit != null)
                    {
                        // The CompilationUnit might not be in a project
                        // any more.  We should only return CompilationUnit's
                        // that are in a project.
                        ICompilerProject projFromCU = compilationUnit.getProject();
                        if ((projFromCU != null) && (projFromCU == project))
                        {
                            result.add(compilationUnit);
                            iter.remove();
                        }  
                    }
                }
               
                if (!collection.isEmpty())
                    map.put(sortKey, collection);
               
                return Collections.unmodifiableList(result);
            }
            else
            {
                ICompilationUnit compilationUnit = ((WeakReference<ICompilationUnit>)mapValue).get();
                if (compilationUnit == null)
                    return Collections.emptyList();

                // if projects don't match, add the map value back in, otherwise return the
                // removed CU
                if ((compilationUnit != null) && (compilationUnit.getProject() == project))
                    return Collections.singletonList(compilationUnit);
                else
                    map.put(sortKey, mapValue);

                return Collections.emptyList();
View Full Code Here

                WeakHashMap<ICompilationUnit, Object> collection = (WeakHashMap<ICompilationUnit, Object>)mapValue;
                List<ICompilationUnit> result = new ArrayList<ICompilationUnit>(collection.size());
                Iterator<Map.Entry<ICompilationUnit, Object>> iter = collection.entrySet().iterator();
                while (iter.hasNext())
                {
                    ICompilationUnit compilationUnit = iter.next().getKey();
                    // We are dealing with a WeakHashMap, here so it
                    // is possible that the CompilationUnit has been gc'd.
                    if ((compilationUnit != null) && (compilationUnit == cuToRemove))
                    {
                        result.add(compilationUnit);
                        iter.remove();
                    }
                }

                if (!collection.isEmpty())
                    map.put(sortKey, collection);

                return Collections.unmodifiableList(result);
            }
            else
            {
                ICompilationUnit compilationUnit = ((WeakReference<ICompilationUnit>)mapValue).get();
                if (compilationUnit == null)
                    return Collections.emptyList();

                // if compilation units don't match, add the map value back in, otherwise
                // return the removed CU
View Full Code Here

        }
        else if (value != null)
        {
            assert value instanceof WeakReference<?>;
            WeakReference<ICompilationUnit> cuRef = (WeakReference<ICompilationUnit>)value;
            ICompilationUnit compilationUnit = cuRef.get();
            // either not limiting search to projects, or projects match so add the CU
            if ((compilationUnit != null) && ((project == null) || (compilationUnit.getProject() == project)) && visibility.match(compilationUnit))
                return Collections.singletonList(cuRef);
            else
                return Collections.emptyList();
        }
        else
View Full Code Here

            // can do, so just bail out.
            return;
        }

        IResolvedQualifiersReference hostComponentRef = ReferenceFactory.packageQualifiedReference(project.getWorkspace(), hostComponentClassName);
        ICompilationUnit referencingCU = project.getScope().getCompilationUnitForDefinition(this);
        IDefinition hostComponentDef = hostComponentRef.resolve(project, referencingCU, SIGNATURE);
        if (!(hostComponentDef instanceof IClassDefinition))
        {
            ICompilerProblem problem = new HostComponentClassNotFoundProblem(metaTags[0], hostComponentClassName);
            problems.add(problem);
View Full Code Here

TOP

Related Classes of org.apache.flex.compiler.units.ICompilationUnit

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.