Read remote properties
-
19-09-2019 - |
Question
First of all, Hello everyone(/world) !
I am making an Eclipse RCP app' who needs to inspect some .properties located in some plugins who's Id I know at runtime.
I'd like to know if there is an easy way to read them, for example I know that in my plugin *org.anyname.myplugins.mypluginthatrocks I have a file named myawsomeproperties.properties*, how can I open it and read it easyly with a sort of getter/setter system like
String getInProperties(String fileNameOrPath,String myPropertieId)
void setInProperties(String fileNameOrPath,String myPropertieId,String myPropertieValue)
orString getInProperties(File file,String myPropertieId)
void setInProperties(File file,String myPropertieId,String myPropertieValue)
or any other mean in that type if you get what I mean ...
Thanks in advance ^^
Solution
Well, if these are juste plain old properties, there is the good old ResourceBundle that will do the trick.
But, if you would like to do it, IMHO, a little bit cleaner, and in a more Eclipse oriented mind, I would suggest that you create a class that you use the NLS class, as explained here.