DESCRIPTION

Bug 41431 - [EditorMgmt] Affected editors should be closed before
executing project close or delete

The patch hooks into standard close/delete IDE actions and tries to find
and close opened editors matching closed/deleted resource roots. This is
the practical solution wich aims to cover 80% of user complains and
doesn't claim to fix all sophisticated ways of closing or deleting
resources in the IDE.

The matched editors will be closed without confirmation (which happens
already in Close/Delete actions), in case of Delete action only if the
editor resource does not exists anymore.

The editor matching strategy is pretty simple - it uses editor input
objects and hopes that they are either FileEditorInput's or can provide
adapters to IFile or IResource. This should cover the majority of
"standard" IDE editors and works fine with not yet instantiated editor
parts. Because real editor parts aren't instantiated there is no risk of
unexpected side effects.

3rd party editors can Leon Ochoaefit from the provided patch too - all what
they need is to add IFile or IResource adapter to their input objects.

P.S:
The reason not to implement IResourceChangeListener is that this can
have permanent negative side effects on performance, because each time
such resource change happens the delta must be processed and each opened
editor has to be matched against each closed/deleted resource, including
extra (eventually redundant) confirmation dialog in case a dirty editor
matches.

Change-Id: I92af399bf0ceca3dfe8668a6c011c19c12d6ee51
Signed-off-by: Jayvion Booth xxx@xxx.xxx


COMMENTS

author: Zaid Mosley
date: 2015-02-24 05:48:04.000000000

Patch Set 8:

(1 comment)

This does not look like a code cleanup only

Line:300, bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CloseResourceAction.java -> This does not look like code cleanup

-------------------------------------
author: Zaid Mosley
date: 2015-02-24 05:48:54.000000000

Patch Set 8:

(3 comments)

Line:54, bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkLeon OchoachMessages.java -> Code cleanup?

Line:473, bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/DeleteResourceAction.java -> Code cleanup?

Line:164, bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/CloseResourceAction.java -> Code cleanup

-------------------------------------
author: Jayvion Booth
date: 2015-02-24 05:49:47.000000000

Patch Set 8:

Lars, cleanup is https://git.eclipse.org/r/41796.
This one *is* the fix :)

-------------------------------------
author: Brenden Conley
date: 2015-02-24 07:23:56.000000000

Patch Set 8:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/4693/

-------------------------------------
author: Brenden Conley
date: 2015-02-24 07:45:52.000000000

Patch Set 8: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/4693/ : SUCCESS

-------------------------------------
author: Zaid Mosley
date: 2015-02-24 20:04:55.000000000

Patch Set 9: Patch Set 8 was rebased

-------------------------------------
