Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 244358 - [common navigator] CommonViewer.remove() called redundantly when removing Java Project
Summary: [common navigator] CommonViewer.remove() called redundantly when removing Jav...
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-16 02:12 EDT by Francis Upton IV CLA
Modified: 2008-08-18 10:43 EDT (History)
1 user (show)

See Also:


Attachments
Stack traces of add() and remove() calls of CommonViewer (44.57 KB, text/plain)
2008-08-16 02:12 EDT, Francis Upton IV CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Francis Upton IV CLA 2008-08-16 02:12:37 EDT
Created attachment 110145 [details]
Stack traces of add() and remove() calls of CommonViewer

When looking into bug 242762 I put some printlns in CommonViewer.remove() and .add() and discovered that the .remove call was being made both by the JDT code and the CNF resource code each time the Java Project was removed (I was using the new project wizard and going back and forth between where it actually creates the project (as instructed in bug 242762).

The attachment shows the stack traces.

This seems wrong, seems like the JDT should not call remove when the project is removed for the Project Explorer case as this is already taken care of.  I note that I did not see the same behavior in when adding the project.  The add() call was made only by the CN resource code.
Comment 1 Dani Megert CLA 2008-08-18 03:59:16 EDT
This is how it works since day one of CN and removing the same element more than once shouldn't do any harm. The registered content provider does too much (not only on remove but also on add) because it cannot assume what the main common navigator content provider does and whether there are other more specific content providers registered. Now, if the owners of CN tell us how clients can resolve that we will be more than happy do fix it. For now I see no way for us to do this.

Note that one way might be to do existence checks but that's normally more expensive than removing it twice.


So - I can either mark this as WONTFIX (but rather it's CANTFIX ;-), or move back to Platform UI to provide API and/or guidelines how clients can fix this problem.
Comment 2 Francis Upton IV CLA 2008-08-18 10:43:29 EDT
(In reply to comment #1)
> This is how it works since day one of CN and removing the same element more
> than once shouldn't do any harm. The registered content provider does too much
> (not only on remove but also on add) because it cannot assume what the main
> common navigator content provider does and whether there are other more
> specific content providers registered. Now, if the owners of CN tell us how
> clients can resolve that we will be more than happy do fix it. For now I see no
> way for us to do this.

Yes, I agree with you, you should not have to assume what the other content providers are doing, and it's hard to check (which is not what I first thought when filing this bug).  Oh, and I'm the current (and only) owner of the CN (Michael is no longer working on it)