use of org.eclipse.xtext.ui.resource.PackageFragmentRootWalker in project xtext-eclipse by eclipse.
the class PackageFragmentRootWalkerTest method testTraversePackageFragmentRoot.
@Test
public void testTraversePackageFragmentRoot() throws Exception {
IJavaProject project = createJavaProject("foo");
String jarName = "JarWalkerTest.jar";
IFile file = project.getProject().getFile(jarName);
file.create(getClass().getResourceAsStream(jarName), true, new NullProgressMonitor());
addJarToClasspath(project, file);
final Set<IPath> pathes = new HashSet<IPath>();
PackageFragmentRootWalker<Void> walker = new PackageFragmentRootWalker<Void>() {
@Override
protected Void handle(IJarEntryResource jarEntry, TraversalState state) {
pathes.add(jarEntry.getFullPath());
return null;
}
};
for (IPackageFragmentRoot root : project.getPackageFragmentRoots()) {
if (root.getElementName().equals(jarName))
walker.traverse(root, false);
}
assertEquals(3, pathes.size());
}
Aggregations