+ addEntries(fileTreePathRootNode.getChild(0), project.getVirtualEntries());
+ addEntries(fileTreePathRootNode.getChild(0), project.getBasePathEntries());
+ }
+
+ /**
+ * Traverses the tree and assigned {@link Entry}s to every file tree
+ * path whose name matchtes the name of an Entry.
+ *
+ * @param fileTreePathRootNode
+ * The root node of the tree to walk
+ * @param entries
+ * The list of entries
+ */
+ private void addEntries(Node<FileTreePath> fileTreePathRootNode, List<Entry> entries) {
+ for (Entry entry: entries) {
+ String completeEntryName = File.separatorChar + entry.getName();
+ FileTreePath fileTreePath = getFileTreePath(fileTreePathRootNode, completeEntryName);
+ if (fileTreePath != null) {
+ fileTreePath.setFileEntry(entry);
+ }
+ }
+ }
+
+ /**
+ * Find the {@link FileTreePath} below the given node that has the given
+ * file path.
+ *
+ * @param fileTreePathNode
+ * The node to start searching at
+ * @param filePath
+ * The path to search
+ * @return The file tree path with the matching file path, or
+ * <code>null</code> if these is no such file tree path
+ */
+ private FileTreePath getFileTreePath(Node<FileTreePath> fileTreePathNode, String filePath) {
+ for (Node<FileTreePath> child: fileTreePathNode) {
+ if (child.getElement().getFilePath().equals(filePath)) {
+ return child.getElement();
+ }
+ FileTreePath fileTreePath = getFileTreePath(child, filePath);
+ if (fileTreePath != null) {
+ return fileTreePath;
+ }
+ }
+ return null;