obtaining a file under development for plugins [message #64380] |
Thu, 05 June 2003 18:48 |
Eclipse User |
|
|
|
Originally posted by: dhavrda.motive.com
I would like to get a file during development of a plugin. I would like to
read the contents of this file during the wizard create file (for my type).
The problem is I dont know how to obtain the reference to this file in an
abstract way so as to work during dev time and deployed time. I am in my
method openContentStream of my Wizard. Here is what I am doing now.
URL url = new URL(MMEPlugin.getDefault().getDescriptor().getInstallURL(),
fileName);
return MMEPlugin.getDefault().openStream(new Path(url.getPath()));
thx,
dave
|
|
|
Re: obtaining a file under development for plugins [message #64495 is a reply to message #64380] |
Thu, 05 June 2003 19:42 |
Eclipse User |
|
|
|
Originally posted by: richkulp.NOSPAM.us.ibm.com
David Havrda wrote:
> I would like to get a file during development of a plugin. I would like to
> read the contents of this file during the wizard create file (for my type).
> The problem is I dont know how to obtain the reference to this file in an
> abstract way so as to work during dev time and deployed time. I am in my
> method openContentStream of my Wizard. Here is what I am doing now.
>
> URL url = new URL(MMEPlugin.getDefault().getDescriptor().getInstallURL(),
> fileName);
>
> return MMEPlugin.getDefault().openStream(new Path(url.getPath()));
>
> thx,
>
> dave
>
>
Why not just use url.openStream(), that should work both in development
or in runtime. Assuming that in development the file is in the same
project in the root of that project that the plugin.xml is in.
--
Thanks, Rich Kulp
|
|
|
Re: obtaining a file under development for plugins [message #64539 is a reply to message #64495] |
Thu, 05 June 2003 19:51 |
Eclipse User |
|
|
|
Originally posted by: dhavrda.motive.com
I guess my real problem is not opening the file but rather obtaining the
location of my file.
"Richard L. Kulp" <richkulp@NOSPAM.us.ibm.com> wrote in message
news:bbo6h7$ksc$1@rogue.oti.com...
> David Havrda wrote:
> > I would like to get a file during development of a plugin. I would like
to
> > read the contents of this file during the wizard create file (for my
type).
> > The problem is I dont know how to obtain the reference to this file in
an
> > abstract way so as to work during dev time and deployed time. I am in
my
> > method openContentStream of my Wizard. Here is what I am doing now.
> >
> > URL url = new
URL(MMEPlugin.getDefault().getDescriptor().getInstallURL(),
> > fileName);
> >
> > return MMEPlugin.getDefault().openStream(new Path(url.getPath()));
> >
> > thx,
> >
> > dave
> >
> >
>
> Why not just use url.openStream(), that should work both in development
> or in runtime. Assuming that in development the file is in the same
> project in the root of that project that the plugin.xml is in.
>
> --
> Thanks, Rich Kulp
>
>
|
|
|
|
|
Re: obtaining a file under development for plugins [message #64769 is a reply to message #64585] |
Thu, 05 June 2003 22:48 |
Eclipse User |
|
|
|
Originally posted by: richkulp.NOSPAM.us.ibm.com
Pay particular attention to the stmt in wiki that the resolved location
MAY NOT BE LOCAL.
That is why I suggested using url.openStream(). The URL does not need to
be resolved in that case, and it will work whether the file is local or not.
You were using the correct mechanism to find the URL for the file, you
just shouldn't try get the path from it for your purposes.
Rich
|
|
|
Powered by
FUDForum. Page generated in 0.04301 seconds