Bug 486644 - Automatic save of dirty textual editors - first iteration
Summary: Automatic save of dirty textual editors - first iteration
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.6 M7   Edit
Assignee: Axel RICHARD CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 34076 (view as bug list)
Depends on:
Blocks: 492401 492438 492587
  Show dependency tree
 
Reported: 2016-01-27 08:35 EST by Axel RICHARD CLA
Modified: 2016-07-07 08:00 EDT (History)
15 users (show)

See Also:


Attachments
Strange looking auto-save status bar item (Windows 7) (2.32 KB, image/png)
2016-02-19 08:01 EST, Dani Megert CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Axel RICHARD CLA 2016-01-27 08:35:22 EST
Here is a proposal for a FIRST implementation of the auto-save in Eclipse:

*The auto-save will be disabled by default. Thus, this will be without consequences for Eclipse users. It need feedback of the community to have a clear view of the impact on usage and performance.
*The auto-save will only save textual editors.
*The auto-save will be active for all textual editors at once.
*The auto-save will save dirty editors automatically (based on the keyboard activity).
*The period of inactivity before automatic save will be customizable in Eclipse Preferences (from Window > Preferences > General > Editors > Auto-save).
*The default value of inactivity before automatic save will be set to 60 seconds.
*The minimum value will be 1 second.
*The maximum value will be the maximum value of a java integer (2147483647 for a 32-bits JVM).
*A warning message will be displayed in case of unauthorized values.
*The status bar will provide a quick access to enable/disable the auto-save (by double-click).
*This quick access will be only visible for appropriate editors.

Here is the wiki link that fully describes the proposition (user story, specification, mock-ups, limitations, possible evolutions): https://wiki.eclipse.org/Platform_UI/AutoSave
Comment 1 Axel RICHARD CLA 2016-01-27 08:36:25 EST
A first implementation will be provided soon.
Comment 2 Eike Stepper CLA 2016-01-28 10:37:16 EST
(In reply to Axel RICHARD from comment #0)
> *The auto-save will only save textual editors.

Then, shouldn't the new Auto-Save preference page appear under Text Editors?
Comment 3 Eric Moffatt CLA 2016-01-28 10:43:57 EST
I'm interested in this since I use auto-save all the time now in Orion and I've come to love it :)

One thing you'll have to look out for is the interaction of auto-save with local history. If I set the auto-save to 1 sec (as I would) I don't want the local history to get spammed with 2-3 char diffs. 

