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

项目:consulo-csharp    文件:CSharpParameterInfoHandler.java   
@Override
@RequiredDispatchThread
public void updateUI(ItemToShow p, ParameterInfoUIContext context)
{
    if(p == null)
    {
        context.setUIComponentEnabled(false);
        return;
    }
    CSharpParametersInfo build = CSharpParametersInfo.build(p.myLikeMethod, p.myScope);

    String text = build.getText();

    TextRange parameterRange = build.getParameterRange(context.getCurrentParameterIndex());

    context.setupUIComponentPresentation(text, parameterRange.getStartOffset(), parameterRange.getEndOffset(), !context.isUIComponentEnabled(), p.isObsolete(), false, context
            .getDefaultParameterColor());
}
项目:consulo-csharp    文件:CSharpGenericParameterInfoHandler.java   
@Override
public void updateUI(DotNetGenericParameterListOwner p, ParameterInfoUIContext context)
{
    if(p == null)
    {
        context.setUIComponentEnabled(false);
        return;
    }
    CSharpGenericParametersInfo build = CSharpGenericParametersInfo.build(p);
    if(build == null)
    {
        context.setUIComponentEnabled(false);
        return;
    }

    String text = build.getText();

    TextRange parameterRange = build.getParameterRange(context.getCurrentParameterIndex());

    context.setupUIComponentPresentation(text, parameterRange.getStartOffset(), parameterRange.getEndOffset(), !context.isUIComponentEnabled(),
            false, false, context.getDefaultParameterColor());
}
项目:intellij-xquery    文件:XQueryParameterInfoHandler.java   
@Override
public void updateUI(Object p, ParameterInfoUIContext context) {
    if (p == null) {
        context.setUIComponentEnabled(false);
        return;
    }
    int index = context.getCurrentParameterIndex();
    ParameterPresentation presentation = null;
    if (p instanceof XQueryFunctionDecl) {
        presentation = buildUserFunctionPresentation((XQueryFunctionDecl) p, index);
    } else if (p instanceof BuiltInFunctionSignature) {
        presentation = buildBuiltInFunctionPresentation((BuiltInFunctionSignature) p, index);
    }
    context.setupUIComponentPresentation(presentation.text, presentation.start, presentation.end,
            presentation.disabled, false, true,
            context.getDefaultParameterColor());
}
项目:consulo-javascript    文件:JSParameterInfoHandler.java   
@Override
public void updateUI(final JSFunction p, final ParameterInfoUIContext context)
{
    final JSParameterList parameterList = p.getParameterList();
    final JSParameter[] params = parameterList != null ? parameterList.getParameters() : new JSParameter[0];
    final int currentParameterIndex = context.getCurrentParameterIndex() >= 0 ? context.getCurrentParameterIndex() : params.length;
    final JSParameter parameter = currentParameterIndex < params.length ? params[currentParameterIndex] : null;

    final SignatureInfo signatureInfo = buildSignature(params, false, currentParameterIndex);
    final String name = signatureInfo.text;

    final String currentParameterSignature = parameter != null ? getSignatureForParameter(parameter, false) : null;
    int highlightStart = parameter != null ? signatureInfo.selectedParameterStart : 0;
    int highlightEnd = parameter != null ? highlightStart + currentParameterSignature.length() : 0;
    context.setupUIComponentPresentation(name, highlightStart, highlightEnd, false, false, false, context.getDefaultParameterColor());
}
项目:consulo-java    文件:MethodParameterInfoHandler.java   
@Override
public void updateUI(final Object p, @NotNull final ParameterInfoUIContext context)
{
    if(p instanceof CandidateInfo)
    {
        CandidateInfo info = (CandidateInfo) p;
        PsiMethod method = (PsiMethod) info.getElement();
        if(!method.isValid())
        {
            context.setUIComponentEnabled(false);
            return;
        }

        updateMethodPresentation(method, getCandidateInfoSubstitutor(info), context);
    }
    else
    {
        updateMethodPresentation((PsiMethod) p, null, context);
    }
}
项目:consulo-apache-velocity    文件:VtlParameterInfoHandler.java   
public void updateUI(final VtlCallable callable, final ParameterInfoUIContext context) {
    PsiElement list = context.getParameterOwner();
    if (!list.isValid()) {
        return;
    }

    final int index = context.getCurrentParameterIndex();
    boolean applicable = isApplicable(callable, list, index);

    int highlightStart = -1;
    int highlightEnd = -1;

    StringBuilder sb = new StringBuilder();
    final VtlVariable[] variables = callable.getParameters();
    boolean isMacro = callable instanceof VtlMacro;
    String delimiter = isMacro ? " " : ", ";
    for (int i = 0; i < variables.length; i++) {
        if (i > 0) {
            sb.append(delimiter);
        }
        if (i == index) {
            highlightStart = sb.length();
        }
        VtlVariable variable = variables[i];
        PsiType type = variable.getPsiType();
        if (type != null) {
            sb.append(type.getPresentableText()).append(" ");
        }
        if (isMacro) {
            sb.append('$');
        }
        sb.append(variable.getName());
        if (i == index) {
            highlightEnd = sb.length();
        }
    }

    if (variables.length == 0) {
        sb.append(CodeInsightBundle.message("parameter.info.no.parameters"));
    }

    final boolean deprecated = callable.isDeprecated();
    context.setupUIComponentPresentation(sb.toString(), highlightStart, highlightEnd, !applicable, deprecated, false, context.getDefaultParameterColor());
}