Eclipse 在哪里存储首选项?

当我在如下屏幕截图所示的窗口中更改设置时,这些设置实际存储在哪里?

When I change a setting in a window like in the screenshot below, where are those settings actually stored?

奖励:有什么方法可以使用 Java、Eclipse RCP 等以编程方式访问设置?

Bonus: Is there any way, using Java, Eclipse RCP etc, to access the settings programmatically?

谢谢!

推荐答案

来源:Eclipse wiki

如果您想将首选项从一个版本保留到另一个版本,请使用 File/Export/Preferences 导出它们.

If you want to keep preferences from one version to the other, export them using File/Export/Preferences.

首选项存储在不同的地方(这适用于 Eclipse 3.1)

Preferences are stored in various places (this applies to Eclipse 3.1)

对于每个安装(但对于多用户安装,这可能会有所不同),存储在以下文件中:<eclipse_home>/eclipse/configuration/.settings/

for each installation (but this may vary for multi-user installations), in files stored in: <eclipse_home>/eclipse/configuration/.settings/

每个插件通常有一个文件,带有 prefs 扩展名.请注意,很少有插件使用安装范围的首选项.

There is typically one file per plugin, with a prefs extension. Note that very few plug-ins use installation-wide preferences.

对于每个工作区,在 /.metadata/.plugins/org.eclipse.core.runtime/.settings 中存储的文件中.

for each workspace, in files stored in <workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings .

每个插件通常有一个文件,带有 prefs 扩展名.对于每个项目 -- 用于项目级设置 -- 存储在项目文件夹的 .settings 子目录中的文件中.

There is typically one file per plugin, with a prefs extension. for each project --for project-level settings -- in files stored in a .settings sub-directory of your project folder.

这里使用java代码访问首选项的文章.

Here's the article to access preferences using java code.

相关文章