2009-07-23 145 views
0

首先,大家好(/ world)!阅读远程属性

我正在制作一个Eclipse RCP应用程序,他需要检查位于某些插件中的某些.properties,这些插件是我在运行时知道的。

我想知道是否有简单方式来读取它们,例如我知道在我的插件* org.anyname.myplugins。 mypluginthatrocks我有一个文件名为myawsomeproperties的.properties *,我怎么能打开它,并带有几分的getter/setter系统,如

String getInProperties(String fileNameOrPath,String myPropertieId) 
void setInProperties(String fileNameOrPath,String myPropertieId,String myPropertieValue)
String getInProperties(File file,String myPropertieId) 
void setInProperties(File file,String myPropertieId,String myPropertieValue)
或该类型的任何其他平均的easyly读它,如果你明白我的意思是......提前^^

回答

1

谢谢,如果这些是中庸之道普通的旧属性外,还有美好的旧ResourceBundle,会做的伎俩。

但是,如果您想要做到这一点,恕我直言,一点点清洁,并在一个更加以Eclipse为导向的头脑中,我建议您创建一个类,使用NLS类,如explained here

+0

我得到了“NLS丢失消息:tamiflu:com.example.rcpapp”并且无法计算如何摆脱它... 我已经在eclipse帮助中心跟踪了这个例子。 我在我的插件的根文件夹中有一个messages.properties文件, 我做了一个Messages类和所有。 我肯定错过了什么,但什么? :/ – Ar3s 2009-07-23 12:30:38