Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 318162 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/core/tests/resources/FilteredResourceTest.java (+63 lines)
Lines 1690-1693 Link Here
1690
			fail("5.0", e);
1690
			fail("5.0", e);
1691
		}
1691
		}
1692
	}
1692
	}
1693
1694
	/**
1695
	 * Regression for  Bug 317783 -  Resource filters do not work at all in "Project Explorer" 
1696
	 * The problem is that a client calls explicitly refreshLocal on a folder that is filtered out by 
1697
	 * resource filters and that doesn't exist in the workspace.  This used to cause the resource to
1698
	 * appear in the workspace, along with all its children, in spite of active resource filters to the
1699
	 * contrary.
1700
	 */
1701
	public void test317783() {
1702
		IFolder folder = existingProject.getFolder("foo");
1703
		ensureExistsInWorkspace(folder, true);
1704
1705
		IFile file = folder.getFile("bar.txt");
1706
		ensureExistsInWorkspace(file, "content");
1707
1708
		try {
1709
			existingProject.refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
1710
		} catch (CoreException e) {
1711
			fail("1.1", e);
1712
		}
1713
1714
		try {
1715
			FileInfoMatcherDescription matcherDescription = new FileInfoMatcherDescription(REGEX_FILTER_PROVIDER, ".*");
1716
			existingProject.createFilter(IResourceFilterDescription.EXCLUDE_ALL | IResourceFilterDescription.FOLDERS, matcherDescription, 0, getMonitor());
1717
		} catch (CoreException e) {
1718
			fail("1.2");
1719
		}
1720
1721
		try {
1722
			existingProject.refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
1723
		} catch (CoreException e) {
1724
			fail("1.3", e);
1725
		}
1726
1727
		IResource members[] = null;
1728
		try {
1729
			members = existingProject.members();
1730
		} catch (CoreException e) {
1731
			fail("1.4", e);
1732
		}
1733
		assertEquals("1.5", members.length, 2);
1734
		assertEquals("1.6", members[0].getName(), ".project");
1735
		assertEquals("1.7", members[1].getName(), existingFileInExistingProject.getName());
1736
1737
		try {
1738
			folder.refreshLocal(IResource.DEPTH_INFINITE, getMonitor());
1739
		} catch (CoreException e) {
1740
			fail("2.0", e);
1741
		}
1742
1743
		try {
1744
			members = existingProject.members();
1745
		} catch (CoreException e) {
1746
			fail("2.1", e);
1747
		}
1748
		assertEquals("2.2", members.length, 2);
1749
		assertEquals("2.3", members[0].getName(), ".project");
1750
		assertEquals("2.4", members[1].getName(), existingFileInExistingProject.getName());
1751
1752
		assertEquals("2.5", false, folder.exists());
1753
		assertEquals("2.6", false, file.exists());
1754
1755
	}
1693
}
1756
}

Return to bug 318162