How do I make a particular node visible in the Explorer, and maybe select it?
Note: These pages are being reviewed.
In general you cannot. See issue #7551.
If you created the Explorer view (e.g. you created a
BeanTreeView or similar and put it in a Swing panel of some sort) then you can use
[https://bits.netbeans.org/dev/javadoc/org-openide-explorer/org/openide/explorer/ExplorerManager.html#setSelectedNodes(org.openide.nodes.Node[ ExplorerManager.setSelectedNodes])] and more rarely
TreeView.expandNode to display a given node in your tree (The node must be a descendant of the current root node. You cannot construct a new "similar"
Node and hope to select it).
If you did not create the Explorer view then there is no reliable way to find it. However you might try scanning`TopComponent.Registry.getOpened()` for instances of
ExplorerManager.Provider and looking for appropriate nodes that way. Such tricks must be done with care - the fact that you can find the component to do this does not imply that the author of the component intends that it be there forever, remain of the same type, continue implementing
ExplorerManager.Provider or anything else. Check nulls, check casts, be prepared for it not to work on future versions.
In the particular case of making a new file wizard, you can and should ask for the file(s) you create to be selected when the wizard finishes, simply by returning them from
Applies to: NetBeans 5.0, 5.5, 6.x