reacting to a resouce going out of synch [message #290284] |
Mon, 22 August 2005 20:33 |
Eclipse User |
|
|
|
Originally posted by: no.yes.maybe
Hi,
I have a custom editor opened on a file. The file contains a reference
to a second file. I want the editor to update when the second file
changes on disk. What strategy can I follow?
I thought I could "listen" for resources going out of synch, but I don't
see such functionality.
I could have a thread polling isOutOfSynch(), but I should also make
sure that any action the user might perform on the editor will validate
that the resource is not out of synch. Note that the resource is not the
file the editor is opened on, but a second one referred by such file.
So the question is: how do I intercept any user action in an editor to
verify whether my resource is out of synch?
Thanks,
Roberto
|
|
|
Re: reacting to a resouce going out of synch [message #290285 is a reply to message #290284] |
Mon, 22 August 2005 20:49 |
Eclipse User |
|
|
|
Originally posted by: john.eclipsefaq.org
If your editor operates on IResource, you can install an
IResourceChangeListener to be notified whenever that resources changes
from within Eclipse. However, that still won't help you when the file
changes from outside of Eclipse. The Eclipse text editor checks for
file system synchronization each time the editor gains focus. This
ensures the editor is updated if the user switches to another
application to perform a change, which catches most cases.
--
roberto wrote:
> Hi,
> I have a custom editor opened on a file. The file contains a reference
> to a second file. I want the editor to update when the second file
> changes on disk. What strategy can I follow?
>
> I thought I could "listen" for resources going out of synch, but I don't
> see such functionality.
>
> I could have a thread polling isOutOfSynch(), but I should also make
> sure that any action the user might perform on the editor will validate
> that the resource is not out of synch. Note that the resource is not the
> file the editor is opened on, but a second one referred by such file.
>
> So the question is: how do I intercept any user action in an editor to
> verify whether my resource is out of synch?
>
> Thanks,
> Roberto
|
|
|
Re: reacting to a resouce going out of synch [message #290288 is a reply to message #290285] |
Mon, 22 August 2005 22:58 |
Eclipse User |
|
|
|
Originally posted by: no.yes.maybe
John Arthorne wrote:
> If your editor operates on IResource, you can install an
> IResourceChangeListener to be notified whenever that resources changes
> from within Eclipse. However, that still won't help you when the file
> changes from outside of Eclipse. The Eclipse text editor checks for
> file system synchronization each time the editor gains focus. This
> ensures the editor is updated if the user switches to another
> application to perform a change, which catches most cases.
That might be enough... how do I trigger my own check when the editor
gains focus? And what if the editor already has focus?
Thanks,
Roberto
> --
>
>
> roberto wrote:
>
>> Hi,
>> I have a custom editor opened on a file. The file contains a reference
>> to a second file. I want the editor to update when the second file
>> changes on disk. What strategy can I follow?
>>
>> I thought I could "listen" for resources going out of synch, but I
>> don't see such functionality.
>>
>> I could have a thread polling isOutOfSynch(), but I should also make
>> sure that any action the user might perform on the editor will
>> validate that the resource is not out of synch. Note that the resource
>> is not the file the editor is opened on, but a second one referred by
>> such file.
>>
>> So the question is: how do I intercept any user action in an editor to
>> verify whether my resource is out of synch?
>>
>> Thanks,
>> Roberto
|
|
|
Re: reacting to a resouce going out of synch [message #290299 is a reply to message #290288] |
Tue, 23 August 2005 08:21 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.gmx.net
roberto wrote:
> John Arthorne wrote:
>
>> If your editor operates on IResource, you can install an
>> IResourceChangeListener to be notified whenever that resources
>> changes from within Eclipse. However, that still won't help you when
>> the file changes from outside of Eclipse. The Eclipse text editor
>> checks for file system synchronization each time the editor gains
>> focus. This ensures the editor is updated if the user switches to
>> another application to perform a change, which catches most cases.
>
>
> That might be enough... how do I trigger my own check when the editor
> gains focus?
Take a look at the text editor.
> And what if the editor already has focus?
Take a look at document providers and file buffers.
Dani
>
> Thanks,
> Roberto
>
>
>> --
>>
>>
>> roberto wrote:
>>
>>> Hi,
>>> I have a custom editor opened on a file. The file contains a
>>> reference to a second file. I want the editor to update when the
>>> second file changes on disk. What strategy can I follow?
>>>
>>> I thought I could "listen" for resources going out of synch, but I
>>> don't see such functionality.
>>>
>>> I could have a thread polling isOutOfSynch(), but I should also make
>>> sure that any action the user might perform on the editor will
>>> validate that the resource is not out of synch. Note that the
>>> resource is not the file the editor is opened on, but a second one
>>> referred by such file.
>>>
>>> So the question is: how do I intercept any user action in an editor
>>> to verify whether my resource is out of synch?
>>>
>>> Thanks,
>>> Roberto
>>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02874 seconds