private void doSetWatchRoots(List<String> recursive, List<String> flat, boolean restart) {
    if (myProcessHandler == null || myProcessHandler.isProcessTerminated() || myIsShuttingDown) {
      return;
    }

    if (!restart && myRecursiveWatchRoots.equals(recursive) && myFlatWatchRoots.equals(flat)) {
      myNotificationSink.notifyManualWatchRoots(this, myIgnoredRoots);
      return;
    }

    mySettingRoots.incrementAndGet();
    myRecursiveWatchRoots = recursive;
    myFlatWatchRoots = flat;

    List<String> ignored = new SmartList<>();
    if (SystemInfo.isWindows) {
      recursive = screenUncRoots(recursive, ignored);
      flat = screenUncRoots(flat, ignored);
    }
    myIgnoredRoots = new CopyOnWriteArrayList<>(ignored);
    myNotificationSink.notifyManualWatchRoots(this, ignored);

    try {
      writeLine(ROOTS_COMMAND);
      for (String path : recursive) writeLine(path);
      for (String path : flat) writeLine('|' + path);
      writeLine("#");
    }
    catch (IOException e) {
      LOG.warn(e);
    }
  }
private void doSetWatchRoots(List<String> recursive, List<String> flat, boolean restart)