Help with JTree-related problem

I'm writing a plugin that shows some partially un-flattened file structure and lets users grab files from that structure.

I've been trying to re-use some of the JTree utility code in the openAPI (com.intellij.ui.treeStructure) libraries (loads of stuff in there that's good to have) but I've got a little stuck; this is the code I use to set up the tree, which then gets added to the main panel of my component:

JTree tree = new SimpleTree();
RootFolder rootFolder = new RootFolder(null);
rootFolder.setNodeText("Root", "", false);
DefaultMutableTreeNode root =
(DefaultMutableTreeNode) tree.getModel().getRoot();
PackageTreeStructure struct =
new PackageTreeStructure(new File[]{new File(m_srcFolder)}, true, rootFolder);
AbstractTreeBuilder atb = new LazySimpleTreeBuilder(tree,
(DefaultTreeModel) tree.getModel(), struct, new WeightBasedComparator());

If I make a call to atb.updateFromRootNode() it (correctly) does the (time-consuming) update work during startup. If I don't I just get a slightly mangled root node shown in the UI and nothing else when the component is shown. My tree structure code seems to be working OK (calls to getChildren are returning the correct lists of descriptors)...

Is there anything else I should be using? This is under IDEA 7294.

Please sign in to leave a comment.