Bug 41431 - [EditorMgmt] Affected editors should be closed before executing project close or delete
Summary: [EditorMgmt] Affected editors should be closed before executing project close...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 normal with 6 votes (vote)
Target Milestone: 4.5 M6   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday, greatfix, helpwanted, noteworthy
: 18421 40795 41432 52279 101391 153692 168554 296920 329019 393718 400019 409782 458266 462043 464848 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-08-12 04:38 EDT by Andre Jagusch CLA
Modified: 2015-06-09 07:13 EDT (History)
35 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Jagusch CLA 2003-08-12 04:38:50 EDT
When an eclipse project is closed the CloseResourceAction.run() method takes 
care of dirty editors associated with the project to be closed by asking the 
user if they should be saved via a dialog. If the user accepts the editors are 
saved and closed. However none dirty editors are left open but should be closed.

When deleting a project neither dirty nor non dirty editors associated with the 
project to be deleted are closed by eclipse.
Comment 1 Andre Jagusch CLA 2003-08-12 04:48:28 EDT
*** Bug 41432 has been marked as a duplicate of this bug. ***
Comment 2 Michael Van Meekeren CLA 2004-05-25 14:43:06 EDT
There exists IDE.saveAllEditors method and there is a need for an 
IDE.closeAllEditors(IResource[], boolean save) method as well to support 
fixing this type of problem
Comment 3 Michael Van Meekeren CLA 2006-04-21 13:19:09 EDT
Moving Dougs bugs
Comment 4 Susan McCourt CLA 2009-07-09 19:03:09 EDT
As per http://wiki.eclipse.org/Platform_UI/Bug_Triage_Change_2009
Comment 5 Boris Bokowski CLA 2009-11-17 13:05:50 EST
Remy is now responsible for watching the [EditorMgmt] component area.
Comment 6 Dani Megert CLA 2009-12-16 02:39:39 EST
*** Bug 52279 has been marked as a duplicate of this bug. ***
Comment 7 Dani Megert CLA 2009-12-16 02:41:06 EST
See bug 29570 for project deletion case.
Comment 8 Dani Megert CLA 2009-12-16 02:41:18 EST
*** Bug 101391 has been marked as a duplicate of this bug. ***
Comment 9 Dani Megert CLA 2009-12-16 02:55:51 EST
*** Bug 296920 has been marked as a duplicate of this bug. ***
Comment 10 Dani Megert CLA 2009-12-16 03:01:20 EST
Please ignore comment 7.

The workbench should simply close the affected editors before deleting or closing a project. Otherwise, the open editors close when their files go away which makes the workbench trying to activate the next editor (for which the file is already gone) and hence results in errors.

