Hi there,
can someone tell me how to programmatically select a node in my beanTreeView
(backed up by an explorerManager) after being created in my data model? I tried
to do this in parent node, by adding a NodeListener like this:
parentNode.addNodeListener(new NodeAdapter() {
@Override
public void childrenAdded(NodeMemberEvent ev) {
if (ev.isAddEvent()) {
final Node node = ev.getNode();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
try {
LibraryViewerTopComponent.findInstance().getExplorerManager().setSelectedNodes(new
Node[] { node });
} catch (PropertyVetoException ex) {
MessageBox.error(ex);
}
}
});
}
}
});
When I create a new item in my data model, the ChildFactory refreshes
asynchronously itself and creates a new node representing the data.
Unfortunately this does’t work because the child node may be not exists yet in
the explorer manager. Any suggestions?
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists