public VisitorAttributes getAttributes() { VisitorAttributes attributes = new VisitorAttributes(); attributes.setIncludeRoot(false); attributes.setRecurseFilter(this); return attributes; }
/** * Create a new ImmutableVirtualFileVisitorAttributes. * * @param leavesOnly whether to visit leaves only * @param recurseFilter - filter which controls whether to recurse */ ImmutableVisitorAttributes(boolean leavesOnly, VirtualFileFilter recurseFilter) { super.setLeavesOnly(leavesOnly); super.setRecurseFilter(recurseFilter); }
return Collections.emptyList(); VisitorAttributes va = new VisitorAttributes(); va.setLeavesOnly(true); SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(Arrays.asList(".zip", ".ear", ".jar", ".rar", ".war", ".sar",".har", ".aop")); // TODO: Where should these come from? va.setRecurseFilter(noJars); FilterVirtualFileVisitor visitor = new FilterVirtualFileVisitor(new VirtualFileFilterAdapter(filter), va);
/** * Create a new VFSFindEntriesEnumeration. * * @param root the root file * @param file the file to enumerate * @param filePattern the file pattern * @param recurse whether to recurse * @throws IOException for any error */ public VFSFindEntriesEnumeration(VirtualFile root, VirtualFile file, String filePattern, boolean recurse) throws IOException { if (root == null) throw MESSAGES.illegalArgumentNull("root"); if (file == null) throw MESSAGES.illegalArgumentNull("file"); String rootPath = root.getPathName(); VisitorAttributes attributes = new VisitorAttributes(); attributes.setIncludeRoot(false); attributes.setLeavesOnly(false); if (recurse) attributes.setRecurseFilter(MatchAllVirtualFileFilter.INSTANCE); VisitorImpl visitor = new VisitorImpl(rootPath, filePattern, attributes); file.visit(visitor); this.paths = visitor.paths.iterator(); }
private void visit(VirtualFileVisitor visitor, boolean root) throws IOException { final VisitorAttributes visitorAttributes = visitor.getAttributes(); if (root && visitorAttributes.isIncludeRoot()) { visitor.visit(this); } // isDirectory does the read security check if (!isDirectory()) { return; } for (VirtualFile child : getChildren()) { // Always visit a leaf, and visit directories when leaves only is false if (!child.isDirectory() || !visitorAttributes.isLeavesOnly()) { visitor.visit(child); } if (child.isDirectory() && visitorAttributes.isRecurse(child)) { child.visit(visitor, false); } } }
final Indexer indexer = new Indexer(); try { final VisitorAttributes visitorAttributes = new VisitorAttributes(); visitorAttributes.setLeavesOnly(true); visitorAttributes.setRecurseFilter(new VirtualFileFilter() { public boolean accepts(VirtualFile file) { return indexIgnorePaths == null || !indexIgnorePaths.contains(file.getPathNameRelativeTo(virtualFile));
final Indexer indexer = new Indexer(); try { final VisitorAttributes visitorAttributes = new VisitorAttributes(); visitorAttributes.setLeavesOnly(true); visitorAttributes.setRecurseFilter(new VirtualFileFilter() { public boolean accepts(VirtualFile file) { return indexIgnorePaths == null || !indexIgnorePaths.contains(file.getPathNameRelativeTo(virtualFile));
public VisitorAttributes getAttributes() { VisitorAttributes attributes = new VisitorAttributes(); attributes.setIncludeRoot(true); attributes.setRecurseFilter(this); return attributes; }
final Indexer indexer = new Indexer(); try { final VisitorAttributes visitorAttributes = new VisitorAttributes(); visitorAttributes.setLeavesOnly(true); visitorAttributes.setRecurseFilter(new VirtualFileFilter() { public boolean accepts(VirtualFile file) { return indexIgnorePaths == null || !indexIgnorePaths.contains(file.getPathNameRelativeTo(virtualFile));
public VisitorAttributes getAttributes() { VisitorAttributes attributes = new VisitorAttributes(); attributes.setIncludeRoot(true); attributes.setRecurseFilter(new NoChildFilter()); return attributes; }
final Indexer indexer = new Indexer(); try { final VisitorAttributes visitorAttributes = new VisitorAttributes(); visitorAttributes.setLeavesOnly(true); visitorAttributes.setRecurseFilter(new VirtualFileFilter() { public boolean accepts(VirtualFile file) { return indexIgnorePaths == null || !indexIgnorePaths.contains(file.getPathNameRelativeTo(virtualFile));