Search in sources :

Example 1 with FilePathReferenceProvider

use of com.intellij.psi.impl.source.resolve.reference.impl.providers.FilePathReferenceProvider in project intellij-plugins by JetBrains.

the class IncludeFileResolvingConverterImpl method createReferences.

@NotNull
public PsiReference[] createReferences(@NotNull final GenericDomValue genericDomValue, @NotNull final PsiElement element, @NotNull final ConvertContext context) {
    final String s = genericDomValue.getStringValue();
    if (s == null) {
        return PsiReference.EMPTY_ARRAY;
    }
    final StrutsModel model = ConverterUtil.getStrutsModel(context);
    if (model == null) {
        return PsiReference.EMPTY_ARRAY;
    }
    final int offset = ElementManipulators.getOffsetInElement(element);
    return new FilePathReferenceProvider() {

        protected boolean isPsiElementAccepted(final PsiElement element) {
            return super.isPsiElementAccepted(element) && (!(element instanceof PsiFile) || isFileAccepted(model, (PsiFile) element));
        }
    }.getReferencesByElement(element, s, offset, true);
}
Also used : FilePathReferenceProvider(com.intellij.psi.impl.source.resolve.reference.impl.providers.FilePathReferenceProvider) StrutsModel(com.intellij.struts2.dom.struts.model.StrutsModel) PsiFile(com.intellij.psi.PsiFile) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 PsiFile (com.intellij.psi.PsiFile)1 FilePathReferenceProvider (com.intellij.psi.impl.source.resolve.reference.impl.providers.FilePathReferenceProvider)1 StrutsModel (com.intellij.struts2.dom.struts.model.StrutsModel)1 NotNull (org.jetbrains.annotations.NotNull)1