Eclipse 自动保存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2635951/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 19:19:59  来源:igfitidea点击:

Eclipse save automatically

eclipseideautosave

提问by Dónal

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:

我希望 Eclipse 每次编辑文件时都自动保存,就像它自动构建的方式一样。因为我去年一直在使用 IntelliJ(默认情况下会自动保存),所以我一直遇到以下问题:

  • 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
  • 在 Eclipse 中进行一些更改
  • 忘记按保存
  • 运行构建、单元测试,并注意一些奇怪的行为
  • (一段时间后......)意识到发生意外行为是因为我忘记保存更改

Is there any way I can make Eclipse save automatically?

有什么办法可以让 Eclipse 自动保存?

回答by ROMANIA_engineer

Eclipse Neon (4.6)

日食霓虹灯 (4.6)

Window> Preferences

窗口>首选项

Window Preferences

窗口首选项

General> Editors> Autosave> check Enable autosave for dirty editors> choose the value for autosave interval (in seconds)

常规>编辑器>自动保存> 选中为脏编辑器启用自动保存> 选择自动保存间隔的值(以秒为单位)

General Editors Autosave

一般编辑器自动保存

Details in M7:

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

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

回答by GuruKulki

You can go here and check the box Save automatically before build

您可以去这里并在构建前选中自动保存框

Windows > Preferences > General -> Workspace

Windows > 首选项 > 常规 -> 工作区

回答by Nick Fortescue

You can do it with the saveDirtyEditor pluginas referenced in this question/answer. There is no non-plugin way of doing it.

您可以使用此问题/答案中引用的saveDirtyEditor 插件来完成。没有非插件的方式来做到这一点。

回答by UmAnusorn

First, try Window -> Preferences -> General -> Workspace. There you can check "Save automatically before build" and "Build automatically."

首先,尝试 Window -> Preferences -> General -> Workspace。在那里您可以选中“构建前自动保存”和“自动构建”。

If that does not work,

如果这不起作用

PLEASE TRY

请尝试

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

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

回答by mystilleef

I wrote an Eclipse plugin for this called smartsave. It's available in the Eclipse Market Place.

我为此编写了一个名为smartsave的 Eclipse 插件。它可以在 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.

它以指定的时间间隔保存您的文件,您甚至可以对其进行调整以防止在首选项对话框中出现错误或警告时进行保存。

回答by AnthonyW

In Helios this can be done by going to preferences and setting:

在 Helios 中,这可以通过转到首选项和设置来完成:

Run/Debug > Launching > Save required dirty editors before launching

运行/调试 > 启动 > 启动前保存所需的脏编辑器

回答by Tatkal

For Eclipse Mars 2, the settings are below Window > Preferences > General > Workspace. These settings are in minutes and not in seconds.

对于 Eclipse Mars 2,设置位于 Window > Preferences > General > Workspace 下。这些设置以分钟为单位,而不是以秒为单位。

enter image description here

在此处输入图片说明

回答by Jasbin karki

You could go to Windows > Preferences > Autosaveand set the auto intervals to 1.

您可以转到Windows > Preferences > Autosave并将自动间隔设置为 1。