diff options
author | Remy Suen | 2010-12-14 15:08:47 +0000 |
---|---|---|
committer | Remy Suen | 2011-10-06 15:24:17 +0000 |
commit | 30d5d63ca3b2556d0e0c9ce86f89da3851a81867 (patch) | |
tree | 5187e0251db179ebf7f2b27cb7dfe4a97243448a | |
parent | bf6bef5807a61fb2b4b04e843485f0c160d11303 (diff) | |
download | eclipse.platform.ui-30d5d63ca3b2556d0e0c9ce86f89da3851a81867.tar.gz eclipse.platform.ui-30d5d63ca3b2556d0e0c9ce86f89da3851a81867.tar.xz eclipse.platform.ui-30d5d63ca3b2556d0e0c9ce86f89da3851a81867.zip |
Bug 305216 [EditorMgmt] Focus lost when closing a dirty editor from the editor selection dialog
2 files changed, 17 insertions, 6 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java index a98a0145535..78f1c038c18 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveablesList.java @@ -343,6 +343,11 @@ public class SaveablesList implements ISaveablesLifecycleListener { */ public Object preCloseParts(List partsToClose, boolean save, final IWorkbenchWindow window) { + return preCloseParts(partsToClose, save, window, window); + } + + public Object preCloseParts(List partsToClose, boolean save, IShellProvider shellProvider, + final IWorkbenchWindow window) { // reference count (how many occurrences of a model will go away?) PostCloseInfo postCloseInfo = new PostCloseInfo(); for (Iterator it = partsToClose.iterator(); it.hasNext();) { @@ -379,7 +384,7 @@ public class SaveablesList implements ISaveablesLifecycleListener { fillModelsClosing(postCloseInfo.modelsClosing, postCloseInfo.modelsDecrementing); if (save) { - boolean canceled = promptForSavingIfNecessary(window, + boolean canceled = promptForSavingIfNecessary(shellProvider, window, postCloseInfo.modelsClosing, postCloseInfo.modelsDecrementing, true); if (canceled) { return null; @@ -396,6 +401,12 @@ public class SaveablesList implements ISaveablesLifecycleListener { */ private boolean promptForSavingIfNecessary(final IWorkbenchWindow window, Set modelsClosing, Map modelsDecrementing, boolean canCancel) { + return promptForSavingIfNecessary(window, window, modelsClosing, modelsDecrementing, + canCancel); + } + + private boolean promptForSavingIfNecessary(IShellProvider shellProvider, + IWorkbenchWindow window, Set modelsClosing, Map modelsDecrementing, boolean canCancel) { List modelsToOptionallySave = new ArrayList(); for (Iterator it = modelsDecrementing.keySet().iterator(); it.hasNext();) { Saveable modelDecrementing = (Saveable) it.next(); @@ -404,8 +415,8 @@ public class SaveablesList implements ISaveablesLifecycleListener { } } - boolean shouldCancel = modelsToOptionallySave.isEmpty() ? false : promptForSaving(modelsToOptionallySave, - window, window, canCancel, true); + boolean shouldCancel = modelsToOptionallySave.isEmpty() ? false : promptForSaving( + modelsToOptionallySave, shellProvider, window, canCancel, true); if (shouldCancel) { return true; @@ -418,8 +429,8 @@ public class SaveablesList implements ISaveablesLifecycleListener { modelsToSave.add(modelClosing); } } - return modelsToSave.isEmpty() ? false : promptForSaving(modelsToSave, - window, window, canCancel, false); + return modelsToSave.isEmpty() ? false : promptForSaving(modelsToSave, shellProvider, + window, canCancel, false); } /** diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java index 1180c6b07e6..5e95035cf46 100644 --- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java +++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java @@ -448,7 +448,7 @@ public class WorkbenchEditorsDialog extends SelectionDialog { SaveablesList saveablesList = (SaveablesList) window .getService(ISaveablesLifecycleListener.class); // prompt for save - if (saveablesList.preCloseParts(selectedEditors, true, window) != null) { + if (saveablesList.preCloseParts(selectedEditors, true, this, window) != null) { // close all editors for (int i = 0; i < items.length; i++) { Adapter e = (Adapter) items[i].getData(); |