[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
|
Hello,
Marc E schrieb:
Basically, the editor in this project doesn't currently support
synchronization between two open editors on the same file.
I'm doing something similar. In my case, it's editing files of different
formats in a common Editor. Here is my code to get the IDocument:
input = new FileEditorInput(file);
provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input);
provider.connect(input);
document = provider.getDocument(input);
Since I'm editing structured data, my Editor has an IPartListener that
checks whether the Editor gains/looses focus and (de)serializes the text
data into the model data.
This enables users to work with the custom editor and a text editor at
the same time. They shouldn't break the well-formedness of the text data
though.
The only feature this solution doesn't give you is detecting when the
file changed on disk. For that, I have no solution. But if anyone else
has any idea about that, I'm all ears.
Regards
Damian Philipp
PS: Never ever forget to call provider.disconnect() exactly once for
every provider.connect(), or you'll get the weirdest behaviour!