如何配置eclipse运行时自动保存?

发布于 2024-07-27 23:21:39 字数 106 浏览 7 评论 0原文

我正在寻找一个自动保存文件的 eclipse 配置或插件(这样我就不必使用 Ctrl+S)。 它可以在失去焦点或一段时间内完成。 我想我看到过类似的东西(我知道IDEA有它),但我现在找不到它。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

早茶月光 2024-08-03 23:21:39

七年后更新(Eclipse Neon 4.6)

Eclipse 现在有自动保存脏编辑器

默认情况下禁用自动保存选项。
新的自动保存首选项页面(首选项 > 常规 > 编辑器 > 自动保存)可用,允许启用/禁用自动保存并更改自动保存的时间间隔。
倒计时会在键盘活动、鼠标单击或显示弹出窗口(例如内容辅助、首选项页面等)时重置。

https: //www.eclipse.org/eclipse/news/4.6/images/autosave-preference-page.png


原始答案(2009)

OP IAdapter 添加了 在评论中

我敢打赌,像我描述的那样的插件是存在的。

...你是对的!

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 和 IntelliJ IDEA 之间的区别eclipse 是“保存时编译”功能:

IDEA FAQ:

问:
我可以在 IntelliJ IDEA 中启用“保存时编译”吗?

IntelliJ IDEA 目前不支持此功能。
但是,有一个“Eclipse-mode”插件提供类似的功能,所以我们建议您尝试一下这个插件。
请注意,默认情况下 IntelliJ IDEA 会为您保存文件,因此您不必像在其他 IDE 中那样经常按 Ctrl+S 快捷键。

但是,使用 Eclipse,“构建保存时”默认情况下处于激活状态,因此缺少该特定功能。

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, ...).

https://www.eclipse.org/eclipse/news/4.6/images/autosave-preference-page.png


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.

心碎无痕… 2024-08-03 23:21:39

http://code.google.com/p/eclatosa/

“将所有打开的编辑器保存在停用 Eclipse 窗口时的 Eclipse(如 IntelliJ 中)”

http://code.google.com/p/eclatosa/

"Saves all open editors in eclipse when deactivating the eclipse window (like in IntelliJ)"

悟红尘 2024-08-03 23:21:39

无需安装更多插件。

窗口-> 首选项-> 一般-> 工作区
您可以在那里检查:

Save automatically before build + Build automatically 

如果这不起作用,请尝试以下操作:

首选项 -> 运行/调试-> 启动-> 启动前保存脏编辑器

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

走过海棠暮 2024-08-03 23:21:39

我很久以前写了一个插件来做到这一点,它似乎仍然有效: http:// www.stateoffflow.com/projects/71/save-me

它会在编辑器失去焦点时保存它。 但是,如果您退出 Eclipse,它不会注意到。

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.

梦开始←不甜 2024-08-03 23:21:39

试试这个

Goto Eclipse Preferences > 一般> 编辑> 自动保存

如果不起作用,请尝试此

首选项 -> 运行/调试-> 启动-> 启动前保存脏编辑器

Try this

Goto Eclipse Preferences > General > Editors > Autosave

if it not work then try this

Preferences -> Run/Debug -> Launching -> Save dirty editors before launching

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文