Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 139933

Summary: [CommonNavigator][Java] Deleting multiple projects does not remove them from project explorer
Product: [Eclipse Project] JDT Reporter: Wolfgang Knauf <wolfgang.knauf>
Component: UIAssignee: Michael D. Elder <mdelder>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert, Kevin_Haaland, markus.kell.r, martinae, Mike_Wilson, rfrost
Version: 3.2   
Target Milestone: 3.2 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Project Explorer before/after deletion
none
Converts IJavaModel to Viewer Input.
none
Remembers real viewer input none

Description Wolfgang Knauf CLA 2006-05-03 08:48:40 EDT
To reproduce:
-Create an enterprise application with a default ejb and web module.
-select those three
-delete, choose option "delete content on file system".

What happens: only the first of the three projects is removed from the project explorer, the other two seem to be left. But they are removed in the file system, and a restart of eclipse shows the right project explorer.

I will attach a screenshot. To the left you will find the three projects before deletion, to the right the project explorer after deletion. Two phantom projects are left.
Comment 1 Wolfgang Knauf CLA 2006-05-03 08:49:34 EDT
Created attachment 40194 [details]
Project Explorer before/after deletion
Comment 2 Rob Frost CLA 2006-05-03 09:06:50 EDT
I cannot always repro this (i.e. I've been able to delete multiple projects and sometimes all of the existing projects without hitting the issue), however, I have seen it (haven't tried enough scenarios to nail down exactly what is triggering it); when it happened I didn't see anything in the .log file, the navigator view did not show the projects and simply closing and reopening the project explorer view was sufficient to refresh the content (i.e. you don't need to shutdown and restart Eclipse).

Wolfgang: does this match your experience?
Comment 3 Rob Frost CLA 2006-05-03 09:11:42 EDT
The key seems to be deleting an EAR and at least two dependent module projects (type doesn't appear to be relevant).
Comment 4 Michael D. Elder CLA 2006-05-04 12:59:29 EDT
When the Java extension refreshes the tree, it does so using IJavaModel, which is not the root of the viewer. The attached patch converts the IJavaModel to ViewerInput, if it is part of the set to be refreshed. 
Comment 5 Michael D. Elder CLA 2006-05-04 13:00:00 EDT
Created attachment 40381 [details]
Converts IJavaModel to Viewer Input.
Comment 6 Michael D. Elder CLA 2006-05-04 13:00:51 EDT
The fix here is simple, and it would be keen if this could make it into RC3. 
Comment 7 Mike Wilson CLA 2006-05-04 14:07:30 EDT
Can you explain what the fix does in more detail?
Comment 8 Mike Wilson CLA 2006-05-04 14:08:27 EDT
doh. missed comment #4. +1.
Comment 9 Markus Keller CLA 2006-05-04 15:14:42 EDT
Michael, I tested the fix, but it does not work.

When I set a breakpoint in postRefresh() and then delete 2 IJavaProjects in the Project Explorer, I see that getViewerInput() returns an IJavaModel as well, so the patch is a no-op.

The two projects are deleted, but the Project Explorer is not refreshed and still shows them.
Comment 10 Michael D. Elder CLA 2006-05-04 15:44:59 EDT
The fix did work locally. I'll take a look.

What does your env look like?
Comment 11 Michael D. Elder CLA 2006-05-04 15:55:45 EDT
Created attachment 40418 [details]
Remembers real viewer input
Comment 12 Michael D. Elder CLA 2006-05-08 11:40:31 EDT
I would still like to see this for 3.2. McQ approved for 3.2RC3, could you verify approval for 3.2RC4 again? 

Also, Martin -- can you review and give feedback?
Comment 13 Mike Wilson CLA 2006-05-08 12:05:18 EDT
The patch seems reasonable. If everyone is comfortable with it, and it has had serious testing, then +1. 
Comment 14 Michael D. Elder CLA 2006-05-08 16:25:36 EDT
Martin or Kevin? Any feedback on this one?
Comment 15 Martin Aeschlimann CLA 2006-05-09 03:47:37 EDT
I reviewed and approve the patch. Markus, can you do the second review?
Michael, we need the OK of 3 component leads. You have mine.
Adding Dani for a second one.


Comment 16 Markus Keller CLA 2006-05-09 04:13:27 EDT
Patch looks good and works. I'll release when we have a third +1.
Comment 17 Dani Megert CLA 2006-05-09 04:37:12 EDT
Looked at the patch. Approving to fix for 3.2 RC4.

One minor issue: the patch might fail in the future because it assumes that Iterator.remove() always works but in fact this is not true for all implementations of List. Should someone call postRefresh(List, boolean) in the future with a List that does not support remove() then the patch fails.
Comment 18 Martin Aeschlimann CLA 2006-05-09 04:59:14 EDT
Markus, I'll do the releasing. McQ, is your +1 also valid for RC4?
We first have to post the bug to the mailing-list as others have the right to veto the change.
Comment 19 Martin Aeschlimann CLA 2006-05-09 05:06:29 EDT
Oh, McQ already approved for RC4 in comment 13. I'll then post the bug to the mailing list.
Comment 20 Martin Aeschlimann CLA 2006-05-10 14:56:20 EDT
patch released > 20060510
Comment 21 Johannes Rieken CLA 2006-05-12 06:41:55 EDT
verifying for I20060512-0010
Comment 22 Johannes Rieken CLA 2006-05-12 07:06:37 EDT
verified
Comment 23 Wolfgang Knauf CLA 2006-06-20 08:47:56 EDT
Verifieid in Eclipse 3.2 RC7 / WTP1.5 RC5.

Thanks for fixing it.