store a file in the plugin [message #267966] |
Fri, 20 August 2004 12:25 |
Eclipse User |
|
|
|
Originally posted by: rm.triadem.ch
Hello
I like store a DTD file in my plugin (similar to a .properties file).
Which is the best way to this, so that the running application has
an easy access to the file?
Thank you in advance
René
|
|
|
Re: store a file in the plugin [message #268005 is a reply to message #267966] |
Fri, 20 August 2004 14:02 |
Eclipse User |
|
|
|
Originally posted by: richkulp.NO.SPAM.us.ibm.com
You can't store in the plugin itself at runtime. However, you are given
a workarea in each workspace per plugin that your plugin can store
files in:
Use Platform.getStateLocation(Bundle) to get a path to this workarea
that your plugin owns.
However if your question is you want to put it in the plugin at
development time so that it is available at runtime, you will need to
either put in your jar (i.e. put it in your source directory) and then
use the standard java class.getResource() to access it or put it in your
project directory and:
1) Update the build.properties bin.includes line to include this new
file or directory
2) Use Platform.find(Bundle, IPath) to get the URL to it and then use
url.openStream() to access the contents of the file.
--
Thanks, Rich Kulp
|
|
|
Re: store a file in the plugin [message #268192 is a reply to message #268005] |
Mon, 23 August 2004 12:12 |
Eclipse User |
|
|
|
Originally posted by: rm.triadem.ch
Rich Kulp wrote:
> You can't store in the plugin itself at runtime.
Sorry my question was not precise enough.
> However if your question is you want to put it in the plugin at
> development time so that it is available at runtime
That is what I am looking for.
> 1) Update the build.properties bin.includes line to include this new
> file or directory
Done.
> 2) Use Platform.find(Bundle, IPath) to get the URL to it and then use
> url.openStream() to access the contents of the file.
Works perfect for me.
Thank you!
René
|
|
|
Powered by
FUDForum. Page generated in 0.02574 seconds