how to get IFolder of this plugin? [message #305030] |
Wed, 21 June 2006 17:06 |
Eclipse User |
|
|
|
Originally posted by: romich_n.mail.ru
How can I get the IFolder of the plugin that is currently running (my
plugin)?
Basically what I want to do is access several files and folders in
Templates folder under my plugin and copy them over to the new project.
Thanks
|
|
|
Re: how to get IFolder of this plugin? [message #305033 is a reply to message #305030] |
Wed, 21 June 2006 17:37 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
Plugins don't have IFolders; only projects in the workspace do. You should access resources via the Bundle.getEntry(/path/to/resource) or Class.getResourceAsStream(/path/to/resource) -- preferably the latter, if you're just coping the data out as a template, becuase then it's a fairly simple read/write copy, and secondly it's more efficient than the Bundle.getEntry() way in the scenario where the plugin is packed.
Alex.
|
|
|
Re: how to get IFolder of this plugin? [message #305035 is a reply to message #305033] |
Wed, 21 June 2006 18:05 |
Eclipse User |
|
|
|
Originally posted by: romich_n.mail.ru
will any of the above allow me to navigate folder structure inside the
plugin?
Lets say I have a folder Templates in my plugin and in this folder I have
some folder structure. Is it posible to duplicate this folder structure in
the new project?
Thanks again
|
|
|
Re: how to get IFolder of this plugin? [message #305038 is a reply to message #305035] |
Wed, 21 June 2006 20:02 |
Eclipse User |
|
|
|
Originally posted by: automatic.javalobby.org
You could probably enumerate through the entries via Bundle.getEntry. You can't do the same with Class.getResource() though as you'll need to know the name of the resource you're looking up. But as long as you know how to read the folder structure, then you can easily process it. For example, you could have the folder structure in a plain text file and use that to create directories, or (even better) compress your templates into a Zip file (say template.zip) and then use the Java APIs to extract the contents of that Zip file into your new project location.
Alex.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04471 seconds