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

Bug 340875

Summary: Opening file from minimized package explorer does not switch to editor
Product: [Eclipse Project] Platform Reporter: Andrew Niefer <aniefer>
Component: UIAssignee: Dean Roberts <dean.t.roberts>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dean.t.roberts, emoffatt, remy.suen
Version: 4.1   
Target Milestone: 4.2 M3   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 357251, 357255, 357782    
Bug Blocks:    
Attachments:
Description Flags
Refactor TrimStack and the use of showStack none

Description Andrew Niefer CLA 2011-03-24 11:29:28 EDT
1 - Minimize the package explorer
2 - Open the package explorer (fly out, covering part of the editor)
3 - double click a file to open it

The file opens in the editor, but the package explorer remains open retaining focus.  I expect the package explorer to go back to minimized and the focus to go to the opened file.
Comment 1 Remy Suen CLA 2011-04-12 10:45:56 EDT
It doesn't seem like the minimized stacks care about keyboard focus. If you bring up a minimized view and then tab out of there so that your keyboard focus is in another part, it still stays up.
Comment 2 Dean Roberts CLA 2011-08-30 15:50:47 EDT
Not sure what comment 1 means.  3.8 works the same way.  If you open a fast view and try to tab out, the fast view stays open.

I am looking at this in 4.1.  There will be a few parts to this fix:
  1) Implementing some listeners so that the fastview closes when the correct model changes happen (such as selected element changes)
  2) Replacing some existing "hacks" that currently close the fast view in special cases like perspective swithces with more model friendly code like #1
  3) See if the open fast view code can be improved along the same lines.

I already have some working code for #1 that needs to be cleaned up.  I'll hold off on the patch until I have a reasonable solution for all 3 items above.
Comment 3 Remy Suen CLA 2011-08-30 16:05:54 EDT
(In reply to comment #2)
> Not sure what comment 1 means.  3.8 works the same way.  If you open a fast
> view and try to tab out, the fast view stays open.

In 3.x, if you select a minimized view and hit tab, it'll only ever be in the workbench window's main tool bar or on the part.

If you do the same in 4.x, you will be able to activate other views (with the minimized view still up and operational).
Comment 4 Dean Roberts CLA 2011-09-09 11:31:32 EDT
To update this defect, I am actively working on a patch for this, but at Eric's suggestion it is turning into a larger refactoring of TrimStack to fix a number of visible defects and implementation shortcomings.

1) Minimized Fast Views keeping focus
2) Fast Views staying open when they should close
3) Fast View implementation leaking into generic ModelServiceImpl

There will be some changes in EPartService and some new life cycle events that will go along with this work.
Comment 5 Dean Roberts CLA 2011-09-13 15:01:22 EDT
Created attachment 203287 [details]
Refactor TrimStack and the use of showStack

This patch is a substantial refactoring of TrimStack and the way that events and handlers are used to manipulate visible stacks items and tool item selection.

The paradigm is that selecting a tool item requests the Part Service to activate an appropriate part.  Part activation fires a bringToTop event, which is handled resulting in a minimized stack being show, or closed.  As a last step, tool item selection is rationalized.

The result of this patch is that:
   1) Using a minimized view to open an editor causes the minimized view to close
   2) Nobody needs to use injection to call showStack(boolean) directly
   3) Event flow through the TrimStack part is simplified.

The patches for this fix need to be applied in the bugzilla dependancy order.  Individual patches can be found on those defects.

357135
357136
357255
(Use GenTopic at this point to regenerate UIEvents)
340875
Comment 6 Dean Roberts CLA 2011-09-15 08:26:31 EDT
*** Bug 357076 has been marked as a duplicate of this bug. ***
Comment 7 Dean Roberts CLA 2011-09-15 08:30:47 EDT
Remy noticed that the patch list in comment 5 was missing a defect.  The patch for bug 357251 also needs to be applied.  So the list is:

357251
357135
357136
357255
(Use GenTopic at this point to regenerate UIEvents)
340875
Comment 8 Dean Roberts CLA 2011-09-15 08:34:13 EDT
Adding dependency on the new bug 357782 - PartActivationHistory does not select proper activation candidate for part stacks.

I suggest that the other patches can be be reviewed, applied and released before a solution for the new dependency is found.
Comment 9 Eric Moffatt CLA 2011-09-21 14:50:30 EDT
Cool, this is a good start ! There are still issues revolving around using the bring to top (BTT) event to tear down (collapse) the FV stack.

The Outline view for example will call BTT on an editor but not activate it. A number of other views (Package Explorer, Search at least) also do this when the 'single click' preference is on. In this case the current logic collapses the trim stack even though it still contains the active part, leaving the UI in a strange state.

Perhaps we should collapse only when the 'open' trim stack no longer contains the *active* part. 

The BTT event should be used to open the stack containing the part that was brought to the top on the premise that BTT == 'I want to see this view'.

Also, an empty editor area currently shows no icon when it's minimized.

In any case this is certainly good enough to commit, knowing that we'll address the remaining issues this milestone...
Comment 10 Eric Moffatt CLA 2011-09-21 15:00:00 EDT
Pushed in >20110921. 

commit ea50f1c2b4e44eded93e42fb8a84381d0f36e2ad

I can't mark this one fixed yet but I've reset the milestone to M3.
Comment 11 Dean Roberts CLA 2011-09-22 09:29:15 EDT
I believe this defect should be closed/fixed and a new defect opened based on what was reported in comment 9.
Comment 12 Eric Moffatt CLA 2011-09-22 21:11:11 EDT
I don't care...as long as one of them has a patch on it...;-).
Comment 13 Dean Roberts CLA 2011-09-23 09:50:27 EDT
Marking as fixed and opening new defect for over aggressively closing fast views.
Comment 14 Dean Roberts CLA 2011-10-26 11:31:44 EDT
I20111025-2000