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

Bug 326081

Summary: [Compatibility] Workbench thinks there's an active editor even if it's behind views
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Remy Suen <remy.suen>
Severity: normal    
Priority: P3    
Version: 1.0   
Target Milestone: 4.1 M6   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 321864    
Attachments:
Description Flags
WorkbenchPage patch v1 none

Description Remy Suen CLA 2010-09-23 13:24:00 EDT
1. Open an editor.
2. Drag it to a view stack.
3. Activate another view in that stack.
4. Ctrl+W
5. The editor gets closed. This doesn't feel right... :|
Comment 1 Remy Suen CLA 2010-09-23 13:40:49 EDT
One caveat is that we can't simply return null if the last active editor is not visible (behind other parts in another stack) as there may be an editor that's visible in the shared area.
Comment 2 Eric Moffatt CLA 2010-09-23 15:03:05 EDT
Sounds like this should be scenario 'K' ('L'?).

This cannot happen in 3.x. The 'active' editor (even when it's the active part) will always be on top (hmmm, is there any 'show editor NOACTIVATE' API as we have for views? If so we might be able to set this up in 3.x to see what it does...).

This is a good one...I agree that closing an editor that's not 'on top' seems quite strange. We could simply check this and ignore it but we're left with other interesting possibilities...what's 'Undo' do?
Comment 3 Remy Suen CLA 2010-09-23 15:54:02 EDT
(In reply to comment #2)
> This cannot happen in 3.x. The 'active' editor (even when it's the active part)
> will always be on top (hmmm, is there any 'show editor NOACTIVATE' API as we
> have for views? If so we might be able to set this up in 3.x to see what it
> does...).

Yes we do, though it is still technically the "active" editor since it is "on top". The question becomes whether that editor becomes the active one or not if you have multiple editor stacks and you show an editor that's not in the same stack as the last active one.

> what's 'Undo' do?

Probably nothing since the active part does not support undo.
Comment 4 Remy Suen CLA 2011-02-04 13:29:35 EST
This is the order I will use to determine what is the "active editor".

1. The currently active part if said part is an editor.
2. Last editor that was activated in the shared area (the org.eclipse.ui.editorss MArea) that is visible or is the selected element of its part stack.
3. Last activated editor outside the shared area/perspective that is visible or is the selected element of its part stack.

If all three options are exhausted then all the remaining editors are presumed to be "in the back" of a part stack and thus should not be deemed "active" (as shown by comment 0).
Comment 5 Remy Suen CLA 2011-02-07 09:00:33 EST
Created attachment 188436 [details]
WorkbenchPage patch v1
Comment 6 Remy Suen CLA 2011-02-07 09:14:39 EST
Fix released to CVS HEAD.
Comment 7 Remy Suen CLA 2011-03-08 13:46:07 EST
Verified with I20110307-2200 on Windows XP.