Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 07:09 Go to next message
Eclipse UserFriend
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 07:15 Go to previous messageGo to next message
Eclipse UserFriend
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 09:01 Go to previous messageGo to next message
Eclipse UserFriend
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 #329348 is a reply to message #329347] Fri, 20 June 2008 09:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fbanica.soluta.net

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
Re: How to read a file inside a plug-in's folder [message #329349 is a reply to message #329348] Fri, 20 June 2008 09:59 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
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 #329351 is a reply to message #329349] Fri, 20 June 2008 10:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fbanica.soluta.net

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
Re: How to read a file inside a plug-in's folder [message #329352 is a reply to message #329351] Fri, 20 June 2008 10:31 Go to previous message
Eclipse UserFriend
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
>> ------------------------------------------------------------ --------
>
>
Previous Topic:platform text: DSL model/document reconciling
Next Topic:[3.4RC4] Disable a plugin installed via dropins
Goto Forum:
  


Current Time: Sat Jul 27 12:35:16 GMT 2024

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

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

Back to the top