public static void addModelRoots(
     SolutionDescriptor solutionDescriptor, VirtualFile[] roots, ModelRootManager rootMgr) {
   Set<String> seenPaths = new HashSet<String>();
   for (ModelRootDescriptor d : solutionDescriptor.getModelRootDescriptors()) {
     ModelRoot root = d.getRoot();
     if (root != null && EqualUtil.equals(root.getManager(), rootMgr)) {
       seenPaths.add(root.getPath());
     }
   }
   for (VirtualFile f : roots) {
     SModelRoot modelRoot = new SModelRoot(rootMgr);
     modelRoot.setPath(getLocalPath(f));
     if (!seenPaths.add(modelRoot.getPath())) continue;
     solutionDescriptor.getModelRootDescriptors().add(modelRoot.toDescriptor());
   }
 }