Community
Participate
Working Groups
When user's switch tasks with a dirty edtior still open, they are presented with a warning asking to save or cancel. Often time the user was unaware of the editor being dirty so wants to check what is going on before switching the task so presses Cancel. Unfortunately, the task still switches (against expectations) but at least the editor is left open (but now being edited and polluting the wrong task context). It seems like the best solution here would be to test for open dirty editors upon task switching and present our own, more informative dialog that upon canceling, actually cancels the task switch and focuses the dirty editor.
Not sure if that's supported by the workbench API. Shawn?
I dont know if this is supported either. Would have to look into this further, but I have had this thought in the past as well as cancel seems that it should cancel deactivation.
It's hard to imagine this not being supported. I think we'd just have to go through all open editors calling IEditorPart.isDirty.
Created attachment 218837 [details] proof of concept We might want to create a different API, e.g. an extension point for adding a new kind of listener, but this works well.
Created attachment 218838 [details] mylyn/context/zip
Created attachment 218961 [details] proof of concept
I've been using this for a couple of months and I find it to be an improvement.
Created attachment 222661 [details] proof of concept
Sam, do you plan to work on this or can I take it over?
Feel free to take it over. I've created the following reviews: 13879: 334937: provide API for canceling a task switch [I77eb930d] https://git.eclipse.org/r/#/c/13879/ 13880: 334937: [context] support canceling the entire task switch when user cancels dirty editor save [Ifa96cc89] https://git.eclipse.org/r/#/c/13880/
I've been running on those reviews for a long time and it's an improvement, but one change I'd like to make is to not show the dialog when the only dirty editor is the task editor for the active task (that is, just show the dialog asking the user to save, but don't ask if they really want to cancel the task switch).
I'd like the dialog to have the following options: Deactivate Task and Save All | Deactivate and Save Some... | Cancel
I've added an additional option "Deactivate Task and Save All" which will immediately save everything that is dirty. There is an additional quirk where if you try to cancel a save on deactivation for only one dirty task (which is also the deactivated task), another save dialog would appear. Looking into that now.
Looks great! The changes have been merged: 47904: 334937: provide API for canceling a task switch [I0962f312] https://git.eclipse.org/r/#/c/47904/ 47669: 334937: support cancelling the entire task switch when user cancels dirty editor save [I9d874250] https://git.eclipse.org/r/#/c/47669/