eclipse项目属性 [英] eclipse project properties

查看:387
本文介绍了eclipse项目属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过 IResource设置 IResource IProject 更具体)的属性.setPersistenceProeprty 。在这种情况下,属性值保存在 .metadata 文件夹中。这不是很好,因为属性与 .project 文件断开连接。

I am setting properties for IResource (IProject to be more specific) through IResource.setPersistenceProeprty. In this case property value is saved in .metadata folder. That is not so good as property is disconnected from .project file.

如何将项目属性保存在 .project 文件?

How can I save project property in .project file?

推荐答案

一个常见的解决方案是使用项目作用域首选项,它们存储在位于文件中的在项目中(在< project> /。settings 文件夹中)

A common solution is to use project scoped preferences that are stored in a file located inside the project (in <project>/.settings folder).

ProjectScope ps = new ProjectScope(projectResource);
IEclipsePreferences prefs = ps.getNode("my.plugin.id");
prefs.put("key", "value");
prefs.flush();

这篇关于eclipse项目属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