[英]Where does Eclipse store preferences?
When I change a setting in a window like in the screenshot below, where are those settings actually stored? 当我更改窗口中的设置时,如下面的屏幕截图所示,这些设置实际存储在哪里?
Bonus: Is there any way, using Java, Eclipse RCP etc, to access the settings programmatically? 额外奖励:有没有办法,使用Java,Eclipse RCP等以编程方式访问设置?
Thanks! 谢谢!
Source : Eclipse wiki 来源: Eclipse维基
If you want to keep preferences from one version to the other, export them using File/Export/Preferences. 如果要将首选项从一个版本保留到另一个版本,请使用“文件/导出/首选项”将其导出。
Preferences are stored in various places (this applies to Eclipse 3.1) 首选项存储在各个位置(这适用于Eclipse 3.1)
for each installation (but this may vary for multi-user installations), in files stored in: <eclipse_home>/eclipse/configuration/.settings/
对于每个安装(但这可能因多用户安装而异),存储在以下文件中:
<eclipse_home>/eclipse/configuration/.settings/
There is typically one file per plugin, with a prefs extension. 每个插件通常有一个文件,带有prefs扩展名。 Note that very few plug-ins use installation-wide preferences.
请注意,很少有插件使用安装范围的首选项。
for each workspace, in files stored in <workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings
. 对于每个工作空间,存储在
<workspace>/.metadata/.plugins/org.eclipse.core.runtime/.settings
。
There is typically one file per plugin, with a prefs extension. 每个插件通常有一个文件,带有prefs扩展名。 for each project --for project-level settings -- in files stored in a .settings sub-directory of your project folder.
对于每个项目 - 对于项目级设置 - 存储在项目文件夹的.settings子目录中的文件。
Here's the article to access preferences using java code. 这是使用java代码访问首选项的文章。
The preferences are stored in prefs files in the workspace at .metadata/.plugins/org.eclipse.core.runtime/.settings
. 首选项存储在工作空间的prefs文件中
.metadata/.plugins/org.eclipse.core.runtime/.settings
。 There is one prefs-file for each plugin contributing preferences. 每个插件贡献首选项都有一个prefs文件。
The programmatical access to the entire preferences is done with IPreferencesService
the which you may obtain using Platform.getPreferencesService()
. 对使用
Platform.getPreferencesService()
可以获得的IPreferencesService
完成对整个首选项的编程访问。
You may find more information and examples on how to use them in the Runtime preferences Eclipse help page. 您可以在运行时首选项 Eclipse帮助页面中找到有关如何使用它们的更多信息和示例。
Search for it: 搜索它:
Change some setting in Eclipse then run: 在Eclipse中更改一些设置然后运行:
find ~ -type f -mmin -5 | grep "\.settings"
This will discover files modified in last 5 minutes. 这将发现最近5分钟内修改的文件。
Mine was in workspace
, literally... 我在
workspace
,字面意思......
~/workspace/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.workbench.prefs
You can see most of the relevant eclipse settings (mainly for JDT) in the saneclipse project from Lars Vogel . 您可以在Lars Vogel的saneclipse项目中看到大多数相关的eclipse设置(主要用于JDT)。
See the vogellacompany/com.vogella.saneclipse
repo, which will tweak and fine-tune the settings of: 请参阅
vogellacompany/com.vogella.saneclipse
repo,它将调整和微调以下设置:
com.vogella.saneclipse.preferences/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.runtime.prefs
com.vogella.saneclipse.preferences/.settings/org.eclipse.core.resources.prefs
com.vogella.saneclipse.templates/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.jdt.core.prefs
com.vogella.saneclipse.fileextensions/.settings/org.eclipse.pde.core.prefs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.