private void waitForFileWatcher(@NotNull Project project) {
    LocalFileSystem fs = LocalFileSystem.getInstance();
    if (!(fs instanceof LocalFileSystemImpl)) return;

    final FileWatcher watcher = ((LocalFileSystemImpl) fs).getFileWatcher();
    if (!watcher.isOperational() || !watcher.isSettingRoots()) return;

    LOG.info("FW/roots waiting started");
    Task.Modal task =
        new Task.Modal(project, ProjectBundle.message("project.load.progress"), true) {
          @Override
          public void run(@NotNull ProgressIndicator indicator) {
            indicator.setIndeterminate(true);
            indicator.setText(ProjectBundle.message("project.load.waiting.watcher"));
            if (indicator instanceof ProgressWindow) {
              ((ProgressWindow) indicator).setCancelButtonText(CommonBundle.message("button.skip"));
            }
            while (watcher.isSettingRoots() && !indicator.isCanceled()) {
              TimeoutUtil.sleep(10);
            }
            LOG.info("FW/roots waiting finished");
          }
        };
    myProgressManager.run(task);
  }