void (final Collection<Module> modules, final boolean mavenized) { ApplicationManager.getApplication().assertWriteAccessAllowed(); EntityStorage initialStorage = WorkspaceModel.getInstance(myProject).getCurrentSnapshot(); MutableEntityStorage storageBuilder = MutableEntityStorage.from(initialStorage.toSnapshot()); for (Module module : modules) { if (module.isDisposed()) continue; ExternalSystemModulePropertyManager modulePropertyManager = ExternalSystemModulePropertyManager.getInstance(module); if (modulePropertyManager instanceof ExternalSystemModulePropertyManagerBridge && module instanceof ModuleBridge && ((ModuleBridge)module).getDiff() == null) { ((ExternalSystemModulePropertyManagerBridge)modulePropertyManager).setMavenized(mavenized, null, storageBuilder); } else { modulePropertyManager.setMavenized(mavenized); } } WorkspaceModel.getInstance(myProject).updateProjectModel("Set mavenized modules", builder -> { builder.addDiff(storageBuilder); return null; }); }