Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » obtaining a file under development for plugins
obtaining a file under development for plugins [message #64380] Thu, 05 June 2003 18:48 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 #64562 is a reply to message #64539] Thu, 05 June 2003 20:33 Go to previous messageGo to next message
Jeff Hunter is currently offline Jeff HunterFriend
Messages: 73
Registered: July 2009
Member
David Havrda wrote:
> I guess my real problem is not opening the file but rather obtaining the
> location of my file.

Read the documentation for Platform.resolve() and read this:

http://eclipsewiki.swiki.net/114#platformurl

Jeff
Re: obtaining a file under development for plugins [message #64585 is a reply to message #64562] Thu, 05 June 2003 20:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dhavrda.motive.com

Thanks. That helps.

"Jeff Hunter" <jxh106@po.cwru.edu> wrote in message
news:bbo9fe$nn0$1@rogue.oti.com...
> David Havrda wrote:
> > I guess my real problem is not opening the file but rather obtaining the
> > location of my file.
>
> Read the documentation for Platform.resolve() and read this:
>
> http://eclipsewiki.swiki.net/114#platformurl
>
> Jeff
>
Re: obtaining a file under development for plugins [message #64769 is a reply to message #64585] Thu, 05 June 2003 22:48 Go to previous message
Eclipse UserFriend
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
Previous Topic:Persist a WorkingSet?
Next Topic:can not access help contents
Goto Forum:
  


Current Time: Fri Dec 27 00:10:45 GMT 2024

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

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

Back to the top