I'm looking for a configuration or plugin for eclipse that automatically saves files (so I don't have to use Ctrl+S). It could do it on lost focus or over some period of time. I think I saw something like that (I know IDEA has it), but I cant find it now.
Update seven years later (Eclipse Neon 4.6)
Eclipse now has an Automatic Save of dirty editors
The autosave option is disabled by default.
A new autosave preference page (Preferences > General > Editors > Autosave) is available and allows to enable/disable the autosave and change the interval of autosave.
The countdown is reset on keyboard activity, mouse click, or when a popup is displayed (e.g. content assist, preference page, ...).
Original answer (2009)
The OP IAdapter added in the comments:
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.
http://code.google.com/p/eclatosa/
"Saves all open editors in eclipse when deactivating the eclipse window (like in IntelliJ)"
No need to install more plugin.
Window -> Preferences -> General -> Workspace
and there you can check:
Save automatically before build + Build automatically
If that doesn't work try this:
Preferences -> Run/Debug -> Launching -> Save dirty editors before launching
I wrote a plugin a long time ago to do this that still seems to work: http://www.stateofflow.com/projects/71/save-me
It saves the editor when it loses focus. However, if you switch away from eclipse it doesn't notice.
Try this
Goto Eclipse Preferences > General > Editors > Autosave
if it not work then try this
Preferences -> Run/Debug -> Launching -> Save dirty editors before launching
Related
I know its a silly question but i am stuck into it from 2 hours..Can any body tell me how should i enable the dialog which opens at the time we start eclipse and we choose workspace location from there.
See I want this window to be displayed first when eclipse starts
By mistake I have checked "Use this as the default and do not ask again".
Please guide me how to show up this dialog again
You can find it here :
Menu: Window -> Preferences -> General -> Startup and Shutdown -> Workspaces -> Prompt for workspace on startup
Eclipse preferences has a lot of options. You can search for specific options by typing in the filter text box at the top of the preferences dialog.
If you type in 'startup' for instance the list will be much shorter.
window > preferences > general > startup and shutdown > workspaces
then check 'Prompt for workspace on startup'
If your workspace is corrupted and Eclipse doesn't startup with your currently pre-selected workspace, you may edit SHOW_WORKSPACE_SELECTION_DIALOG=false to SHOW_WORKSPACE_SELECTION_DIALOG=true
which is located in file
C:\PathToEclipse\eclipse\configuration\.settings\org.eclipse.ui.ide.prefs
before you start the IDE.
Every time I create a new workspace in Eclipse I have to turn off the spell checking via Preferences. (Preferences->General->Editors->Text Editors->Spelling->Enable Spell Checking)
This is very irritating. How do I turn off the spell checking for good? I.e. the spell checker is disabled when I create a new workspace and I can turn it on should I want to use it.
It's not a perfect fix, but you can copy existing workspace preferences into any workspace. I keep a separate .epf (Eclipse preferences file, I guess) that I just import into every new workspace I create:
File → Import... → General → Preferences → Next > From preference file
Related
Importing/Exporting Project Preferences
Preferences->General->Editors->Text Editors->Spelling
Uncheck the box "Enable spell checking"
There are some ways for sharing preferences, but it doesn't come with the platform.
The one I use is now available as an attachment to https://bugs.eclipse.org/bugs/show_bug.cgi?id=334016 or more particular as attachment https://bugs.eclipse.org/bugs/attachment.cgi?id=196866
Install into your Eclipse.
Then you can export selected preferences to an .epf file.
Also add a preference (!) in Preferences > General > Common Preferences which will share your settings across newly created workspaces.
I use this all the time and though it is not perfect, it does save a lot of effort in keeping my preferences aligned across workspaces.
If you are writing Java code, Window -> Preferences -> Java -> JDT Spelling
I would like Eclipse to automatically save every time I edit a file, in much the same way that it builds automatically. Because I've been using IntelliJ for the last year (which saves automatically by default), I keep having the following problem:
Make some changes in Eclipse
Forget to press save
Run the build, unit tests, and notice some strange behaviour
(Some time later....) realize that the unexpected behaviour occurred because I forgot to save the changes
Is there any way I can make Eclipse save automatically?
Eclipse Neon (4.6)
Window > Preferences
General > Editors > Autosave > check Enable autosave for dirty editors > choose the value for autosave interval (in seconds)
Details in M7:
Auto-save of dirty editors is now available in Eclipse. The autosave option is disabled by default. A new autosave preference page (Preferences > General > Editors > Autosave) is available and allows to enable/disable the autosave and change the interval of autosave. The countdown is reset on keyboard activity, mouse click, or when a popup is displayed (e.g. content assist, preference page, ...).
You can go here and check the box Save automatically before build
Windows > Preferences > General -> Workspace
First, try Window -> Preferences -> General -> Workspace. There you can check "Save automatically before build" and "Build automatically."
If that does not work,
PLEASE TRY
Preferences -> Run/Debug -> Launching -> "Save dirty editors before
launching"
You can do it with the saveDirtyEditor plugin as referenced in this question/answer. There is no non-plugin way of doing it.
I wrote an Eclipse plugin for this called smartsave. It's available in the Eclipse Market Place.
It saves your files at a specified interval and you can even tune it to prevent saving if errors, or warnings, are present in the preferences dialog.
In Helios this can be done by going to preferences and setting:
Run/Debug > Launching > Save required dirty editors before launching
For Eclipse Mars 2, the settings are below Window > Preferences > General > Workspace. These settings are in minutes and not in seconds.
You could go to Windows > Preferences > Autosave and set the auto intervals to 1.
When I used previous versions of Eclipse (e.g. Ganymede/Europa) if I had edited a file and then attempted a build Eclipse would prompt me to save first.
Since I updated to Galileo (Build id: 20090920-1017 & just checked for updates) when I build I'm not prompted to save first. Perhaps the dialog had a checkbox for "don't tell me again" which I mistakenly checked on???
I figure it is just a preference setting some where but I can't seem to find it, search in Preferences for 'save' and for 'build' but did not find it. I tried "Save automatically before build" but that actually did not work for me, and isn't really what I was looking for anyways.
Any ideas?
thanks.
Edit: I'm actually using an Ant script to 'build' (right click on script and Run As...Ant Build). So perhaps my original wording was a bit off base since I did not state how I was building.
It's under Window -> Preferences -> General -> Workspace -> Save automatically before build. This works for me if I'm doing an Eclipse build (Project -> Build All). Is that how you're building?
As mention in this thread, the only other options (other than the "Save automatically before build") which actually prompt for the user for file saving are:
> Run/Debug > Launching > Save required dirty editors before launching
> Run/Debug > Launching > [x] Build (if required) before launching
Answer of VonC looks great, but does not work as it seems (Eclipse 3.5.1.R35x_v20090910 on WinXP-Pro-32). However Eclipse and I seem to think differently about what is a "required dirty editor" :-( --
Would be nice if it would be possible to define a scope of resources to check for dirtyness for every single launch configuration -- with "containing project & refernced projects" as the default setting.
But it looks like 3.5.2 fixes this problem.
Eclipse (3.4.2 with PyDev) deals with out-of-sync resources (files that have been edited outside of the IDE) differently from other IDEs that I've used, where only resources with editors open are considered out-of-sync. In Eclipse, any resource can go out of sync.
This means that when I perform a search after any file has changed outside of Eclipse, I get an error dialog telling me that files are out of sync, even if they have no open editors. As far as I can tell, there is no global refresh command, so I'm forced to read the project names (I have several projects) in the error dialog, and do a right-click + refresh for each of them.
I've checked the Refresh Automatically setting in Settings > General > Workspace, but this has no effect. Is there any way to get Eclipse to always just load non-active resources from disk?
This issue will be fixed in Eclipse 3.7 (Indigo). While "Refresh Automatically" does eventually bring resources back into sync, the refresh hook only exists for Windows, so on Linux and Mac OS it has to poll the filesystem periodically.
From 3.7 there's a new preference Settings > General > Workspace > Refresh On Access (aka Lightweight Refresh). This preference causes Eclipse to automatically refresh resources when it discovers that they're 'out-of-sync'. When opening, reading or searching files, it'll prevent out-of-sync errors from occurring.
See also: https://bugs.eclipse.org/303517
I think if you click on the project node in the Project Explorer and press F5 or right click and select Refresh, all resources for that project will be refreshed. Also, if you CTRL+click on multiple projects, you should be able to refresh multiple projects at the same time.
A single click on a project, a CTRL+A to select everything, and an F5 should do exactly what you need - refresh everything.
I'll have to test this when I get the chance, but I believe this is how I overcame similar problems in the past.
I've noticed that this answer routinely is getting down voted. I'd like to point out that the question refers to a specific version of Eclipse: 3.4.2. There was actually no automatic method to refresh out-of-sync resources until version 3.7 Indigo of Eclipse, as mentioned in James Blackburn's answer. The method described in this answer is the only method to achieve this in version 3.4.2 (and any other version before 3.7 Indigo).
Out of synchronization problem is common in eclipse IDE so you have to check this option windows -> preference -> Workspace -> refresh using native hooks or polling.
Eclipse Helios possesses a built in refresh feature at Preferences > General > Workspace. It's in the same spot where you disable automatic builds. Select refresh automatically. A plugin with the same functionality is Andrei Loskutov's Filesync Plugin. The update site address is: http://andrei.gmxhome.de/eclipse/. During installation, select Eclipse 3.5-3.7 plugins > FileSync.
Given that Java 7 has an api for filesystem hooks, one would think that refresh could be handled better in Eclipse.
Edit: Actually, there is a plugin that uses this mechanism: https://github.com/psxpaul/EclipseJava7Refresher
There is a global refresh - have nothing (or everything) selected in the package explorer and press F5 (or right-click on empty space and select Refresh). Of course, this could take rather long if you have large projects.
The global refresh actually exists in plain Eclipse without any plugins and without selecting every project in your workspace.
Basically you need to deselect everything in your project explorer and hit F5. To do that Ctrl+click the selected resource in the project explorer and hit F5.
A global refresh is really missing in Eclipse. The above procedure with selecting all projects and then running refresh (e.g. F5) does not work if you have closed projects included in your selection. This means, if you have 1/2 of your many projects closed as I do, you find yourself manually Ctrl-clicking through your dozens of projects. This is quite painful. I wish Eclipse would simply ignore closed projects.
Perhaps you should add a feature request on the eclipse site:
https://bugs.eclipse.org/bugs/
I think it would be a great idea to add a preference for automatically refreshing out of date resources.
Yes, Refresh on Access is long overdue ... those answers to this and similar enquires usually suggested enabling the global auto-refresh, which could take an age for large remote projects.
In fact there are those who would say that Refresh on Access should have been the original (< 3.x) default behaviour ...
I managed to solve this by creating a new "external tool" run config that executes a blank batch file. In the run config, you can have it refresh the workspace when complete. Then I created a macro using Practically Macro that 1) executes the last external tool run config (refreshing the workspace), then 2) executes the last debug run config (running my app). If you uncheck "Allocate console" then the completed external tool entry won't show up in the debug window.
Even if the solutions proposed by others perso are indeed correct, you have a "Refresh All" plugin for Eclipse. Simply add the Update page to your Eclipse list of update sites to install it in your IDE.
For Starting up there is an option to automatically refresh files in
Window -> Preferences -> General -> Startup and Shutdown -> Refresh workspace on startup
Click it in order to have a "fresh" start in eclipse. :)
Version: Eclipse 4.12