Java Code Examples for com.intellij.psi.xml.XmlTag#getProject()

The following examples show how to use com.intellij.psi.xml.XmlTag#getProject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MuleConfigUtils.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
public static List<XmlTag> findFlowRefsForFlow(@NotNull XmlTag flow) {
    List<XmlTag> flowRefs = new ArrayList<>();

    final Project project = flow.getProject();
    final String flowName = flow.getAttributeValue(MuleConfigConstants.NAME_ATTRIBUTE);

    Collection<VirtualFile> vFiles = FileTypeIndex.getFiles(StdFileTypes.XML, ProjectScope.getContentScope(project));
    for (VirtualFile virtualFile : vFiles) {
        PsiFile psiFile = PsiManager.getInstance(project).findFile(virtualFile);
        if (psiFile != null) {
            XmlFile xmlFile = (XmlFile) psiFile;
            XmlTag mule = xmlFile.getRootTag();

            FlowRefsFinder finder = new FlowRefsFinder(flowName);
            mule.accept(finder);
            flowRefs.addAll(finder.getFlowRefs());
        }
    }
    return flowRefs;
}
 
Example 2
Source File: RTAttributeDescriptorsProvider.java    From react-templates-plugin with MIT License 5 votes vote down vote up
@Override
    public XmlAttributeDescriptor[] getAttributeDescriptors(XmlTag xmlTag) {
        if (xmlTag instanceof HtmlTag /*&& RTFileUtil.hasRTExt(xmlTag.getContainingFile())*/) {
            final Project project = xmlTag.getProject();
            if (RTActionUtil.isRTEnabled(project)) {
                final Map<String, XmlAttributeDescriptor> result = new LinkedHashMap<String, XmlAttributeDescriptor>();
                for (String attr : RTAttributes.ALL_ATTRIBUTES) {
                    result.put(attr, new RTXmlAttributeDescriptor(attr));
                }
//                result.put("rt-repeat", new RTXmlAttributeDescriptor("rt-repeat")); // x in [javascript]
//                result.put("rt-if", new RTXmlAttributeDescriptor("rt-if")); //[javascript]
//                result.put("rt-scope", new RTXmlAttributeDescriptor("rt-scope")); //a as b;c as d
//                result.put("rt-class", new RTXmlAttributeDescriptor("rt-class")); // [javascript]
//                result.put("rt-props", new RTXmlAttributeDescriptor("rt-props")); // [javascript]
                return result.values().toArray(new XmlAttributeDescriptor[result.size()]);

    //            return new XmlAttributeDescriptor[]{
    //                    new AnyXmlAttributeDescriptor("rt-if"),
    //                    new AnyXmlAttributeDescriptor("rt-repeat"),
    //                    new AnyXmlAttributeDescriptor("rt-scope"),
    //                    new AnyXmlAttributeDescriptor("rt-props"),
    //                    new AnyXmlAttributeDescriptor("rt-class"),
    //                    new AnyXmlAttributeDescriptor("rt-require")
    //            };
            }
        }
        return XmlAttributeDescriptor.EMPTY;
    }
 
Example 3
Source File: RTAttributeDescriptorsProvider.java    From react-templates-plugin with MIT License 5 votes vote down vote up
@Override
    public XmlAttributeDescriptor[] getAttributeDescriptors(XmlTag xmlTag) {
        if (xmlTag instanceof HtmlTag /*&& RTFileUtil.hasRTExt(xmlTag.getContainingFile())*/) {
            final Project project = xmlTag.getProject();
            if (RTActionUtil.isRTEnabled(project)) {
                final Map<String, XmlAttributeDescriptor> result = new LinkedHashMap<String, XmlAttributeDescriptor>();
                for (String attr : RTAttributes.ALL_ATTRIBUTES) {
                    result.put(attr, new RTXmlAttributeDescriptor(attr));
                }
//                result.put("rt-repeat", new RTXmlAttributeDescriptor("rt-repeat")); // x in [javascript]
//                result.put("rt-if", new RTXmlAttributeDescriptor("rt-if")); //[javascript]
//                result.put("rt-scope", new RTXmlAttributeDescriptor("rt-scope")); //a as b;c as d
//                result.put("rt-class", new RTXmlAttributeDescriptor("rt-class")); // [javascript]
//                result.put("rt-props", new RTXmlAttributeDescriptor("rt-props")); // [javascript]
                return result.values().toArray(new XmlAttributeDescriptor[result.size()]);

    //            return new XmlAttributeDescriptor[]{
    //                    new AnyXmlAttributeDescriptor("rt-if"),
    //                    new AnyXmlAttributeDescriptor("rt-repeat"),
    //                    new AnyXmlAttributeDescriptor("rt-scope"),
    //                    new AnyXmlAttributeDescriptor("rt-props"),
    //                    new AnyXmlAttributeDescriptor("rt-class"),
    //                    new AnyXmlAttributeDescriptor("rt-require")
    //            };
            }
        }
        return XmlAttributeDescriptor.EMPTY;
    }
 
Example 4
Source File: XmlServiceArgumentInspection.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
private ContainerCollectionResolver.LazyServiceCollector getLazyServiceCollector(XmlTag xmlTag) {
    if(this.lazyServiceCollector != null) {
        return this.lazyServiceCollector;
    }

    return this.lazyServiceCollector = new ContainerCollectionResolver.LazyServiceCollector(xmlTag.getProject());
}