String (T key) { String path = myPaths.get(key); if (path == null) return key.toString(); Node current = myRootNode; Node firstNodeWithBranches = null; Node firstNodeBeforeNodeWithBranches = null; Node fileNameNode = null; Iterator<String> pathComponentsIterator = new PathComponentsIterator(path); while (pathComponentsIterator.hasNext()) { String pathComponent = pathComponentsIterator.next(); current = current.findOrAddChild(pathComponent); if (fileNameNode == null) fileNameNode = current; if (firstNodeBeforeNodeWithBranches == null && firstNodeWithBranches != null && current.myChildren.size() <= 1) { if (current.myParentNode.myNestedChildrenCount - current.myParentNode.myChildren.size() < 1) { firstNodeBeforeNodeWithBranches = current; } } if (current.myChildren.size() != 1 && firstNodeWithBranches == null) { firstNodeWithBranches = current; } } StringBuilder b = new StringBuilder(); if (firstNodeBeforeNodeWithBranches == null) { firstNodeBeforeNodeWithBranches = current; } boolean skipFirstSeparator = true; for (Node c = firstNodeBeforeNodeWithBranches; c != myRootNode; c = c.myParentNode) { if (c != fileNameNode && c != firstNodeBeforeNodeWithBranches && c.myParentNode.myChildren.size() == 1) { b.append(mySeparator); b.append("\u2026"); while (c.myParentNode != fileNameNode && c.myParentNode.myChildren.size() == 1) c = c.myParentNode; } else { if (c.myText.startsWith(VFS_SEPARATOR)) { if (!skipFirstSeparator) b.append(mySeparator); skipFirstSeparator = false; b.append(c.myText, VFS_SEPARATOR.length(), c.myText.length()); } else { b.append(c.myText); } } } return b.toString(); }