Home » Eclipse Projects » Eclipse Platform » How to read a file inside a plug-in's folder
How to read a file inside a plug-in's folder [message #329344] |
Fri, 20 June 2008 03:09  |
Eclipse User |
|
|
|
Originally posted by: fbanica.soluta.net
Hello all,
I want to solve the following problem:
- I have a file (whatsnew.txt) which contains a history of updates for every
version of my RCP application
- at the moment, this file is in the application folder (when the
application is deployed) and is read by a BufferedReader (BufferedReader in
= new BufferedReader(new FileReader(pathFile));)
- when I use an update of the features of my application, the features and
plug-in's are updated, but I don't know how to make even the whatsnew.txt
file get updated by this mechanism.
So, I imagined this scenario:
- put the whatsnew.txt file inside the plug-in folder (together with
plugin.xml or plugin.properties, etc.)
- read this file, somehow, and get its content
The problem is: how can I read it, being inside the plug-in folder?
Any hint? Please, help!
Thank you,
Floppy
|
|
|
Re: How to read a file inside a plug-in's folder [message #329345 is a reply to message #329344] |
Fri, 20 June 2008 03:15   |
Eclipse User |
|
|
|
Originally posted by: fbanica.soluta.net
P.S. In other words, how to read a .txt file from the workspace? It's a .txt
file, not a .properties file...
"Florin Banica" <fbanica@soluta.net> wrote in message
news:g3fl2f$im2$1@build.eclipse.org...
> Hello all,
>
> I want to solve the following problem:
> - I have a file (whatsnew.txt) which contains a history of updates for
> every version of my RCP application
> - at the moment, this file is in the application folder (when the
> application is deployed) and is read by a BufferedReader (BufferedReader
> in = new BufferedReader(new FileReader(pathFile));)
> - when I use an update of the features of my application, the features and
> plug-in's are updated, but I don't know how to make even the whatsnew.txt
> file get updated by this mechanism.
>
> So, I imagined this scenario:
> - put the whatsnew.txt file inside the plug-in folder (together with
> plugin.xml or plugin.properties, etc.)
> - read this file, somehow, and get its content
>
> The problem is: how can I read it, being inside the plug-in folder?
>
> Any hint? Please, help!
>
>
> Thank you,
>
>
>
>
> Floppy
>
|
|
|
Re: How to read a file inside a plug-in's folder [message #329347 is a reply to message #329345] |
Fri, 20 June 2008 05:01   |
Eclipse User |
|
|
|
Originally posted by: ali.akar.geensys.com
I think you can use URI.createPlatformPlugin() if ur file is in the
install location and URI.createPlatformResource() if your file is in the
workspace.
hope this help you,
Florin Banica a écrit :
> P.S. In other words, how to read a .txt file from the workspace? It's a .txt
> file, not a .properties file...
>
>
> "Florin Banica" <fbanica@soluta.net> wrote in message
> news:g3fl2f$im2$1@build.eclipse.org...
>> Hello all,
>>
>> I want to solve the following problem:
>> - I have a file (whatsnew.txt) which contains a history of updates for
>> every version of my RCP application
>> - at the moment, this file is in the application folder (when the
>> application is deployed) and is read by a BufferedReader (BufferedReader
>> in = new BufferedReader(new FileReader(pathFile));)
>> - when I use an update of the features of my application, the features and
>> plug-in's are updated, but I don't know how to make even the whatsnew.txt
>> file get updated by this mechanism.
>>
>> So, I imagined this scenario:
>> - put the whatsnew.txt file inside the plug-in folder (together with
>> plugin.xml or plugin.properties, etc.)
>> - read this file, somehow, and get its content
>>
>> The problem is: how can I read it, being inside the plug-in folder?
>>
>> Any hint? Please, help!
>>
>>
>> Thank you,
>>
>>
>>
>>
>> Floppy
>>
>
>
|
|
| |
Re: How to read a file inside a plug-in's folder [message #329349 is a reply to message #329348] |
Fri, 20 June 2008 05:59   |
Eclipse User |
|
|
|
Assuming your file is inside the META-INF-Directory
Activator.getDefault().getBundle().getEntry("/META-INF/changelog.txt ").openStream();
Florin Banica schrieb:
> Sorry, I don't get it... Do you a have a code snippet? It would be more
> meaningful.
>
> Thanks!
>
>
> "Ali Akar" <ali.akar@geensys.com> wrote in message
> news:g3frai$b2o$1@build.eclipse.org...
>> I think you can use URI.createPlatformPlugin() if ur file is in the install
>> location and URI.createPlatformResource() if your file is in the workspace.
>>
>> hope this help you,
>>
>> Florin Banica a écrit :
>>> P.S. In other words, how to read a .txt file from the workspace? It's a
>>> .txt file, not a .properties file...
>>>
>>>
>>> "Florin Banica" <fbanica@soluta.net> wrote in message
>>> news:g3fl2f$im2$1@build.eclipse.org...
>>>> Hello all,
>>>>
>>>> I want to solve the following problem:
>>>> - I have a file (whatsnew.txt) which contains a history of updates for
>>>> every version of my RCP application
>>>> - at the moment, this file is in the application folder (when the
>>>> application is deployed) and is read by a BufferedReader (BufferedReader
>>>> in = new BufferedReader(new FileReader(pathFile));)
>>>> - when I use an update of the features of my application, the features
>>>> and plug-in's are updated, but I don't know how to make even the
>>>> whatsnew.txt file get updated by this mechanism.
>>>>
>>>> So, I imagined this scenario:
>>>> - put the whatsnew.txt file inside the plug-in folder (together with
>>>> plugin.xml or plugin.properties, etc.)
>>>> - read this file, somehow, and get its content
>>>>
>>>> The problem is: how can I read it, being inside the plug-in folder?
>>>>
>>>> Any hint? Please, help!
>>>>
>>>>
>>>> Thank you,
>>>>
>>>>
>>>>
>>>>
>>>> Floppy
>>>>
>
--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
|
|
| |
Re: How to read a file inside a plug-in's folder [message #329352 is a reply to message #329351] |
Fri, 20 June 2008 06:31  |
Eclipse User |
|
|
|
Originally posted by: fbanica.soluta.net
Ooops, sorry, I misspelled the file name...
It's working fine, thanks again!
"Florin Banica" <fbanica@soluta.net> wrote in message
news:g3g0cp$2hg$1@build.eclipse.org...
> Hmmm, I tried that, but it gives me a big
> java.lang.NullPointerException... :-(
>
> Do you have any idea why this should happen?
>
> "Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
> news:g3fv20$ru5$1@build.eclipse.org...
>> Assuming your file is inside the META-INF-Directory
>>
>> Activator.getDefault().getBundle().getEntry("/META-INF/changelog.txt ").openStream();
>>
>> Florin Banica schrieb:
>>> Sorry, I don't get it... Do you a have a code snippet? It would be more
>>> meaningful.
>>>
>>> Thanks!
>>>
>>>
>>> "Ali Akar" <ali.akar@geensys.com> wrote in message
>>> news:g3frai$b2o$1@build.eclipse.org...
>>>> I think you can use URI.createPlatformPlugin() if ur file is in the
>>>> install location and URI.createPlatformResource() if your file is in
>>>> the workspace.
>>>>
>>>> hope this help you,
>>>>
>>>> Florin Banica a crit :
>>>>> P.S. In other words, how to read a .txt file from the workspace? It's
>>>>> a .txt file, not a .properties file...
>>>>>
>>>>>
>>>>> "Florin Banica" <fbanica@soluta.net> wrote in message
>>>>> news:g3fl2f$im2$1@build.eclipse.org...
>>>>>> Hello all,
>>>>>>
>>>>>> I want to solve the following problem:
>>>>>> - I have a file (whatsnew.txt) which contains a history of updates
>>>>>> for every version of my RCP application
>>>>>> - at the moment, this file is in the application folder (when the
>>>>>> application is deployed) and is read by a BufferedReader
>>>>>> (BufferedReader in = new BufferedReader(new FileReader(pathFile));)
>>>>>> - when I use an update of the features of my application, the
>>>>>> features and plug-in's are updated, but I don't know how to make even
>>>>>> the whatsnew.txt file get updated by this mechanism.
>>>>>>
>>>>>> So, I imagined this scenario:
>>>>>> - put the whatsnew.txt file inside the plug-in folder (together with
>>>>>> plugin.xml or plugin.properties, etc.)
>>>>>> - read this file, somehow, and get its content
>>>>>>
>>>>>> The problem is: how can I read it, being inside the plug-in folder?
>>>>>>
>>>>>> Any hint? Please, help!
>>>>>>
>>>>>>
>>>>>> Thank you,
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Floppy
>>>>>>
>>>
>>
>>
>> --
>> B e s t S o l u t i o n . at
>> ------------------------------------------------------------ --------
>> Tom Schindl JFace-Committer
>> ------------------------------------------------------------ --------
>
>
|
|
|
Goto Forum:
Current Time: Wed Apr 30 01:53:34 EDT 2025
Powered by FUDForum. Page generated in 0.04101 seconds
|