The question of the day comes from Jesper Sahner: "I have a node representing a folder on disk. How can I easilyselect/omit specific file types?"
My response:
  1. Follow all the steps here:
    http://blogs.sun.com/geertjan/entry/...outside_of_the
    Then add this file to the module:public class FileFilterNodeChildren extends FilterNode.Children{ public FileFilterNodeChildren(Node original) { super(original); } @Override protected Node[] createNodes(Node object) { List result = new ArrayList(); for (Node node : super.createNodes(object)) { if (accept(node)) { result.add(node); } } return result.toArray(new Node[0]); } private boolean accept(Node node) { if (node.getDisplayName().endsWith(".doc") || node.getDisplayName().endsWith(".xls")){ return true; } else { return false; } }}
That's all. Similar story to part 1 which also discusses FilterNode.


Read More about [org.openide.nodes.FilterNode (Part 2)...