Perhaps you could implement a 'generate local history' timer set at say 5 mins so that we only generate a local history record if the file has changed since the last record was generated and it's been > 5 mins.
Comment 4 Mickael Istria CLA 2016-01-28 10:44:44 EST
(In reply to Axel RICHARD from comment #0)
> *The auto-save will only save textual editors.

Is this a limitation you're planning to drop in a next iteration? I believe the save behavior must be consistent between all editors for a more unified user experience. So in fine, this constraint will most likely have to disappear.
Isn't it actually more complicated to set up that restriction than it is to apply auto-save on all editors?
What about multi-page editors with a form and a text (such as pom.xml) ?
Comment 5 Axel RICHARD CLA 2016-01-28 10:49:26 EST
(In reply to Eike Stepper from comment #2)
> (In reply to Axel RICHARD from comment #0)
> > *The auto-save will only save textual editors.
> 
> Then, shouldn't the new Auto-Save preference page appear under Text Editors?

Eike,

I asked the same question to myself. In the future steps, the auto-save will possibly save various kinds of editors, not only text editors. If we put the preference page under 'Text Editors', we should then move it in the future under 'Editors'. Some users could be troubled by this change.
So I think it is better that the preference page appears under 'Editors' and not under 'Text Editors', It will allow to not trouble users habits.
Comment 6 Eike Stepper CLA 2016-01-28 10:53:43 EST
(In reply to Axel RICHARD from comment #5)

That sounds reasonable to me. Thanks for the clarification ;-)
Comment 7 Axel RICHARD CLA 2016-01-28 10:57:42 EST
(In reply to Eric Moffatt from comment #3)
> I'm interested in this since I use auto-save all the time now in Orion and
> I've come to love it :)
> 
> One thing you'll have to look out for is the interaction of auto-save with
> local history. If I set the auto-save to 1 sec (as I would) I don't want the
> local history to get spammed with 2-3 char diffs. 
> 
> Perhaps you could implement a 'generate local history' timer set at say 5
> mins so that we only generate a local history record if the file has changed
> since the last record was generated and it's been > 5 mins.

I totally understand your concerns, but as part of the FEEP initiative, we can't handle all the whole problematic with the time given. That's why it is a first iteration and may be others iterations will come with next FEEP rounds. Thanks for understanding.
Comment 8 Axel RICHARD CLA 2016-01-28 10:59:19 EST
(In reply to Mickael Istria from comment #4)
> (In reply to Axel RICHARD from comment #0)
> > *The auto-save will only save textual editors.
> 
> Is this a limitation you're planning to drop in a next iteration? I believe
> the save behavior must be consistent between all editors for a more unified
> user experience. So in fine, this constraint will most likely have to
> disappear.
> Isn't it actually more complicated to set up that restriction than it is to
> apply auto-save on all editors?
> What about multi-page editors with a form and a text (such as pom.xml) ?

Mickael,

As part of the FEEP initiative, we can't handle all the whole problematic with the time given. That's why it is a first iteration and may be others iterations will come with next FEEP rounds. Thanks for understanding.
Comment 9 Mickael Istria CLA 2016-01-28 11:01:39 EST
(In reply to Axel RICHARD from comment #8)
> As part of the FEEP initiative, we can't handle all the whole problematic
> with the time given. That's why it is a first iteration and may be others
> iterations will come with next FEEP rounds. Thanks for understanding.

Sure, I understand. However, I'm technically curious about why is limiting support to text editor simpler than leaving it open. If your implementation is relying on the save command; what's the difference between a text and a diagram editor?
Comment 10 Lars Vogel CLA 2016-01-28 11:10:51 EST
I think a pure time-based approach based on the keyboard activity is wrong. I have uploaded a similar approach to https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076#c68 but Dani right fully rejected that approach. 

I did not find the time to review the existing contribution from Vijay Aravamudhan (see for example https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076#c74)

Axel, did you review Vijay code?
Comment 11 Bruno Medeiros CLA 2016-01-28 11:15:15 EST
(In reply to Axel RICHARD from comment #0)
> Here is a proposal for a FIRST implementation of the auto-save in Eclipse:
> 
> *The auto-save will only save textual editors.

> 
> Here is the wiki link that fully describes the proposition (user story,
> specification, mock-ups, limitations, possible evolutions):
> https://wiki.eclipse.org/Platform_UI/AutoSave

There's a few key UI aspects that are not described there. For example, does auto-save save to the same file that the editor is editing, or to a backup location elsewhere? I'm assuming it's the former since another concern mentioned in the wiki is possible interactions with the auto-build feature (that is only a concern if saving to the same file). However, in any case this aspect should be mentioned explicitly.

What happens to the UI dirty state of an editor when it's auto-saved? Does the editor become non-dirty? Or is the save just done internally/transparently?


Also, what about due diligence of technical feasibility? That is, what about - before discussing how the preference page for the auto-save feature will work (which is of minor importance anyways) - we check about the technical feasibility, implementation wise, of auto-save in the current Platform code. It's important to get a bearing early on of how hard this would be to implement, and what the implications could be for the rest of Platform behavior and API. I'll give a concrete example, based upon my earlier explorations on this feature:

Saving a file as it's currently implemented is an action that is performed in the UI thread. This means the UI thread may be blocked by a minuscule amount of time, but possibly a noticeable one (20-100ms). This is currently fine because a save is only invoked after some manual user action (like saving the editor, or building the workspace). So it's ok if the user experiences that small delay when saving a file.

However once we add a feature that makes a save happen automatically, especially if we want auto-save to happen frequently, such delays would be extremely detrimental to the user experience (if not downright unadmissable). As such the file save should happen on a background thread. And this brings up the issue of whether the Platform API is ready to handle that. In theory it should, but this needs to be looked at. Hopefully someone with experience on this aspect of the API could comment on it, but it needs to be looked at properly in any case. Because even if the ITextFileBuffer's can be saved on a background thread, they still fire listener events to some of listeners (and now those events would be triggered outside the UI thread). This could potentially be a breaking change, if the listeners assume they are only triggered in UI thread.

Last time I looked at the Platform code (ITextFileBuffers, IDocument's and related stuff), it was quite hard to figure what the actual concurrency constraints where.
Comment 12 Dani Megert CLA 2016-01-28 11:17:39 EST
(In reply to Mickael Istria from comment #9)
> (In reply to Axel RICHARD from comment #8)
> > As part of the FEEP initiative, we can't handle all the whole problematic
> > with the time given. That's why it is a first iteration and may be others
> > iterations will come with next FEEP rounds. Thanks for understanding.
> 
> Sure, I understand. However, I'm technically curious about why is limiting
> support to text editor simpler than leaving it open. If your implementation
> is relying on the save command; what's the difference between a text and a
> diagram editor?

+1. I don't see how the restriction makes it easier for you.


As outlined in bug 34076 the solution should simply save the files periodically in the background so that the current user experience stays the same. No impact on dirty state or performance due to constant builds.

Only when the IDE crashes those files are used to restore the last saved state.
Comment 13 Lars Vogel CLA 2016-01-28 11:31:22 EST
(In reply to Dani Megert from comment #12)

> As outlined in bug 34076 the solution should simply save the files
> periodically in the background so that the current user experience stays the
> same. No impact on dirty state or performance due to constant builds.
> 
> Only when the IDE crashes those files are used to restore the last saved
> state.

I think that is not the desired outcome for the user. My understanding of the requirement is that the usage of Ctrl+S or the save button can be avoided. Similar to IntelliJ, in which the user never has to select the save operation and an editor never gets dirty.

I think you are describing a different feature. Not "auto-save" but "a better way to recover user changes in case of a crash", which I think is not scope of this bug and FEEP.
Comment 14 Dani Megert CLA 2016-01-28 11:38:29 EST
(In reply to Lars Vogel from comment #13)
> I think you are describing a different feature. Not "auto-save" but "a
> better way to recover user changes in case of a crash", which I think is not
> scope of this bug and FEEP.

The FEEP came out of bug 34076 where many different approaches are discussed. Maybe a poll should be done before investing to much into one or the other solution.

Note that besides the obvious performance hit with the proposed solution where save happens on the real editor and in the UI , it will drive all users who use Save Actions mad, because in the middle of typing it will reformat their code. Bummer!
Comment 15 Mickael Istria CLA 2016-01-28 11:44:06 EST
(In reply to Dani Megert from comment #14)
> Note that besides the obvious performance hit with the proposed solution
> where save happens on the real editor and in the UI , it will drive all
> users who use Save Actions mad, because in the middle of typing it will
> reformat their code. Bummer!

I don't think it's that much a bummer. Maybe at usage, it will become comfortable to see the code reorganized correctly just as we type, rather than a bulk operation on save. A benefit of immediate actions is that they are also more "pedagogic" than delayed correction.
And for sure users' habits will change if they come to use the auto-save. Probably they'll use save action less and less. In any case, they'll do what they want since they have always had choice...
So I don't believe this issue about save action is something that should be taken into account right now. It will be easier to see how good/bad it is once there is an implementation working.
Comment 16 Lars Vogel CLA 2016-01-28 11:47:58 EST
(In reply to Dani Megert from comment #14)
> (In reply to Lars Vogel from comment #13)
> > I think you are describing a different feature. Not "auto-save" but "a
> > better way to recover user changes in case of a crash", which I think is not
> > scope of this bug and FEEP.
> 
> The FEEP came out of bug 34076 where many different approaches are
> discussed. Maybe a poll should be done before investing to much into one or
> the other solution.

I would suggest that the foundation should clarify the scope of the development with Axel and the Eclipse PMC, as they paying for it.

> Note that besides the obvious performance hit with the proposed solution
> where save happens on the real editor and in the UI , it will drive all
> users who use Save Actions mad, because in the middle of typing it will
> reformat their code. Bummer!

I agree that this is one of the challenges how to implement this. My first guess would be that save actions and auto-save should be exclusive options, but maybe looking at how other IDEs handle that might bring up better ideas.
Comment 17 Holger CLA 2016-01-28 14:12:53 EST
(In reply to Mickael Istria from comment #15)
> A benefit of immediate actions is that they are also more "pedagogic" than delayed correction.

Typing an open comment /* will wreak havoc on the rest of the file ... at least it makes for a good excuse to not document your code anymore :-)


(In reply to Lars Vogel from comment #13)
> I think you are describing a different feature. Not "auto-save" but "a
> better way to recover user changes in case of a crash", which I think is not
> scope of this bug and FEEP.

Right, but in absence of the second, I'd try to use the first as a poor man's crash recovery, though given the choice, I'd prefer Dani's suggestion as the real thing.

Maybe that is why I felt 60 sec is way to short and I already envisioned myself setting it to about 15-20 minutes, to give me enough time to do my normal manual saves as I'm used to and only cover up should I walk off to lunch without saving.


(In reply to Axel RICHARD from comment #0)
> *The auto-save will save dirty editors automatically (based on the keyboard activity).

Axel, can you please confirm: Keyboard-activity will reset the timer, so the timeout won't ever expire, as long as I still type another letter every 59 seconds?
Comment 18 Axel RICHARD CLA 2016-01-29 03:43:23 EST
(In reply to Mickael Istria from comment #9)
> (In reply to Axel RICHARD from comment #8)
> > As part of the FEEP initiative, we can't handle all the whole problematic
> > with the time given. That's why it is a first iteration and may be others
> > iterations will come with next FEEP rounds. Thanks for understanding.
> 
> Sure, I understand. However, I'm technically curious about why is limiting
> support to text editor simpler than leaving it open. If your implementation
> is relying on the save command; what's the difference between a text and a
> diagram editor?

Mickael,

For example, a save of a Sirius editor (diagram editor) implies a save of a Sirius Session (see https://www.eclipse.org/sirius/doc/developer/Architecture.html#session), which is potentially costly in time and memory. You can imagine the same with a CDO session and many other technologies.
Comment 19 Mickael Istria CLA 2016-01-29 05:54:47 EST
(In reply to Axel RICHARD from comment #18)
> For example, a save of a Sirius editor (diagram editor) implies a save of a
> Sirius Session (see
> https://www.eclipse.org/sirius/doc/developer/Architecture.html#session),
> which is potentially costly in time and memory. You can imagine the same
> with a CDO session and many other technologies.

Ok.
I believe that for a 1st iteration, it's more user-friendly to offer a consistent save behavior for editors, even if some of them may take time and pop-up a dialog from time to time; than to have different processes for different editors.
By the way, you may consider allow the save operation for those editors a background and non-blocking operation, so user wouldn't even notice that saving operation. A command parameter could be used to explicit the need for a "background" save.
Comment 20 Axel RICHARD CLA 2016-01-29 07:59:21 EST
(In reply to Lars Vogel from comment #10)
> I think a pure time-based approach based on the keyboard activity is wrong.
> I have uploaded a similar approach to
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076#c68 but Dani right fully
> rejected that approach. 
> 
> I did not find the time to review the existing contribution from Vijay
> Aravamudhan (see for example
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076#c74)
> 
> Axel, did you review Vijay code?

Lars, yes I saw your contribution and the refusal of Dani. I don’t see in the comment of the associated review why it is a wrong approach. 
Can you share with us why you think that ?

About the Vijay code, It is an old development and not a platform UI contribution. After imported the code, I didn’t succeed to run the plugin. It is may minor things to fix, or not, I don’t know. There are probably good ideas in his code that will help me.
Comment 21 Axel RICHARD CLA 2016-01-29 08:00:24 EST
(In reply to Bruno Medeiros from comment #11)
> What happens to the UI dirty state of an editor when it's auto-saved? Does
> the editor become non-dirty? Or is the save just done
> internally/transparently?

When the editor is save by the auto-save, it will become non dirty (like a ‘manual’ save).
Comment 22 Axel RICHARD CLA 2016-01-29 08:05:22 EST
(In reply to Holger from comment #17)
> 
> Axel, can you please confirm: Keyboard-activity will reset the timer, so the
> timeout won't ever expire, as long as I still type another letter every 59
> seconds?

Yes I confirm this behavior.
Comment 23 Axel RICHARD CLA 2016-01-29 08:07:22 EST
(In reply to Lars Vogel from comment #16)
> (In reply to Dani Megert from comment #14)
> > (In reply to Lars Vogel from comment #13)
> > > I think you are describing a different feature. Not "auto-save" but "a
> > > better way to recover user changes in case of a crash", which I think is not
> > > scope of this bug and FEEP.
> > 
> > The FEEP came out of bug 34076 where many different approaches are
> > discussed. Maybe a poll should be done before investing to much into one or
> > the other solution.
> 
> I would suggest that the foundation should clarify the scope of the
> development with Axel and the Eclipse PMC, as they paying for it.
> 
> > Note that besides the obvious performance hit with the proposed solution
> > where save happens on the real editor and in the UI , it will drive all
> > users who use Save Actions mad, because in the middle of typing it will
> > reformat their code. Bummer!
> 
> I agree that this is one of the challenges how to implement this. My first
> guess would be that save actions and auto-save should be exclusive options,
> but maybe looking at how other IDEs handle that might bring up better ideas.

Lars, Dani, everybody,

The Eclipse Foundation has missioned us to provide a first implementation of the auto-save.

The scope accepted by the Eclipse Foundation is:

- A first step of the auto-save in Eclipse IDE, which can be largely tested and try. This project will be to make a short specification of the expected behavior for a first run. This work will:
- select one user story from the bug discussions
- make a user experience specification (with functional scope and limitations)
- propose some UI mockups
- the proposed behavior is to not activate this feature by default because it need feedback of the community to have a clear view of the impact on usage and performance.
- as JDT is the most popular editors, we will focus our work on this editor.
The autosave features for Java editor will be implemented based on the choice made during the specification step.
- the crash recovery will be out of scope
- the impact of auto-save with local history, auto-build, auto-format … will be out of scope
- at the end of work, a short report will be created to explain the result, its limitations, and a first proposition of what could be a more generic architecture to take in account other kinds of editors

At first sight, It is not much more complicated to have the auto-save for all text editors not JDT only, this is why I propose to have the auto-save in Platform UI instead of JDT UI. If you, Platform UI leaders think I should only handle JDT editors for this first iteration, I will move the bug in JDT UI. If you’re ok, I’ll try, in a first contribution, to handle text editors. Then, based on this on the first contribution, we’ll see what can be improved or added.

The idea of our work as part of the FEEP initiative is to provide a first implementation of the auto-save, which will have a very simple behavior and will be without consequences for the users.
That’s why the feature will not be active by default. 
That’s why the default value of the countdown I proposed is set to 60 seconds.
That’s why the value of the countdown will be modifiable.
That’s why we will not handle crash recovery, local history, background saving… for this first iteration.

I think we should provide a first version of the auto-save as I proposed in this ticket, and then gather the community feedback.
Then, based on  this feedback, we (the community) will improve the auto-save.
The initial bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076 has been reported in 2003 and there’s still no auto-save in Eclipse IDE. I agree this is a complex subject, but after 13 years of discuss, may be It is time to try something. That’s what the FEEP initiative want to do.
Comment 24 Lars Vogel CLA 2016-01-29 12:08:47 EST
(In reply to Axel RICHARD from comment #20)
> (In reply to Lars Vogel from comment #10)
> > I think a pure time-based approach based on the keyboard activity is wrong.
> > I have uploaded a similar approach to
> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076#c68 but Dani right fully
> > rejected that approach. 
> > 
> > I did not find the time to review the existing contribution from Vijay
> > Aravamudhan (see for example
> > https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076#c74)
> > 
> > Axel, did you review Vijay code?
> 
> Lars, yes I saw your contribution and the refusal of Dani. I don’t see in
> the comment of the associated review why it is a wrong approach. 
> Can you share with us why you think that ?
> 

I share the concerns about local history. 

But more importantly, auto-save should IMHO not a "delayed" time based save but consider other user interactions as well. For example if I enable auto-save and start my Java program via Ctrl + F11, I don't want to see a popup asking me if I want to save. In general all actions in which I leave the current editor or trigger an command/ action should save the editor.
Comment 25 Lars Vogel CLA 2016-01-29 12:11:43 EST
Axel, to your other question, I think the Platform UI project (which includes platform.text) is the right place to handle the devrlopment, doing this in JDT would IMHO wrong.
Comment 26 Axel RICHARD CLA 2016-02-01 12:04:29 EST
(In reply to Lars Vogel from comment #24)
> But more importantly, auto-save should IMHO not a "delayed" time based save
> but consider other user interactions as well. For example if I enable
> auto-save and start my Java program via Ctrl + F11, I don't want to see a
> popup asking me if I want to save. In general all actions in which I leave
> the current editor or trigger an command/ action should save the editor.

Yes, I'm agree, another example is the closing of a dirty editor who prompt to the user a dialog "XXX has been modified. Save Changes ?". 
If, in these cases, the auto-save preference state is enabled, then the prompt dialog could be not launched. I think this is compatible with my proposition. I will think about other similar cases, and see if it is possible to handle it.
Comment 27 Dani Megert CLA 2016-02-02 09:40:02 EST
(In reply to Axel RICHARD from comment #23)
> Lars, Dani, everybody,
> 
> The Eclipse Foundation has missioned us to provide a first implementation of
> the auto-save.
> 
> The scope accepted by the Eclipse Foundation is:
> 
> - A first step of the auto-save in Eclipse IDE, which can be largely tested
> and try. This project will be to make a short specification of the expected
> behavior for a first run. This work will:
> - select one user story from the bug discussions

Why not ask the community before you choose a scenario?


The proposed solution must work for all editors in the Eclipse SDK (including PDE editors), but also for editors that are based on the Structured Source Editor framework from WTP (e.g. XML editor).


> - as JDT is the most popular editors, we will focus our work on this editor.

Auto-save is a platform concept that needs to work for most (if not all) editors.


> - the crash recovery will be out of scope

That was one of (if not) the major concern/request in the original bug 34076. Ignoring that is taking the original bug report into a wrong direction.


> That’s why the feature will not be active by default. 

+1
Comment 28 Axel RICHARD CLA 2016-02-02 11:51:38 EST
(In reply to Dani Megert from comment #27)
> (In reply to Axel RICHARD from comment #23)
> > Lars, Dani, everybody,
> > 
> > The Eclipse Foundation has missioned us to provide a first implementation of
> > the auto-save.
> > 
> > The scope accepted by the Eclipse Foundation is:
> > 
> > - A first step of the auto-save in Eclipse IDE, which can be largely tested
> > and try. This project will be to make a short specification of the expected
> > behavior for a first run. This work will:
> > - select one user story from the bug discussions
> 
> Why not ask the community before you choose a scenario?
> 
> 
> The proposed solution must work for all editors in the Eclipse SDK
> (including PDE editors), but also for editors that are based on the
> Structured Source Editor framework from WTP (e.g. XML editor).

Dani, thank you for your answer.

The initial bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076 has been reported in 2003 and there’s still no auto-save in Eclipse IDE. That shows it is very hard to find an ideal solution that is suitable for everyone from the beginning.
I think three choices are possible:
1) we implement and push a limited feature for Neon, but a working one.
2) we propose a vote, make specifications based on this vote for a more generic solution which will try to handle all use cases and editors, but with no functional feature in the short term.
3) we propose the feature only for the JDT, not for all textual editors, in agreement with our initial proposal to the FEEP.

Today, it is impossible to reach the second choice with the Neon’s schedule and the FEEP’s budget, and it seems very hard to me to get a consensus without a first working limited feature.
The first choice seems the most reasonable, if we take care to implement a solution that will be enough open and generic to handle all use cases and editors.

Regards,
Comment 29 Dani Megert CLA 2016-02-02 13:03:17 EST
(In reply to Axel RICHARD from comment #28)
> (In reply to Dani Megert from comment #27)
> > (In reply to Axel RICHARD from comment #23)
> > > Lars, Dani, everybody,
> > > 
> > > The Eclipse Foundation has missioned us to provide a first implementation of
> > > the auto-save.
> > > 
> > > The scope accepted by the Eclipse Foundation is:
> > > 
> > > - A first step of the auto-save in Eclipse IDE, which can be largely tested
> > > and try. This project will be to make a short specification of the expected
> > > behavior for a first run. This work will:
> > > - select one user story from the bug discussions
> > 
> > Why not ask the community before you choose a scenario?
> > 
> > 
> > The proposed solution must work for all editors in the Eclipse SDK
> > (including PDE editors), but also for editors that are based on the
> > Structured Source Editor framework from WTP (e.g. XML editor).
> 
> Dani, thank you for your answer.
> 
> The initial bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076 has been
> reported in 2003 and there’s still no auto-save in Eclipse IDE. That shows
> it is very hard to find an ideal solution that is suitable for everyone from
> the beginning.
> I think three choices are possible:
> 1) we implement and push a limited feature for Neon, but a working one.
> 2) we propose a vote, make specifications based on this vote for a more
> generic solution which will try to handle all use cases and editors, but
> with no functional feature in the short term.
> 3) we propose the feature only for the JDT, not for all textual editors, in
> agreement with our initial proposal to the FEEP.
> 
> Today, it is impossible to reach the second choice with the Neon’s schedule
> and the FEEP’s budget, and it seems very hard to me to get a consensus
> without a first working limited feature.
> The first choice seems the most reasonable, if we take care to implement a
> solution that will be enough open and generic to handle all use cases and
> editors.

3) is no option for me. 1) depends on the scope of "limited". As said, it must at least work for all editors in the SDK and SSEs.
Comment 30 Mickael Istria CLA 2016-02-02 13:12:41 EST
(In reply to Axel RICHARD from comment #28)
> 1) we implement and push a limited feature for Neon, but a working one.
> 2) we propose a vote, make specifications based on this vote for a more
> generic solution which will try to handle all use cases and editors, but
> with no functional feature in the short term.
> 3) we propose the feature only for the JDT, not for all textual editors, in
> agreement with our initial proposal to the FEEP.

1 is the best solution, however I don't support your definition of "limited" to only some editors.
Having a hybrid behavior with editors behaving differently inside the same workspace is really not a pleasant user-experience. Users won't understand why some are working, some other not and it will drive them crazy so they'll either forget to save some editors, or always use Ctrl-S (which is exactly the opposite purpose of this issue).

I believe that a solution that would save ALL editors, even if some (Sirius, CDO...) are not responsive enough is a better first iteration than adding "filters" on the feature to hide the fact that some editors require tweaks. Both from design and user point of view.
If you want to make sure an issue (such as the save "lag" for some editor) get fixed, the first step is to make it visible.
Comment 31 Bruno Medeiros CLA 2016-02-08 09:26:39 EST
(Hum, for some reason I forgot to add me to CC, so missed all the newer comments)

(In reply to Mickael Istria from comment #15)
> 
> I don't think it's that much a bummer. Maybe at usage, it will become
> comfortable to see the code reorganized correctly just as we type, rather
> than a bulk operation on save. 

I disagree. I think it's a really bad idea to have auto-save trigger save actions. Furthermore some editors/IDEs may have save actions that don't preserve the editor cursor position (might be rare, but we have to cater for that scenario), so having save-actions implicitly triggered as the user types (or after a delay), would be very annoying. I think even the first iteration of the auto-save functionality should avoid triggering save-actions. Maybe some advanced IDEs would be able to have save actions as the user types, but that shouldn't be the default behavior.
Comment 32 Bruno Medeiros CLA 2016-02-08 09:28:42 EST
(In reply to Dani Megert from comment #27)
> 
> > - as JDT is the most popular editors, we will focus our work on this editor.
> 
> Auto-save is a platform concept that needs to work for most (if not all)
> editors.
> 

I agree. 

> > - the crash recovery will be out of scope
> 
> That was one of (if not) the major concern/request in the original bug
> 34076. Ignoring that is taking the original bug report into a wrong
> direction.
> 
> 

I think there is some miscommunication here. If auto-save is implemented by saving directly to the original file (like IntelliJ IDEA does), then the crash recovery *user scenario* is automatically handled - because if Eclipse crashes, when it's restarted the original files will obviously already have a recent version of the last edited version (at most only a few minutes or seconds old).

I think what Alex meant when he said "crash recovery will be out of scope" is that it's out of scope to try to implement a functionality that works only by saving dirty editors into separate, backup locations/files (and restoring them if Eclipse crashes).
Comment 33 Axel RICHARD CLA 2016-02-08 10:09:08 EST
(In reply to Dani Megert from comment #29)
> (In reply to Axel RICHARD from comment #28)
> > (In reply to Dani Megert from comment #27)
> > 
> > Dani, thank you for your answer.
> > 
> > The initial bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=34076 has been
> > reported in 2003 and there’s still no auto-save in Eclipse IDE. That shows
> > it is very hard to find an ideal solution that is suitable for everyone from
> > the beginning.
> > I think three choices are possible:
> > 1) we implement and push a limited feature for Neon, but a working one.
> > 2) we propose a vote, make specifications based on this vote for a more
> > generic solution which will try to handle all use cases and editors, but
> > with no functional feature in the short term.
> > 3) we propose the feature only for the JDT, not for all textual editors, in
> > agreement with our initial proposal to the FEEP.
> > 

> 
> 3) is no option for me. 1) depends on the scope of "limited". As said, it
> must at least work for all editors in the SDK and SSEs.

Dani, all,

Ok, I will update the specification page with your demands. So, it must at least work for all editors in the SDK and SSEs.
I also propose to start the work upon the contribution of Lars (https://git.eclipse.org/r/40794) instead of restart from the beginning.

Regards,
Comment 34 Lars Vogel CLA 2016-02-08 10:11:17 EST
(In reply to Axel RICHARD from comment #33)
> I also propose to start the work upon the contribution of Lars
> (https://git.eclipse.org/r/40794) instead of restart from the beginning.

Of course, reusing my Gerrit is fine for me.
Comment 35 Bruno Medeiros CLA 2016-02-10 13:23:46 EST
Just to let everyone know, I'm doing some parallel work on the auto-save functionality. This is because I have a specific requirement that is out of scope (as things stand) for the FEEP:

* I want to be able to auto-save editors on-the-fly, that is, immediately, as the user types (no delay). 

This is for a use case particular to several IDES I work on (for Go, D, Rust), that all use external tools for building, code completion, analysis, etc., and long story short: some advanced functionality requires keeping the editor buffers in-sync with the underlying files as soon as possible.

This means Lars' prototype, or anything else that uses the ISaveablePart.doSave(IProgressMonitor) layer, directly or indirectly, is not suitable. That's because that method has to be called from the UI thread, and doing on-the-fly auto-save requires the save to be performed on the background, otherwise the UI would become sluggish/unresponsive. There is also the problem that there is no way to prevent triggering save-actions, and local-history snapshots, when using #ISaveablePart.doSave(IProgressMonitor). (as far as I know at least)

I've written an alternate prototype that works by hooking into the ITextFileBufferManager layer. It listens to when new documents are created, and then for those documents it listens for document change events. Whenever such document changes happens, a request to save the file is sent to a background worker thread. The actual save is made using IFileBuffer API. The editor/parts API is bypassed completely.

The first iteration of the prototype used IFileBuffer.commit(IProgressMonitor, boolean) to perform the save, but that turned to not work, it has subtle UI concurrency bugs: it triggers ITextFileBufferManager listener events outside the UI thread, and those listeners are not meant to be triggered that way. 

A proper version of my AutoSaveManager necessitated changes to the IFileBuffer, namely the addition of a method that commits the file, but doesn't trigger the listeners. You can see this version of the manager here:  https://github.com/bruno-medeiros/MelnormeEclipse/blob/e14eb9280d08b8b3f8c6b4c10b92daaa28cd564e/plugin_ide.core/src-lang/melnorme/lang/ide/core/engine/AutoSaveManager.java

I'm gonna submit a Gerrit patch of the IFileBuffer changes next, for consideration. Those should be helpful even if using a different auto save implementation.

This AutoSaveManager is not complete though, as certain concurrent scenarios are not guaranteed to work correctly all the time (such as a manual save requested in super quick succession after document changes). I want to make it 100% correct, but it will further necessitate more IFileBuffer API changes. I'd like to get some feedback on the initial changes first though.
Comment 36 Eclipse Genie CLA 2016-02-10 13:25:10 EST
New Gerrit change created: https://git.eclipse.org/r/66336
Comment 37 Axel RICHARD CLA 2016-02-11 02:57:10 EST
(In reply to Eclipse Genie from comment #36)
> New Gerrit change created: https://git.eclipse.org/r/66336

Hello Bruno,

Thanks for your proposal. As it is not the same scope than the proposal of this enhancement ticket (see comment 1), could you open a new bug and associate your gerrit review with this new bug please ? On my side, I will push a first implementation soon.

Regards,
Comment 38 Dani Megert CLA 2016-02-11 03:05:39 EST
(In reply to Bruno Medeiros from comment #35)
> A proper version of my AutoSaveManager necessitated changes to the
> IFileBuffer, namely the addition of a method that commits the file, but
> doesn't trigger the listeners. You can see this version of the manager here:
> https://github.com/bruno-medeiros/MelnormeEclipse/blob/e14eb9280d08b8b3f8c6b4c10b92daaa28cd564e/plugin_ide.core/src-lang/melnorme/lang/ide/core/engine/AutoSaveManager.java

Not sending the events is a no go. That would leave/put all buffer listeners into an inconsistent state, e.g. dirty state of editors, refactorings that currently work on files (not open in any editor), etc.
Comment 39 Bruno Medeiros CLA 2016-02-11 05:46:58 EST
(In reply to Dani Megert from comment #38)
> (In reply to Bruno Medeiros from comment #35)
> > A proper version of my AutoSaveManager necessitated changes to the
> > IFileBuffer, namely the addition of a method that commits the file, but
> > doesn't trigger the listeners. You can see this version of the manager here:
> > https://github.com/bruno-medeiros/MelnormeEclipse/blob/e14eb9280d08b8b3f8c6b4c10b92daaa28cd564e/plugin_ide.core/src-lang/melnorme/lang/ide/core/engine/AutoSaveManager.java
> 
> Not sending the events is a no go. That would leave/put all buffer listeners
> into an inconsistent state, e.g. dirty state of editors, refactorings that
> currently work on files (not open in any editor), etc.

Not exactly. Note that with those changes there are now two levels of saving, the full save (the normal save as we know it, saves and does everything, notifies listeners, etc.), and a partial, or lets call it internal save. (That does not notify listeners - nor saves the annotation model BTW). When this internal save occurs, the dirty state of the buffer does not change either (it remains dirty). As such the UI still thinks its dirty (in a way it is), which means the user is still forced to save the editor manually. When such a manual save occurs, a full-save is performed, which will notify listeners and make everything consistent.

This is not the ideal end-picture for the UI behavior, since after all we want to remove explicit saving, but the behavior above can then be combined with another auto-save mechanism that performs the full-save on a regular interval (or when an editor frame is deactivated), which is pretty much what we've been discussing already.
Comment 40 Bruno Medeiros CLA 2016-02-11 06:05:59 EST
(In reply to Axel RICHARD from comment #37)
> (In reply to Eclipse Genie from comment #36)
> > New Gerrit change created: https://git.eclipse.org/r/66336
> 
> Hello Bruno,
> 
> Thanks for your proposal. As it is not the same scope than the proposal of
> this enhancement ticket (see comment 1), could you open a new bug and
> associate your gerrit review with this new bug please ? On my side, I will
> push a first implementation soon.
> 
> Regards,

Ok: https://bugs.eclipse.org/bugs/show_bug.cgi?id=487653
Comment 41 Eclipse Genie CLA 2016-02-12 03:23:35 EST
New Gerrit change created: https://git.eclipse.org/r/66465
Comment 42 Eclipse Genie CLA 2016-02-17 09:21:45 EST
New Gerrit change created: https://git.eclipse.org/r/66742
Comment 43 Mikaël Barbero CLA 2016-02-17 09:28:28 EST
Axel, I will give it a try and give you some feedback shortly (probably tomorrow)
Comment 44 Axel RICHARD CLA 2016-02-17 09:30:15 EST
Great, thanks Mikaël !
Comment 45 Mikaël Barbero CLA 2016-02-19 04:04:41 EST
I've given a first test to your review. It already works well. However, I've some concerns:

- I don't see the behavior described in comment 17 and that you (Axel) confirmed in comment 22. The autosave is triggered after the end of the timer regardless of my keyboard activity. It does no seem to be reset. This is really annoying. I've managed to see this behavior by setting the autosave timer to a low value.

- I've tried editing some java code with "save actions / formatter" enabled. It is really confusing, especially because the caret does not always retain its location after a save. This behavior is even worst because of the behavior described above (the autosave is triggered in the middle of my typing). I'm not sure the conflict with "saves actions" should be addressed in this initial version. At least, a warning notice about this disturbing behavior should be displayed on the preference page.

- The "quick access" in the status bar requires a double click (as specified in https://wiki.eclipse.org/Platform_UI/AutoSave#Behavior). I think it will be simpler to require a single click (I initially tried a single click and thought the button was broken). Also, when activating the autosave from this location, it would be great to open a popup with the warning notices described in the preference page. It would be even greater to let user check a box to say whether they want popup should be displayed next they activate auto-save.
Comment 46 Dani Megert CLA 2016-02-19 07:41:01 EST
(In reply to Mikael Barbero from comment #45)
> - The "quick access" in the status bar requires a double click (as specified
> in https://wiki.eclipse.org/Platform_UI/AutoSave#Behavior). I think it will
> be simpler to require a single click (I initially tried a single click and
> thought the button was broken). Also, when activating the autosave from this
> location, it would be great to open a popup with the warning notices
> described in the preference page. It would be even greater to let user check
> a box to say whether they want popup should be displayed next they activate
> auto-save.

There is no reason that justifies adding this preference into the status bar or anywhere in the workbench window. It is a preference/feature like any other, which a user will either enable or disable. If everyone would put its preference into the workbench window, then it would be big mess. Please remove it. By the way, on Windows one can hardly see it (see attached screenshot).
Comment 47 Dani Megert CLA 2016-02-19 07:59:17 EST
I've done an initial review of the feature and captured it in https://git.eclipse.org/r/#/c/66742/

The main concerns mentioned there are:

- One big show stopper is that the auto-save operation terminates many existing actions (closes their shell), e.g. content assist, hover, Quick Fix/Assist, linked mode etc. This will not be accepted by the users.

- As mentioned before, using this together with Auto Save is almost impossible due to the unexpected caret movement.
Comment 48 Dani Megert CLA 2016-02-19 08:01:11 EST
Created attachment 259823 [details]
Strange looking auto-save status bar item (Windows 7)

NOTE: Do not try to fix it. Just get rid of it.
Comment 49 Axel RICHARD CLA 2016-02-24 04:47:05 EST
(In reply to Dani Megert from comment #47)
> I've done an initial review of the feature and captured it in
> https://git.eclipse.org/r/#/c/66742/
> 
> The main concerns mentioned there are:
> 
> - One big show stopper is that the auto-save operation terminates many
> existing actions (closes their shell), e.g. content assist, hover, Quick
> Fix/Assist, linked mode etc. This will not be accepted by the users.
> 
> - As mentioned before, using this together with Auto Save is almost
> impossible due to the unexpected caret movement.

Hello,

In https://git.eclipse.org/r/#/c/66742/, the SaveAllDirtyPartsAddon class has an IEventBroker that subscribes to UIEvents.Dirtyable.TOPIC_DIRTY, but this is not the right event to subscribe, because when an editor is already dirty, then a change in this editor will not send another dirty event.
I need to subscribe to any change in an (active) editor. Is anybody can help me about this ?

Thanks in advance

Best Regards,
Comment 50 Eclipse Genie CLA 2016-03-02 11:10:57 EST
New Gerrit change created: https://git.eclipse.org/r/67669
Comment 51 Axel RICHARD CLA 2016-03-02 11:26:57 EST
(In reply to Dani Megert from comment #47)
> I've done an initial review of the feature and captured it in
> https://git.eclipse.org/r/#/c/66742/
> 
> The main concerns mentioned there are:
> 
> - One big show stopper is that the auto-save operation terminates many
> existing actions (closes their shell), e.g. content assist, hover, Quick
> Fix/Assist, linked mode etc. This will not be accepted by the users.
> 
> - As mentioned before, using this together with Auto Save is almost
> impossible due to the unexpected caret movement.

Hello I just pushed a new version of the contribution for the auto-save in Eclipse.
It takes the comments into account, except the one about the termination of existing actions (e.g. content assist...). As said in the comment 45, I don't think the conflict with "saves actions" should be addressed in this initial version.

About this new version, I introduced a new event Last_Modified to let users know that a part has been modified. I also introduced a new ISaveablePart3 that inherits from ISaveablePart.

Do not hesitate to review and comment this new version of the contribution.

Best Regards,
Comment 52 Axel RICHARD CLA 2016-03-02 11:29:10 EST
As you can see, the change is now also affecting the AbstractTextEditor in the platform text  repository. So the change is in two parts :
https://git.eclipse.org/r/66742 (Platform UI)
https://git.eclipse.org/r/67669 (Platform Text)
Comment 53 Dani Megert CLA 2016-03-02 11:54:04 EST
(In reply to Axel RICHARD from comment #51)
> It takes the comments into account, except the one about the termination of
> existing actions (e.g. content assist...). 

Sorry, but this is a no go. Let me know when you have something that doesn't interrupt those, and I will take another look.


> As said in the comment 45, I
> don't think the conflict with "saves actions" should be addressed in this
> initial version.

A lot of developers use save actions and if you look at the project settings of our Eclipse projects, they have them enabled at the project level. There would have to be a big warning that enabling auto-save interferes with this, and as a result most developers will probably not use the auto-save feature.


> About this new version, I introduced a new event Last_Modified to let users 
> know that a part has been modified. 

How do you let the user know? The change in AbstractTextEditor indicates (didn't do a full review of the Platform UI changes) that you are restricting the feature to specific editors now, or, expect other editors to do something in order to get the feature. In that sense I liked the previous version better.
Comment 54 Axel RICHARD CLA 2016-03-02 12:04:06 EST
(In reply to Dani Megert from comment #53)
> 
> > About this new version, I introduced a new event Last_Modified to let users 
> > know that a part has been modified. 
> 
> How do you let the user know? The change in AbstractTextEditor indicates
> (didn't do a full review of the Platform UI changes) that you are
> restricting the feature to specific editors now, or, expect other editors to
> do something in order to get the feature. In that sense I liked the previous
> version better.

It is the only I found to be notified for editors changes. In the previous version of the contribution, the SaveAllDirtyPartsAddon class had an IEventBroker that subscribed to UIEvents.Dirtyable.TOPIC_DIRTY, but this is not the right event to subscribe, because when an editor is already dirty, then a change in this editor will not send another dirty event.
With this new version, the IEventBroker subsribes now to UIEvents.Dirtyable.TOPIC_LAST_MODIFIED, an event that is send when a change occurs in an editor, not only when an editor switch to the dirty state.
Comment 55 Dani Megert CLA 2016-03-02 12:22:29 EST
(In reply to Axel RICHARD from comment #54)
> (In reply to Dani Megert from comment #53)
> > 
> > > About this new version, I introduced a new event Last_Modified to let users 
> > > know that a part has been modified. 
> > 
> > How do you let the user know? The change in AbstractTextEditor indicates
> > (didn't do a full review of the Platform UI changes) that you are
> > restricting the feature to specific editors now, or, expect other editors to
> > do something in order to get the feature. In that sense I liked the previous
> > version better.
> 
> It is the only I found to be notified for editors changes. In the previous
> version of the contribution, the SaveAllDirtyPartsAddon class had an
> IEventBroker that subscribed to UIEvents.Dirtyable.TOPIC_DIRTY, but this is
> not the right event to subscribe, because when an editor is already dirty,
> then a change in this editor will not send another dirty event.
> With this new version, the IEventBroker subsribes now to
> UIEvents.Dirtyable.TOPIC_LAST_MODIFIED, an event that is send when a change
> occurs in an editor, not only when an editor switch to the dirty state.

I got that, but it really restricts where the feature will work. You should try to apply the timeout to the idle UI.
Comment 56 Axel RICHARD CLA 2016-03-03 04:40:03 EST
(In reply to Dani Megert from comment #53)
> (In reply to Axel RICHARD from comment #51)
> > It takes the comments into account, except the one about the termination of
> > existing actions (e.g. content assist...). 
> 
> Sorry, but this is a no go. Let me know when you have something that doesn't
> interrupt those, and I will take another look.

I understand that you want a fully functional feature for the auto-save, that handles all interactions with eclipse. 
Except for that part, I think the contributions I pushed on gerrit do the job correctly. As Mikael proposed in the comment 45, I could add warning notice about this disturbing behavior should be displayed on the preference page.
As a first step I would really need your review and comments on the current design as I assume specifically handling the content assist is not challenging the approach (but tell me if you think it is).  Right now I have no idea if I'll have enough bandwith to consider handling it as part of this work, any pointer on this specific issue would be really appreciated. Then, the community will be able to handle the termination of existing actions like the content assist, based on the contributions I made.

In the new version of the contribution, yes, the editors have to send the new event but we implemented in the abstract editors like AbstractTextEditor and FormEditor.
So the huge part of editors won’t have to do anything to get the auto-save.
So far that's the only way I found to handle the auto-save with a countdown which gets re-initialized when the user interacts within the editor.
As an alternative solution, in the comment 55, you said that I should try to apply the timeout to the idle UI. 
Could you please elaborate on this comment ? Would that be an alternative solution for the countdown ?

Thank you

Best Regards,
Comment 57 Dani Megert CLA 2016-03-03 04:55:48 EST
(In reply to Axel RICHARD from comment #56)
> As a first step I would really need your review and comments on the current
> design as I assume specifically handling the content assist is not
> challenging the approach (but tell me if you think it is). 

Taking down content assist or any other shell is a no go as it interrupts the user's workflow.


> Right now I have
> no idea if I'll have enough bandwith to consider handling it as part of this
> work, any pointer on this specific issue would be really appreciated.

One way would be to only save when the editor (shell) itself has the focus. Drawback is that it won't save while any other shell is open. But that is far less an issue than interrupting the user's workflow.

Another way would be to save when the editor part is no longer the active part. That would avoid interfering with typing and also make the Save Action problem a bit less an issue. Additionally, one could consider to save when the focus is lost, but the tricky part is to only do this when a "main" window/shell becomes focus, otherwise one runs into the original shell lost problem. This solution would also get rid of any code that needs to figure out inactivity to trigger the save.


> Then,
> the community will be able to handle the termination of existing actions
> like the content assist, based on the contributions I made.

I don't exactly understand what you mean.


> As an alternative solution, in the comment 55, you said that I should try to
> apply the timeout to the idle UI. 
> Could you please elaborate on this comment ? Would that be an alternative
> solution for the countdown ?

Yes, instead of relying on modification events, try to figure out whether the IDE is idle for a certain time. org.eclipse.ui.internal.ide.application.IDEIdleHelper does something like that to decide when to do a GC.
Comment 58 Axel RICHARD CLA 2016-03-03 05:46:22 EST
(In reply to Dani Megert from comment #57)

Dani,

Thank you very much for your answers.

Here is what I propose:
- Way 1 : I revert to the first version of the existing contribution and do what you propose in the comment 57:
« One way would be to only save when the editor (shell) itself has the focus. Drawback is that it won't save while any other shell is open. But that is far less an issue than interrupting the user's workflow. »
So, the countdown will not be reset on user activity, but the content assist will not be close anymore on auto-save.
I will also add a notice in the preference page to warn users that the save actions (auto-format…) could be problematic when the auto-save is enabled.

- Way 2 : I create a new contribution and try the org.eclipse.ui.internal.ide.application.IDEIdleHelper way.
The countdown will be reset on user activity, and the content assist will not be close anymore on auto-save if I also apply your proposition: « One way would be to only save when the editor (shell) itself has the focus ».
I will also add a notice in the preference page to warn users that the save actions (auto-format…) could be problematic when the auto-save is enabled.


To everybody,

What do you think about these propositions ? Which one seems the best according to you ?

Best Regards,

Axel
Comment 59 Dani Megert CLA 2016-03-03 06:19:31 EST
(In reply to Axel RICHARD from comment #58)
> (In reply to Dani Megert from comment #57)
> 
> Dani,
> 
> Thank you very much for your answers.
> 
> Here is what I propose:
> - Way 1 : I revert to the first version of the existing contribution and do
...
 
> - Way 2 : I create a new contribution and try the
...


With way 1 you really need to add some means to reset the timer. For example you could reset it whenever you get an SWT.Modify event (hint: see Display#addFilter). Drawback: it will also reset when the user types some text into a text field anywhere in the IDE.

The benefit of way 1 is that you can faster deliver a new version of the change which fixes the shell issue. If the inactivity code doesn't work well, you can still move to way 2.
Comment 60 Axel RICHARD CLA 2016-03-07 09:26:41 EST
Hi,

I just pushed a new version of the contribution that takes into account the last comments from our discussions.
Do not hesitate to review and comment this new version of the contribution.
Thanks in advance.

Best Regards,
Axel
Comment 61 Mikaël Barbero CLA 2016-03-15 06:19:56 EDT
I've given a try to your latest patch. It works well and is much less intrusive than the previous one. It does not interrupt any code completion, hover, etc. 

However, now that the timer is reset at each click, I have the feeling that the default timer value should be shorter than 60sec. I rarely do nothing in my IDE window for 60sec. Such a long timer makes the auto-save useless. IMHO, a good default would be something from 15 to 20sec.

I will make some comments about the code directly in the review.
Comment 62 Mikaël Barbero CLA 2016-03-15 07:03:15 EDT
After trying it a bit more, it happens that it does not handle the multiple workbench windows well. Step to reproduce:

1/ open a new workbench window (Windows > New Window)
2/ Edit some files in the new window
3/ Come back to the first windows and edit other files in there.
4/ Wait for the auto-save to be triggered

Only the first windows editors are saved.
Comment 63 Axel RICHARD CLA 2016-03-17 09:11:34 EDT
(In reply to Mikael Barbero from comment #62)
> After trying it a bit more, it happens that it does not handle the multiple
> workbench windows well. Step to reproduce:
> 
> 1/ open a new workbench window (Windows > New Window)
> 2/ Edit some files in the new window
> 3/ Come back to the first windows and edit other files in there.
> 4/ Wait for the auto-save to be triggered
> 
> Only the first windows editors are saved.

Mikaël,

The last version of the contribution should solved the problem.

Best Regards,
Comment 64 Mikaël Barbero CLA 2016-03-17 09:45:22 EDT
There is still a new issue now: you are adding a lot of idleListener (basically each time a dirty event is triggered). I will submit a change to your review shortly but I'm afraid we're out of time for M6...
Comment 65 Mikaël Barbero CLA 2016-03-17 12:13:04 EDT
(In reply to Mikael Barbero from comment #64)
> There is still a new issue now: you are adding a lot of idleListener
> (basically each time a dirty event is triggered). I will submit a change to
> your review shortly but I'm afraid we're out of time for M6...

I've fixed the issue and done some cleanup in the SaveAllDirtyPartsAddon (see https://git.eclipse.org/r/#/c/66742/4..5/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/addons/SaveAllDirtyPartsAddon.java). Please review and test ASAP.

I think that, with this last change, we're good to go for a formal review from the Platform UI committers. Does any of you think it could still be done before M6? It would be so great to have this feature in Neon. Thanks a lot.
Comment 66 Axel RICHARD CLA 2016-03-17 12:46:22 EDT
(In reply to Mikael Barbero from comment #65)
> (In reply to Mikael Barbero from comment #64)
> > There is still a new issue now: you are adding a lot of idleListener
> > (basically each time a dirty event is triggered). I will submit a change to
> > your review shortly but I'm afraid we're out of time for M6...
> 
> I've fixed the issue and done some cleanup in the SaveAllDirtyPartsAddon
> (see
> https://git.eclipse.org/r/#/c/66742/4..5/bundles/org.eclipse.ui.ide/src/org/
> eclipse/ui/internal/ide/addons/SaveAllDirtyPartsAddon.java). Please review
> and test ASAP.
> 
> I think that, with this last change, we're good to go for a formal review
> from the Platform UI committers. Does any of you think it could still be
> done before M6? It would be so great to have this feature in Neon. Thanks a
> lot.

Mikaël,

With your last modifications from https://git.eclipse.org/r/#/c/66742/6, the issue you described in comment 64 is gone, and it still works very well. 

Thank you very much.

Best Regards,
Comment 67 Mikaël Barbero CLA 2016-04-13 03:56:53 EDT
Dani, as your concerns have been addressed, could you please review the latest change set? Thanks.
Comment 68 Dani Megert CLA 2016-04-25 09:32:10 EDT
(In reply to Mikaël Barbero from comment #67)
> Dani, as your concerns have been addressed, could you please review the
> latest change set? Thanks.

Looks good. I would like to commit this today, so that we can include it in our test pass tomorrow.

Axel or Mikael, are you able to address my comments today?
Comment 69 Mikaël Barbero CLA 2016-04-25 09:45:56 EDT
(In reply to Dani Megert from comment #68)
> (In reply to Mikaël Barbero from comment #67)
> > Dani, as your concerns have been addressed, could you please review the
> > latest change set? Thanks.
> 
> Looks good. I would like to commit this today, so that we can include it in
> our test pass tomorrow.
> 
> Axel or Mikael, are you able to address my comments today?

Thanks Dani. I will address you comments today.
Comment 70 Bruno Medeiros CLA 2016-04-25 13:52:44 EDT
Any plans for further improvements in the UI side of things, such as:
* Automatically saving the editor if the user clicks on the close button/action (without asking for confirmation).
* Not showing the dirty mark on an editor if auto-save is on.
? 
Or would this be left for a future iteration?
Comment 71 Dani Megert CLA 2016-04-25 14:08:33 EDT
(In reply to Bruno Medeiros from comment #70)
> Any plans for further improvements in the UI side of things, such as:
> * Automatically saving the editor if the user clicks on the close
> button/action (without asking for confirmation).
> * Not showing the dirty mark on an editor if auto-save is on.
> ? 
> Or would this be left for a future iteration?

Yes, new feature requests.
Comment 72 Mikaël Barbero CLA 2016-04-25 14:45:58 EDT
I've updated the change set. Sorry for the delay
Comment 74 Dani Megert CLA 2016-04-25 16:36:47 EDT
Remaining and new issues will be handled by new bug reports.
Comment 75 Lars Vogel CLA 2016-04-26 00:29:19 EDT
Axel/ Mikael can you this to the N&N for M7
Comment 76 Bruno Medeiros CLA 2016-04-26 10:02:32 EDT
(In reply to Dani Megert from comment #74)
> Remaining and new issues will be handled by new bug reports.

Created: https://bugs.eclipse.org/bugs/show_bug.cgi?id=492454
Comment 77 Dani Megert CLA 2016-04-26 12:07:52 EDT
*** Bug 34076 has been marked as a duplicate of this bug. ***
Comment 78 Axel RICHARD CLA 2016-04-26 12:19:18 EDT
(In reply to Lars Vogel from comment #75)
> Axel/ Mikael can you this to the N&N for M7

Lars, here is the gerrit review for the N&N : https://git.eclipse.org/r/#/c/71458/
Comment 79 Bruno Medeiros CLA 2016-05-03 12:47:03 EDT
BTW, I think this phrase on the preferences page is a bit weird: "the Save Actions from editors may cause a disturbing behavior." 

It's not very clear for a normal user what that means. But more than that, it doesn't seem written in good English. It probably should be "may cause disturbing behavior", or even better: "may cause erratic behavior". 

Maybe it's just me, but when I hear "disturbing behavior" I usually associate that idiom with violence or gore, similar to when news casters say the expression "The following pictures may be disturbing to some viewers".