| [news.eclipse.platform] Re: Synchronizing open editors on the same file |
I found the difference: TextEditor uses TextFileDocumentProvider instead of FileDocumentProvider.
Interestingly enough, this is in the javadoc:
* Text file document providers use {@linkplain org.eclipse.core.filebuffers.ITextFileBuffer text file buffers}
* to access the file content. This allows to share it between various clients including
* headless ones. Text file document providers should be preferred over file document
* providers due to this advantage.
Here's one of those cases where a dude like me says, "if it's preferred, then why doesn't the wizard generate code that uses this one instead!?"
Which wizard? Simply looks like the wizard needs some updating.
I"m sure there's quite a good reason. For example, I don't see anything immediately obvious for partitioning, so maybe that's it. Not sure.
Anyway.... looks like I at least found the path to go down. I sure was hoping for a 3-line "oh, dude, just add this listenener..." kind of answer, which so often seems to be the case.
Time to get my game face on!
marc
"Eric Rizzo" <eclipse-news@xxxxxxxxxxxx> wrote in message news:gncqno$u5d$1@xxxxxxxxxxxxxxxxxxxxOn 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