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

Bug 312195

Summary: "New > Untitled Text File" via wizard does not give focus to editor
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: SWTAssignee: Scott Kovatch <skovatch>
Status: RESOLVED FIXED QA Contact: Silenio Quarti <Silenio_Quarti>
Severity: normal    
Priority: P3 CC: daniel_megert, hudsonr, pwebster, remy.suen, sandipchitale, skovatch
Version: 3.6   
Target Milestone: 3.7 M1   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
work in progress none

Description Markus Keller CLA 2010-05-09 19:59:26 EDT
I20100509-0800 Cocoa

"New > Untitled Text File" via wizard does not give focus to editor. The editor is created, but the previously focused editor keeps focus.

Works fine via toolbar button menu or via File > New > submenu.
Comment 1 Dani Megert CLA 2010-05-10 02:48:26 EDT
Works fine for me on Windows XP using N20100507-2000.

Markus, can you check since when this is broken?
Comment 2 Dani Megert CLA 2010-05-11 02:23:25 EDT
Markus, please quickly debug on your Mac.
Comment 3 Markus Keller CLA 2010-05-11 18:57:21 EDT
I can only reproduce the problem with the new editor opening "behind" the active editor in my dev workspace. Will not pursue this problem further for now.

In another workspace, in the target, and in 3.5, the editor is opened and its tab comes to front, but the StyledText doesn't take keyboard focus.

Debugging this revealed that StyledText#setFocus() is called while the wizard shell is still open. On Windows, this stores the StyledText in Decorations.savedFocus, and when the wizard shell is closed, Decoration#restoreFocus() is executed.

On Cocoa, Decoration#restoreFocus() is only called from Shell#open(). That's not enough. Moving to SWT.
Comment 4 Scott Kovatch CLA 2010-05-12 13:31:34 EDT
Created attachment 168209 [details]
work in progress

This addresses the bug by adding the save/restoreFocus similar to what Carbon was doing. It probably needs more testing than we can give it for rc1, though.
Comment 5 Scott Kovatch CLA 2010-07-15 13:06:13 EDT
Fixed > 20100715, using the attached patch.
Comment 6 Scott Kovatch CLA 2010-07-15 18:32:47 EDT
*** Bug 303677 has been marked as a duplicate of this bug. ***
Comment 7 Silenio Quarti CLA 2010-08-09 14:41:06 EDT
This fix causes bug#322151.
Comment 8 Remy Suen CLA 2011-05-25 11:02:46 EDT
*** Bug 347166 has been marked as a duplicate of this bug. ***