@@ -55,21 +55,30 @@ public class BasicFileDetector {
55
55
private static final Set <FileVisitOption > FOLLOW_LINKS_OPTION = EnumSet .of (FileVisitOption .FOLLOW_LINKS );
56
56
private List <Path > directories ;
57
57
private Path rootDir ;
58
- private String fileName ;
58
+ private List < String > fileNames ;
59
59
private int maxDepth = 5 ;
60
60
private boolean includeNested = true ;
61
61
private Set <String > exclusions = new LinkedHashSet <>(1 );
62
62
63
63
/**
64
- * Constructs a new BasicFileDetector for the given root directory, searching for a fileName.
65
- * By default, the search depth is limited to 5. Sub-directories of a found directory will be walked through.
66
- * The ".metadata" folder is excluded.
67
- * @param rootDir the root directory to search for files
68
- * @param fileName the name of the file to search
64
+ * Constructs a new BasicFileDetector for the given root directory, searching
65
+ * for fileNames. By default, the search depth is limited to 5. Sub-directories
66
+ * of a found directory will be walked through. The ".metadata" folder is
67
+ * excluded.
68
+ *
69
+ * @param rootDir
70
+ * the root directory to search for files
71
+ * @param fileNames
72
+ * the names of the file to search
69
73
*/
70
- public BasicFileDetector (Path rootDir , String fileName ) {
74
+ public BasicFileDetector (Path rootDir , String ... fileNames ) {
71
75
this .rootDir = rootDir ;
72
- this .fileName = fileName ;
76
+ this .fileNames = new ArrayList <>();
77
+ if (fileNames != null ) {
78
+ for (String fileName : fileNames ) {
79
+ this .fileNames .add (fileName );
80
+ }
81
+ }
73
82
directories = new ArrayList <>();
74
83
addExclusions (METADATA_FOLDER );
75
84
List <String > javaImportExclusions = JavaLanguageServerPlugin .getPreferencesManager ().getPreferences ().getJavaImportExclusions ();
@@ -190,7 +199,12 @@ private boolean isExcluded(Path dir) {
190
199
}
191
200
192
201
private boolean hasTargetFile (Path dir ) {
193
- return Files .isRegularFile (dir .resolve (fileName ));
202
+ for (String fileName : fileNames ) {
203
+ if (Files .isRegularFile (dir .resolve (fileName ))) {
204
+ return true ;
205
+ }
206
+ }
207
+ return false ;
194
208
}
195
209
196
210
}
0 commit comments