int (@NotNull VirtualFile vf1, @NotNull VirtualFile vf2) { boolean isDir1 = vf1.isDirectory(); boolean isDir2 = vf2.isDirectory(); if (!isDir1 && !isDir2) return 0; if (isDir1 && !isDir2) return -1; if (!isDir1) return 1; return Integer.compare(vf1.getPath().length(), vf2.getPath().length()); }