Access all source XML, Java, Kotlin files for android plugin ?


Hello there,
I am a newbie in plugin development. I want to create a plugin for android studio for which i want to access all XML, JAVA, KOTLIN files and search specific pattern in these files. Please help me to achieve this. So there are two tasks--->
1. Get all XML , JAVA, KOTLIN files
2. Search specified pattern in these files . [ For Example-> I want to search for a specified string in these retrieved files]

1 comment

To search for the files of specific FileType, use:

FileTypeIndex.getFiles(@NotNull FileType fileType, @NotNull GlobalSearchScope scope)

To search and process these files, use:

FileTypeIndex.processFiles(@NotNull FileType fileType, @NotNull Processor<? super VirtualFile> processor, @NotNull GlobalSearchScope scope)

Please sign in to leave a comment.