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

Bug 207228

Summary: [context] editors from second window not restored upon activation
Product: z_Archived Reporter: Robert Elves <robert.elves>
Component: MylynAssignee: Shawn Minto <shawn.minto>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P4 CC: mik.kersten, rolf, shawn.minto, steffen.pingel
Version: unspecified   
Target Milestone: 3.0   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch
none
mylyn/context/zip none

Description Robert Elves CLA 2007-10-23 16:37:23 EDT
If editors are open in secondary window and task is deactivated, these editors are not restored upon reactivation of the task, and should ideally be restored in the secondary window if available. Mementos are only being saved for the active window which can cause this issue.
Comment 1 Shawn Minto CLA 2008-03-10 13:44:56 EDT
I think that it is important to restore the users entire state when a task is activated since when a task is deactivated all of editors close in all windows.  There is a mismatch between what is restored on activation and what is closed on task deactivation which can disorient the user especially if there are some key files open in the second window.
Comment 2 Shawn Minto CLA 2008-04-10 13:08:40 EDT
Will this be looked at for Mylyn 3.0?
Comment 3 Steffen Pingel CLA 2008-04-10 14:06:43 EDT
This is currently not a priority for Mylyn 3.0. Shawn, would you be willing to investigate a solution?
Comment 4 Mik Kersten CLA 2008-04-10 20:48:55 EDT
There could be some priority here if there is an impact on API.  Either way, the best chances of having it in 3.0 is to provide a patch with test coverage.
Comment 5 Shawn Minto CLA 2008-04-30 11:29:38 EDT
Created attachment 98198 [details]
patch

Here is a patch that makes restoring editors for multiple workbench windows work.  Right now, this is always on, but we could add a couple preferences to modify the behavior and whether it is supported.  The basic idea for how this works is that it tries to restore the editors to the window that they were originally in by using the window number.  If this doesn't work (i.e. one of the windows is closed), the active window gets the editors from the closed window.  The preferences that could be created are:

* Restore the active window on save to the current active window if there is no match for the saved window and that window was active
* Restore all windows to the active window if there is no match for the saved window

I also added API in MonitorUi for getting the launching workbench window and the monitored windows and have updated the ContextEditorManager to use these API's instead of using the MonitorUiPlugin.
Comment 6 Shawn Minto CLA 2008-04-30 11:29:40 EDT
Created attachment 98199 [details]
mylyn/context/zip
Comment 7 Mik Kersten CLA 2008-04-30 19:41:22 EDT
Wow, awesome.  Patch applied.