[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Synchronizing open editors on the same file

Eric,
Thanks for responding. I've been poring through TextEditor and its partners for quite a while now and am still having trouble tracking down the thing that's making it tick.


To rule out any weirdness in the project i'm working on, I created a new fresh plugin project with an editor contribution... straight from the plugin wizard, no mods except to change the file extension (I made mine a .marc file editor). and I've verified that even that editor won't do what the default text editor does. If I open up my .marc file in the plugin-wizard-generated editor, I don't get the synched behavior. Open the same file in two instances of TextEditor, and I get what I'm looking for.

I see that FileDocumentProvider has a FileSynchronizer inner class, and I thought maybe he was involved, but I can only get its methods to trip on save, not just dirtying the file.

I imagine it's some listener, somewhere. But I don't yet have the Eclipse KungFu to track the bugger down.

Anyway, thanks for responding, and thanks for listening.

Cheers!

Marc



"Eric Rizzo" <eclipse-news@xxxxxxxxxxxx> wrote in message news:gncqno$u5d$1@xxxxxxxxxxxxxxxxxxxx
On 2/16/2009 1:10 PM, Marc E wrote:
All,
I'm interested in contributing this feature to an open source project
based on Eclipse. I have done a fair amount of plugin programming but
never any Editor programming.
Basically, the editor in this project doesn't currently support
synchronization between two open editors on the same file. For example,
if I have any text file, and I open it in the Default Text Editor, then
choose "New Editor" and modify that file in one editor, the other editor
automatically reflects those changes. I'd like to add that behavior into
the editor in this project.
Can someone point me down the right path?

I think this is more of a fundamental design problem than a particular code problem. The editor in question must be using some kind of backing model that can be shared between editor instances. If it does not have some kind og in-memory model that is sharable, I'm not sure if you can do what you want.
If EMF is involved, this is quite doable. But if not I would first look at the code of the basic text editor to see how they are doing it. Try org.eclipse.ui.editors.text.TextEditor


Hope this helps,
Eric