Community
Participate
Working Groups
Closing one of several open editors (all showing the same, modified, file) prompts user to save changes. Such dialog is confusing (correct answer is 'No' ;) ).
Nick, according to bug 112225 it would be the right thing not to prompt and could be solved using the new ISaveableModel* support, right?
Yes, if the text editors implements ISaveableModelSource, with the ISaveableModel mapping to the underlying IDocument, this prompt could be avoided for editors on the same document in the same window. I think we should do this for 3.2.
I am working on this right now. May I take this bug?
Yes please ;-) Do you intend to provide a patch for Text? I don't see how you could solve this just on the UI side.
Yes, the plan is to provide a patch.
Created attachment 36292 [details] work in progress Just to save my current state...
Thanks Boris.
Created attachment 36967 [details] work in progress
Daniel, I forgot to talk to you about this earlier but would like to see it in 3.2. Could you have a look at the latest patch? Do you think we can still do this?
I'm reluctant to do and bring this change to the PMC at this point. Boris, how do you assess the risk when applying the patch? In addition what would be the ETA for a clean patch which also handles editor input and document provider changes and correct formatting as it is used in Platform Text?
Created attachment 38458 [details] patch against org.eclipse.ui.workbench.texteditor Sorry about that, I saw two patches and thought the newer of the two was my current state. Here is the patch I wanted you to look at. I deleted the spaces between assigned variables and the "=", but I'm sure there are other differences between the default formatter settings and the settings you are using. Are your formatter settings available somewhere?
Created attachment 38459 [details] helper plugin jar This helper plugin provides a view (Model->Models) that displays the list of open "Saveable" objects and their dirty state. It can be used while testing, to verify that the internal state of the Workbench is correct. Note that without the patch, if you open a second editor on a file, the view contains two entries. With the patch, there is only one entry. I have tested the patch by checking "Close editors automatically" in the preferences with a low number of editors that should be open concurrently. I would be interested to know if there are other interesting cases like this that I should test.
As for the risk, it is hard to say since I am not familiar enough with the text editor. If updateDocumentProvider() is guaranteed to be called when either the document provider or the editor input changes, I think the risk is low. If the assumption is wrong, we should not make this change now. Ultimately, it is your call. I would like to see the patch in if possible, because it makes use of API that would otherwise not be used by the SDK itself.
Boris, I'll take a look at this for RC2. Did you also make tests with multi-page editors like the PDE Manifest editor?
The latest patch does not work for non-multipage editors and also only works per editor type i.e. if I open A.java with the Text and the Java editor I still get asked when closing one of the two. This gives an inconsistent story to the user and might be confusing. I prefer to consistently get (or not get) the dialog in all cases and therefore will not apply this patch for 3.2. We should work towards a more complete story for 3.3. This will also give us time to carefully test the new code and let others, like multi-page editors adopt to the new behavior i.e. not ask to save if another editor still works on the same model object (or a higher level model that contains the one which gets closed).
it seems like there is a related issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=106689
*** Bug 106689 has been marked as a duplicate of this bug. ***
I'll look into the problem where the textual (e.g. Text and Java) editor interact which each other but will probably have to move it back to Platform UI for the multi-page editor scenario.
See also bug 17102.
First cut of a fix is in HEAD. Available in builds > N20061218-0010. NOTE: bug 17102 in Platform UI land is almost a dup of this one. I close this one as the text part is done. Open issue as mentioned in comment 15 might be multi-page editors. The following scenario works: we can open the PDE editor plus e.g. the text editor on plugin.xml and when the file is dirty you can close the text editor without getting a dialog.
Filed bug 168435 which reports that the user cannot undo his close strategy.
*** Bug 17102 has been marked as a duplicate of this bug. ***
Verified in I20070207-0800.
*** Bug 169669 has been marked as a duplicate of this bug. ***