Package com.xenji.php.symfony2.clickableviews

Source Code of com.xenji.php.symfony2.clickableviews.TwigViewPsiReferenceProvider

package com.xenji.php.symfony2.clickableviews;

import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import com.intellij.psi.PsiReferenceProvider;
import com.intellij.util.ProcessingContext;
import com.jetbrains.php.lang.psi.elements.StringLiteralExpression;
import org.jetbrains.annotations.NotNull;

/**
* Reference Provider implementation for Twig Templates.
*
* @author Mario Mueller mario@xenji.com
* @license MIT
*/
public class TwigViewPsiReferenceProvider extends PsiReferenceProvider {
    @NotNull
    @Override
    public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {

        // IF we touch down here, we do have a StringLiteralExpression.
        StringLiteralExpression se = (StringLiteralExpression) element;

        TwigViewPsiReference psiReference = new TwigViewPsiReference(se, element.getProject());

        if (psiReference.resolve() != null) {
            return new PsiReference[]{psiReference};
        }
        return PsiReference.EMPTY_ARRAY;
    }
}
TOP

Related Classes of com.xenji.php.symfony2.clickableviews.TwigViewPsiReferenceProvider

TOP
Copyright © 2018 www.massapi.com. 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.