How to write file to workspace w.r.t. PDE [message #226646] |
Thu, 09 August 2007 08:47  |
Eclipse User |
|
|
|
Originally posted by: amit.hanchinamani.gmail.com
Hi Guys,
I want to create a file and write it to the eclipse workspace.
I know how to create and write a file to disk, but dont know how to write
it w.r.t the plug-in using Bundle.
I know the following can be used to get file
Bundle bundle = Platform.getBundle("id");
Path path = new Path("path");
URL url = FileLocator.find(bundle, path, null);
but I cannot figure out how to write a file using Bundle to my plug-in
workspace.
Any help appreciated.
Cheers,
Amit
|
|
|
Re: How to write file to workspace w.r.t. PDE [message #226765 is a reply to message #226646] |
Thu, 09 August 2007 14:18   |
Eclipse User |
|
|
|
Originally posted by: wharley.bea.com
"Amit" <amit.hanchinamani@gmail.com> wrote in message
news:e1cb2c90d03cb0ec98076267e1917788$1@www.eclipse.org...
> Hi Guys,
>
> I want to create a file and write it to the eclipse workspace.
> I know how to create and write a file to disk, but dont know how to write
> it w.r.t the plug-in using Bundle.
>
> I know the following can be used to get file
>
> Bundle bundle = Platform.getBundle("id");
> Path path = new Path("path");
> URL url = FileLocator.find(bundle, path, null);
>
> but I cannot figure out how to write a file using Bundle to my plug-in
> workspace.
Your terminology is a bit confusing. The "workspace" is where your projects
live; saying you want to write to the workspace, relative to a plug-in, is
meaningless. What exactly are you trying to do? Write some sort of bundle
configuration data, or write a temporary file, or ....?
I think what you're looking for might be Plugin.getStateLocation(), or
equivalently Platform.getStateLocation(Bundle). There are also some other
interesting locations, like Platform.getConfigurationLocation(),
Platform.getInstallLocation(), and so forth.
You cannot, in general, write files to the directory that your plug-in lives
in, because it is very likely inside a jar file.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08662 seconds