当前位置: 首页>>代码示例>>Java>>正文


Java ParameterList.getContext方法代码示例

本文整理汇总了Java中com.jetbrains.php.lang.psi.elements.ParameterList.getContext方法的典型用法代码示例。如果您正苦于以下问题:Java ParameterList.getContext方法的具体用法?Java ParameterList.getContext怎么用?Java ParameterList.getContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jetbrains.php.lang.psi.elements.ParameterList的用法示例。


在下文中一共展示了ParameterList.getContext方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isFunctionParameter

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
private static boolean isFunctionParameter(PsiElement psiElement, int parameterIndex, String... funcName) {
    PsiElement variableContext = psiElement.getContext();
    if(!(variableContext instanceof ParameterList)) {
        return false;
    } else {
        ParameterList parameterList = (ParameterList) variableContext;
        PsiElement context = parameterList.getContext();
        if(!(context instanceof FunctionReference)) {
            return false;
        } else {
            FunctionReference methodReference = (FunctionReference) context;
            String name = methodReference.getName();

            return (name != null && Arrays.asList(funcName).contains(name) && getParameterIndex(parameterList, psiElement) == parameterIndex);
        }
    }
}
 
开发者ID:adelf,项目名称:idea-php-dotenv-plugin,代码行数:18,代码来源:PsiUtil.java

