RE: Access file in developed plugin [message #330639] |
Wed, 06 August 2008 13:35  |
Eclipse User |
|
|
|
Hi all,
I have a little problem. I have developed a plugin, and in my plugin in
have an XML properties file. I need to be able to access this properties
file in my plugin code - to do this i need the file location. Does anyone
know how to do this?
Thanks for your help,
Mark
|
|
|
|
Re: Access file in developed plugin [message #330699 is a reply to message #330651] |
Sun, 10 August 2008 01:39  |
Eclipse User |
|
|
|
Mark,
Maybe this method will help.
public static Properties getPropertiesFromPlugin(
String fileName, String pluginId) {
Properties properties = new Properties();
try {
Path path = new Path(fileName);
Bundle bundle = Platform.getBundle(pluginId);
InputStream propStream = FileLocator.openStream(bundle, path, false);
properties.load(propStream);
propStream.close();
} catch (IOException e) {
}
return properties;
}
Shawn
Phurnace Software
Mark Melia wrote:
> Hi all,
> I found this post
> http://dev.eclipse.org/mhonarc/newsLists/news.eclipse.platfo rm/msg32261.html
> , which outlines how to access a file in a plugin at runtime using an
> InputStream. What I am trying to do is to define a build file and embed
> that in the plugin and then call the ant programmatically using the
> AntRunner. Unfortunately the AntRunner doesnt seem to work with an
> InputStream representation of the build file - so does anyone know how
> to either allow AntRunner to accept an InputStream as its buildfile
> (instead of the file location) or know how to specify a file location
> for the build file which is in the plugin jar at runtime?
>
> Thanks for your help,
> Mark
>
> Mark Melia wrote:
>
>> Hi all,
>
>> I have a little problem. I have developed a plugin, and in my plugin
>> in have an XML properties file. I need to be able to access this
>> properties file in my plugin code - to do this i need the file
>> location. Does anyone know how to do this?
>
>> Thanks for your help,
>> Mark
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03486 seconds