private static List getRequiredXMLFiles(Project p, FileAcceptor a) { Collection roots = QuerySupport.findRoots(p, null, Collections.emptyList(), Collections.emptyList()); try { String regexp = ".*\\.xml"; // all *.xml files QuerySupport q = QuerySupport.forRoots( "org-netbeans-modules-jumpto-file-FileIndexer", // org.netbeans.modules.jumpto.file.FileIndexer.ID 1, // org.netbeans.modules.jumpto.file.FileIndexer.VERSION roots.toArray(new FileObject [roots.size()])); Collection results = q.query( "ci-file-name", // org.netbeans.modules.jumpto.file.FileIndexer.FIELD_CASE_INSENSITIVE_NAME regexp, QuerySupport.Kind.CASE_INSENSITIVE_REGEXP); ArrayList files = new ArrayList(); for(IndexResult r : results) { FileObject file = r.getFile(); if (file == null || !file.isValid()) { // the file has been deleted in the meantime continue; } if (a.accept(file)) { files.add(file); } } .... } catch (PatternSyntaxException pse) { return Collections.emptyList(); } catch (IOException ioe) { logger.log(Level.WARNING, null, ioe); return Collections.emptyList(); } } /** Used to narrow the search results by MIME type */ private static interface FileAcceptor { public boolean accept(FileObject fo); }