Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » determining Eclipse or Eclipse plug in location at run time
determining Eclipse or Eclipse plug in location at run time [message #461508] Wed, 10 January 2007 20:11 Go to next message
Eclipse UserFriend
Originally posted by: ramapra.gmail.com

Hi ,

I have a plug in and need to save some user information . To do this I
was thinking of using a File , but I need to specify the location of the
file . I want the file to ideally be in the same folder as my plug in (
.../eclipse/plugins/MyPlugin)


Basically I need a mechanism where I am storing this file under MY plugin
directory.


Is there an API or mechanism that provides the location of the currently
running plugin ?


I am running on Linux and When i check for the current working directory
it returns /root


Thanks
Re: determining Eclipse or Eclipse plug in location at run time [message #461511 is a reply to message #461508] Wed, 10 January 2007 22:07 Go to previous messageGo to next message
Eclipse UserFriend
Read http://wiki.eclipse.org/index.php/FAQ_Where_do_plug-ins_stor e_their_state%3F
Re: determining Eclipse or Eclipse plug in location at run time [message #461523 is a reply to message #461511] Thu, 11 January 2007 05:35 Go to previous messageGo to next message
Eclipse UserFriend
Yeah, and to follow it up, you shouldn't assume that (a) myplugin is a directory, or (b) that it's writable. You certainly shouldn't expect to get out resources via a java.io.File object.

Look for the getPluginStateLocation(), and if you need to instantiate a template, access it from the plugin with getClass().getResourceAsStream("/the.template.txt"), then pass that to whatever stream is expecting to read from it. You can then dump it out to the plugin state location later.

Alex.
Re: determining Eclipse or Eclipse plug in location at run time [message #461544 is a reply to message #461523] Thu, 11 January 2007 14:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ramapra.gmail.com

Thank you everyone for the responses . I had one question regarding the
process of Writing


You were suggesting that I not use java.io. classes


How would i write to this same resource ?
Re: determining Eclipse or Eclipse plug in location at run time [message #461550 is a reply to message #461544] Thu, 11 January 2007 19:04 Go to previous message
Eclipse UserFriend
I think Alex was saying for reading defaults or templates out of your
plugin, don't use java.io.File, just use getResource(*) or
getResourceAsStream(*).

To write to your plugin state location, it's OK to use java.io.File,
Writer, etc.

Later,
PW
Previous Topic:Help! How to Debug in RCP Development?
Next Topic:how to change the color of the title bar of RCP product
Goto Forum:
  


Current Time: Mon Mar 17 21:58:18 EDT 2025

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

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

Back to the top