Package com.intellij.psi.util

Examples of com.intellij.psi.util.PsiElementFilter


        if(parameters.length == 0 || parameterIndex >= parameters.length) {
            return null;
        }

        final String tempVariableName = parameters[parameterIndex].getName();
        return PsiTreeUtil.collectElements(method.getLastChild(), new PsiElementFilter() {
            @Override
            public boolean isAccepted(PsiElement element) {
                return element instanceof Variable && tempVariableName.equals(((Variable) element).getName());
            }
        });
View Full Code Here


    }

    public PsiElement[] getBlock() {

        final String name = this.getName();
        return PsiTreeUtil.collectElements(this.psiFile, new PsiElementFilter() {
            @Override
            public boolean isAccepted(PsiElement psiElement) {

                // @TODO: move this to PlatformPatterns; withName?
                return PlatformPatterns.psiElement(TwigElementTypes.BLOCK_TAG).accepts(psiElement)
View Full Code Here

    public static ArrayList<TwigMacro> getImportedMacros(PsiFile psiFile) {

        ArrayList<TwigMacro> macros = new ArrayList<TwigMacro>();

        PsiElement[] importPsiElements = PsiTreeUtil.collectElements(psiFile, new PsiElementFilter() {
            @Override
            public boolean isAccepted(PsiElement paramPsiElement) {
                return PlatformPatterns.psiElement(TwigElementTypes.IMPORT_TAG).accepts(paramPsiElement);
            }
        });
View Full Code Here

                if(!(psiFile instanceof TwigFile)) {
                    return map;
                }

                PsiElement[] twigExtendsTags = PsiTreeUtil.collectElements(psiFile, new PsiElementFilter() {
                    @Override
                    public boolean isAccepted(PsiElement psiElement) {
                        return psiElement instanceof TwigExtendsTag;
                    }
                });
View Full Code Here

                if(!(psiFile instanceof TwigFile)) {
                    return map;
                }

                PsiTreeUtil.collectElements(psiFile, new PsiElementFilter() {
                    @Override
                    public boolean isAccepted(PsiElement psiElement) {

                        // {% include %}
                        if(psiElement instanceof TwigTagWithFileReference) {
View Full Code Here

    private TreeMap<String, Integer> getPossibleDomainTreeMap(TwigFile psiFile, final Set<String> domainNames) {

        final Map<String, Integer> found = new HashMap<String, Integer>();

        // visit every trans or transchoice to get possible domain names
        PsiTreeUtil.collectElements(psiFile, new PsiElementFilter() {
            @Override
            public boolean isAccepted(PsiElement psiElement) {

                if (TwigHelper.getTransDomainPattern().accepts(psiElement)) {
                    PsiElement psiElementTrans = PsiElementUtils.getPrevSiblingOfType(psiElement, PlatformPatterns.psiElement(TwigTokenTypes.IDENTIFIER).withText(PlatformPatterns.string().oneOf("trans", "transchoice")));
View Full Code Here

                if(!(psiFile instanceof TwigFile)) {
                    return map;
                }

                PsiTreeUtil.collectElements(psiFile, new PsiElementFilter() {
                    @Override
                    public boolean isAccepted(PsiElement psiElement) {

                        // {% include %}
                        if(psiElement instanceof TwigTagWithFileReference) {
View Full Code Here

        final String blockName = psiElement.getText();

        List<PsiElement> blockTargets = new ArrayList<PsiElement>();
        for(PsiFile psiFile1: twigChild) {

            blockTargets.addAll(Arrays.asList(PsiTreeUtil.collectElements(psiFile1, new PsiElementFilter() {
                @Override
                public boolean isAccepted(PsiElement psiElement) {
                    return TwigHelper.getBlockTagPattern().accepts(psiElement) && blockName.equals(psiElement.getText());
                }
            })));
View Full Code Here

        if(parameterLists != null) {
            return parameterLists;
        }

        return parameterLists = PsiTreeUtil.collectElements(method, new PsiElementFilter() {
            @Override
            public boolean isAccepted(PsiElement psiElement) {
                return psiElement.getParent() instanceof ParameterList;
            }
        });
View Full Code Here

        return descriptors.toArray(new FoldingDescriptor[descriptors.size()]);
    }

    private void attachTemplateFoldingDescriptors(PsiElement psiElement, List<FoldingDescriptor> descriptors) {
        // find path calls in file
        PsiElement[] fileReferences = PsiTreeUtil.collectElements(psiElement, new PsiElementFilter() {
            @Override
            public boolean isAccepted(PsiElement psiElement) {
                return TwigHelper.getTemplateFileReferenceTagPattern().accepts(psiElement) || TwigHelper.getFormThemeFileTag().accepts(psiElement);
            }
        });
View Full Code Here

TOP

Related Classes of com.intellij.psi.util.PsiElementFilter

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.