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.

Bug 8534 - problems with multiple selection delete when objects are nested
Summary: problems with multiple selection delete when objects are nested
Status: CLOSED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: Sun Solaris
: P3 normal (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-11-23 06:15 UTC by Rochelle Raccah
Modified: 2007-09-26 09:14 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rochelle Raccah 2000-11-23 06:15:23 UTC
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.
Comment 1 Jesse Glick 2000-11-23 15:12:59 UTC
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).
Comment 2 Jesse Glick 2000-12-11 10:11:59 UTC
Yarda did you fix this one, or am I thinking of something else?
Comment 3 Svata Dedic 2000-12-11 10:18:59 UTC
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.
Comment 4 Jesse Glick 2000-12-11 17:22:59 UTC
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...
Comment 5 Rochelle Raccah 2000-12-12 22:02:59 UTC
Now delete is disabled but cut/paste and copy/paste result in similar errors.
Comment 6 Jaroslav Tulach 2001-02-25 10:39:01 UTC
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.
Comment 7 Svata Dedic 2001-02-26 07:17:35 UTC
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.
Comment 8 Jesse Glick 2001-02-26 14:50:31 UTC
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...
Comment 9 Jan Chalupa 2001-03-12 10:46:09 UTC
Version: 'Dev' -> 3.2
Comment 10 Svata Dedic 2001-04-03 09:38:05 UTC
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).
Comment 11 Svata Dedic 2001-04-10 13:51:16 UTC
Fixed in dev trunk, pending merge to 3.2
Comment 12 Svata Dedic 2001-04-11 16:12:49 UTC
Reopening, merging to Release-3.2
Comment 13 Svata Dedic 2001-04-11 16:14:36 UTC
Fixed in release-3.2
Comment 14 Jan Chalupa 2001-05-05 23:26:12 UTC
Target milestone -> 3.2
Comment 15 Jan Becicka 2001-06-18 10:49:09 UTC
Cut/paste still throws Exceptions
Comment 16 Jaroslav Tulach 2001-06-18 16:56:09 UTC
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.

Comment 17 Svata Dedic 2001-08-24 08:37:35 UTC
Supposedly fixed by Tomas Hurka's changes in 
org.openide.src.nodes.SourceEditorSupport.

Comment 18 Jan Becicka 2001-09-07 17:14:57 UTC
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.
Comment 19 Svata Dedic 2001-09-10 12:32:17 UTC
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.

Comment 20 Quality Engineering 2003-07-01 13:12:02 UTC
Resolved for 3.3.x or earlier, no new info since then -> closing.
Comment 21 Quality Engineering 2003-07-01 13:20:08 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.