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

Bug 435421

Summary: Active Part is incorrect and does not have focus on a restart
Product: [Eclipse Project] Platform Reporter: Paul Webster <pwebster>
Component: UIAssignee: Wojciech Sudol <sudol.wojciech>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert, emoffatt, harawata, karl.weber99, Lars.Vogel, markus.kell.r, Mike_Wilson, pinnamur, pwebster, remy.suen, steffen.pingel
Version: 4.4Flags: daniel_megert: pmc_approved+
markus.kell.r: review+
Target Milestone: 4.4.2   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Bug Depends on: 348954, 433275    
Bug Blocks:    

Description Paul Webster CLA 2014-05-21 12:54:45 EDT
This is still a problem on a mac as the original fix caused bug 431966

+++ This bug was initially created as a clone of Bug #348954 +++

To reproduce:

open an inner, open an editor, make it the active part

shut down and restart

Note that the Package Explorer's stack indicates that it's the active part rather than the one that was active on the shutdown. Also, even though active the Tree doesn't have focus (it's actually on the Package Explorer stack's minimize button...

We should be to at least determine the part that was active on shutdown by following the MApplication's 'selectedElement' chain down to either an MPart or MPlaceholder.
Comment 1 Paul Webster CLA 2014-05-21 12:55:28 EDT
When I run the steps now, focus on restart goes to my quick access text field.

PW
Comment 2 Eric Moffatt CLA 2014-07-15 11:33:53 EDT
Paul, IIRC we 'tag' the active part on shutdown so we can find it again...I think the question is why doesn't that code work...
Comment 3 Wojciech Sudol CLA 2015-01-16 08:11:45 EST
(In reply to Eric Moffatt from comment #2)
> Paul, IIRC we 'tag' the active part on shutdown so we can find it again...I
> think the question is why doesn't that code work...

The problem was with restoring focus on SWT level. 
A fix has been provided in bug 348954, but it uncovered another issue on Mac (bug 431966), so we decided to disable the fix on Mac. Recently, the root cause of the bug 431966 has been fixed, so now we can reenable the original fix on Mac.
Review link: https://git.eclipse.org/r/39750. I tested the patch against bugs 348954 and 431966.
Comment 4 Wojciech Sudol CLA 2015-01-19 08:19:05 EST
(In reply to Wojciech Sudol from comment #3)
> Review link: https://git.eclipse.org/r/39750.

Released to master with 
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=57cbb8ced551819266aa83570f5fde75fe19a8ea.
Thank you Markus!

Review link for R4_4_maintenance: https://git.eclipse.org/r/39846.
Comment 5 Dani Megert CLA 2015-01-19 11:54:40 EST
+1 for 4.4.2, but please wait for Markus to confirm the fix work in 4.4.2.
Comment 6 Markus Keller CLA 2015-01-19 14:24:53 EST
The change looks good, and I couldn't reproduce bug 431966 any more.

Pushed to R4_4_maintenance with http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=bdebafd701f0380487b94349d5fbc2ec3c49a0c9
Comment 7 Wojciech Sudol CLA 2015-01-28 04:09:37 EST
Verified in 4.5 I20150126-2000.