Community
Participate
Working Groups
Hi, I am using Eclipse 3.2 WTP and there are times when I close my project, a few of the editors remain open (with no content though.) I could reproduce this by following these steps: I created a Dynamic Web Project, added a build.xml file. Opened the web.xml and the build.xml plus one index.html file. I closed the IDE. I restarted the IDE. I closed the project, and some of the editor tabs still remained opened (with empty content). I am not sure if this is WTP 3.2 specific or an Eclipse 3.2 bug, though. Regards, Behi
Amy, please see if you can reproduce, and if related to our code ... or that pesky ant editor :)
reassigning to inbox
I can reproduce this. The build.xml and index.html files stay open. Will investigate.
I have investigated this further and this is my findings. STEPS: 1. Create a dynamic web project (though any project would probably do) 2. Create some documents, could be Java, xml, html, anything whos editor inhertis from the AbstractTextEditor (which is jsut about everything I would imagin) 3. Open all of these documents 4. Close eclipse 5. Open eclipse 6. Close the project containing all of these documents RESULT: Only the editor that was active is closed, all others stay open with no content with a messaging saying their file has gone missing PROBLEM: In org.eclipse.ui.texteditor.AbstractTextEditor the local class ElementStateListener is responsible for detecting if the backing file of the editor has been deleted (or in this case had its project closed) and then in turn closing the editor. This listener gets registered in #updateDocumentProvider which is only called when #doSetInput is called on the editor. This only happens when an editor gets focus. Therefor if an editor never gets focus then its IElementStateListener will never be registered and when its backing project is closed the editor will not get the event that the file is now "deleted" and thus will not close. Thus is the case here because all of the docuemnts that were open before Eclispe was shut down are restored when Eclipse is opened again, but only one of the editors gains focus and thus only that editor has its document provider set and is in turn the only editor to ahve its IElementStateListener registered and finally is because of all this the only editor to be closed when the project is closed. If after step 5 you then click on each editor once to 'initialize' it (thus setting the editor input and in turn the document provider and IElementStateListener) then when you close the project all the editors close.
See comment #4 for reason behind re-assigning to Platform. I took a guess at the correct component based on the package name of AbstractTextEditor, if I got the component wrong please redirect. Thank you.
*** This bug has been marked as a duplicate of bug 41431 ***