ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
for (Module module : myModulesToDispose) {
String moduleName = module.getName();
if (moduleManager.findModuleByName(moduleName) != null) {
moduleManager.disposeModule(module);
}
}
}
});
myModulesToDispose.clear();