Another way to improve this would be to fix bug 29570 which asks not to activate the editor part if its input doesn't exist.
Comment 11 Dani Megert CLA 2009-12-16 11:08:58 EST
*** Bug 153692 has been marked as a duplicate of this bug. ***
Comment 12 Behrang Saeedzadeh CLA 2010-08-16 10:19:10 EDT
Come on guys! Thisis so depressing. 7 years and still no progress on this one?
Comment 13 Remy Suen CLA 2010-08-16 10:37:53 EDT
(In reply to comment #10)
> The workbench should simply close the affected editors before deleting or
> closing a project.

Wouldn't we be forced to cause bundle initialization on every editor on the basis that we need to load and check whether their inputs are related to the project being closed or deleted?

(In reply to comment #12)
> Come on guys! Thisis so depressing. 7 years and still no progress on this one?

I'm afraid the age of a bug is not a good indication of its importance and/or its severity.
Comment 14 Behrang Saeedzadeh CLA 2010-08-17 05:04:10 EDT
> I'm afraid the age of a bug is not a good indication of its importance and/or
> its severity.

I actually think the reason why this bug hasn't been fixed so far is because of its non-severity. The thing is it's a harmless bug but it is so distractive. I say it is so distractive because I can't remember any of the other IDEs (VisualAge, Visual Cafe, JBuilder, NetBeans, JDeveloper, IDEA, CodeGuide, etc.) I have used in the past have had a similar bug.
Comment 15 Dani Megert CLA 2010-11-04 08:47:39 EDT
*** Bug 329019 has been marked as a duplicate of this bug. ***
Comment 16 Dani Megert CLA 2010-11-04 08:47:49 EDT
*** Bug 18421 has been marked as a duplicate of this bug. ***
Comment 17 Remy Suen CLA 2010-11-08 13:44:13 EST
*** Bug 168554 has been marked as a duplicate of this bug. ***
Comment 18 Anton Stoychev CLA 2011-08-04 09:47:53 EDT
Still experiencing the same thing. I think that workflow bugs like this one should be as important as security or crashes.

The more quickly this one is resolved the speedier development will be. This means that the fixes of other bugs will be resolved quicker if this one goes away.
Comment 19 Remy Suen CLA 2011-08-04 10:16:49 EDT
Without looking at the code the only "safe" way I can think of resolving this is to check all available editors' inputs and determine whether they're a FileEditorInput or not. Based on that information we can restore them (which shouldn't cause bundle activation as org.eclipse.ui.ide should already have been activated long ago) and compare their files with the project(s) being closed/deleted and close the owning editor if applicable.

I would be willing to look at patches contributed from the community that implements the above or some other solution that is superior to the above.
Comment 20 Behrang Saeedzadeh CLA 2011-08-04 11:59:18 EDT
Whenever I use Eclipse I can find a bug or two per day. As bugs like this are ignored for more than 7 years, I cannot even be bothered to submit bug reports anymore.

> Without looking at the code the only "safe" way I can think of resolving this
is to check all available editors' inputs and determine whether they're a
FileEditorInput or not. Based on that information we can restore them (which
shouldn't cause bundle activation as org.eclipse.ui.ide should already have
been activated long ago) and compare their files with the project(s) being
closed/deleted and close the owning editor if applicable.

I don't know much about Eclipse's architecture, but an elegant way of doing this, if permitted by Eclipse's architecture, is to make editors implement a ProjectListener or something that listen to projectClosed/projectDeleted events and then close themselves.
Comment 21 Remy Suen CLA 2011-08-04 14:45:50 EDT
(In reply to comment #20)
> I don't know much about Eclipse's architecture, but an elegant way of doing
> this, if permitted by Eclipse's architecture, is to make editors implement a
> ProjectListener or something that listen to projectClosed/projectDeleted events
> and then close themselves.

Behrang, the editors are already listening for this event. The issue is that editors do not get reinstantiated when Eclipse restarts until the user actually activates them (to support lazy-loading). As a result, the editors' code for attaching the listener never gets called.
Comment 22 Szymon Ptaszkiewicz CLA 2012-12-22 15:25:48 EST
*** Bug 393718 has been marked as a duplicate of this bug. ***
Comment 23 Szymon Ptaszkiewicz CLA 2012-12-22 15:32:47 EST
*** Bug 346220 has been marked as a duplicate of this bug. ***
Comment 24 Peter Severin CLA 2013-01-04 06:56:17 EST
I would also like to see this fixed. I have an RCP product that has this issue and it's confusing for my users. When a project is deleted or closed, they expect all related editors to be closed too, and not to remain in error state with a confusing error message.
Comment 25 Martin Oberhuber CLA 2013-01-08 09:07:09 EST
CQ:WIND00383632
Comment 26 Beth Tibbitts CLA 2013-02-08 09:13:58 EST
I agree it would be nice to see this fixed. nasty empty editor with lots of red X's :)    Closing https://bugs.eclipse.org/bugs/show_bug.cgi?id=400019 as duplicate of this.
Comment 27 Beth Tibbitts CLA 2013-02-08 09:14:20 EST
*** Bug 400019 has been marked as a duplicate of this bug. ***
Comment 28 Paul Webster CLA 2013-06-04 08:39:54 EDT
*** Bug 409782 has been marked as a duplicate of this bug. ***
Comment 29 John Cortell CLA 2013-06-04 17:00:44 EDT
This issue is ten years old and the problem has been independently found and reported five times. It would be great if someone with the required expertise and committer status could give this some attention.
Comment 30 Paul Webster CLA 2013-06-05 06:21:10 EDT
This is marked as helpwanted. I can guide someone that wants to contribute a patch, but I won't have time to look at this for some time.

PW
Comment 31 Dani Megert CLA 2014-06-02 07:24:06 EDT
*** Bug 40795 has been marked as a duplicate of this bug. ***
Comment 32 Wojciech Sudol CLA 2015-01-23 10:34:41 EST
*** Bug 458266 has been marked as a duplicate of this bug. ***
Comment 33 Eclipse Genie CLA 2015-02-11 15:11:17 EST
New Gerrit change created: https://git.eclipse.org/r/41675
Comment 34 Eclipse Genie CLA 2015-02-13 01:45:46 EST
New Gerrit change created: https://git.eclipse.org/r/41796
Comment 36 Lars Vogel CLA 2015-02-24 15:12:39 EST
(In reply to Eclipse Genie from comment #34)
> New Gerrit change created: https://git.eclipse.org/r/41796

The cleanup patch in not yet applied, it has a rebase conflict.
Comment 38 Lars Vogel CLA 2015-02-24 15:33:04 EST
Thanks Andrey, can you also provide a N&N for this change?
Comment 39 Lars Vogel CLA 2015-02-24 15:33:18 EST
.
Comment 40 Andrey Loskutov CLA 2015-03-01 13:29:33 EST
(In reply to Lars Vogel from comment #38)
> Thanks Andrey, can you also provide a N&N for this change?

See https://git.eclipse.org/r/42972
Comment 41 Dani Megert CLA 2015-03-02 11:14:57 EST
*** Bug 458266 has been marked as a duplicate of this bug. ***
Comment 42 Andrey Loskutov CLA 2015-03-19 18:05:20 EDT
Verified in I20150318-2000
Comment 43 Andrey Loskutov CLA 2015-03-29 12:02:49 EDT
*** Bug 462043 has been marked as a duplicate of this bug. ***
Comment 44 Andrey Loskutov CLA 2015-04-22 15:12:41 EDT
*** Bug 464848 has been marked as a duplicate of this bug. ***
Comment 45 Shreya Dixit CLA 2015-06-09 01:24:22 EDT
Hello,

I'm facing a similar issue.
Since the issue is fixed, which build/version of Eclipse can I find the fix in?
Currently I'm using Eclipse Java EE IDE for Web Developers.

Version: Luna Service Release 2 (4.4.2)
Build id: 20150219-0600

Thanks & Regards,
Shreya
Comment 46 Dani Megert CLA 2015-06-09 07:13:47 EDT
(In reply to Shreya Dixit from comment #45)
> Hello,
> 
> I'm facing a similar issue.
> Since the issue is fixed, which build/version of Eclipse can I find the fix
> in?
> Currently I'm using Eclipse Java EE IDE for Web Developers.
> 
> Version: Luna Service Release 2 (4.4.2)
> Build id: 20150219-0600
> 
> Thanks & Regards,
> Shreya

You can either switch to 4.5 RC3:
https://www.eclipse.org/downloads/index-developer-default.php

Or wait until June 24 when 4.5 is officially released.