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 an example with a java class, though there are similar examples using a folder and some arbitrary node underneath it: - Create a new java class and save it - Expand the node in the explorer so the source and class nodes are showing - Highlight the source and class node (multi-select) and choose Delete from the right-click menu * Problem #1: You will get a warning asking if you want to delete 2 objects. Note that there is really only one object which will be deleted. (This part definitely happens with arbitrary nodes in the explorer, not just java nodes) - Choose Yes in the warning message * Problem #2: You will get an exception. The exception differs between 2.0 and 3.0 builds, but in both cases there is an exception. (I'm not sure if there is an exception for arbitrary nodes or only java nodes....) Some observations: - I believe delete code should check for nested nodes. That would probably solve both problems mentioned above. - Although this sounds like a strange case, I actually ran into it when I multi-selected two separate adjacent nodes using Shift-click, one of which was expanded. The reproducible case mentioned above doesn't sound like something reasonable for a user to do, but the multi-select for two nodes is reasonable.
Checking for nested nodes would be simple and might be fine. Note that under obscure circumstances it is possible for deleting a node and one or more of its subnodes to have a different effect than deleting only the parent. For example, create a shadow link to a directory (to elsewhere in Filesystems, not to the Project tab). Then expand the link, select it, and select one of the files within it. If you hit delete, it will remove the link, and the selected file in the original directory. For this reason--to avoid murkily defined behavior--I would prefer such a check to just disable DeleteAction when some selected nodes were contained in others, rather than for the deletion to proceed and ignore the child nodes. I.e. for Problem #1 I do not consider it a bug as such, just an unfortunate situation. Problem #2 may be a bug in Java module or in org.openide.src.nodes. BTW please select an appropriate Version field, I doubt you meant to set it to 3.0 (= old NetBeans version no longer developed); changing to Dev (CVS trunk).
Yarda did you fix this one, or am I thinking of something else?
The exception pops up because the Class' node (and its associated data) being deleted no longer exist, but the node layer cannot determine this particular situation (no liveness indicator on the data, single exception type); some logic in Delete action that would remove selected nodes from a subtree whose root is also selected from the to-be-deleted node list would solve #2 as well as #1.
Please check whether this bug is still true--I believe Yarda changed things so that it would simply disable DeleteAction in this situation on the grounds that too many things could go wrong or be poorly defined, and the user should simply delete things one at a time according to what they really intended. I believe this was the right fix, so if you want to argue it please do...
Now delete is disabled but cut/paste and copy/paste result in similar errors.
The cut/paste and copy/paste problems should be probably solved on java module level, because I can see no way how to solve it in general in openide.
Cut/paste of nodes nested in each other are quite peculiar with the current IDE's api: suppose you have a node A that hosts another node B. Then you cut-paste them into node C. Since the cut-paste operation is performed (usually) one by one, if you select B first, A next, you'll get: C -> B A Since B has been already deleted from A at the time A was being Cutted out. If you select the original nodes in the opposite order, you'll likely to get an exception, or C -> A -> B It may help if I delete the node immediately after Cut operation and Paste will only paste the clipboard to the new location.
The target for a paste can define specific behavior when multiple nodes are pasted into it at once. If Java nodes have some meaningful special behavior when this happens and some are subnodes of others, it should implement that behavior. Probably the ExplorerActions class should never try to do sequential pastes of nodes where the paste type is a node transfer from more than one node, some of which are in a parent-child relationship--for the same reasons I suggested that Delete be disabled, i.e. the correct behavior is not obvious so it should be forbidden. Specific paste targets can and should handle pasting multiselections all at once. Or at least this is what I remember of node transfer, someone please correct me if that is not accurate...
Version: 'Dev' -> 3.2
As it seems it is no longer an UI bug since UI effects have been solved. Moving to `code' component for proper implementation (and removing ui from CC).
Fixed in dev trunk, pending merge to 3.2
Reopening, merging to Release-3.2
Fixed in release-3.2
Target milestone -> 3.2
Cut/paste still throws Exceptions
Guys, but there is such code! toNotify is used to signal the successful creation of a data object (at least I thought). In Item.register something is added into the toNotify field and after the data object is created DataObjectPool.notifyCreated is called. I thought this should behave in the same way as your patch.
Supposedly fixed by Tomas Hurka's changes in org.openide.src.nodes.SourceEditorSupport.
There are no exception thrown now. If cut/paste is performed, there are two .java files created in target folder. One with source class and one without it.
I lack some better operation grouping support for this from the OpenIDE. java nodes already provide a special operation for pasting into the package, but cannot control/communicate with sibling nodes in the transferable being pasted.
Resolved for 3.3.x or earlier, no new info since then -> closing.
Resolved for 3.4.x or earlier, no new info since then -> closing.