String () { final Element rootElement = new Element("root"); rootElement.setAttribute("isBackward", String.valueOf(!myForward)); final List<PsiFile> files = new ArrayList<>(myDependencies.keySet()); files.sort((f1, 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); } try { return JbXmlOutputter.collapseMacrosAndWrite(rootElement, myProject); } catch (IOException e) { LOG.error(e); return ""; } }