This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Here is a problem with drag'n'drop. I have two different parent nodes. The destination parent node containts Index Support (has a Support cookie attached.) So reordering of the child nodes works flawlessly. Now I'm trying to drag a node which is a child of first parent node into the second parent node _between two nodes_. The problem is that now the node is not placed at the right position between these two nodes but at the end of the nodes. I think I found the reason: The class TreeViewDropSupport implements the drop sequence. It includes some code to perform the reordering. But the reordering of nodes in this case operates upon the nodes names. So the problem is: The dropped node has to get the same name as the dragged node. Otherwise the code in findDropedNodes() can't find the node to be reordered. But I can't give the dropped node the same name as the dragged node. Because if I did this I would end up with nodes with the same name when using the copying drag'n'drop mode (using the control key) mutiple times. Jiri answered already: The heart of this problem is a weakness in finding node in explorer, it's based on name of node. The several issues about it was filed (see issue 18780, issue 22030). Code wants select node with a given name but the name is being changed to avoid duplicate names on one folder (i.e. Foo changed to Foo_1). The code finds the node Foo instead of Foo_1, but it's wrong.
Peer, the findDropedNodes() asks the parent node for index on which droped node is placed. See Children's javadoc of findChild(String name), it proposes implement more advanced way to find a child. It's a one of places which can improve DnD behavior. You could extend you parent node children and provide better findChild() method. On the other hand, a name is lack of information to return a right node. I try use a util method for finding child, attach a jar patch to this issue. Could you ensure if it would fix this issue? Thanks
Jiri, I know the findChild() method. But as you stated the name is not enough to identify destination. But I would be very glad to try your patch and post the results.
Created attachment 12219 [details] binary patch applicable in lib/patches
I attached the patch, it finds pasted nodes in folder and trying to select it. It should work better then now. Please, test it. Thanks
Congratulations! The pasted nodes are now identified correctly. The pasted nodes are selected (mostly). The dropped nodes are not selected when I perform a drag to a different explorer. But nonetheless -thanks!
Fine, I did more work on selecting nodes which are moved from one folder to other on. It worked more better. It's fixed in maintrunk.
closed