View | Details | Raw Unified | Return to bug 174349 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse UI/org/eclipse/ui/dialogs/SearchPattern.java (-10 / +27 lines)
Lines 17-23 Link Here
17
 * 
17
 * 
18
 * <p>
18
 * <p>
19
 * This class is intended to be subclassed by clients. A default behavior is
19
 * This class is intended to be subclassed by clients. A default behavior is
20
 * provided for each of the methods above, that clients can override if they
20
 * provided for each of the methods above, that clients can ovveride if they
21
 * wish.
21
 * wish.
22
 * </p>
22
 * </p>
23
 * 
23
 * 
Lines 207-223 Link Here
207
			return;
207
			return;
208
		}
208
		}
209
209
210
		if (last == END_SYMBOL || last == BLANK) {
211
			matchRule = RULE_EXACT_MATCH;
212
			stringPattern = pattern.substring(0, length - 1);
213
			return;
214
		}
215
216
		if (validateMatchRule(pattern, RULE_CAMELCASE_MATCH) == RULE_CAMELCASE_MATCH) {
210
		if (validateMatchRule(pattern, RULE_CAMELCASE_MATCH) == RULE_CAMELCASE_MATCH) {
217
			matchRule = RULE_CAMELCASE_MATCH;
211
			matchRule = RULE_CAMELCASE_MATCH;
218
			stringPattern = pattern;
212
			stringPattern = pattern;
219
			return;
213
			return;
220
		}
214
		}
215
		
216
		if (last == END_SYMBOL || last == BLANK) {
217
			matchRule = RULE_EXACT_MATCH;
218
			stringPattern = pattern.substring(0, length - 1);
219
			return;
220
		}
221
221
222
		matchRule = RULE_PREFIX_MATCH;
222
		matchRule = RULE_PREFIX_MATCH;
223
		stringPattern = pattern;
223
		stringPattern = pattern;
Lines 437-442 Link Here
437
			return false;
437
			return false;
438
		}
438
		}
439
439
440
		int patternLength = patternEnd;
441
		
442
		if (pattern.charAt(patternEnd - 1) == END_SYMBOL || pattern.charAt(patternEnd - 1) == BLANK )
443
			patternLength = patternEnd - 1;
444
445
440
		char patternChar, nameChar;
446
		char patternChar, nameChar;
441
		int iPattern = patternStart;
447
		int iPattern = patternStart;
442
		int iName = nameStart;
448
		int iName = nameStart;
Lines 453-458 Link Here
453
			}
459
			}
454
460
455
			if (iName == nameEnd) {
461
			if (iName == nameEnd) {
462
				if (iPattern == patternLength) 
463
					return true;
456
				// We have exhausted name (and not pattern), so it's not a match
464
				// We have exhausted name (and not pattern), so it's not a match
457
				return false;
465
				return false;
458
			}
466
			}
Lines 472-484 Link Here
472
			// name
480
			// name
