Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Text editor synchronization problem
Text editor synchronization problem [message #444514] Fri, 31 July 2009 13:15 Go to next message
Norbert  Schöpke is currently offline Norbert Schöpke
Messages: 63
Registered: July 2009
Member
Hi

I have a problem with the synchronization of external changes for
workspace files. I wrote my own little text editor (extends TextEditor)
and everything works fine. But recently I discovered that changes made
with an external editor get synchronized with my open editor without a
chance to intervene. The usual question dialog DOES pop up and blocks the
UI, but the editor does get updated with the new text anyway, in the
background. Whether I click yes or no, the new text is already there.

I did a lot of debugging and traced it to the FileSynchronizer instance of
ResourceFileBuffer, which is activated because a file in the workspace
changed. I don't even need to activate the Eclipse editor for this to
happen. It seems to be a completely separate update mechanism compared to
the one that triggers the dialog to pop up.
This also happens for simple .properties files. I tried to switch between
FileDocumentProvider and TextFileDocumentProvider (one of which I extend
for my own use) but the behaviour is the same. This is all on the latest
Ganymede platform. I would appreciate any hints on what could be wrong
here. The mechanisms involved are fairly common, so I wouldn't expect
serious bugs here. So what else could it be?
Thanks for any pointers...

Norbert Schöpke
Re: Text editor synchronization problem [message #467922 is a reply to message #444514] Mon, 03 August 2009 07:32 Go to previous messageGo to next message
Norbert  Schöpke is currently offline Norbert Schöpke
Messages: 63
Registered: July 2009
Member
Ok, i tracked it down further and now I think it actually is a bug.
The "forced background synchronization" occurs if the workspace preference
"Refresh automatically" is enabled. After editing a file contained in the
workspace with an external editor, the RefreshJob kicks in after a few
seconds and causes the Eclipse editor's ResourceFileBuffer to queue a job
for handling the changed content (via FileSynchronizer which listens to
workspace changes). This is all fine and works as the preference
advertises. The bug is that if I switch to the Eclipse editor before the
RefreshJob kicks in, a dialog pops up, notifying me of the file change and
asking whether I want to load the new content or not. While this dialog
waits (its a blocking wait) the editor's content gets replaced with the
content on disk. I think this is because the blocking dialog causes the
event loop to process pending async messages, the synchronization job
mentioned above being one of them.

I resolved the situation by disabling automatic refresh as I see no other
choice to avoid accidental loss of user input.
Re: Text editor synchronization problem [message #467925 is a reply to message #467922] Mon, 03 August 2009 07:56 Go to previous message
Norbert  Schöpke is currently offline Norbert Schöpke
Messages: 63
Registered: July 2009
Member
I found the bug on Bugzilla. Its #248415
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=248415), also known as "gap
problem". Details can also be found in Bug #248068
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=248068).
As of this writing its not fixed yet :(
Previous Topic:How do I wrap jars in a plugin?
Next Topic:Possible bug with findView
Goto Forum:
  


Current Time: Wed Apr 16 15:56:42 EDT 2014

Powered by FUDForum. Page generated in 0.03558 seconds