Lines 11-16
Link Here
|
11 |
package org.eclipse.jdt.internal.core; |
11 |
package org.eclipse.jdt.internal.core; |
12 |
|
12 |
|
13 |
import java.net.URL; |
13 |
import java.net.URL; |
|
|
14 |
import java.util.ArrayList; |
15 |
import java.util.StringTokenizer; |
14 |
|
16 |
|
15 |
import org.eclipse.core.runtime.IProgressMonitor; |
17 |
import org.eclipse.core.runtime.IProgressMonitor; |
16 |
import org.eclipse.core.runtime.OperationCanceledException; |
18 |
import org.eclipse.core.runtime.OperationCanceledException; |
Lines 192-201
Link Here
|
192 |
} |
194 |
} |
193 |
} |
195 |
} |
194 |
} |
196 |
} |
|
|
197 |
IBinaryMethod info = (IBinaryMethod) getElementInfo(); |
198 |
final int paramCount = Signature.getParameterCount(new String(info.getMethodDescriptor())); |
199 |
if (this.parameterNames == null) { |
200 |
// try to see if we can retrieve the names from the attached javadoc |
201 |
if (paramCount != 0) { |
202 |
String javadoc = this.getAttachedJavadoc(null, "UTF-8"); //$NON-NLS-1$ |
203 |
if (javadoc != null) { |
204 |
final int indexOfOpenParen = javadoc.indexOf('('); |
205 |
if (indexOfOpenParen != -1) { |
206 |
final int indexOfClosingParen = javadoc.indexOf(')', indexOfOpenParen); |
207 |
if (indexOfClosingParen != -1) { |
208 |
final char[] paramsSource = |
209 |
CharOperation.replace( |
210 |
javadoc.substring(indexOfOpenParen + 1, indexOfClosingParen).toCharArray(), |
211 |
" ".toCharArray(), //$NON-NLS-1$ |
212 |
new char[] {' '}); |
213 |
final StringTokenizer tokenizer = new StringTokenizer(String.valueOf(paramsSource), ", \n\r"); //$NON-NLS-1$ |
214 |
int index = 0; |
215 |
final ArrayList paramNames = new ArrayList(paramCount); |
216 |
while (tokenizer.hasMoreTokens()) { |
217 |
final String token = tokenizer.nextToken(); |
218 |
if ((index & 1) != 0) { |
219 |
// if odd then this is a parameter name |
220 |
paramNames.add(token); |
221 |
} |
222 |
index++; |
223 |
} |
224 |
if (!paramNames.isEmpty()) { |
225 |
this.parameterNames = new String[paramNames.size()]; |
226 |
paramNames.toArray(this.parameterNames); |
227 |
} |
228 |
} |
229 |
} |
230 |
} |
231 |
} |
232 |
} |
195 |
// if still no parameter names, produce fake ones |
233 |
// if still no parameter names, produce fake ones |
196 |
if (this.parameterNames == null) { |
234 |
if (this.parameterNames == null) { |
197 |
IBinaryMethod info = (IBinaryMethod) getElementInfo(); |
|
|
198 |
int paramCount = Signature.getParameterCount(new String(info.getMethodDescriptor())); |
199 |
this.parameterNames = new String[paramCount]; |
235 |
this.parameterNames = new String[paramCount]; |
200 |
for (int i = 0; i < paramCount; i++) { |
236 |
for (int i = 0; i < paramCount; i++) { |
201 |
this.parameterNames[i] = "arg" + i; //$NON-NLS-1$ |
237 |
this.parameterNames[i] = "arg" + i; //$NON-NLS-1$ |