Bug 44081 - [Navigator] Resource Navigator has sticky duplicate item after rename
Summary: [Navigator] Resource Navigator has sticky duplicate item after rename
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.0 M5   Edit
Assignee: Kim Horne CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 40214 41710 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-10-02 11:19 EDT by Markus Keller CLA
Modified: 2004-04-01 15:42 EST (History)
2 users (show)

See Also:


Attachments
Patch for org.eclipse.ui.ide (3.90 KB, patch)
2003-11-18 09:30 EST, Kim Horne CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2003-10-02 11:19:32 EDT
I20030930
Resource Navigator has sticky duplicate item after rename

Steps:
- create new workspace
- in the Resource Navigator, create new simple project "prj"
- create folder "folder" inside "prj"
- create file "file.txt" inside "folder"
- in the Resource Navigator, select file "file.txt"
- choose menu File > Rename (or press F2) and change the name to "fool.txt"

-> In "folder", I have two items "fool.txt" which both represent the same file.
When I delete one of the tree items, the file is deleted from the filesystem.
One of the tree items "fool.txt" inside "folder" stays there and can't be
removed, not even by a refresh. It only goes away when I rename "folder" or
restart eclipse.

Note: the same problem seems to exist for *all* files and folders on the second
level ("thing" inside a folder inside a project)

Note2: this might be related to bug 44066.
Comment 1 Tod Creasey CLA 2003-10-07 12:59:32 EDT
Fix released for M4
Comment 2 Tod Creasey CLA 2003-10-07 12:59:44 EDT
*** Bug 41710 has been marked as a duplicate of this bug. ***
Comment 3 Tod Creasey CLA 2003-10-17 07:28:53 EDT
Reopened with comments from Nick (Kim please investigate if these are issues)

- The old warning about processing removals before additions to avoid multiple 
equal elements is being ignored.  Additions are now processed before removals, 
and the comment has been removed.
- It turns redraw off and on, which will cause flicker since this always 
forces a complete redraw.
- It does this even if there are no items to add.
- The comment says it's doing this to avoid a flash showing both the old and 
new element, however the redraw is turned on before the removals are processed.

Please ensure that the changes here:
- avoids the problems with multiple equal elements in the viewers
- doesn't cause any extra redraws, particularly for the common cases of 
elements changing, and single elements being added or removed.
Comment 4 Kim Horne CLA 2003-10-23 10:54:04 EDT
It's been awhile, but this was the gist of our findings at the time.

We found that when you processed removals first there was a refresh of the tree
happening deep within the removal logic.  This refresh was occuring when you
tried to preserve the  selection of the tree.  This action actually caused the
additions to be handled in the removal step because the input to the viewer was
being refreshed in internalExpand(). When the additions were processed after
removals this caused the duplicate element to be added twice.

Your comment about the refresh is completely right, however.  The calls to
setRedraw() do seem unnecessary.
Comment 5 Kim Horne CLA 2003-11-18 09:12:42 EST
*** Bug 40214 has been marked as a duplicate of this bug. ***
Comment 6 Kim Horne CLA 2003-11-18 09:30:00 EST
Created attachment 6836 [details]
Patch for org.eclipse.ui.ide

Patch to clean up redraw issues.  Only toggles redraw in the case of an
addition and a deletion in the same delta.
Comment 7 Kim Horne CLA 2003-11-18 12:06:04 EST
Patch applied by Nick.
Comment 8 Nick Edgar CLA 2003-11-18 12:11:33 EST
Patch applied.

I tried doing the removes before the adds to try to reproduce the original 
problem.  It did not end up calling the content provider's getChildren method.  
Tried both the case where the parent had been expanded, and where it had not.
Of course, in the latter the element being removed wasn't in the selection, so 
it wouldn't try to expand the parent.

In any case, remove should not try to preserve the selection for the removed 
elements (it should still preserve the rest of the selection, if any).

Comment 9 Nick Edgar CLA 2003-11-18 12:19:48 EST
Filed bug 46852 [Viewers] remove should not try to preserve selection for 
removed elements.
Comment 10 Kim Horne CLA 2004-04-01 15:42:03 EST
Closed.