private void processDependencies(
     final Set<PsiFile> searchIn,
     final Set<PsiFile> searchFor,
     Processor<List<PsiFile>> processor) {
   if (myTransitiveBorder == 0) return;
   Set<PsiFile> initialSearchFor = new HashSet<PsiFile>(searchFor);
   for (DependenciesBuilder builder : myBuilders) {
     for (PsiFile from : searchIn) {
       for (PsiFile to : initialSearchFor) {
         final List<List<PsiFile>> paths = builder.findPaths(from, to);
         Collections.sort(
             paths,
             new Comparator<List<PsiFile>>() {
               public int compare(final List<PsiFile> p1, final List<PsiFile> p2) {
                 return p1.size() - p2.size();
               }
             });
         for (List<PsiFile> path : paths) {
           if (!path.isEmpty()) {
             path.add(0, from);
             path.add(to);
             if (!processor.process(path)) return;
           }
         }
       }
     }
   }
 }
 public String getReportText() {
   final Element rootElement = new Element("root");
   rootElement.setAttribute("isBackward", String.valueOf(!myForward));
   final List<PsiFile> files = new ArrayList<PsiFile>(myDependencies.keySet());
   Collections.sort(
       files,
       new Comparator<PsiFile>() {
         @Override
         public int compare(PsiFile f1, PsiFile f2) {
           final VirtualFile virtualFile1 = f1.getVirtualFile();
           final VirtualFile virtualFile2 = f2.getVirtualFile();
           if (virtualFile1 != null && virtualFile2 != null) {
             return virtualFile1.getPath().compareToIgnoreCase(virtualFile2.getPath());
           }
           return 0;
         }
       });
   for (PsiFile file : files) {
     final Element fileElement = new Element("file");
     fileElement.setAttribute("path", file.getVirtualFile().getPath());
     for (PsiFile dep : myDependencies.get(file)) {
       Element depElement = new Element("dependency");
       depElement.setAttribute("path", dep.getVirtualFile().getPath());
       fileElement.addContent(depElement);
     }
     rootElement.addContent(fileElement);
   }
   PathMacroManager.getInstance(myProject).collapsePaths(rootElement);
   return JDOMUtil.writeDocument(new Document(rootElement), SystemProperties.getLineSeparator());
 }
 public DependenciesPanel(Project project, final DependenciesBuilder builder) {
   this(project, Collections.singletonList(builder), new HashSet<PsiFile>());
 }