Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » store a file in the plugin
store a file in the plugin [message #267966] Fri, 20 August 2004 12:25 Go to next message
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 Go to previous messageGo to next message
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 Go to previous message
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é
Previous Topic:Toolbar style pulldown example
Next Topic:Source code folding in my own editor
Goto Forum:
  


Current Time: Tue Oct 21 07:05:42 GMT 2014

Powered by FUDForum. Page generated in 0.13757 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software