Java 类com.intellij.lang.parameterInfo.ParameterInfoUtils 实例源码

项目:consulo-csharp    文件:CSharpParameterInfoHandler.java   
@Override
public void updateParameterInfo(@NotNull PsiElement place, UpdateParameterInfoContext context)
{
    CSharpCallArgumentListOwner owner = resolveCallArgumentListOwner(place);
    int parameterIndex = -1;
    CSharpCallArgumentList callArgumentList = owner == null ? null : owner.getParameterList();
    if(callArgumentList != null)
    {
        IElementType delimiter = CSharpTokens.COMMA;
        if(callArgumentList instanceof CSharpDictionaryInitializerImpl)
        {
            delimiter = CSharpTokens.EQ;
        }
        parameterIndex = ParameterInfoUtils.getCurrentParameterIndex(callArgumentList.getNode(), context.getOffset(), delimiter);
    }

    context.setCurrentParameter(parameterIndex);

    if(context.getParameterOwner() == null)
    {
        context.setParameterOwner(place);
    }
    else if(context.getParameterOwner() != owner)
    {
        context.removeHint();
        return;
    }
    final Object[] objects = context.getObjectsToView();

    for(int i = 0; i < objects.length; i++)
    {
        context.setUIComponentEnabled(i, true);
    }
}
项目:consulo-csharp    文件:CSharpGenericParameterInfoHandler.java   
@Override
public void updateParameterInfo(@NotNull PsiElement place, UpdateParameterInfoContext context)
{
    int parameterIndex = -1;
    DotNetTypeList typeList = PsiTreeUtil.getParentOfType(place, DotNetTypeList.class, false);

    if(typeList == null)
    {
        context.removeHint();
        return;
    }
    if(!(typeList.getParent() instanceof CSharpReferenceExpression))
    {
        context.removeHint();
        return;
    }

    parameterIndex = ParameterInfoUtils.getCurrentParameterIndex(typeList.getNode(), context.getOffset(), CSharpTokens.COMMA);

    context.setCurrentParameter(parameterIndex);

    if(context.getParameterOwner() == null)
    {
        context.setParameterOwner(place);
    }
    else if(context.getParameterOwner() != PsiTreeUtil.getParentOfType(place, CSharpReferenceExpression.class, false))
    {
        context.removeHint();
        return;
    }
    final Object[] objects = context.getObjectsToView();

    for(int i = 0; i < objects.length; i++)
    {
        context.setUIComponentEnabled(i, true);
    }
}
项目:consulo-javascript    文件:JSParameterInfoHandler.java   
@Nullable
public static JSArgumentList findArgumentList(final PsiFile file, final int offset)
{
    JSArgumentList argList = ParameterInfoUtils.findParentOfType(file, offset, JSArgumentList.class);
    if(argList == null)
    {
        final JSCallExpression callExpression = ParameterInfoUtils.findParentOfType(file, offset, JSCallExpression.class);
        if(callExpression != null)
        {
            argList = callExpression.getArgumentList();
        }
    }
    return argList;
}
项目:consulo-javascript    文件:JSParameterInfoHandler.java   
@Override
public void updateParameterInfo(@NotNull final JSArgumentList o, final UpdateParameterInfoContext context)
{
    if(context.getParameterOwner() != o)
    {
        context.removeHint();
        return;
    }
    final int currentParameterIndex = ParameterInfoUtils.getCurrentParameterIndex(o.getNode(), context.getOffset(), JSTokenTypes.COMMA);
    context.setCurrentParameter(currentParameterIndex);
}
项目:consulo-java    文件:MethodParameterInfoHandler.java   
private PsiExpressionList findArgumentList(final PsiFile file, int offset, int parameterStart)
{
    PsiExpressionList argumentList = ParameterInfoUtils.findArgumentList(file, offset, parameterStart, this);
    if(argumentList == null)
    {
        final PsiMethodCallExpression methodCall = ParameterInfoUtils.findParentOfTypeWithStopElements(file, offset, PsiMethodCallExpression.class, PsiMethod.class);

        if(methodCall != null)
        {
            argumentList = methodCall.getArgumentList();
        }
    }
    return argumentList;
}
项目:intellij-xquery    文件:XQueryParameterInfoHandler.java   
@Override
public void updateParameterInfo(@NotNull XQueryArgumentList place, UpdateParameterInfoContext context) {
    context.setCurrentParameter(ParameterInfoUtils.getCurrentParameterIndex(place.getNode(), context.getOffset(),
            XQueryTypes.COMMA));
}
项目:intellij-xquery    文件:XQueryParameterInfoHandler.java   
@Nullable
@Override
public String getParameterCloseChars() {
    return ParameterInfoUtils.DEFAULT_PARAMETER_CLOSE_CHARS;
}
项目:consulo-java    文件:MethodParameterInfoHandler.java   
@Override
public String getParameterCloseChars()
{
    return ParameterInfoUtils.DEFAULT_PARAMETER_CLOSE_CHARS;
}