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 13348 - After deletion of selected node, nice to select a nearby one
Summary: After deletion of selected node, nice to select a nearby one
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Explorer (show other bugs)
Version: 3.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords: UI
: 15875 18924 (view as bug list)
Depends on: 29551
Blocks:
  Show dependency tree
 
Reported: 2001-06-30 18:19 UTC by Jesse Glick
Modified: 2008-12-22 18:53 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
selects nearby node when node is deleted (1.97 KB, patch)
2002-11-13 03:59 UTC, _ jrichard
Details | Diff
patch for both treetable and trees (4.42 KB, patch)
2002-11-14 04:49 UTC, _ jrichard
Details | Diff
fix for breakpoint problem (1.57 KB, text/plain)
2002-11-29 02:50 UTC, _ jrichard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2001-06-30 18:19:31 UTC
[dev jun 22] If a node is selected in the Explorer and then deleted
(either by user action, or just things refresh and it no longer
exists, etc.), the Explorer should make an attempt to select some
nearby node. Otherwise the user is left with no selected node and must
start finding his place from the top of the Explorer. If there are
many nodes visible in a deep nesting structure, this can take a
significant amount of time.
Comment 1 Jesse Glick 2001-10-03 21:32:05 UTC
*** Issue 15875 has been marked as a duplicate of this issue. ***
Comment 2 Jan Chalupa 2001-11-27 13:02:48 UTC
Target milestone -> 3.3.1.
Comment 3 Marian Mirilovic 2002-01-30 08:44:26 UTC
*** Issue 18924 has been marked as a duplicate of this issue. ***
Comment 4 David Simonek 2002-02-06 15:08:43 UTC
Seems reasonable to me (and doable for 3.4). Only complicated part is
definition of "nearby" node: Could it be some node with the same
parent and index n+1 or n-1 or parent node in case folder will be
empty? (or give up otherwise)
I expect problems with multiple node deletion, selection is best to
perform *after* all deleting is done.
Comment 5 Jesse Glick 2002-02-07 13:24:51 UTC
Could be parent node. I would say: given the current
expanded/contracted state of nodes, "nearby" means adjacent (up or
down) if you were to sort all nodes according to vertical position in
Explorer, regardless of nesting level. I.e. where you would go if you
were to press Up or Down arrow rather than Delete.
Comment 6 Marek Grummich 2002-07-22 11:24:17 UTC
Set target milestone to TBD
Comment 7 Marek Grummich 2002-07-22 11:27:19 UTC
Set target milestone to TBD
Comment 8 _ jrichard 2002-11-13 03:59:28 UTC
Created attachment 7921 [details]
selects nearby node when node is deleted
Comment 9 _ jrichard 2002-11-13 04:04:42 UTC
Here's something to select a nearby node when a node is deleted.

I've only done minimal testing, but it seems to work for me.
It tries to select the sibling above (I followed MS NT File Explorer)
or parent if required.

This should definately be reviewed, I'm not comfortable making changes
here (and as I look at the diff, I can see a few changes I'd make). :)

Next would be the treetable...
Comment 10 David Simonek 2002-11-13 08:33:54 UTC
John, great! I didn't try it, but I'm looking forward to see this
functionality in dev builds soon...
Comment 11 _ jrichard 2002-11-13 13:11:37 UTC
Ah, I'm a bit worried about two things: if the node will always be a
TreeNode (if the cast will always work) and if this is always done on
the AWT thread.

When I get a chance I'll check these.
Comment 12 _ jrichard 2002-11-14 04:48:34 UTC
It looks like I didn't have to worry about those things... TreeNode is 
commonly used, and it looks like all invocations are on the AWT 
thread.  (I only verified this with a println though, not analysis).

Otherwise, it now works for the TreeTable (breakpoints, watches).

Again, minimal testing, but it works for me.
Comment 13 _ jrichard 2002-11-14 04:49:49 UTC
Created attachment 7944 [details]
patch for both treetable and trees
Comment 14 _ jrichard 2002-11-14 04:54:35 UTC
One more thing... the code is basically a copy/paste job and
the body of treeNodesRemoved should probably be impelemented
someplace common.  But there doesn't seem to be such a place
at the moment.  

Ideas: a JTree.TreeModelHandler subclass which is subclassed by 
TreeView and used directly by TreeTable, or a static function
which is common to the two.
Comment 15 Jiri Rechtacek 2002-11-14 11:14:14 UTC
John, thank you for your patch above all. I'm now time pressed by
other tasks. I'm going to look on in and integrate asap. Keep patching
the code furthermore it's very valuable and great.
Comment 16 Jiri Rechtacek 2002-11-20 15:21:33 UTC
The patch was applied and committed to main trunk.
I added the method findSiblingTreePath which is called from TreeView
and from TreeTable too, in TreeView was called requestFocus to have
focus on the newly selected node.
Thank you for this patch it's very handy.
Comment 17 _ jrichard 2002-11-29 02:50:38 UTC
Created attachment 8103 [details]
fix for breakpoint problem
Comment 18 _ jrichard 2002-11-29 02:54:01 UTC
I reopened this because there seems to be a bug when
removing breakpoints.  I noticed this in todays 4.0
dev build (dev-200211280100).  Unfortunately, I don't
have CVS set up for the dev builds, but this change is pretty
much self contained within TreeView.java, so I attached the
findSiblingTreePath function...  hopefully someone can
put this into the dev builds...
Comment 19 _ jrichard 2002-11-29 02:56:48 UTC
I should mention that that problem was, if you add two 
breakpoints in the editor window (with shift f8) and then hit 
shift f8 a few times to add/remove/add a breakpoint 
in the editor window, there was an index out of bounds 
where no children were affected by a delete (but delete was called).
Comment 20 _ jrichard 2002-12-11 03:01:16 UTC
Setting this back to fixed... jrechtacek applied a fix and
apparently a seperate bug was opened (which I missed).

Comment 21 Marian Mirilovic 2002-12-11 13:25:21 UTC
verified in [nb_dev](20021211)