views:

1167

answers:

2

Im looking for plugin for eclipse that automatically saves files(so i dont have to use Ctrl+S). it could do it on focus lost or over some period of time. I think I saw something like that(I know IDEA has it), but I cant find it now :/

+6  A: 

01 added:

I bet plugin like I describe exists.

... and you are right!

Eclipse plugin saveDirtyEditor should do just what you need.
Copy the SaveDirtyEditors_1.0.2.jar in your plugin directory.

You will get a new preference page under

General > Editors > Text Editors > Save Dirty Editors

, allowing you to save dirty files like 'myfile.java' under 'myfile.java.snapshot' every 30 seconds (can be less if you want).


Without additional plugin, though, Eclipse does not support natively that feature.

The closest could be:

Window > Preferences > type "build"
  > General > Workspace > [x] Save automatically before build

That way, each time you hit CTRL+B for actually building your sources, they would be saved.
But I realize this is not exactly what you are after.
Beware your option would not be very efficient with the "build automatically" option activated... (that would trigger too much builds)

Again, without achieving exactly what you are looking for, you also have:

Run/Debug > Launching > Save required dirty editors before launching
Run/Debug > Launching > [x] Build (if required) before launching


Note: the difference between IntelliJ IDEA and eclipse is the "compile on save" feature:

As mentioned in the IDEA FAQ:

Q:
Can I enable "compile on save" in IntelliJ IDEA?

IntelliJ IDEA currently doesn't support this feature.
However there is an "Eclipse-mode" plug-in which provides similar functionality, so we suggest you to try this plug-in.
Note that by default IntelliJ IDEA saves the files for you, so you don't have to press the Ctrl+S shortcut frequently like you need to do in other IDEs.

However, with Eclipse, the "build on save" is activated by default, hence the absence of that particular feature.

VonC
I build from console since Maven plugin has sometimes problem with open projects. I bet plugin like I describe exists.
01
downvote seems harsh, answer is perfectly reasonable.
Rich Seller
The plugin doesn't work as expected. It saves a copy of the file, rather than just saving the file :(
Karl
@Karl: strange, I did test it (on a eclipse4.5Mx at the time) and it was working as advertised... What is your configuration? (version of eclipse and of JDK)
VonC
A: 

I like the idea that it saves it as a snapshot. Otherwise, it might save some changes I later decided to abandon. If you want it to save the file itself, I think you might just be able to remove the .snapshot file suffix, and have it save the file. Nice writeup, but it might be nice to mention that Workspace Save Interval does not save open editor files.

One caveat: this plugin fails to save pages being edited in the "Web Page Editor" (available most conveniently from the JavaEE version of eclipse). Thus, there is no way to autosave these at all (unless there is a proprietary solution I don't know about).

CodeLurker