Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » how to add a file necessary to run the plugin?
how to add a file necessary to run the plugin? [message #334114] Wed, 21 January 2009 12:40 Go to next message
Alvaro is currently offline AlvaroFriend
Messages: 3
Registered: July 2009
Junior Member
Hello!
I'm developing a plug-in project, and need a file that contains some
important info. This file ("config_file.xml") is already created and is
located in the "src/" folder of my plugin.

How can I locate this file with a relative path to the plug-in? Do I need
an specific extension-point?

Thanks for your help!!
Re: how to add a file necessary to run the plugin? [message #334126 is a reply to message #334114] Wed, 21 January 2009 15:31 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Within your own plugin, you can either use
getClass().getResourceAsStream(*) or Bundle#getEntry(*)

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: how to add a file necessary to run the plugin? [message #334178 is a reply to message #334126] Fri, 23 January 2009 13:40 Go to previous message
Alvaro is currently offline AlvaroFriend
Messages: 3
Registered: July 2009
Junior Member
Thank you Paul!
Your comment was really important to solve my problem. I finally found the
way to get the path of my files:

URL url = FileLocator.find(Activator.getDefault().getBundle(), new Path
("src/config.xml"), null);
URL fileUrl = null;
fileUrl = FileLocator.toFileURL(url);
File file = new File(fileUrl.getPath());


I found it on this website:
http://codeache.blogspot.com/2007/05/loading-files-with-rcp. html

Ciao!
Previous Topic:Maximize workbench window
Next Topic:How to provide duplicating a file within a project ?
Goto Forum:
  


Current Time: Fri Nov 08 22:01:33 GMT 2024

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

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

Back to the top