/** * Don't show expansion button on leaves leaf: all children are (file) or (directory named "." or * "..") * * @param node * @return whether node is a leaf */ private static boolean isLeafDirectory(DirectoryNode node) { Directory dir = node.getLookup().lookup(Directory.class); boolean ret = true; try { for (Content c : dir.getChildren()) { if (c instanceof Directory && (!((Directory) c).getName().equals(".") && !((Directory) c).getName().equals(".."))) { ret = false; break; } } } catch (TskException ex) { Logger.getLogger(DirectoryTreeFilterChildren.class.getName()) .log(Level.WARNING, "Error getting directory children", ex); return false; } return ret; }
/** Helper to ignore the '.' and '..' directories */ private static boolean isDotDirectory(DirectoryNode dir) { String name = dir.getDisplayName(); return name.equals(DirectoryNode.DOTDIR) || name.equals(DirectoryNode.DOTDOTDIR); }