Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335303

Summary: [implementation] Focus lost after canceling out of the save dialog prompt of an untitled text editor closed by the editor selection dialog
Product: [Eclipse Project] Platform Reporter: Remy Suen <remy.suen>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: daniel_megert
Version: 3.7   
Target Milestone: 3.7 M6   
Hardware: All   
OS: All   
Whiteboard:

Description Remy Suen CLA 2011-01-25 07:59:52 EST
I20110124-1800

1. File > New > Untitled Text File
2. Make it dirty.
3. Ctrl+Shift+E
4. Select the file.
5. Click 'Close Selected Editors'.
6. Pick 'Yes'.
7. Click 'Cancel'.
8. The save dialog is closed and the focus is now granted to the workbench window
but you can't do anything because of the modal dialog. The focus should be
granted to the modal dialog.
Comment 1 Remy Suen CLA 2011-01-31 08:48:45 EST
The text editor directly calls getSite().getShell(). It seems to me that IWorkbench's getModalDialogShellProvider() should be used instead so that we don't parent the dialog off of the workbench window's shell.

Thread [main] (Suspended (breakpoint at line 1466 in AbstractDecoratedTextEditor))	
	TextEditor(AbstractDecoratedTextEditor).performSaveAs(IProgressMonitor) line: 1466	
	TextEditor(AbstractTextEditor).doSave(IProgressMonitor) line: 4823	
	AbstractTextEditor$TextEditorSavable.doSave(IProgressMonitor) line: 7176	
	AbstractTextEditor$TextEditorSavable(Saveable).doSave(IProgressMonitor, IShellProvider) line: 214	
	SaveableHelper.doSaveModel(Saveable, IProgressMonitor, IShellProvider, boolean) line: 349	
	SaveablesList$4.run(IProgressMonitor) line: 621	
	SaveableHelper$5.run(IProgressMonitor) line: 277	
	ModalContext.runInCurrentThread(IRunnableWithProgress, IProgressMonitor) line: 464	
	ModalContext.run(IRunnableWithProgress, boolean, IProgressMonitor, Display) line: 372	
	ApplicationWindow$1.run() line: 759	
	BusyIndicator.showWhile(Display, Runnable) line: 70	
	WorkbenchWindow(ApplicationWindow).run(boolean, boolean, IRunnableWithProgress) line: 756	
	WorkbenchWindow.run(boolean, boolean, IRunnableWithProgress) line: 2642	
	SaveableHelper.runProgressMonitorOperation(String, IRunnableWithProgress, IRunnableContext, IShellProvider) line: 285	
	SaveablesList.saveModels(List, IShellProvider, IRunnableContext) line: 630	
	SaveablesList.promptForSaving(List, IShellProvider, IRunnableContext, boolean, boolean) line: 594	
	SaveablesList.promptForSavingIfNecessary(IShellProvider, IWorkbenchWindow, Set, Map, boolean) line: 433	
	SaveablesList.preCloseParts(List, boolean, IShellProvider, IWorkbenchWindow) line: 388	
	WorkbenchEditorsDialog.closeItems(TableItem[]) line: 454
Comment 2 Dani Megert CLA 2011-02-01 04:19:06 EST
>IWorkbench's getModalDialogShellProvider()
Nice new method. It would be good if one would announce such things in the porting guide.

Fixed in HEAD (AbstractDecoratedTextEditor.java, rev. 1.148).
Available in builds >= I20110201-0800.
Comment 3 Remy Suen CLA 2011-02-01 06:41:36 EST
(In reply to comment #2)
> >IWorkbench's getModalDialogShellProvider()
> Nice new method. It would be good if one would announce such things in the
> porting guide.

Good point, Dani. I have opened bug 335949 for this.