Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to get the plugin installation directory?
How to get the plugin installation directory? [message #168006] Fri, 09 July 2004 21:43 Go to next message
Eclipse UserFriend
Originally posted by: dtwchiu.hotmail.com

Hi,

I am wonder if it is possible to find out the directory of where the
plugin code is installed. For example, My eclipse is installed at
d:\eclipse and my plugin is called org.xyz.foo_1.0.0. What is the best
way to get the directory "d:\eclipse\plugins\org.xyz.foo_1.0.0"
programmatically inside the plugin code?

I am thinking of putting in some template files inside my plugin, but
don't know how to get it back.

Thanks.

David.
Re: How to get the plugin installation directory? [message #168057 is a reply to message #168006] Sun, 11 July 2004 06:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: phil.dadabeatnik.com

Well, I'm going to answer this one, because it took me a while to figure it
out.

This is code inside of my Plugin which extends AbstractUIPlugin:

/**
* @return The File Location of this plugin
*/
public File getPluginFolder() throws IOException {
URL url = getBundle().getEntry("/");
url = Platform.asLocalURL(url);
return new File(url.getPath());
}

Phillipus


"David Chiu" <dtwchiu@hotmail.com> wrote in message
news:ccnhkr$19e$1@eclipse.org...
> Hi,
>
> I am wonder if it is possible to find out the directory of where the
> plugin code is installed. For example, My eclipse is installed at
> d:\eclipse and my plugin is called org.xyz.foo_1.0.0. What is the best
> way to get the directory "d:\eclipse\plugins\org.xyz.foo_1.0.0"
> programmatically inside the plugin code?
>
> I am thinking of putting in some template files inside my plugin, but
> don't know how to get it back.
>
> Thanks.
>
> David.
>
Re: How to get the plugin installation directory? [message #168099 is a reply to message #168057] Sun, 11 July 2004 19:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dtwchiu.hotmail.com

Phillipus,

Thanks so much. It works!

David.

Phillipus wrote:

> Well, I'm going to answer this one, because it took me a while to figure it
> out.

> This is code inside of my Plugin which extends AbstractUIPlugin:

> /**
> * @return The File Location of this plugin
> */
> public File getPluginFolder() throws IOException {
> URL url = getBundle().getEntry("/");
> url = Platform.asLocalURL(url);
> return new File(url.getPath());
> }

> Phillipus


> "David Chiu" <dtwchiu@hotmail.com> wrote in message
> news:ccnhkr$19e$1@eclipse.org...
> > Hi,
> >
> > I am wonder if it is possible to find out the directory of where the
> > plugin code is installed. For example, My eclipse is installed at
> > d:eclipse and my plugin is called org.xyz.foo_1.0.0. What is the best
> > way to get the directory "d:eclipsepluginsorg.xyz.foo_1.0.0"
> > programmatically inside the plugin code?
> >
> > I am thinking of putting in some template files inside my plugin, but
> > don't know how to get it back.
> >
> > Thanks.
> >
> > David.
> >
Re: How to get the plugin installation directory? [message #168276 is a reply to message #168099] Mon, 12 July 2004 11:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

Please don't use asLocal(). That will cause a local physical copy of the
file to be made if the file is on another system. Just use
resolveURL(). If it is a local file, then it will become a file:
protocol. But it may resolve to a file:...jar!... type if the entire
plugin was a jar, or it may be http: if the plugin is on a different system.


--
Thanks, Rich Kulp

Re: How to get the plugin installation directory? [message #168411 is a reply to message #168276] Tue, 13 July 2004 05:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: phil.dadabeatnik.com

Good call, Rich.

Thanks,

Phillipus


"Rich Kulp" <richkulp@NO.SPAM.us.ibm.com> wrote in message
news:ccua3r$fhu$2@eclipse.org...
> Please don't use asLocal(). That will cause a local physical copy of the
> file to be made if the file is on another system. Just use
> resolveURL(). If it is a local file, then it will become a file:
> protocol. But it may resolve to a file:...jar!... type if the entire
> plugin was a jar, or it may be http: if the plugin is on a different
system.
>
>
> --
> Thanks, Rich Kulp
> 
>
Re: How to get the plugin installation directory? [message #170165 is a reply to message #168411] Tue, 27 July 2004 00:30 Go to previous message
Eclipse UserFriend
Originally posted by: anuj.andale.com

Just wondering. Couldnt you bundle them in your jar, and pick them as
resources?

-anuj

"Phillipus" <phil@dadabeatnik.com> wrote in message
news:cd0947$jk5$1@eclipse.org...
> Good call, Rich.
>
> Thanks,
>
> Phillipus
>
>
> "Rich Kulp" <richkulp@NO.SPAM.us.ibm.com> wrote in message
> news:ccua3r$fhu$2@eclipse.org...
>> Please don't use asLocal(). That will cause a local physical copy of the
>> file to be made if the file is on another system. Just use
>> resolveURL(). If it is a local file, then it will become a file:
>> protocol. But it may resolve to a file:...jar!... type if the entire
>> plugin was a jar, or it may be http: if the plugin is on a different
> system.
>>
>>
>> --
>> Thanks, Rich Kulp
>> 
>>
>
>
Previous Topic:Plugins: J2EE support?
Next Topic:CVS: Checking out a folder into an existing project
Goto Forum:
  


Current Time: Thu Jul 24 15:43:24 EDT 2025

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

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

Back to the top