我正在寻找一个自动保存文件的 Eclipse 配置或插件(这样我就不必使用 Ctrl+S)。它可以在失去焦点或一段时间内完成。我想我看到过类似的东西(我知道 IDEA 有它),但我现在找不到它。
最佳答案
七年后更新(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, ...).
原始答案(2009)
OP IAdapter添加in the comments :
I bet plugin like I describe exists.
...你是对的!
Eclipse 插件 saveDirtyEditor应该做你需要的。
将 SaveDirtyEditors_1.0.2.jar
复制到您的插件目录中。
您将在下面看到一个新的偏好设置页面
General > Editors > Text Editors > Save Dirty Editors
,允许您每 30 秒(如果您愿意,可以更少)在“myfile.java.snapshot
”下保存诸如“myfile.java
”之类的脏文件。
不过,如果没有额外的插件,Eclipse 本身并不支持该功能。
最接近的可能是:
Window > Preferences > type "build"
> General > Workspace > [x] Save automatically before build
这样,每次您点击 CTRL+B 来实际构建源代码时,它们都会被保存。
但我意识到这并不是您所追求的。
请注意,激活“自动构建”选项后,您的选项不会非常有效...(这会触发过多的构建)
同样,在没有完全实现您所寻求的目标的情况下,您还可以:
Run/Debug > Launching > Save required dirty editors before launching
Run/Debug > Launching > [x] Build (if required) before launching
<小时/>
注意:IntelliJ IDEA 和 eclipse 之间的区别在于“保存时编译”功能:
如 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.
但是,对于 Eclipse,默认情况下会激活“保存时构建”,因此缺少该特定功能。
关于eclipse - 如何配置eclipse运行时自动保存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1142547/