How to find XML files on a project's folder?

 Is there a simple way to iterate over only the XML files on a project's folder? My goal is to change the body of the XML file by replacing 

"<uses-permission android:name=\"com.android.vending.BILLING\" />"; 

with 

"<uses-permission android:name=\"org.onepf.openiab.permission.BILLING\" />"; 
0

Do you want to do this from the plugin? I'm asking because this can be done without any plugins, just invoke 'Replace in Path' action and specify *.xml as file mask.

0
Avatar
Permanently deleted user

Yes, because my plugin also does other things (non-involving XML).

0

You can use 

ProjectRootManager.getInstance(project).getFileIndex().iterateContent()

for that and filter xml files by comparing file.getFileType() with StdFileTypes.XML. This should be fast enough unless the project has several thousands of files.

0
Avatar
Permanently deleted user

Thank you for your help!

0
Avatar
Permanently deleted user

Can this be also done with a .AIDL file?

0

请先登录再写评论。