Eclipse:将信息存储在 .project 文件中

我正在尝试将信息与项目(某些属性)相关联.我尝试使用持久存储(getPersistentProperty()setPersistentProperty()).
这样做的问题是,当我导出项目并将其重新导入到不同的工作区时,这些属性就消失了(因为它们存储在工作区的 .metadata 文件夹中的某个位置).

I'm trying to associate information with projects (certain properties). I tried using the persistence store (getPersistentProperty() and setPersistentProperty()).
The problem with that is that when I export the project and re-import it in a different workspace, those properties are gone (since they are stored somewhere in the .metadata folder of the workspace).

所以我在想,如果有办法将信息存储在 .project 文件中,那么这将解决我的问题,因为导出项目时始终包含该文件.

So I was thinking that if there's a way to store the info in the .project file then this would solve my problem because this file is always included when projects are exported.

是否有 API 可以做到这一点?

Is there an API to do that?

任何指针将不胜感激!谢谢!

Any pointers would be appreciated! Thank you!

问候,T

推荐答案

您可能需要考虑使用 配置范围 跨工作区存储首选项.
请参阅 项目范围偏好.
使用 Store(如 this thread 中所述),您还获取有关配置性质的一些详细信息在此常见问题解答中.

You may need to consider using a configuration scope to store preferences across workspace.
See project scope preferences.
Using Store (as discussed in this thread), you also get some details on the nature of a configuration in this FAQ.

相关文章