View | Details | Raw Unified | Return to bug 250685
Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java (-2 / +2 lines)
Lines 50-57 Link Here
50
		return super.findType(compoundTypeName);
50
		return super.findType(compoundTypeName);
51
	}
51
	}
52
52
53
	public void findTypes(char[] prefix, boolean findMembers, boolean camelCaseMatch, int searchFor, ISearchRequestor storage) {
53
	public void findTypes(char[] prefix, boolean findMembers, boolean camelCaseMatch, int searchFor, ISearchRequestor storage, IProgressMonitor progressMonitor) {
54
		checkCanceled();
54
		checkCanceled();
55
		super.findTypes(prefix, findMembers, camelCaseMatch, searchFor, storage);
55
		super.findTypes(prefix, findMembers, camelCaseMatch, searchFor, storage, progressMonitor);
56
	}
56
	}
57
}
57
}
(-)model/org/eclipse/jdt/internal/core/SearchableEnvironment.java (-19 / +69 lines)
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(
(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-3 / +8 lines)
Lines 619-624 Link Here
619
	}
619
	}
620
620
621
	private void acceptTypes(Scope scope) {
621
	private void acceptTypes(Scope scope) {
622
		this.checkCancel();
623
		
622
		if(this.acceptedTypes == null) return;
624
		if(this.acceptedTypes == null) return;
623
625
624
		int length = this.acceptedTypes.size();
626
		int length = this.acceptedTypes.size();
Lines 6263-6269 Link Here
6263
					findMembers,
6265
					findMembers,
6264
					this.options.camelCaseMatch,
6266
					this.options.camelCaseMatch,
6265
					IJavaSearchConstants.TYPE,
6267
					IJavaSearchConstants.TYPE,
6266
					this);
6268
					this,
6269
					this.monitor);
6267
			acceptTypes(null);
6270
			acceptTypes(null);
6268
		}
6271
		}
6269
	}
6272
	}
Lines 9199-9205 Link Here
9199
						proposeAllMemberTypes,
9202
						proposeAllMemberTypes,
9200
						this.options.camelCaseMatch,
9203
						this.options.camelCaseMatch,
9201
						searchFor,
9204
						searchFor,
9202
						this);
9205
						this,
9206
						this.monitor);
9203
				acceptTypes(scope);
9207
				acceptTypes(scope);
9204
			}
9208
			}
9205
			if(!isEmptyPrefix && !this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
9209
			if(!isEmptyPrefix && !this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
Lines 9337-9343 Link Here
9337
					false,
9341
					false,
9338
					this.options.camelCaseMatch,
9342
					this.options.camelCaseMatch,
9339
					searchFor,
9343
					searchFor,
9340
					this);
9344
					this,
9345
					this.monitor);
9341
			acceptTypes(scope);
9346
			acceptTypes(scope);
9342
		}
9347
		}
9343
		if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {
9348
		if(!this.requestor.isIgnored(CompletionProposal.PACKAGE_REF)) {

Return to bug 250685