/** Sets the list of roots, old roots will be cleared. */
  public void setRoots(File... newRoots) {
    this.roots.clear();
    // call cancel editing before tree is cleared
    directoryTree.cancelEditing();
    directoryTreeModel.removeSubRoots();
    this.roots.addAll(retainAncestors(newRoots));

    List<File> list = new ArrayList<File>(roots);
    Collections.sort(
        list,
        new Comparator<File>() {
          public int compare(File o1, File o2) {
            if (o1.equals(SharingSettings.TORRENT_DATA_DIR_SETTING.getValue())) {
              return -1;
            }
            if (o2.equals(SharingSettings.TORRENT_DATA_DIR_SETTING.getValue())) {
              return 1;
            }
            return o1.compareTo(o2);
          }
        });

    for (File root : list) {
      directoryTreeModel.addSubRoot(root);
    }
    setRootExpanded();
  }
 private void addDirToTree(File dir) {
   roots.add(dir);
   directoryTreeModel.addSubRoot(dir);
 }