String (final String signature, final boolean parameterNames) { @NonNls final StringBuilder sb = new StringBuilder(); final StringTokenizer st = new StringTokenizer(signature, "(,)"); for (int i = 0; st.hasMoreTokens(); i++) { final String token = st.nextToken().trim(); if (i > 1) sb.append(", "); final int idx; if (i == 0) { sb.append(token).append("("); } else if ((idx = token.indexOf(' ')) > -1) { if (parameterNames) { sb.append(token); } else { sb.append(token, 0, idx); } } else { sb.append(token); if (parameterNames) { sb.append(' ').append('p').append(i); } } } sb.append(")"); return sb.toString(); }