473
			while (true) {
481
			while (true) {
474
				if (iName == nameEnd) {
482
				if (iName == nameEnd) {
475
					// We have exhausted name (and not pattern), so it's not a
483
					if ((iPattern == patternLength) && (patternChar == END_SYMBOL || patternChar == BLANK))
476
					// match
484
						return true;
477
					return false;
485
					return false;
478
				}
486
				}
479
487
480
				nameChar = name.charAt(iName);
488
				nameChar = name.charAt(iName);
481
489
490
				if ((iPattern == patternLength) && (patternChar == END_SYMBOL || patternChar == BLANK)) {
491
					if (isNameCharAllowed(nameChar)) {
492
						return false;
493
					}
494
					iName++;
495
					continue;
496
				}
497
482
				if (!isNameCharAllowed(nameChar)) {
498
				if (!isNameCharAllowed(nameChar)) {
483
					// nameChar is lowercase
499
					// nameChar is lowercase
484
					iName++;
500
					iName++;
Lines 505-511 Link Here
505
	 * @return true if patternChar is in set of allowed characters for pattern
521
	 * @return true if patternChar is in set of allowed characters for pattern
506
	 */
522
	 */
507
	protected boolean isPatternCharAllowed(char patternChar) {
523
	protected boolean isPatternCharAllowed(char patternChar) {
508
		return Character.isUpperCase(patternChar);
524
		return Character.isUpperCase(patternChar) || patternChar == END_SYMBOL
525
				|| patternChar == BLANK;
509
	}
526
	}
510
527
511
	/**
528
	/**
(-)ui/org/eclipse/jdt/internal/ui/dialogs/FilteredTypesSelectionDialog.java (-5 / +30 lines)
Lines 110-117 Link Here
110
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
110
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
111
import org.eclipse.jdt.internal.ui.util.TypeNameMatchLabelProvider;
111
import org.eclipse.jdt.internal.ui.util.TypeNameMatchLabelProvider;
112
import org.eclipse.jdt.internal.ui.viewsupport.ColoredJavaElementLabels;
112
import org.eclipse.jdt.internal.ui.viewsupport.ColoredJavaElementLabels;
113
import org.eclipse.jdt.internal.ui.viewsupport.ColoredViewersManager;
114
import org.eclipse.jdt.internal.ui.viewsupport.ColoredString;
113
import org.eclipse.jdt.internal.ui.viewsupport.ColoredString;
114
import org.eclipse.jdt.internal.ui.viewsupport.ColoredViewersManager;
115
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
115
import org.eclipse.jdt.internal.ui.viewsupport.JavaElementImageProvider;
116
import org.eclipse.jdt.internal.ui.viewsupport.OwnerDrawSupport;
116
import org.eclipse.jdt.internal.ui.viewsupport.OwnerDrawSupport;
117
import org.eclipse.jdt.internal.ui.workingsets.WorkingSetFilterActionGroup;
117
import org.eclipse.jdt.internal.ui.workingsets.WorkingSetFilterActionGroup;
Lines 566-580 Link Here
566
		SearchEngine engine= new SearchEngine((WorkingCopyOwner) null);
566
		SearchEngine engine= new SearchEngine((WorkingCopyOwner) null);
567
		String packPattern= typeSearchFilter.getPackagePattern();
567
		String packPattern= typeSearchFilter.getPackagePattern();
568
		progressMonitor.setTaskName(JavaUIMessages.FilteredTypesSelectionDialog_searchJob_taskName);
568
		progressMonitor.setTaskName(JavaUIMessages.FilteredTypesSelectionDialog_searchJob_taskName);
569
		
569
		/*
570
		/*
570
		 * Setting the filter into match everything mode avoids filtering twice by the same pattern
571
		 * Setting the filter into match everything mode avoids filtering twice
571
		 * (the search engine only provides filtered matches).
572
		 * by the same pattern (the search engine only provides filtered
573
		 * matches). For the case when the pattern is a camel case pattern with
574
		 * a terminator, the filter is not set to match everything mode because
575
		 * it handles this case wrong.
572
		 */ 
576
		 */ 
573
		typeSearchFilter.setMatchEverythingMode(true);
577
		String tempPatternString = itemsFilter.getPattern();
578
		SearchPattern searchPattern = new SearchPattern();
579
		searchPattern.setPattern(tempPatternString);
580
581
		if (searchPattern.getMatchRule() == SearchPattern.RULE_CAMELCASE_MATCH) {
582
			/*
583
			 * If the pattern is empty, the RULE_BLANK_MATCH will be chose, so
584
			 * we don't have to check the pattern length
585
			 */
586
			String lastChar = tempPatternString.substring(tempPatternString
587
					.length() - 1);
588
589
			if (lastChar.equals("<") || lastChar.equals(" ")) { //$NON-NLS-1$//$NON-NLS-2$
590
				tempPatternString = tempPatternString.substring(0,
591
						tempPatternString.length() - 1);
592
			} else {
593
				typeSearchFilter.setMatchEverythingMode(true);
594
			}
595
		} else {
596
			typeSearchFilter.setMatchEverythingMode(true);
597
		}
598
574
		try {
599
		try {
575
			engine.searchAllTypeNames(packPattern == null ? null : packPattern.toCharArray(),
600
			engine.searchAllTypeNames(packPattern == null ? null : packPattern.toCharArray(),
576
					typeSearchFilter.getPackageFlags(), //TODO: https://bugs.eclipse.org/bugs/show_bug.cgi?id=176017
601
					typeSearchFilter.getPackageFlags(), //TODO: https://bugs.eclipse.org/bugs/show_bug.cgi?id=176017
577
					typeSearchFilter.getPattern().toCharArray(),
602
					tempPatternString.toCharArray(),
578
					typeSearchFilter.getMatchRule(), //TODO: https://bugs.eclipse.org/bugs/show_bug.cgi?id=176017
603
					typeSearchFilter.getMatchRule(), //TODO: https://bugs.eclipse.org/bugs/show_bug.cgi?id=176017
579
					typeSearchFilter.getElementKind(),
604
					typeSearchFilter.getElementKind(),
580
					typeSearchFilter.getSearchScope(),
605
					typeSearchFilter.getSearchScope(),

Return to bug 174349