private static void renameModule(@NotNull Module module, @NotNull String newName) {
    if (module.isDisposed()) {
      // happens if module gets removed while Usages Preview is shown
    }
    else {
      try {
        final ModifiableModuleModel model = ModuleManager.getInstance(module.getProject()).getModifiableModel();
        model.renameModule(module, newName);
        model.commit();
      }
      catch (ModuleWithNameAlreadyExists ignored) {
        // happens if another module gets renamed while Usages Preview is shown
      }
    }
  }
private static void renameModule(@NotNull Module module, @NotNull String newName)