Skip to main content



      Home
Home » Newcomers » Newcomers » How to write file to workspace w.r.t. PDE
How to write file to workspace w.r.t. PDE [message #226646] Thu, 09 August 2007 08:47 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: How to write file to workspace w.r.t. PDE [message #226798 is a reply to message #226765] Thu, 09 August 2007 16:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: amit.hanchinamani.gmail.com

Hi,

What I want to do is follows
I have a view with data. I am reading this data and then building an html
file and want to save that html file in my workspace. This workspace is my
current working project directory and not the plug-in project folder. If I
try to write/save the file directly I get an exception as location not
found. It works fine if I use an absolute path. So how can I write/save
this created file in my project folder..?
Re: How to write file to workspace w.r.t. PDE [message #226885 is a reply to message #226798] Fri, 10 August 2007 04:24 Go to previous message
Eclipse UserFriend
Originally posted by: amit.hanchinamani.gmail.com

Hi,

I have managed to fix the problem.
Thanks for your suggestions :)
Previous Topic:Help! PHPize and Installing DBG?
Next Topic:pleaseee help me
Goto Forum:
  


Current Time: Tue May 13 17:49:38 EDT 2025

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

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

Back to the top