myFixture.addFileToProject("dir2/example/web/foo.dart", "");
myFixture.addFileToProject("dir2/example/web/sub/foo.dart", "");
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final ModifiableRootModel model = ModuleRootManager.getInstance(myModule).getModifiableModel();
final ContentEntry contentEntry = model.getContentEntries()[0];
contentEntry.addExcludeFolder(rootUrl + "/dir1/someFolder");
contentEntry.addExcludeFolder(rootUrl + "/dir1/packages/project1");
contentEntry.addExcludeFolder(rootUrl + "/dir1/web/packages");
contentEntry.addExcludeFolder(rootUrl + "/dir2/packages/oldProject2Name");
contentEntry.addExcludeFolder(rootUrl + "/dir2/someFolder");
contentEntry.addExcludeFolder(rootUrl + "/dir2/lib/someFolder");
contentEntry.addExcludeFolder(rootUrl + "/dir2/example/nonexistent/packages");
contentEntry.addExcludeFolder(rootUrl + "/dir2/example/packages/oldProject3Name");
model.commit();
}
});
DartProjectComponent.excludeBuildAndPackagesFolders(myModule, pubspec2);