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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java (+38 lines)
Lines 620-625 Link Here
620
	assertTrue("java should have subpackages",					java.hasSubpackages());
620
	assertTrue("java should have subpackages",					java.hasSubpackages());
621
	assertTrue("java.lang  should NOT have subpackages",			!lang.hasSubpackages());
621
	assertTrue("java.lang  should NOT have subpackages",			!lang.hasSubpackages());
622
}
622
}
623
/*
624
 * Ensures that the structure is known for a package fragment on the classpath.
625
 */
626
public void testPackageFragmentIsStructureKnown1() throws CoreException {
627
	IPackageFragment pkg = getPackageFragment("JavaProjectTests", "", "x");
628
	assertTrue("Structure of package 'x' should be known", pkg.isStructureKnown());
629
}
630
/*
631
 * Ensures that asking if the structure is known for a package fragment outside the classpath throws a JavaModelException.
632
 * (regression test for bug 138577 Package content disapear in package explorer)
633
 */
634
public void testPackageFragmentIsStructureKnown2() throws CoreException {
635
	try {
636
		createJavaProject("P");
637
		createFolder("/P/pack");
638
		IPackageFragment pkg = getPackage("/P/pack");
639
		editFile(
640
			"/P/.classpath",
641
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + 
642
			"<classpath>\n" + 
643
			"	<classpathentry excluding=\"pack/\" kind=\"src\" path=\"\"/>\n" + 
644
			"	<classpathentry kind=\"output\" path=\"\"/>\n" + 
645
			"</classpath>"
646
		);
647
		JavaModelException exception = null;
648
		try {
649
			pkg.isStructureKnown();
650
		} catch (JavaModelException e) {
651
			exception = e;
652
		}
653
		assertExceptionEquals(
654
			"Unexpected exception", 
655
			"pack [in <project root> [in P]] does not exist",
656
			exception);
657
	} finally {
658
		deleteProject("P");
659
	}
660
}
623
/**
661
/**
624
 * Test getting the non-java resources from a package fragment.
662
 * Test getting the non-java resources from a package fragment.
625
 */
663
 */
(-)model/org/eclipse/jdt/internal/core/PackageFragment.java (-1 / +5 lines)
Lines 65-72 Link Here
65
65
66
	// check whether this pkg can be opened
66
	// check whether this pkg can be opened
67
	if (!underlyingResource.isAccessible()) throw newNotPresentException();
67
	if (!underlyingResource.isAccessible()) throw newNotPresentException();
68
68
	
69
	// check that it is not excluded (https://bugs.eclipse.org/bugs/show_bug.cgi?id=138577)
69
	int kind = getKind();
70
	int kind = getKind();
71
	if (kind == IPackageFragmentRoot.K_SOURCE && Util.isExcluded(this)) 
72
		throw newNotPresentException();
73
70
74
71
	// add compilation units/class files from resources
75
	// add compilation units/class files from resources
72
	HashSet vChildren = new HashSet();
76
	HashSet vChildren = new HashSet();

Return to bug 138577