| Get property in "plugin.properties" file. [message #230116] |
Thu, 25 May 2006 02:05  |
Eclipse User |
|
|
|
Dear all,
Hi all, did anyone know how to get the property from the
"plugin.properties" file in code? For example, I defined a property in
plugin.properties and I know to use this property in the plugin class.
Thanks
Best Regards,
Eddie
|
|
|
| Re: Get property in "plugin.properties" file. [message #230138 is a reply to message #230116] |
Thu, 25 May 2006 08:56  |
Eclipse User |
|
|
|
This can load the file (from a method within your plugin):
ResourceBundle b = ResourceBundle.getBundle("plugin",
Locale.getDefault(), getClass().getClassLoader());
plugin.properties is ONLY for localization of your plugin.xml and
MANIFEST.MF. It is not for storing plugin-configuration type
properties. i.e. if the property is not used for localization, it
shouldn't be in there.
1) if you need a config type properties file, create another .properties
file and load it into a Properties object. You can find it using
getClass().getResourceAsStream(name).
2) for config-type files, remember that for all intents and purposes
your plugin is read-only.
3) if you need configuration, why not use your plugin's preferences?
Later,
PW
|
|
|
Powered by
FUDForum. Page generated in 0.02653 seconds