示例2: invoke

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
private void invoke(@NotNull ProblemsHolder holder, @NotNull PsiElement psiElement) {
    if (!(psiElement instanceof StringLiteralExpression) || !(psiElement.getContext() instanceof ParameterList)) {
        return;
    }

    ParameterList parameterList = (ParameterList) psiElement.getContext();

    PsiElement methodReference = parameterList.getContext();
    if (!(methodReference instanceof MethodReference)) {
        return;
    }

    if (!PhpElementsUtil.isMethodReferenceInstanceOf((MethodReference) methodReference, TranslationUtil.PHP_TRANSLATION_SIGNATURES)) {
        return;
    }

    int domainParameter = 2;
    if("transChoice".equals(((MethodReference) methodReference).getName())) {
        domainParameter = 3;
    }

    ParameterBag currentIndex = PsiElementUtils.getCurrentParameterIndex(psiElement);
    if(currentIndex != null && currentIndex.getIndex() == domainParameter) {
        annotateTranslationDomain((StringLiteralExpression) psiElement, holder);
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:27,代码来源:PhpTranslationDomainInspection.java

示例3: getReferencesByElement

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
    if (!Symfony2ProjectComponent.isEnabled(psiElement) || !(psiElement.getContext() instanceof ParameterList)) {
        return new PsiReference[0];
    }

    ParameterList parameterList = (ParameterList) psiElement.getContext();
    PsiElement methodReference = parameterList.getContext();
    if (!(methodReference instanceof MethodReference)) {
        return new PsiReference[0];
    }

    for(Call call: this.oneOfCall) {
        if (PhpElementsUtil.isMethodReferenceInstanceOf((MethodReference) methodReference, call.getClassName(), call.getMethodName()) && PsiElementUtils.getParameterIndexValue(psiElement) == call.getIndex()) {
            return this.getPsiReferenceBase(psiElement);
        }
    }

    return new PsiReference[0];
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:22,代码来源:PhpStringLiteralExpressionReference.java

示例4: getMethodReferenceWithFirstStringParameter

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
@Nullable
public static MethodReference getMethodReferenceWithFirstStringParameter(PsiElement psiElement) {
    if (!PlatformPatterns.psiElement()
            .withParent(StringLiteralExpression.class).inside(ParameterList.class)
            .withLanguage(PhpLanguage.INSTANCE).accepts(psiElement)) {

        return null;
    }

    ParameterList parameterList = PsiTreeUtil.getParentOfType(psiElement, ParameterList.class);
    if (parameterList == null) {
        return null;
    }

    if (!(parameterList.getContext() instanceof MethodReference)) {
        return null;
    }

    return (MethodReference) parameterList.getContext();
}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:21,代码来源:PsiElementUtils.java

示例5: isInContextOfDispatchMethod

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
private boolean isInContextOfDispatchMethod(PsiElement psiElement) {
    ParameterList parameterList = PsiTreeUtil.getParentOfType(psiElement, ParameterList.class);
    if (parameterList == null) {
        return false;
    }
    if (!(parameterList.getContext() instanceof MethodReference)) {
        return false;
    }
    MethodReference methodReference = (MethodReference)parameterList.getContext();
    return methodReference.getName() != null && methodReference.getName().equals("dispatch");
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:12,代码来源:EventNameIndex.java

示例6: getReferencesByElement

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
    ParameterList parameterList = PsiTreeUtil.getParentOfType(psiElement, ParameterList.class);

    if (parameterList == null) {
        return new PsiReference[0];
    }

    if(!(parameterList.getContext() instanceof MethodReference)) {
        return new PsiReference[0];
    }

    MethodReference methodReference = (MethodReference)parameterList.getContext();
    if (!DISPATCH_METHOD.equals(methodReference.getName())) {
        return new PsiReference[0];
    }

    PsiElement resolvedElement = methodReference.resolve();
    if (resolvedElement != null && resolvedElement instanceof Method) {
        PhpClass containingClass = ((Method) resolvedElement).getContainingClass();

        if (containingClass != null && MagentoTypes.EVENT_MANAGER_TYPE.equals(containingClass.getPresentableFQN())) {
            return new PsiReference[]{new TypeReference(psiElement, this.resultsFillers, true)};
        }
    }


    return new PsiReference[0];
}
 
开发者ID:dkvashninbay,项目名称:magento2plugin,代码行数:31,代码来源:EventReferenceProvider.java

示例7: getCurrentParameterIndex

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
@Nullable
public static ParameterBag getCurrentParameterIndex(PsiElement psiElement) {

    if (!(psiElement.getContext() instanceof ParameterList)) {
        return null;
    }

    ParameterList parameterList = (ParameterList) psiElement.getContext();
    if (!(parameterList.getContext() instanceof ParameterListOwner)) {
        return null;
    }

    return getCurrentParameterIndex(parameterList.getParameters(), psiElement);
}
 
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:15,代码来源:PsiElementUtils.java

示例8: getReferencesByElement

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {

    ParameterList parameterList = (ParameterList) psiElement.getContext();

    if (parameterList == null || !(parameterList.getContext() instanceof MethodReference)) {
        return new PsiReference[0];
    }
    MethodReference method = (MethodReference) parameterList.getContext();
    // System.err.println(referenceClass);
    return this.getPsiReferenceBase(psiElement);

    // return new PsiReference[0];
}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:16,代码来源:PhpStringLiteralExpressionReference.java

示例9: invoke

import com.jetbrains.php.lang.psi.elements.ParameterList; //导入方法依赖的package包/类
private void invoke(@NotNull ProblemsHolder holder, @NotNull PsiElement psiElement) {
    if (!(psiElement instanceof StringLiteralExpression) || !(psiElement.getContext() instanceof ParameterList)) {
        return;
    }

    ParameterList parameterList = (ParameterList) psiElement.getContext();
    PsiElement methodReference = parameterList.getContext();
    if (!(methodReference instanceof MethodReference)) {
        return;
    }

    if (!PhpElementsUtil.isMethodReferenceInstanceOf((MethodReference) methodReference, TranslationUtil.PHP_TRANSLATION_SIGNATURES)) {
        return;
    }

    ParameterBag currentIndex = PsiElementUtils.getCurrentParameterIndex(psiElement);
    if(currentIndex == null || currentIndex.getIndex() != 0) {
        return;
    }

    int domainParameter = 2;
    if("transChoice".equals(((MethodReference) methodReference).getName())) {
        domainParameter = 3;
    }

    PsiElement domainElement = PsiElementUtils.getMethodParameterPsiElementAt(parameterList, domainParameter);

    if(domainElement == null) {
        // no domain found; fallback to default domain
        annotateTranslationKey((StringLiteralExpression) psiElement, "messages", holder);
    } else {
        // resolve string in parameter
        PsiElement[] parameters = parameterList.getParameters();
        if(parameters.length >= domainParameter) {
            String domain = PhpElementsUtil.getStringValue(parameters[domainParameter]);
            if(domain != null) {
                annotateTranslationKey((StringLiteralExpression) psiElement, domain, holder);
            }
        }
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:42,代码来源:PhpTranslationKeyInspection.java


注:本文中的com.jetbrains.php.lang.psi.elements.ParameterList.getContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。