String (@NotNull ParameterInfoUIContext context, @NotNull MethodPresentation methodPresentation) { CodeInsightSettings settings = CodeInsightSettings.getInstance(); int numParams = methodPresentation.parameters().size(); @Nls StringBuilder buffer = new StringBuilder(numParams * 8); // crude heuristics if (settings.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO && !context.isSingleParameterInfo()) { if (!methodPresentation.constructor()) { buffer.append(methodPresentation.modifiers()); buffer.append(methodPresentation.type()); buffer.append(" "); } buffer.append(methodPresentation.name()); buffer.append("("); } int currentParameter = context.getCurrentParameterIndex(); int highlightStartOffset = -1; int highlightEndOffset = -1; if (numParams > 0) { if (context.isSingleParameterInfo() && methodPresentation.varArgs() && currentParameter >= numParams) currentParameter = numParams - 1; for (int j = 0; j < numParams; j++) { if (context.isSingleParameterInfo() && j != currentParameter) continue; ParameterPresentation parameterPresentation = methodPresentation.parameters().get(j); int startOffset = buffer.length(); if (context.isSingleParameterInfo()) buffer.append("<b>"); buffer.append(parameterPresentation.modifiers()); String type = parameterPresentation.type(); buffer.append(context.isSingleParameterInfo() ? StringUtil.escapeXmlEntities(type) : type); String name = parameterPresentation.name(); if (!context.isSingleParameterInfo()) { buffer.append(" "); buffer.append(name); } if (context.isSingleParameterInfo()) buffer.append("</b>"); if (context.isSingleParameterInfo()) { String javaDoc = parameterPresentation.javaDoc(); if (javaDoc != null) { if (javaDoc.length() < 100) { buffer.append("&nbsp;&nbsp;<i>").append(javaDoc).append("</i>"); } else { buffer.insert(0, "<table><tr><td valign='top'>") .append("</td><td style='width:400px'>&nbsp;&nbsp;<i>").append(javaDoc).append("</i></td></tr></table>"); } } } else { int endOffset = buffer.length(); if (j < numParams - 1) { buffer.append(", "); } if (context.isUIComponentEnabled() && (j == currentParameter || j == numParams - 1 && parameterPresentation.varArgs() && currentParameter >= numParams)) { highlightStartOffset = startOffset; highlightEndOffset = endOffset; } } } } else { buffer.append(CodeInsightBundle.message("parameter.info.no.parameters")); } if (settings.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO && !context.isSingleParameterInfo()) { buffer.append(")"); } String text = buffer.toString(); if (context.isSingleParameterInfo()) { context.setupRawUIComponentPresentation(text); return text; } else { return context.setupUIComponentPresentation( text, highlightStartOffset, highlightEndOffset, !context.isUIComponentEnabled(), methodPresentation.deprecated() && !context.isSingleParameterInfo() && !context.isSingleOverload(), false, context.getDefaultParameterColor() ); } }