How to set and get a configuration file for a eclipse plugin [message #332217] |
Sat, 11 October 2008 09:22  |
Eclipse User |
|
|
|
I am developing a eclipse plug-in and have a configuration file which
contains the configuration information for the plug-in. These information
are not neccessary to be exposed to the plug-in user. So these information
are not preference. I would like to put the configuration file within the
plug-in such as the root folder of the plug-in jar or the .metadata area
of the plug-in. I am not sure which way is a better practice and how could
I retrieve the configuration file when plug-in is activated.
Highly appreciated for any suggestion!
hao
|
|
|
Re: How to set and get a configuration file for a eclipse plugin [message #332220 is a reply to message #332217] |
Sun, 12 October 2008 01:04   |
Eclipse User |
|
|
|
"Hao " <d95776@yahoo.com> wrote in message
news:4c579dc9efae68d04f30666d971c8332$1@www.eclipse.org...
>I am developing a eclipse plug-in and have a configuration file which
>contains the configuration information for the plug-in. These information
>are not neccessary to be exposed to the plug-in user. So these information
>are not preference. I would like to put the configuration file within the
>plug-in such as the root folder of the plug-in jar or the .metadata area of
>the plug-in. I am not sure which way is a better practice and how could I
>retrieve the configuration file when plug-in is activated.
>
> Highly appreciated for any suggestion!
Try Platform.getStateLocation().
There are also a bunch of similar getXxxLocation() methods in Platform - you
might want to read the javadoc for all of them, to be sure you are thinking
about your problem correctly.
|
|
|
Re: How to set and get a configuration file for a eclipse plugin [message #332222 is a reply to message #332217] |
Sun, 12 October 2008 14:46   |
Eclipse User |
|
|
|
Hao schrieb:
> I am developing a eclipse plug-in and have a configuration file which
> contains the configuration information for the plug-in. These
> information are not neccessary to be exposed to the plug-in user. So
> these information are not preference. I would like to put the
> configuration file within the plug-in such as the root folder of the
> plug-in jar or the .metadata area of the plug-in. I am not sure which
> way is a better practice and how could I retrieve the configuration file
> when plug-in is activated.
>
> Highly appreciated for any suggestion!
>
> hao
>
Hi Hao,
for delivering the initial plug-in configuration, i would prefer to put
the properties file into the plug-in root directory. Your activator may
access the ressource via getBundle().getResource("props_file_name").
If you want to provide the ability of load/save an plug-in internal
state, then use the suggestion of Walter.
Holger
|
|
|
Re: How to set and get a configuration file for a eclipse plugin [message #332304 is a reply to message #332222] |
Fri, 17 October 2008 15:31  |
Eclipse User |
|
|
|
[for delivering the initial plug-in configuration, i would prefer to put
the properties file into the plug-in root directory. Your activator may
access the ressource via getBundle().getResource("props_file_name").
If you want to provide the ability of load/save an plug-in internal
state, then use the suggestion of Walter.
]
You are right. I like your idea.
thanks!
hao
|
|
|
Powered by
FUDForum. Page generated in 0.03078 seconds