Lines 2450-2456
Link Here
|
2450 |
ICompilationUnit cuB = this. getCompilationUnit("JavaSearch", "src", "a10", "B.java"); |
2450 |
ICompilationUnit cuB = this. getCompilationUnit("JavaSearch", "src", "a10", "B.java"); |
2451 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2451 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2452 |
IType type = cuC.getType("C"); |
2452 |
IType type = cuC.getType("C"); |
2453 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2453 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2454 |
|
2454 |
|
2455 |
// don't include super-classes: |
2455 |
// don't include super-classes: |
2456 |
assertFalse("a10.A should not be included in hierarchy scope", scope.encloses(cuB.getType("A"))); |
2456 |
assertFalse("a10.A should not be included in hierarchy scope", scope.encloses(cuB.getType("A"))); |
Lines 2464-2474
Link Here
|
2464 |
public void testSearchScope07() throws CoreException { |
2464 |
public void testSearchScope07() throws CoreException { |
2465 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2465 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2466 |
IType type = cuC.getType("C"); |
2466 |
IType type = cuC.getType("C"); |
2467 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2467 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2468 |
|
2468 |
|
2469 |
// don't include focus type: |
2469 |
// don't include focus type: |
2470 |
assertFalse("a10.C should be not included in hierarchy scope", scope.encloses(type)); |
2470 |
assertFalse("a10.C should not be included in hierarchy scope", scope.encloses(type)); |
2471 |
assertFalse("a10/C.java should be included in hierarchy scope", scope.encloses(cuC.getUnderlyingResource().getFullPath().toString())); |
2471 |
assertFalse("a10/C.java should not be included in hierarchy scope", scope.encloses(cuC.getUnderlyingResource().getFullPath().toString())); |
|
|
2472 |
} |
2473 |
/** |
2474 |
* Hierarchy scope test. |
2475 |
* test for enhancement bug 215139 encloses(): find only subtypes. |
2476 |
* also test enhancement bug 295894: include focus type. |
2477 |
*/ |
2478 |
public void testSearchScope07a() throws CoreException { |
2479 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2480 |
IType type = cuC.getType("C"); |
2481 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2482 |
|
2483 |
// include focus type: |
2484 |
assertTrue("a10.C should be included in hierarchy scope", scope.encloses(type)); |
2485 |
assertTrue("a10/C.java should be included in hierarchy scope", scope.encloses(cuC.getUnderlyingResource().getFullPath().toString())); |
2472 |
} |
2486 |
} |
2473 |
/** |
2487 |
/** |
2474 |
* Hierarchy scope test. |
2488 |
* Hierarchy scope test. |
Lines 2479-2485
Link Here
|
2479 |
ICompilationUnit cuD = this. getCompilationUnit("JavaSearch", "src", "a10", "D.java"); |
2493 |
ICompilationUnit cuD = this. getCompilationUnit("JavaSearch", "src", "a10", "D.java"); |
2480 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2494 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2481 |
IType type = cuC.getType("C"); |
2495 |
IType type = cuC.getType("C"); |
2482 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2496 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2483 |
|
2497 |
|
2484 |
// regular sub-types: |
2498 |
// regular sub-types: |
2485 |
assertTrue("a10.D should be included in hierarchy scope", scope.encloses(cuD.getType("D"))); |
2499 |
assertTrue("a10.D should be included in hierarchy scope", scope.encloses(cuD.getType("D"))); |
Lines 2496-2502
Link Here
|
2496 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2510 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2497 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2511 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2498 |
IType type = cuC.getType("C"); |
2512 |
IType type = cuC.getType("C"); |
2499 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2513 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2500 |
|
2514 |
|
2501 |
// sub-type is a nested type: |
2515 |
// sub-type is a nested type: |
2502 |
assertTrue("a10.H$I should be included in hierarchy scope", scope.encloses(cuE.getType("H").getType("I"))); |
2516 |
assertTrue("a10.H$I should be included in hierarchy scope", scope.encloses(cuE.getType("H").getType("I"))); |
Lines 2509-2515
Link Here
|
2509 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2523 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2510 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2524 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2511 |
IType type = cuC.getType("C"); |
2525 |
IType type = cuC.getType("C"); |
2512 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2526 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2513 |
|
2527 |
|
2514 |
// member of a sub-type: |
2528 |
// member of a sub-type: |
2515 |
assertFalse("a10.F$G should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G"))); |
2529 |
assertFalse("a10.F$G should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G"))); |
Lines 2517-2524
Link Here
|
2517 |
/** |
2531 |
/** |
2518 |
* Hierarchy scope test. |
2532 |
* Hierarchy scope test. |
2519 |
* (test for enhancement bug 215139 encloses(): find only subtypes and their member types). |
2533 |
* (test for enhancement bug 215139 encloses(): find only subtypes and their member types). |
|
|
2534 |
* Note: this combination of arguments is no longer supported after the change from bug 295894 |
2520 |
*/ |
2535 |
*/ |
2521 |
public void testSearchScope11() throws CoreException { |
2536 |
public void _testSearchScope11() throws CoreException { |
2522 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2537 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2523 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2538 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2524 |
IType type = cuC.getType("C"); |
2539 |
IType type = cuC.getType("C"); |
Lines 2535-2541
Link Here
|
2535 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2550 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2536 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2551 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2537 |
IType type = cuC.getType("C"); |
2552 |
IType type = cuC.getType("C"); |
2538 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2553 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2539 |
|
2554 |
|
2540 |
// enclosing of a sub-type: |
2555 |
// enclosing of a sub-type: |
2541 |
assertFalse("a10.H should not be included in hierarchy scope", scope.encloses(cuE.getType("H"))); |
2556 |
assertFalse("a10.H should not be included in hierarchy scope", scope.encloses(cuE.getType("H"))); |
Lines 2548-2554
Link Here
|
2548 |
public void testSearchScope13() throws CoreException { |
2563 |
public void testSearchScope13() throws CoreException { |
2549 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2564 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2550 |
IType type = cuC.getType("C"); |
2565 |
IType type = cuC.getType("C"); |
2551 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2566 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2552 |
|
2567 |
|
2553 |
search("**", TYPE, DECLARATIONS, scope); |
2568 |
search("**", TYPE, DECLARATIONS, scope); |
2554 |
assertSearchResults( |
2569 |
assertSearchResults( |
Lines 2581-2592
Link Here
|
2581 |
} |
2596 |
} |
2582 |
/** |
2597 |
/** |
2583 |
* Hierarchy scope test. |
2598 |
* Hierarchy scope test. |
|
|
2599 |
* test for enhancement bug 215139 search: find only subtypes - disabled, |
2600 |
* also test enhancement bug 295894: exclude focus type. |
2601 |
*/ |
2602 |
public void testSearchScope14a() throws CoreException { |
2603 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2604 |
IType type = cuC.getType("C"); |
2605 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, /*onlySubTypes*/false, false, null); |
2606 |
|
2607 |
search("**", TYPE, DECLARATIONS, scope); |
2608 |
assertSearchResults( |
2609 |
"src/a10/B.java a10.A [A]\n" + |
2610 |
"src/a10/B.java a10.B [B]\n" + |
2611 |
"src/a10/D.java a10.D [D]\n" + |
2612 |
"src/a10/E.java a10.E [E]\n" + |
2613 |
"src/a10/E.java a10.F [F]\n" + |
2614 |
"src/a10/E.java a10.H$I [I]\n" + |
2615 |
getExternalJCLPathString() + " java.lang.Object" |
2616 |
); |
2617 |
} |
2618 |
/** |
2619 |
* Hierarchy scope test. |
2584 |
* (test for enhancement bug 215139 search: find only subtypes - different call chain). |
2620 |
* (test for enhancement bug 215139 search: find only subtypes - different call chain). |
2585 |
*/ |
2621 |
*/ |
2586 |
public void testSearchScope15() throws CoreException { |
2622 |
public void testSearchScope15() throws CoreException { |
2587 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2623 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2588 |
IType type = cuC.getType("C"); |
2624 |
IType type = cuC.getType("C"); |
2589 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2625 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2590 |
TypeNameMatchCollector collector = new TypeNameMatchCollector() { |
2626 |
TypeNameMatchCollector collector = new TypeNameMatchCollector() { |
2591 |
public String toString(){ |
2627 |
public String toString(){ |
2592 |
return toFullyQualifiedNamesString(); |
2628 |
return toFullyQualifiedNamesString(); |
Lines 2610-2617
Link Here
|
2610 |
/** |
2646 |
/** |
2611 |
* Hierarchy scope test. |
2647 |
* Hierarchy scope test. |
2612 |
* (test for enhancement bug 215139 search: find only subtypes plus member & enclosing types - different call chain). |
2648 |
* (test for enhancement bug 215139 search: find only subtypes plus member & enclosing types - different call chain). |
|
|
2649 |
* Note: this combination of arguments is no longer supported after the change from bug 295894 |
2613 |
*/ |
2650 |
*/ |
2614 |
public void testSearchScope16() throws CoreException { |
2651 |
public void _testSearchScope16() throws CoreException { |
2615 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2652 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2616 |
IType type = cuC.getType("C"); |
2653 |
IType type = cuC.getType("C"); |
2617 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2654 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
Lines 2645-2651
Link Here
|
2645 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2682 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2646 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2683 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2647 |
IType type = cuC.getType("C"); |
2684 |
IType type = cuC.getType("C"); |
2648 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, true, null); |
2685 |
IJavaSearchScope scope = SearchEngine.createHierarchyScope(null, type, true, false, null); |
2649 |
|
2686 |
|
2650 |
// method of a member of a sub-type: |
2687 |
// method of a member of a sub-type: |
2651 |
assertFalse("a10.F$G.m() should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G").getMethod("m", new String[0]))); |
2688 |
assertFalse("a10.F$G.m() should not be included in hierarchy scope", scope.encloses(cuE.getType("F").getType("G").getMethod("m", new String[0]))); |
Lines 2653-2660
Link Here
|
2653 |
/** |
2690 |
/** |
2654 |
* Hierarchy scope test. |
2691 |
* Hierarchy scope test. |
2655 |
* (test for enhancement bug 215139 encloses(method): find only subtypes but also member types). |
2692 |
* (test for enhancement bug 215139 encloses(method): find only subtypes but also member types). |
|
|
2693 |
* Note: this combination of arguments is no longer supported after the change from bug 295894 |
2656 |
*/ |
2694 |
*/ |
2657 |
public void testSearchScope18() throws CoreException { |
2695 |
public void _testSearchScope18() throws CoreException { |
2658 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2696 |
ICompilationUnit cuC = this. getCompilationUnit("JavaSearch", "src", "a10", "C.java"); |
2659 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2697 |
ICompilationUnit cuE = this. getCompilationUnit("JavaSearch", "src", "a10", "E.java"); |
2660 |
IType type = cuC.getType("C"); |
2698 |
IType type = cuC.getType("C"); |