Search in sources :

Example 1 with NamedTemplateMatcher

use of org.intellij.lang.xpath.xslt.util.NamedTemplateMatcher in project intellij-community by JetBrains.

the class TemplateReference method multiResolve.

@NotNull
public ResolveResult[] multiResolve(boolean incompleteCode) {
    final PsiElement element = resolve();
    if (element != null) {
        return new ResolveResult[] { new PsiElementResolveResult(element) };
    }
    final XmlFile xmlFile = (XmlFile) getElement().getContainingFile();
    if (xmlFile != null) {
        final List<PsiElementResolveResult> targets = new SmartList<>();
        XsltIncludeIndex.processBackwardDependencies(xmlFile, xmlFile1 -> {
            final PsiElement e = ResolveUtil.resolve(new NamedTemplateMatcher(xmlFile1.getDocument(), myName));
            if (e != null) {
                targets.add(new PsiElementResolveResult(e));
            }
            return true;
        });
        return targets.toArray(new ResolveResult[targets.size()]);
    } else {
        return ResolveResult.EMPTY_ARRAY;
    }
}
Also used : XmlFile(com.intellij.psi.xml.XmlFile) NamedTemplateMatcher(org.intellij.lang.xpath.xslt.util.NamedTemplateMatcher) PsiElementResolveResult(com.intellij.psi.PsiElementResolveResult) SmartList(com.intellij.util.SmartList) PsiElementResolveResult(com.intellij.psi.PsiElementResolveResult) ResolveResult(com.intellij.psi.ResolveResult) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 PsiElementResolveResult (com.intellij.psi.PsiElementResolveResult)1 ResolveResult (com.intellij.psi.ResolveResult)1 XmlFile (com.intellij.psi.xml.XmlFile)1 SmartList (com.intellij.util.SmartList)1 NamedTemplateMatcher (org.intellij.lang.xpath.xslt.util.NamedTemplateMatcher)1 NotNull (org.jetbrains.annotations.NotNull)1