public static void createOsmorcFacetForAllModules(final Project project) {
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
final Module[] modules = ModuleManager.getInstance(project).getModules();
for (Module module : modules) {
final ModifiableFacetModel modifiableFacetModel = FacetManager.getInstance(module).createModifiableModel();
final OsmorcFacet facet = new OsmorcFacet(module);
facet.getConfiguration().setUseProjectDefaultManifestFileLocation(false);
facet.getConfiguration().setManifestLocation("META-INF/MANIFEST.MF");
facet.getConfiguration().setManifestGenerationMode(ManifestGenerationMode.Manually);
modifiableFacetModel.addFacet(facet);
modifiableFacetModel.commit();
}
}
});
}