Lines 293-299
Link Here
|
293 |
* types are found relative to their enclosing type. |
293 |
* types are found relative to their enclosing type. |
294 |
*/ |
294 |
*/ |
295 |
public void findTypes(char[] prefix, final boolean findMembers, boolean camelCaseMatch, int searchFor, final ISearchRequestor storage) { |
295 |
public void findTypes(char[] prefix, final boolean findMembers, boolean camelCaseMatch, int searchFor, final ISearchRequestor storage) { |
296 |
|
296 |
findTypes(prefix, findMembers, camelCaseMatch, searchFor, storage, null); |
|
|
297 |
} |
298 |
/** |
299 |
* Must be used only by CompletionEngine. |
300 |
* The progress monitor is used to be able to cancel completion operations |
301 |
* |
302 |
* Find the top-level types that are defined |
303 |
* in the current environment and whose name starts with the |
304 |
* given prefix. The prefix is a qualified name separated by periods |
305 |
* or a simple name (ex. java.util.V or V). |
306 |
* |
307 |
* The types found are passed to one of the following methods (if additional |
308 |
* information is known about the types): |
309 |
* ISearchRequestor.acceptType(char[][] packageName, char[] typeName) |
310 |
* ISearchRequestor.acceptClass(char[][] packageName, char[] typeName, int modifiers) |
311 |
* ISearchRequestor.acceptInterface(char[][] packageName, char[] typeName, int modifiers) |
312 |
* |
313 |
* This method can not be used to find member types... member |
314 |
* types are found relative to their enclosing type. |
315 |
*/ |
316 |
public void findTypes(char[] prefix, final boolean findMembers, boolean camelCaseMatch, int searchFor, final ISearchRequestor storage, IProgressMonitor monitor) { |
317 |
|
297 |
/* |
318 |
/* |
298 |
if (true){ |
319 |
if (true){ |
299 |
findTypes(new String(prefix), storage, NameLookup.ACCEPT_CLASSES | NameLookup.ACCEPT_INTERFACES); |
320 |
findTypes(new String(prefix), storage, NameLookup.ACCEPT_CLASSES | NameLookup.ACCEPT_INTERFACES); |
Lines 371-394
Link Here
|
371 |
storage.acceptType(packageName, simpleTypeName, enclosingTypeNames, modifiers, access); |
392 |
storage.acceptType(packageName, simpleTypeName, enclosingTypeNames, modifiers, access); |
372 |
} |
393 |
} |
373 |
}; |
394 |
}; |
374 |
try { |
395 |
|
375 |
int matchRule = SearchPattern.R_PREFIX_MATCH; |
396 |
int matchRule = SearchPattern.R_PREFIX_MATCH; |
376 |
if (camelCaseMatch) matchRule |= SearchPattern.R_CAMELCASE_MATCH; |
397 |
if (camelCaseMatch) matchRule |= SearchPattern.R_CAMELCASE_MATCH; |
377 |
new BasicSearchEngine(this.workingCopies).searchAllTypeNames( |
398 |
if (monitor != null) { |
378 |
qualification, |
399 |
found : while (true) { //the loop will finish if the search request ends or is cancelled |
379 |
SearchPattern.R_EXACT_MATCH, |
400 |
try { |
380 |
simpleName, |
401 |
new BasicSearchEngine(this.workingCopies).searchAllTypeNames( |
381 |
matchRule, // not case sensitive |
402 |
qualification, |
382 |
searchFor, |
403 |
SearchPattern.R_EXACT_MATCH, |
383 |
getSearchScope(), |
404 |
simpleName, |
384 |
typeRequestor, |
405 |
matchRule, // not case sensitive |
385 |
CANCEL_IF_NOT_READY_TO_SEARCH, |
406 |
searchFor, |
386 |
progressMonitor); |
407 |
getSearchScope(), |
387 |
} catch (OperationCanceledException e) { |
408 |
typeRequestor, |
388 |
findTypes( |
409 |
CANCEL_IF_NOT_READY_TO_SEARCH, |
389 |
new String(prefix), |
410 |
progressMonitor); |
390 |
storage, |
411 |
break found; |
391 |
convertSearchFilterToModelFilter(searchFor)); |
412 |
} catch (OperationCanceledException e) { |
|
|
413 |
if (monitor.isCanceled()) { |
414 |
throw e; |
415 |
} else { |
416 |
try { |
417 |
Thread.sleep(50); // indexes are not ready. sleep 50ms and retry the search request |
418 |
} catch (InterruptedException e1) { |
419 |
// Do nothing |
420 |
} |
421 |
} |
422 |
} |
423 |
} |
424 |
} else { |
425 |
try { |
426 |
new BasicSearchEngine(this.workingCopies).searchAllTypeNames( |
427 |
qualification, |
428 |
SearchPattern.R_EXACT_MATCH, |
429 |
simpleName, |
430 |
matchRule, // not case sensitive |
431 |
searchFor, |
432 |
getSearchScope(), |
433 |
typeRequestor, |
434 |
CANCEL_IF_NOT_READY_TO_SEARCH, |
435 |
progressMonitor); |
436 |
} catch (OperationCanceledException e) { |
437 |
findTypes( |
438 |
new String(prefix), |
439 |
storage, |
440 |
convertSearchFilterToModelFilter(searchFor)); |
441 |
} |
392 |
} |
442 |
} |
393 |
} catch (JavaModelException e) { |
443 |
} catch (JavaModelException e) { |
394 |
findTypes( |
444 |
findTypes( |