@NotNull
  private Object2IntMap<VirtualFile> calcRoots() {
    OrderRootsEnumerator en = getOrderEnumeratorForOptions().roots(entry -> {
      if (entry instanceof ModuleOrderEntry || entry instanceof ModuleSourceOrderEntry) return OrderRootType.SOURCES;
      return OrderRootType.CLASSES;
    });
    Set<VirtualFile> roots = new LinkedHashSet<>();
    Collections.addAll(roots, en.getRoots());

    int i = 1;
    Object2IntMap<VirtualFile> map = new Object2IntOpenHashMap<>(roots.size());
    for (VirtualFile root : roots) {
      map.put(root, i++);
    }
    return map;
  }
@NotNull
  private Object2IntMap<VirtualFile> calcRoots()